/* ==========================================================================
   OHDB FILTERS : COMMAND DECK (V13 - SEAMLESS & COMPACT)
   ========================================================================== */

/* 1. CONTENEUR PRINCIPAL */
.page-filters-area {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 5px; /* RÉDUIT : Rapproche fortement le tableau du panneau (était 20px) */
    padding: 0;
    box-sizing: border-box;
    position: relative;
    z-index: 20;
}

/* LA BARRE UNIFIÉE (Glassmorphism Premium) */
.filters-container.distinct-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    
    /* Fond Verre Sombre avec léger dégradé */
    background: linear-gradient(180deg, rgba(15, 20, 25, 0.8) 0%, rgba(8, 10, 14, 0.95) 100%);
    border: 1px solid rgba(104, 253, 214, 0.15); 
    border-top: none; /* FUSION : On supprime la bordure du haut pour l'attacher à la barre */
    border-radius: 0 0 12px 12px; /* FUSION : Coins ronds uniquement en bas */
    padding: 20px; 
    
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.02), inset 0 0 20px rgba(104, 253, 214, 0.03); 
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    gap: 18px; 
}

/* 2. ZONES DE FILTRES (Organisation Horizontale & Grille) */

.filter-section.toggles-section {
    display: flex;
    flex-direction: row; 
    flex-wrap: wrap; 
    align-items: center;
    gap: 25px; 
    padding: 0;
}

.filter-section.modals-section {
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); 
    gap: 15px;
    align-items: end; 
    padding: 0;
}

/* Zone Reset */
.filter-section.reset-section {
    display: flex;
    justify-content: center;
    padding: 0;
    border: none;
    margin: 0;
}

/* Séparateur (Sleek & Soft) */
.section-separator, 
.vertical-separator {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(104, 253, 214, 0.15) 50%, transparent);
    margin: 2px 0;
}

.filter-group {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: auto; 
}

/* 3. STYLE DES TOGGLES (Néon Sci-Fi) */
.filter-checkbox-input { display: none; }

.filter-checkbox-display {
    display: flex; 
    align-items: center; 
    gap: 10px;
    cursor: pointer; 
    font-family: 'h73bold', sans-serif; 
    color: #888;
    text-transform: uppercase; 
    font-size: 0.85rem; 
    letter-spacing: 1px;
    transition: all 0.3s ease; 
    user-select: none;
    position: relative;
    padding-left: 50px;
    height: 24px;
}

.filter-checkbox-display:hover {
    color: #aaa;
}

/* La Piste du switch (Creusée) */
.filter-checkbox-display::before {
    content: ''; 
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 38px; height: 20px; 
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px; 
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

/* Le Bouton du switch (Métallique/LED) */
.filter-checkbox-display::after {
    content: ''; 
    position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
    width: 12px; height: 12px; 
    background: #555; 
    border-radius: 50%; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* État Activé (Glow intense) */
.filter-checkbox-input:checked + .filter-checkbox-display { 
    color: #fff; 
    text-shadow: 0 0 8px rgba(104, 253, 214, 0.5); 
}
.filter-checkbox-input:checked + .filter-checkbox-display::before { 
    border-color: rgba(104, 253, 214, 0.4); 
    background: rgba(104, 253, 214, 0.1); 
    box-shadow: inset 0 0 10px rgba(104, 253, 214, 0.2);
}
.filter-checkbox-input:checked + .filter-checkbox-display::after { 
    background: #68fdd6; 
    transform: translateY(-50%) translateX(18px); 
    box-shadow: 0 0 10px #68fdd6, 0 0 3px #fff; 
}

/* 4. STYLE DES BOUTONS SÉLECTEURS */
.filter-group-modal {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%; 
    min-width: 0;
}

.filter-select {
    width: 100%;
    box-sizing: border-box;
}

.filter-label-tech {
    font-family: 'h73bold', sans-serif; 
    color: #68fdd6; 
    font-size: 0.7rem;
    text-transform: uppercase; 
    letter-spacing: 1.5px; 
    opacity: 0.8;
    margin-left: 4px;
}

/* --- STYLE DES CHAMPS DE SAISIE TEXTE (Ingrédients, Mots-clés, etc.) --- */
.filter-group-modal input[type="text"],
.filter-group-modal input[type="search"] {
    width: 100%;
    min-width: 0; /* Formule magique : empêche l'input de casser la grille (Grid Blowout) */
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.02); 
    border: 1px solid rgba(104, 253, 214, 0.15); 
    border-radius: 6px; 
    color: #fff; 
    font-family: 'h73light', sans-serif;
    font-size: 0.85rem; 
    padding: 0 15px; 
    height: 38px; /* Exactement la même hauteur que les boutons déclencheurs */
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Texte par défaut (Placeholder) */
.filter-group-modal input[type="text"]::placeholder,
.filter-group-modal input[type="search"]::placeholder {
    color: #555;
    font-style: italic;
}

/* Survol de la souris */
.filter-group-modal input[type="text"]:hover,
.filter-group-modal input[type="search"]:hover {
    background: rgba(104, 253, 214, 0.05); 
    border-color: rgba(104, 253, 214, 0.4); 
}

/* Quand on clique dedans pour écrire (Focus) */
.filter-group-modal input[type="text"]:focus,
.filter-group-modal input[type="search"]:focus {
    outline: none;
    background: rgba(10, 20, 16, 0.6); 
    border-color: #68fdd6; 
    box-shadow: 0 0 15px rgba(104, 253, 214, 0.15), inset 0 0 10px rgba(104, 253, 214, 0.1);
}

/* Empêche le conteneur d'autocomplétion des ingrédients de casser la grille */
.ingredient-search-container {
    width: 100%;
    min-width: 0;
}

/* Bouton déclencheur */
.oh-modal-trigger {
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 8px 15px; 
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.02); 
    border: 1px solid rgba(104, 253, 214, 0.15); 
    border-radius: 6px; 
    color: #d0d0d0; 
    font-family: 'h73light', sans-serif;
    font-size: 0.85rem; 
    text-transform: uppercase; 
    cursor: pointer; 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    height: 38px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
}

.oh-modal-trigger:hover {
    background: rgba(104, 253, 214, 0.05); 
    border-color: rgba(104, 253, 214, 0.4); 
    color: #fff;
    box-shadow: 0 0 15px rgba(104, 253, 214, 0.1), inset 0 0 10px rgba(104, 253, 214, 0.05);
}

.oh-modal-trigger::after { 
    content: '▼'; 
    font-size: 0.7rem; 
    color: #68fdd6; 
    margin-left: 10px;
    opacity: 0.7;
}

/* 5. COMPTEUR DE RÉSULTATS (Intégré à la barre de Toggle) */
.filter-count-badge {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-family: 'h73bold', sans-serif;
    color: #666;
    font-size: 0.7rem; /* Plus petit pour la barre */
    padding: 6px 15px; /* Compact */
    margin: 0; 
    
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    user-select: none;
}

.filter-count-badge .count-value {
    font-size: 1.1rem;
    color: #888;
    transition: all 0.3s;
}

.filter-count-badge.has-results {
    border-color: rgba(104, 253, 214, 0.15);
    background: rgba(10, 20, 16, 0.6);
}

.filter-count-badge.has-results .count-value {
    color: #fff;
    text-shadow: 0 0 10px rgba(104, 253, 214, 0.8);
}

.filter-count-badge.has-results .count-label {
    color: #68fdd6;
    opacity: 0.8;
}

/* 6. BOUTON RESET (Croix compacte rouge) */
.filter-btn-reset.distinct-reset {
    background: rgba(255, 82, 82, 0.05); 
    border: 1px solid rgba(255, 82, 82, 0.2);
    color: #ff5252; 
    
    width: 32px; /* Un carré parfait */
    height: 32px; 
    border-radius: 6px; 
    
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 1rem; 
    font-family: 'h73bold', sans-serif;
    cursor: pointer; 
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
}

.filter-btn-reset.distinct-reset:hover {
    background: rgba(255, 82, 82, 0.2); 
    border-color: #ff5252;
    box-shadow: 0 0 15px rgba(255, 82, 82, 0.3), inset 0 0 10px rgba(255, 82, 82, 0.1); 
    color: #fff;
}

.hidden-select { display: none !important; }

/* 7. ETAT ACTIF (Feedback Visuel Global) */
.oh-modal-trigger.active-filter {
    border-color: #68fdd6;
    background: rgba(104, 253, 214, 0.1);
    color: #fff;
    box-shadow: 0 0 15px rgba(104, 253, 214, 0.15);
}

.filter-checkbox-input:checked ~ .filter-label-tech {
    color: #fff;
    text-shadow: 0 0 5px #68fdd6;
}

.filter-btn-reset {
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   STYLE PREMIUM DE LA MODALE DES FILTRES (100% Isolé)
   ========================================================================== */

.oh-filter-modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(6, 9, 13, 0.6); 
    backdrop-filter: blur(8px); 
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999; 
    display: flex; justify-content: center; align-items: center; 
    opacity: 0; visibility: hidden; 
    transition: all 0.4s ease; 
}
.oh-filter-modal-overlay.active { opacity: 1; visibility: visible; }

.oh-filter-modal { 
    width: 700px; 
    max-width: 90%; 
    max-height: 85vh; 
    background: rgba(15, 20, 25, 0.75); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(104, 253, 214, 0.15); 
    border-radius: 12px; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.03), inset 0 0 30px rgba(104, 253, 214, 0.03); 
    display: flex; flex-direction: column; 
    transform: scale(0.95) translateY(20px); 
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1); 
    overflow: hidden; 
}
.oh-filter-modal-overlay.active .oh-filter-modal { transform: scale(1) translateY(0); }

.oh-modal-header { 
    padding: 25px 35px; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); 
    display: flex; justify-content: space-between; align-items: center; 
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 100%);
}
.oh-modal-title { 
    font-family: 'h73bold'; 
    color: #fff; 
    font-size: 1.3rem; 
    text-transform: uppercase; 
    letter-spacing: 3px; 
    text-shadow: 0 0 15px rgba(104, 253, 214, 0.4); 
}
.oh-modal-close { 
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    color: #aaa; 
    width: 36px; height: 36px; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 1.1rem; cursor: pointer; transition: all 0.3s ease; 
    border-radius: 50%; 
}
.oh-modal-close:hover { 
    background: rgba(255, 82, 82, 0.1); 
    border-color: rgba(255, 82, 82, 0.4);
    color: #ff5252;
    transform: rotate(90deg); 
    box-shadow: 0 0 15px rgba(255, 82, 82, 0.2); 
}

.oh-modal-content { 
    padding: 35px; 
    overflow-y: auto; 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 15px; 
}

.oh-modal-option { 
    background: rgba(255, 255, 255, 0.02); 
    border: 1px solid rgba(255, 255, 255, 0.05); 
    padding: 16px 12px; 
    text-align: center; 
    color: #999; 
    font-family: 'h73light', sans-serif; 
    font-size: 0.95rem; 
    cursor: pointer; 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
    text-transform: uppercase; 
    letter-spacing: 1px;
    position: relative; 
    border-radius: 6px; 
    display: flex;
    align-items: center;
    justify-content: center;
}
.oh-modal-option:hover { 
    background: rgba(104, 253, 214, 0.05); 
    border-color: rgba(104, 253, 214, 0.3); 
    color: #fff; 
    transform: translateY(-3px); 
    box-shadow: 0 6px 15px rgba(0,0,0,0.4), 0 0 12px rgba(104, 253, 214, 0.1); 
}
.oh-modal-option.selected { 
    background: rgba(104, 253, 214, 0.15); 
    border-color: #68fdd6; 
    color: #fff; 
    font-family: 'h73bold', sans-serif; 
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 20px rgba(104, 253, 214, 0.2), inset 0 0 10px rgba(104, 253, 214, 0.1); 
}

.oh-modal-content::-webkit-scrollbar {
    width: 6px;
}
.oh-modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}
.oh-modal-content::-webkit-scrollbar-thumb {
    background: rgba(104, 253, 214, 0.3);
    border-radius: 3px;
}
.oh-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(104, 253, 214, 0.6);
}

/* ==========================================================================
   8. PANNEAU DE CONTRÔLE RÉCTRACTABLE (UX Improvement)
   ========================================================================== */

/* La barre de toggle (FUSIONNÉE AVEC LE CONTENEUR) */
.filters-toggle-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 20, 25, 0.95);
    border: 1px solid rgba(104, 253, 214, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px 12px 0 0;
    padding: 12px 20px;
    margin-bottom: 0;
    cursor: pointer;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: all 0.3s ease;
    
    /* --- AJOUTS A11Y (Reset Button) --- */
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    color: inherit;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
}

.filters-toggle-bar:hover {
    background: rgba(104, 253, 214, 0.08);
}

.filters-toggle-left {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-family: 'h73bold', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.filters-toggle-left svg {
    width: 18px;
    height: 18px;
    color: #68fdd6;
}

/* NOUVEAU : Zone droite de la barre (Compteur + Croix + Flèche) */
.filters-toggle-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-chevron {
    color: #68fdd6;
    font-size: 0.8rem;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* État quand le panneau de filtres est replié */
.filters-toggle-bar.is-collapsed {
    border-radius: 12px; 
    border-bottom: 1px solid rgba(104, 253, 214, 0.15); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
}

.filters-toggle-bar.is-collapsed:hover {
    border-color: rgba(104, 253, 214, 0.4);
    box-shadow: 0 5px 20px rgba(104, 253, 214, 0.1);
}

.filters-toggle-bar.is-collapsed .toggle-chevron {
    transform: rotate(-90deg);
}

/* Mécanique de repli du conteneur (Transition fluide) */
.filters-container {
    transform-origin: top;
    transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
                opacity 0.3s ease, 
                padding 0.4s ease, 
                margin 0.4s ease,
                border-color 0.4s ease;
    max-height: 1000px;
    overflow: visible; 
    opacity: 1;
}

/* La classe ajoutée par le JS quand c'est fermé */
.filters-container.is-collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    opacity: 0;
    overflow: hidden; 
    border-color: transparent; 
}