/* ============================================================
   NAVIGATION UNIFIEE - ElyseScope 2027
   Injectee par nav.js sur toutes les pages
   Structure :
     1. Header fixe (56px)
     2. Barre de recherche fixe (48px)
     3. Ancres contextuelles fixes (40px, si page en a)
     4. Spacer (pousse le contenu)
     5. Bottom nav mobile (60px)
   ============================================================ */

/* ---- 1. HEADER ---- */
/* Reset: prevent individual page CSS (nav { padding: X; }) from affecting injected nav */
nav.es-header { padding: 0 !important; margin: 0 !important; width: 100% !important; }

.es-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: 56px;
    background: rgba(245,244,240,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid #dddbd6;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.es-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    gap: 1rem;
}
.es-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #111827;
    flex-shrink: 0;
    white-space: nowrap;
    transition: color 0.15s;
}
.es-logo:hover {
    color: #2563eb;
}
.es-logo-icon {
    display: none;
}
.es-header-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}
.es-hl {
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}
.es-hl:hover { color: #111827; background: rgba(0,0,0,0.05); }
.es-hl.active { color: #2563eb; background: rgba(37,99,235,0.08); font-weight: 600; }

/* Radar + Eclaireur specific */
.es-hl--radar { color: #0369a1; }
.es-hl--radar:hover { background: rgba(3,105,161,0.08); }
.es-hl--radar.active { color: #0369a1; background: rgba(3,105,161,0.08); font-weight: 600; }
.es-hl--eclaireur { color: #92400e; }
.es-hl--eclaireur:hover { background: rgba(146,64,14,0.08); }
.es-hl--eclaireur.active { color: #92400e; background: rgba(146,64,14,0.08); font-weight: 600; }


/* ---- 2. BARRE DE RECHERCHE ---- */
.es-search-bar {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 190;
    height: 48px;
    background: rgba(245,244,240,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid #dddbd6;
    display: flex;
    align-items: center;
}
.es-search-inner {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem;
}
.es-search-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid #dddbd6;
    border-radius: 8px;
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    width: 100%;
    max-width: 480px;
    font-family: 'DM Sans', -apple-system, sans-serif;
    transition: border-color 0.15s, box-shadow 0.15s;
    text-align: left;
}
.es-search-btn:hover {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
.es-search-btn svg {
    color: #9ca3af;
    flex-shrink: 0;
}
.es-search-placeholder {
    color: #9ca3af;
    font-size: 0.85rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ---- 3. ANCRES CONTEXTUELLES ---- */
.es-anchors-bar {
    position: fixed;
    top: 104px; /* 56 header + 48 search */
    left: 0;
    right: 0;
    z-index: 180;
    height: 40px;
    background: rgba(245,244,240,0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid #eae8e3;
    display: flex;
    align-items: center;
}
.es-anchors-inner {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}
.es-anchors-inner::-webkit-scrollbar { display: none; }
.es-anchor-pill {
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.13s, background 0.13s;
    border: 1px solid transparent;
}
.es-anchor-pill:hover {
    color: #111827;
    background: rgba(0,0,0,0.05);
}
.es-anchor-pill.active {
    color: #2563eb;
    background: rgba(37,99,235,0.08);
    border-color: rgba(37,99,235,0.2);
    font-weight: 600;
}


/* ---- 4. ESPACEMENT DU CONTENU ---- */
/*
   Hauteur totale de la nav fixe :
     Sans ancres  : 56 header + 48 recherche = 104px
     Avec ancres  : 56 + 48 + 40 = 144px

   On met a jour --nav-h globalement. Les pages qui utilisent ce
   var (ex: index.html .layout { padding-top: var(--nav-h) })
   s'ajustent automatiquement.
*/
:root {
    --nav-h: 104px;
}
body.has-anchors {
    --nav-h: 144px;
}

/*
   Pour les pages qui n'utilisent pas --nav-h :
   - .page (themes.html) : 5rem trop peu, on augmente
   - .page-header / .wrapper : 8rem ok sans ancres, mais trop peu avec ancres
*/

/* themes.html : .page avait 5rem (~80px), trop peu pour 104px+ nav */
.page {
    padding-top: var(--nav-h, 104px);
}

/* pages avec ancres : on augmente le padding pour eviter le chevauchement */
body.has-anchors .page-header,
body.has-anchors .wrapper,
body.has-anchors .skeleton-wrap {
    padding-top: calc(var(--nav-h) + 1.5rem) !important;
}

/* Spacer injecte par nav.js : masque (on utilise les espacements pages + --nav-h) */
.es-nav-spacer {
    display: none;
}


/* ---- 5. BOTTOM NAV MOBILE ---- */
.es-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 300;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(245,244,240,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid #dddbd6;
    flex-direction: row;
    align-items: stretch;
}
.es-bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: #9ca3af;
    padding: 0.25rem 0;
    position: relative;
    transition: color 0.15s;
    min-width: 0;
}
.es-bn-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2.5px;
    background: #2563eb;
    border-radius: 0 0 3px 3px;
    opacity: 0;
    transition: opacity 0.15s;
}
.es-bn-item.active { color: #2563eb; }
.es-bn-item.active::before { opacity: 1; }
.es-bn-item--radar.active { color: #0369a1; }
.es-bn-item--radar.active::before { background: #0369a1; }
.es-bn-item--eclaireur.active { color: #92400e; }
.es-bn-item--eclaireur.active::before { background: #92400e; }
.es-bn-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.es-bn-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.es-bn-label {
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 0.58rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0 2px;
}


/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .es-bottom-nav { display: flex; }
    body { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }

    .es-header { height: 52px; }
    .es-header-inner { padding: 0 1rem; }
    .es-logo { font-size: 0.95rem; }
    .es-hl { font-size: 0.78rem; padding: 0.3rem 0.55rem; }

    .es-search-bar { top: 52px; height: 46px; }
    .es-search-inner { padding: 0 1rem; }
    .es-search-btn { max-width: 100%; }

    .es-anchors-bar { top: 98px; } /* 52 + 46 */
    .es-anchors-inner { padding: 0 1rem; }

    .es-nav-spacer { height: 98px; } /* 52 + 46 */
    body.has-anchors .es-nav-spacer { height: 138px; } /* 52 + 46 + 40 */

    /* Chat bubble above bottom nav on mobile */
    #es-chat-bubble {
        bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 14px) !important;
    }
    #es-chat-panel {
        bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 76px) !important;
    }
}


/* ---- SUPPRIME LES ANCIENS ELEMENTS DE NAV (pages individuelles) ---- */

/* Ancienne barre de nav superieure (pages HTML individuelles) */
/* - pages avec classe .top-nav */
nav.top-nav,
.top-nav {
    display: none !important;
}
/* - pages avec <nav><div class="inner">...</div></nav> (candidats, themes, comparer, etc.) */
nav:has(> div.inner) {
    display: none !important;
}

/* Ancien burger menu / drawer */
#burgerMenuBtn,
#hamburgerBtn,
.burger-menu-btn,
.hamburger,
#burgerDrawer,
.burger-drawer,
#burgerOverlay,
.burger-overlay,
.sidebar-overlay {
    display: none !important;
}

/* Ancienne barre de pills de la homepage */
#section-pills-nav {
    display: none !important;
}

/* Anciennes bottom nav individuelles des pages */
.mobile-bottom-nav,
#mobileBottomNav {
    display: none !important;
}

/* Supprimer la mobile search bar injectee par global-search.js
   car nav.js gere maintenant la barre de recherche */
#gsMobileBar,
.gs-mobile-bar {
    display: none !important;
}
