/* ==========================================================================
   PAGE RECHERCHE (vue/search.php)
   Vignettes : css/product-card.css / Variables : css/chavigny.css
   ========================================================================== */

.sr {
    background: var(--ch-white);
}

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */
.sr-head {
    padding: 22px 0 28px;
    border-bottom: 1px solid var(--ch-border);
    background: var(--ch-grey-light);
}

.sr-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 0;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
    font-size: .85rem;
}

.sr-breadcrumb li {
    display: inline-flex;
    align-items: center;
    color: var(--ch-grey-dark);
}

.sr-breadcrumb li + li::before {
    content: "";
    width: 6px;
    height: 6px;
    margin: 0 12px;
    border-top: 1.5px solid var(--ch-grey);
    border-right: 1.5px solid var(--ch-grey);
    transform: rotate(45deg);
}

.sr-breadcrumb a {
    color: var(--ch-grey-dark);
    text-decoration: none;
}

.sr-breadcrumb a:hover {
    color: var(--ch-red);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sr-breadcrumb [aria-current] {
    color: var(--ch-text);
    font-weight: 700;
}

.sr-kicker {
    margin: 0 0 4px;
    color: var(--ch-red);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sr-title {
    margin: 0;
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: clamp(1.5rem, 1.15rem + 1.4vw, 2.2rem);
    font-weight: 700;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.sr-count {
    margin: 8px 0 0;
    color: var(--ch-grey-dark);
    font-size: .95rem;
}

.sr-count strong {
    color: var(--ch-text);
}

/* --------------------------------------------------------------------------
   Mise en page
   -------------------------------------------------------------------------- */
.sr-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    align-items: start;
    gap: 36px;
    padding-top: 32px;
    padding-bottom: 72px;
}

/* --------------------------------------------------------------------------
   Filtres
   -------------------------------------------------------------------------- */
.sr-filters {
    position: sticky;
    z-index: 30; /* liste des marques ouverte au-dessus des vignettes produits */
    top: calc(var(--ch-header-main-h) + var(--ch-header-nav-h) + 20px);
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius);
    background: var(--ch-white);
}

.sr-filters-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ch-grey-light);
}

.sr-filters-title {
    flex: 1 1 auto;
    margin: 0;
    color: var(--ch-text);
    font-size: 1.05rem;
    font-weight: 700;
}

.sr-reset {
    color: var(--ch-red);
    font-size: .85rem;
    font-weight: 700;
    text-decoration: none;
}

.sr-reset:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sr-filters-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1.5px solid var(--ch-border);
    border-radius: 50%;
    background: var(--ch-white);
    color: var(--ch-grey-dark);
    cursor: pointer;
}

.sr-filters-close:hover {
    border-color: var(--ch-red);
    background: var(--ch-red);
    color: var(--ch-white);
}

.sr-filters-foot {
    display: none;
}

.sr-block {
    padding: 18px 20px;
}

.sr-block + .sr-block {
    border-top: 1px solid var(--ch-grey-light);
}

.sr-block-title {
    display: block;
    margin: 0 0 12px;
    color: var(--ch-grey-dark);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

/* Recherche texte */
.sr-query {
    position: relative;
}

.sr-query-input {
    width: 100%;
    height: 44px;
    padding: 0 48px 0 16px;
    border: 1.5px solid var(--ch-border);
    border-radius: var(--ch-radius-pill);
    background: var(--ch-white);
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: .93rem;
    transition: border-color .2s var(--ch-ease), box-shadow .2s var(--ch-ease);
    -webkit-appearance: none;
    appearance: none;
}

.sr-query-input::placeholder {
    color: var(--ch-grey);
}

.sr-query-input:focus {
    outline: none;
    border-color: var(--ch-red);
    box-shadow: 0 0 0 4px rgba(208, 52, 58, .12);
}

.sr-query-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--ch-red);
    color: var(--ch-white);
    cursor: pointer;
    transition: background-color .2s var(--ch-ease);
}

.sr-query-btn:hover {
    background: var(--ch-red-dark);
}

.sr-hint {
    margin: 6px 0 0 16px;
    color: var(--ch-grey);
    font-size: .76rem;
}

/* Interrupteur "en stock" */
.sr-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.sr-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.sr-switch-track {
    flex: 0 0 44px;
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-border);
    transition: background-color .2s var(--ch-ease);
}

.sr-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ch-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s var(--ch-ease);
}

.sr-switch input:checked + .sr-switch-track {
    background: var(--ch-red);
}

.sr-switch input:checked + .sr-switch-track .sr-switch-thumb {
    transform: translateX(20px);
}

.sr-switch input:focus-visible + .sr-switch-track {
    outline: 3px solid rgba(208, 52, 58, .45);
    outline-offset: 2px;
}

.sr-switch-label {
    color: var(--ch-text);
    font-size: .92rem;
}

/* Groupes */
.sr-groups-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--ch-grey-dark);
    font-size: .85rem;
    text-decoration: none;
}

.sr-groups-back:hover {
    color: var(--ch-red);
}

.sr-groups-current {
    margin: 0 0 8px;
    color: var(--ch-text);
    font-size: .98rem;
    font-weight: 700;
}

.sr-groups-list {
    margin: 0 -8px;
    padding: 0;
    list-style: none;
}

.sr-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 7px 10px;
    border-radius: var(--ch-radius-sm);
    color: var(--ch-grey-dark);
    font-size: .9rem;
    line-height: 1.3;
    text-decoration: none;
    transition: background-color .15s var(--ch-ease), color .15s var(--ch-ease);
}

.sr-group > span {
    flex: 1 1 auto;
}

.sr-group > .fa-chevron-right {
    flex: 0 0 auto;
    color: var(--ch-grey);
    font-size: .75rem;
}

.sr-group-icon {
    flex: 0 0 20px;
    color: var(--ch-red);
    font-size: 1.05rem;
    text-align: center;
}

.sr-group--root {
    color: var(--ch-text);
}

.sr-group:hover {
    background: var(--ch-grey-light);
    color: var(--ch-red);
}

.sr-group.is-active {
    background: var(--ch-red-soft);
    color: var(--ch-red);
    font-weight: 700;
}

/* Marques : liste déroulante avec recherche (js/search.js) */
.brand-combo {
    position: relative;
}

.brand-combo-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border: 1.5px solid var(--ch-border);
    border-radius: var(--ch-radius-pill);
    background: var(--ch-white);
    color: var(--ch-grey-dark);
    font-family: var(--ch-font);
    font-size: .93rem;
    text-align: left;
    cursor: pointer;
    transition: border-color .2s var(--ch-ease);
}

.brand-combo-toggle > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-combo-toggle .has-value {
    color: var(--ch-text);
    font-weight: 700;
}

.brand-combo-toggle i {
    transition: transform .2s var(--ch-ease);
}

.brand-combo.open .brand-combo-toggle,
.brand-combo-toggle:hover {
    border-color: var(--ch-red);
}

.brand-combo.open .brand-combo-toggle i {
    transform: rotate(180deg);
}

.brand-combo-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 20;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius);
    background: #ffffff;
    background: var(--ch-white, #ffffff);
    box-shadow: var(--ch-shadow-lg);
    overflow: hidden;
    isolation: isolate;
}

.brand-combo.open-up .brand-combo-panel {
    top: auto;
    bottom: calc(100% + 6px);
}

.brand-combo-search {
    position: relative;
    padding: 10px;
    background: var(--ch-white, #ffffff);
    border-bottom: 1px solid var(--ch-grey-light);
}

.brand-combo-search i {
    position: absolute;
    top: 50%;
    left: 24px;
    color: var(--ch-grey);
    transform: translateY(-50%);
}

.brand-combo-search input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius-pill);
    font-family: var(--ch-font);
    font-size: 16px;
}

.brand-combo-search input:focus {
    outline: none;
    border-color: var(--ch-red);
}

.brand-combo-list {
    max-height: 300px;
    margin: 0;
    padding: 6px;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--ch-white, #ffffff);
}

.brand-combo-option {
    padding: 9px 12px;
    background: var(--ch-white, #ffffff);
    border-radius: var(--ch-radius-sm);
    color: var(--ch-grey-dark);
    font-size: .9rem;
    cursor: pointer;
}

.brand-combo-option:hover,
.brand-combo-option:focus-visible {
    outline: none;
    background: var(--ch-grey-light);
    color: var(--ch-red);
}

.brand-combo-option.selected {
    background: var(--ch-red-soft);
    color: var(--ch-red);
    font-weight: 700;
}

.brand-combo-more,
.brand-combo-empty {
    padding: 10px 16px;
    background: var(--ch-white, #ffffff);
    border-top: 1px solid var(--ch-grey-light);
    color: var(--ch-grey-dark);
    font-size: .8rem;
}

.brand-combo-more[hidden],
.brand-combo-empty[hidden] {
    display: none;
}

/* --------------------------------------------------------------------------
   Barre d'outils des résultats
   -------------------------------------------------------------------------- */
.sr-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 20px;
}

.sr-filters-open {
    display: none;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border: 1.5px solid var(--ch-grey);
    border-radius: var(--ch-radius-pill);
    background: var(--ch-white);
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: .92rem;
    font-weight: 700;
    cursor: pointer;
}

.sr-filters-open:hover {
    border-color: var(--ch-red);
    color: var(--ch-red);
}

.sr-active {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sr-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 260px;
    min-height: 34px;
    padding: 0 12px 0 14px;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-red-soft);
    color: var(--ch-red);
    font-size: .85rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .15s var(--ch-ease), color .15s var(--ch-ease);
}

.sr-chip span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-chip:hover {
    background: var(--ch-red);
    color: var(--ch-white);
}

.sr-chip-reset {
    color: var(--ch-grey-dark);
    font-size: .85rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sr-chip-reset:hover {
    color: var(--ch-red);
}

.sr-page-info {
    margin: 0 0 0 auto;
    color: var(--ch-grey-dark);
    font-size: .88rem;
}

/* --------------------------------------------------------------------------
   Grille et pagination
   -------------------------------------------------------------------------- */
.sr-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
}

.sr-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.sr-pagination ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sr-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border: 1.5px solid var(--ch-border);
    border-radius: var(--ch-radius-pill);
    background: var(--ch-white);
    color: var(--ch-text);
    font-size: .92rem;
    font-weight: 700;
    text-decoration: none;
    transition: border-color .15s var(--ch-ease), color .15s var(--ch-ease), background-color .15s var(--ch-ease);
}

a.sr-page:hover {
    border-color: var(--ch-red);
    color: var(--ch-red);
}

.sr-page.is-current {
    border-color: var(--ch-red);
    background: var(--ch-red);
    color: var(--ch-white);
}

.sr-page--nav {
    padding: 0 18px;
}

.sr-page-gap {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 0 4px;
    color: var(--ch-grey);
}

/* --------------------------------------------------------------------------
   Aucun résultat
   -------------------------------------------------------------------------- */
.sr-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 56px 24px;
    border: 1.5px dashed var(--ch-border);
    border-radius: var(--ch-radius-lg);
    text-align: center;
}

.sr-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: var(--ch-grey-light);
    color: var(--ch-grey);
    font-size: 1.9rem;
}

.sr-empty-title {
    max-width: 560px;
    margin: 0 0 12px;
    color: var(--ch-text);
    font-size: 1.15rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.sr-empty-tips {
    margin: 0 0 22px;
    padding: 0;
    list-style: none;
    color: var(--ch-grey-dark);
    font-size: .92rem;
    line-height: 1.7;
}

.sr-empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* --------------------------------------------------------------------------
   Responsive : filtres en panneau latéral sous 1024 px
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .sr-layout {
        grid-template-columns: 260px minmax(0, 1fr);
        gap: 28px;
    }
}

@media (max-width: 1023px) {
    .sr-layout {
        grid-template-columns: minmax(0, 1fr);
        padding-top: 20px;
        padding-bottom: 56px;
    }

    .sr-filters-open {
        display: inline-flex;
    }

    .sr-filters {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1001;
        display: flex;
        flex-direction: column;
        width: min(380px, calc(100vw - 40px));
        border: 0;
        border-radius: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, .15);
        visibility: hidden;
        transform: translateX(-100%);
        transition: transform .3s var(--ch-ease), visibility 0s linear .3s;
    }

    .sr-filters.is-open {
        visibility: visible;
        transform: none;
        transition: transform .3s var(--ch-ease), visibility 0s;
    }

    .sr-filters-head {
        flex: 0 0 auto;
        min-height: 68px;
    }

    .sr-filters-close {
        display: inline-flex;
    }

    .sr-filters-body {
        flex: 1 1 auto;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .sr-filters-foot {
        display: block;
        flex: 0 0 auto;
        padding: 14px 20px;
        border-top: 1px solid var(--ch-grey-light);
    }

    .sr-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1000;
        background: rgba(30, 30, 32, .5);
    }

    .sr-backdrop[hidden] {
        display: none;
    }

    .sr-query-input {
        font-size: 16px; /* évite le zoom automatique iOS */
    }

    .sr-page-info {
        flex-basis: 100%;
        margin: 0;
    }
}

@media (min-width: 1024px) {
    .sr-backdrop {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .sr-head {
        padding: 16px 0 20px;
    }

    .sr-breadcrumb ol {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
    }

    .sr-breadcrumb ol::-webkit-scrollbar {
        display: none;
    }

    .sr-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sr-page-label {
        display: none;
    }

    .sr-page--nav {
        padding: 0 12px;
    }

    .sr-chip {
        max-width: 200px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sr-filters,
    .sr-switch-thumb,
    .sr-switch-track {
        transition: none;
    }
}
