/*
 * Champ de recherche de produits de l'en-tête (Views/Default/Shared/_AutocompleteSearch.cshtml, Content/js/product-search.js), commun à 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).
 * Variantes : --header (ligne du logo sur ordinateur, tous les sites), --mobile (en tête du menu déroulant mobile, tous les sites).
 * La liste des résultats est en position fixe, placée sous le champ par le script.
 */
.product-search {
    --ps-main: #004a82;
    --ps-accent: #ed1b2f;
    --ps-soft: #f3f4f4;
    --ps-text: #2b2f33;
    --ps-muted: #6b7380;
    --ps-border: #d5dae0;
    --ps-radius: 10px;
    position: relative;
    width: 100%;
    text-align: left;
    font-family: inherit;
    line-height: 1.4;
}

.product-search--poolstar { --ps-main: #004a82; --ps-accent: #ed1b2f; --ps-soft: #f3f4f4; --ps-radius: 999px; }
.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: 999px; }
.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: 999px; }
.product-search--wattsup2 { --ps-main: #26769b; --ps-accent: #ff7500; --ps-soft: #f2f2f2; --ps-radius: 999px; }

/* Champ */
.product-search .ps-field {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    margin: 0;
    padding: 0 16px;
    background: #fff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius);
    cursor: text;
    transition: border-color .15s, box-shadow .15s;
}

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

.product-search .ps-icon {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--ps-main);
    stroke-width: 2.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 .ps-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: var(--ps-text);
    font: inherit;
    font-size: .95rem;
    letter-spacing: normal;
    text-transform: none;
    -webkit-appearance: none;
    appearance: none;
}

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

/* Ligne du logo (ordinateur) : champ compact */
.product-search--header .ps-field { height: 38px; padding: 0 14px; gap: 8px; box-shadow: 0 1px 3px rgba(16, 24, 40, .06); }
.product-search--header .ps-icon { flex-basis: 16px; width: 16px; height: 16px; }
.product-search--header .ps-input { font-size: .875rem; }

/* Menu déroulant mobile */
.product-search--mobile .ps-field { height: 46px; }

/* Liste des résultats (position calculée par le script) */
.product-search .ps-panel {
    position: fixed;
    z-index: 10000000;   /* au-dessus des menus mobiles (Poolstar : 9999999) */
    overflow-y: auto;
    padding: 12px;
    background: #fff;
    border: 1px solid #e1e5ea;
    border-radius: min(var(--ps-radius), 12px);
    box-shadow: 0 16px 40px rgba(16, 24, 40, .18);
    overscroll-behavior: contain;
}

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

.product-search .ps-count {
    padding: 4px 14px 10px;
    color: var(--ps-muted);
    font-size: .8rem;
    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; margin: 0; padding: 0; }

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

.product-search .ps-item {
    display: flex;
    align-items: center;
    gap: 18px;
    height: 100%;
    padding: 12px 14px;
    border-radius: min(var(--ps-radius), 10px);
    color: var(--ps-text);
    text-align: left;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    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 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eceef1;
    border-radius: min(var(--ps-radius), 8px);
}

.product-search .ps-thumb img {
    width: 100%;
    height: 100%;
    max-width: none;
    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: .75rem;
    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: 1.15rem;
    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: 2px;
    color: var(--ps-muted);
    font-size: .95rem;
    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 .ps-panel { padding: 6px; }
    .product-search .ps-item { gap: 14px; padding: 10px; }
    .product-search .ps-thumb { flex-basis: 72px; width: 72px; height: 72px; }
    .product-search .ps-title { font-size: 1.05rem; }
    .product-search .ps-subtitle { font-size: .9rem; }
    .product-search .ps-arrow { display: none; }
    .product-search .ps-input { font-size: 16px; }   /* 16 px : pas de zoom automatique d'iOS au focus */
}

/* Emplacements dans les en-têtes des thèmes */

/* Ordinateur : dans la ligne du logo, entre le logo et le menu (tous les sites) ; mobile : en tête du menu déroulant */
.ps-slot-header { flex: 1 1 260px; align-self: center; min-width: 200px; max-width: 760px; margin: 0 32px; }
.ps-mobile-only { display: none; }
.ps-menu-search { padding: 12px 16px; background: #fff; }

@media (max-width: 991.98px) {
    .ps-desktop-only { display: none !important; }
    .ps-mobile-only { display: block; }
}

/* Poolex : menu burger jusqu'à 1199 px (Content/poolex/css/header.less) : recherche dans le menu latéral jusqu'à cette largeur */
@media (max-width: 1199.98px) {
    .ps-slot-header:has(> .product-search--poolex) { display: none !important; }
    #sidebar .ps-menu-search:has(> .product-search--poolex) { display: block; }
}

/* Poolex, NetSpa : menu latéral (#sidebar) */
#sidebar .ps-menu-search { padding: 12px 20px; background: transparent; }
.ps-menu-search:has(> .product-search--francesauna),
.ps-menu-search:has(> .product-search--wattsup2) { background: transparent; }   /* menus mobiles transparents : pas de bande blanche */

/* WattSUP mobile, en-tête transparent (accueil, en haut de page, .transparent sans .menu_fixed) : en-tête sur fond bleu de la marque quand le menu est déplié
   (il était sans fond, sur la vidéo) et champ « verre » assorti aux liens blancs. En-tête blanc (défilement, autres pages) : champ blanc normal. */
@media (max-width: 991.98px) {
    .main_navigation.transparent:not(.menu_fixed):has(.navbar-collapse.show .product-search--wattsup2, .navbar-collapse.collapsing .product-search--wattsup2) { background: rgba(38, 118, 155, .97); }
    .main_navigation.transparent:not(.menu_fixed) .product-search--wattsup2 .ps-field { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .7); }
    .main_navigation.transparent:not(.menu_fixed) .product-search--wattsup2 .ps-field:focus-within { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); }
    .main_navigation.transparent:not(.menu_fixed) .product-search--wattsup2 .ps-icon { stroke: #fff; }
    .main_navigation.transparent:not(.menu_fixed) .product-search--wattsup2 .ps-input { color: #fff; }
    .main_navigation.transparent:not(.menu_fixed) .product-search--wattsup2 .ps-input::placeholder { color: rgba(255, 255, 255, .85); }
}

/* Poolex et NetSpa ordinateur : champ de 520 px au plus (sur grand écran il s'étirait jusqu'à 760 px), centré entre le logo et les liens de droite */
.ps-slot-header:has(> .product-search--poolex),
.ps-slot-header:has(> .product-search--netspa) { box-sizing: border-box; flex: 1 1 260px; max-width: 568px; min-width: 200px; margin: 0 auto; padding: 0 24px; }   /* 520 px + au moins 24 px de chaque côté */
.navbar:has(> .ps-slot-header > .product-search--poolex) > .navbar-nav,
.navbar:has(> .ps-slot-header > .product-search--netspa) > .navbar-nav { margin-left: 0 !important; }   /* au lieu de ml-auto : l'espace libre se partage de part et d'autre du champ */
.navbar:has(> .ps-slot-header > .product-search--poolex) > .navbar-brand,
.navbar:has(> .ps-slot-header > .product-search--netspa) > .navbar-brand { margin-right: 0 !important; }   /* marge propre du logo (thème) retirée : vraiment au milieu */

/* Waterflex ordinateur : menu chargé, le champ se contente de la place libre et les liens du menu restent sur une ligne */
.ps-slot-header:has(> .product-search--waterflex) { flex: 0 1 280px; min-width: 170px; margin: 0 20px; }
.navbar:has(> .ps-slot-header) .navbar-nav .nav-link,
.navbar:has(> .ps-slot-header) .navbar-nav .btn { white-space: nowrap; }

/* Poolstar ordinateur : la colonne du menu (flex, alignée à droite) commence par le champ */
.col-lg-10 > .ps-slot-header { margin: 0 auto 0 0; max-width: 520px; }
