/* ============================================================
   1. BASE DES MENUS (Structure Fixe avec Scroll Interne)
   ============================================================ */
nav-pages-links,
categories-nav-links {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    /* SOLUTION : S'adapte dynamiquement aux barres mobiles */
    height: 100dvh; 
    background: #ffffff;
    z-index: 9999;
    transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid #f0f0f0;

    /* SOLUTION : On empêche le scroll sur le parent et on utilise Flex */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

nav-pages-links.active,
categories-nav-links.active {
    left: 0;
}

/* Zone de contenu dynamique qui scrolle entre la recherche et le modal */
.search-results,
#dynamic-facets {
    flex: 1;
    /* Prend tout l'espace disponible au milieu */
    overflow-y: auto;
    /* Seule cette zone scrolle */
    padding-bottom: 20px;
    scrollbar-width: none;
}

.search-results::-webkit-scrollbar,
#dynamic-facets::-webkit-scrollbar {
    display: none;
}

body.no-scroll {
    overflow: hidden;
    height: 100vh;
}

/* Liens du haut */
nav-pages-links .links-and-buttons {
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
    /* Empêche la compression */
}

nav-pages-links .links-and-buttons::-webkit-scrollbar {
    display: none;
}

nav-pages-links .links-and-buttons a {
    text-decoration: none;
    color: #000000;
    /* padding: 10px 15px;
    border-radius: 20px;
    border: 1px solid #fafafa; */
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-size: 13px;
}

nav-pages-links .links-and-buttons a:hover {
    text-decoration: underline;
}

nav-pages-links hr,
categories-nav-links hr {
    border: 0;
    height: 1px;
    background: #f8f8f8;
    margin: 0 11px;
    flex-shrink: 0;
}

/* ============================================================
   2. WELCOME AREA
   ============================================================ */

welcome-area.mobile-only-welcome h1 {
    /* font-size: 1rem; */
    font-style: italic;
    line-height: 1.4;
    color: #555;
    font-weight: 300;
}

welcome-area.mobile-only-welcome strong {
    font-weight: 400;
}

/* Le welcome area suit le scroll du contenu */
welcome-area {
    display: none;
    padding: 15px;
    text-align: center;
    border: 1px solid #f8f8f8;
    border-radius: 20px;
    margin: 20px;
    /* background: #ffffff; */
}


/* Masquer le texte du menu UNIQUEMENT sur très grands écrans (PC) */
@media (min-width: 913px) {
    welcome-area.desktop-only-welcome {
        display: block;
    }

    welcome-area h1 {
        font-style: unset;
    }

    nav-pages-links hr,
    categories-nav-links hr {
        margin: 0 25px;
    }

}

/* --- ISOLATION DE LA SECTION INDEX (Le texte sur la page) --- */
/* On masque le texte de la section sur mobile ET tablette pour libérer l'image */
@media (max-width: 912px) {
    welcome-area.mobile-only-welcome {
        display: block;
    }

    welcome-area.mobile-only-welcome h1 {
        font-weight: 200;
        line-height: 1;
    }

    welcome-area.mobile-only-welcome strong {
        font-weight: 250;
    }

}

/* ============================================================
   3. RÉSULTATS DE RECHERCHE (Optimisé Dynamique & Écrans)
   ============================================================ */
categories-nav-links .facet-section,
nav-pages-links .facet-section {
    min-height: 200px;
}

categories-nav-links .facet-section h4,
nav-pages-links .facet-section h4 {
    font-size: 11px;
    text-transform: uppercase;
    color: #006edb;
    letter-spacing: 2px;
    margin: 15px 0 15px 20px;
    font-weight: 400;
}

/* Sections scrollables (Annonceurs & Marques) */
categories-nav-links .facet-row.scrollable,
nav-pages-links .facet-row.scrollable {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 0 20px 10px 20px;
    scrollbar-width: none;
}

categories-nav-links .facet-btn,
nav-pages-links .facet-btn {
    color: #000000;
    padding: 10px 15px;
    border-radius: 20px;
    border: 1px solid #f8f8f8;
    background: #ffffff;
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    transition: 0.2s;
}

/* GRILLE CATÉGORIES (Fixée pour éviter l'étirement sur PC) */
categories-nav-links .facet-grid,
nav-pages-links .facet-grid {
    display: grid;
    /* 3 colonnes sur mobile, auto-remplissage sur PC avec taille fixe */
    grid-template-columns: repeat(3, minmax(0, 150px));
    gap: 10px;
    padding: 0 20px;
    justify-content: center;
    /* Centre les cartes si l'écran est large */
}

/* CARTES CARRÉES DYNAMIQUES */
categories-nav-links .facet-grid a,
nav-pages-links .facet-grid a {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    background: #ffffff;
    border: 1px solid #f8f8f8;
    border-radius: 20px;
    font-size: 11px;
    color: #006edb;
    text-decoration: none;
    transition: 0.2s;
    word-break: break-word;
    /* Évite que le texte sorte de la carte */
}

/* Ajustement spécifique pour les grands écrans */
@media (min-width: 912px) {

    categories-nav-links .facet-grid,
    nav-pages-links .facet-grid {
        /* Sur PC, on aligne plus de cartes si nécessaire, mais elles restent petites (max 150px) */
        grid-template-columns: repeat(auto-fill, 150px);
        max-width: 100%;
    }
}

categories-nav-links .nav-hint,
nav-pages-links .nav-hint,
categories-nav-links .no-data,
nav-pages-links .no-data {
    text-align: center;
    padding: 30px;
    color: #ccc;
    font-size: 12px;
    font-weight: 300;
}

/* ============================================================
   4. STRUCTURES FIXES (SearchBox & Modals)
   ============================================================ */

/* Le ModalController reste fixé en bas du conteneur Flex */
modal-controller.modal-items-container {
    width: 100%;
    border-top: 1px solid #fafafa;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    flex-shrink: 0; /* Empêche de disparaître au scroll */
    /* Ceci pour le confort sur iPhone/Android récent */
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

modal-controller.modal-items-container a {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

modal-controller.modal-items-container a svg {
    width: 20px;
}

modal-controller.modal-items-container .close-btn-box {
    position: absolute;
    left: 25px;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
}

modal-controller.modal-items-container svg {
    width: 20px;
    height: 20px;
}

modal-controller #nav-publish-button {
    position: absolute;
    right: 25px;
    padding: 10px 20px;
    border-radius: 20px;
    background: #006edb;
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: unset;
}

/* Bloc central de recherche */
search-box.search-box-container {
    width: calc(100% - 40px);
    height: 36px;
    margin: 0 auto;
    border: 1px solid #fafafa;
    border-radius: 18px;
    position: absolute;
    top: 10px;
    display: flex;
    align-items: center;
    position: relative;
}


/* L'input s'adapte à la place restante */
search-box .search-area {
    /* border-radius: 20px; */
    border: 1px solid #ccc;
    outline: none;
    height: 100%;
    width: calc(100% - 46px);
    border-bottom-left-radius: 18px;
    border-top-left-radius: 18px;
    border: none;
    padding-left: 25px;
}

/* Le label porte l'icône loupe */
search-box.search-box-container label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    height: 30px;
    width: 40px;
    border-radius: 15px;
    border: 1px solid #fafafa;
    margin: auto;
    background: #006edb;
}

search-box.search-box-container svg {
    width: 20px;
    height: 20px;
}

@media (min-width: 912px) {
    search-box.search-box-container {
        width: 60%;
        height: 40px;
        border-radius: 20px;
    }

    search-box .search-area {
        width: calc(100% - 50px);
    }

    search-box.search-box-container label {
        width: 40px;
        height: 30px;
    }
}