/*
 * Recherche de produits de l'en-tête (Views/Default/Shared/_AutocompleteSearch.cshtml, Content/js/product-search.js), commune à tous les sites.
 * Couleurs et arrondis de chaque marque : variables --ps-* par thème (mêmes couleurs que les filtres des catégories, Content/{marque}/css/filters.less).
 * Les anciennes règles des marques (autocomplete.less : #search, #search_container) sont neutralisées ici par des sélecteurs plus précis.
 */
.product-search {
    --ps-main: #004a82;
    --ps-accent: #ed1b2f;
    --ps-soft: #f3f4f4;
    --ps-text: #2b2f33;
    --ps-muted: #6b7380;
    --ps-border: #dde1e6;
    --ps-radius: 12px;
    position: relative;
    max-width: 920px;
    margin: 0 auto;
    padding: 14px 0;
    text-align: left;
    font-family: inherit;
    line-height: 1.4;
}

.product-search--poolstar { --ps-main: #004a82; --ps-accent: #ed1b2f; --ps-soft: #f3f4f4; --ps-radius: 14px; }
.product-search--poolex { --ps-main: #005487; --ps-accent: #00bad3; --ps-soft: #f5f5f5; --ps-radius: 0; }
.product-search--waterflex { --ps-main: #0168b4; --ps-accent: #00b8f1; --ps-soft: #f3f3f3; --ps-radius: 8px; }
.product-search--netspa { --ps-main: #002c52; --ps-accent: #b42e6c; --ps-soft: #f5f5f5; --ps-radius: 8px; }
.product-search--francesauna { --ps-main: #9b0070; --ps-accent: #5d0b58; --ps-soft: #f2f2f2; --ps-radius: 8px; }
.product-search--wattsup2 { --ps-main: #26769b; --ps-accent: #ff7500; --ps-soft: #f2f2f2; --ps-radius: 8px; }

/* bandeau de l'en-tête : hauteur fixe des anciens thèmes retirée (la liste déborde dessous) ; thèmes dont la colonne a déjà une marge (p-4) */
body #search_container { height: auto; }
.p-4 > .product-search { padding: 0; }

/* Champ */
.product-search .ps-field {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 54px;
    padding: 0 6px 0 18px;
    background: #fff;
    border: 1.5px solid var(--ps-border);
    border-radius: var(--ps-radius);
    box-shadow: 0 2px 8px rgba(16, 24, 40, .06);
    transition: border-color .15s, box-shadow .15s;
}

.product-search .ps-field:focus-within {
    border-color: var(--ps-main);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--ps-main) 14%, transparent);
}

.product-search .ps-icon {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: var(--ps-main);
    stroke-width: 2;
    stroke-linecap: round;
}

.product-search.ps-loading .ps-icon { animation: ps-pulse .8s ease-in-out infinite alternate; }

@keyframes ps-pulse { to { opacity: .3; } }

.product-search #search {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0 10px;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: var(--ps-text);
    font: inherit;
    font-size: 1.05rem;
    letter-spacing: normal;
    -webkit-appearance: none;
    appearance: none;
}

.product-search #search::placeholder { color: var(--ps-muted); opacity: 1; font-style: normal; letter-spacing: normal; }
.product-search #search::-webkit-search-cancel-button,
.product-search #search::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

.product-search .ps-close {
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: background-color .15s;
}

.product-search--poolex .ps-close { border-radius: 0; }

.product-search .ps-close:hover,
.product-search .ps-close:focus-visible { background: var(--ps-soft); outline: 0; }

.product-search .ps-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--ps-muted);
    stroke-width: 2;
    stroke-linecap: round;
}

.product-search .ps-close:hover svg { stroke: var(--ps-main); }

/* Liste des résultats */
.product-search .ps-panel {
    position: absolute;
    top: calc(100% - 6px);
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: min(70vh, 600px);
    overflow-y: auto;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius);
    box-shadow: 0 16px 40px rgba(16, 24, 40, .16);
    overscroll-behavior: contain;
}

.product-search .ps-panel[hidden] { display: none; }

.product-search .ps-count {
    padding: 4px 10px 8px;
    color: var(--ps-muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.product-search .ps-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.product-search .ps-list > li { min-width: 0; }

@media (min-width: 768px) {
    .product-search .ps-list { grid-template-columns: 1fr 1fr; gap: 4px 8px; }
}

.product-search .ps-item {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    padding: 8px 10px;
    border-radius: calc(var(--ps-radius) * .7);
    color: var(--ps-text);
    text-decoration: none;
    transition: background-color .12s;
}

.product-search .ps-item:hover,
.product-search .ps-item:focus-visible,
.product-search .ps-item.ps-active {
    background: var(--ps-soft);
    color: var(--ps-text);
    text-decoration: none;
    outline: 0;
}

.product-search .ps-thumb {
    flex: 0 0 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eceef1;
    border-radius: calc(var(--ps-radius) * .6);
}

.product-search .ps-thumb img {
    width: 100%;
    height: 100%;
    padding: 4px;
    object-fit: contain;
}

.product-search .ps-noimage {
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background: var(--ps-soft);
}

.product-search .ps-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.product-search .ps-brand {
    color: var(--ps-accent);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .07em;
    line-height: 1.3;
    text-transform: uppercase;
}

.product-search--francesauna .ps-brand,
.product-search--waterflex .ps-brand { color: var(--ps-main); }

.product-search .ps-title {
    color: var(--ps-main);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-search .ps-title mark {
    padding: 0;
    background: none;
    color: inherit;
    font-weight: 800;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--ps-accent) 55%, transparent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.product-search .ps-subtitle {
    margin-top: 1px;
    color: var(--ps-muted);
    font-size: .85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-search .ps-arrow {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--ps-main);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .12s, transform .12s;
}

.product-search .ps-item:hover .ps-arrow,
.product-search .ps-item.ps-active .ps-arrow { opacity: 1; transform: none; }

.product-search .ps-more {
    margin-top: 8px;
    padding: 10px 10px 4px;
    border-top: 1px solid #eceef1;
    color: var(--ps-muted);
    font-size: .8rem;
}

.product-search .ps-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 12px;
    color: var(--ps-muted);
    font-size: .9rem;
}

.product-search .ps-message strong { color: var(--ps-main); font-size: 1rem; font-weight: 600; }

@media (max-width: 767.98px) {
    .product-search { padding: 10px 0; }
    .product-search .ps-field { height: 50px; padding-left: 14px; }
    .product-search #search { font-size: 1rem; }
    .product-search .ps-panel { max-height: calc(100vh - 220px); padding: 6px; }
    .product-search .ps-thumb { flex-basis: 56px; width: 56px; height: 56px; }
    .product-search .ps-arrow { display: none; }
}
