/* =========================================================
   MOBILE NAV / HEADER SYSTEM LOCKED
   Validé : menu compact popover ancré à droite sous hamburger
   - Modal compact (pas pleine page)
   - right: 16px, top: 72px (60px mobile)
   - Breakpoint hamburger ≤1199px, desktop ≥1200px
   - X fermeture, langue drapeaux, ordre liens conservés

   Ne pas modifier sans validation explicite.
   Source principale header/menu : nav-redesign.css
   ========================================================= */

/* ==========================================================
   GLOBAL NAV — desktop, mobile menu, language switcher
   ========================================================== */

.tmc-header,
.tmc-desktop-nav,
.tmc-mobile-menu,
.lang-switcher,
.mobile-lang-section {
    font-family: var(--tmc-font-main, 'Inter', system-ui, sans-serif);
}

/* ── Desktop nav links ───────────────────────────────────── */
.tmc-desktop-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tmc-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 14px;
    text-decoration: none;
    color: #0F2D3A;
    font-size: 0.92rem;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.tmc-nav-link:hover {
    background: #F7F9FA;
    color: #0F2D3A;
}

.tmc-nav-link--active {
    background: rgba(249, 168, 38, 0.14);
    color: #0F2D3A;
    font-weight: 750;
}

.tmc-nav-link--cta {
    border: 1px solid rgba(15, 45, 58, 0.14);
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 45, 58, 0.04);
}

.tmc-nav-link--cta:hover {
    background: rgba(249, 168, 38, 0.1);
    border-color: rgba(249, 168, 38, 0.35);
}

.tmc-nav-link--cta.tmc-nav-link--active {
    background: rgba(249, 168, 38, 0.16);
    border-color: rgba(249, 168, 38, 0.4);
}

.tmc-logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
    text-decoration: none;
    margin-right: auto;
}

.tmc-logo img {
    display: block;
    height: 56px;
    width: auto;
    max-width: min(220px, 42vw);
    object-fit: contain;
}

@media (min-width: 769px) {
    .tmc-logo img {
        height: 64px;
        max-width: 280px;
    }
}

@media (min-width: 1200px) {
    .tmc-logo img {
        height: 72px;
        max-width: none;
    }
}

.tmc-desktop-nav .tmc-nav-link:hover,
.tmc-desktop-nav .tmc-nav-link.tmc-nav-link--active {
    color: #0F2D3A !important;
}

/* ── Language switcher (desktop) ─────────────────────────── */
.lang-switcher {
    position: relative;
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border: 1px solid rgba(15, 45, 58, 0.12);
    border-radius: 14px;
    background: #fff;
    color: #0F2D3A;
    font-size: 0.82rem;
    font-weight: 650;
    font-family: inherit;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
    white-space: nowrap;
}

.lang-btn:hover {
    background: rgba(249, 168, 38, 0.08);
    border-color: rgba(249, 168, 38, 0.28);
}

.lang-globe {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.lang-btn-flag {
    font-size: 0.95em;
    line-height: 1;
    flex: 0 0 auto;
}

.lang-btn-code {
    letter-spacing: 0.02em;
}

.lang-chevron {
    width: 14px;
    height: 14px;
    transition: transform .18s ease;
}

.lang-switcher.open .lang-chevron {
    transform: rotate(180deg);
}

.lang-dropdown {
    display: block;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 190px;
    max-height: min(360px, 70vh);
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(15, 45, 58, 0.1);
    border-radius: 16px;
    box-shadow: 0 16px 44px rgba(15, 45, 58, 0.14);
    padding: 6px;
    z-index: 10000;
    transform: translateY(-6px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}

.lang-switcher.open .lang-dropdown {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #0F2D3A;
    font-size: 0.86rem;
    font-weight: 600;
    transition: background .15s ease;
}

.lang-option:hover {
    background: #F7F9FA;
}

.lang-option.active {
    background: rgba(249, 168, 38, 0.14);
    font-weight: 750;
}

.lang-option.active::after {
    content: '✓';
    margin-left: auto;
    font-size: .8rem;
}

.lang-flag {
    font-size: 0.95em;
    line-height: 1;
    flex: 0 0 auto;
}

/* ── Mobile hamburger popover (compact, not full screen) ─── */
@media screen and (max-width: 1199px) {
    .mobile-menu-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 100000;
        background: rgba(15, 45, 58, 0.08);
        opacity: 0;
        pointer-events: none;
        transition: opacity .18s ease;
    }

    .mobile-menu-backdrop.open {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .tmc-mobile-menu,
    .tmc-mobile-menu.mobile-menu-popover {
        display: none !important;
        position: fixed !important;
        top: auto !important;
        left: auto !important;
        right: 16px !important;
        bottom: auto !important;
        inset: auto 16px auto auto !important;
        transform: none !important;
        translate: none !important;
        width: min(360px, calc(100vw - 32px)) !important;
        max-width: 360px !important;
        max-height: 78vh !important;
        margin: 0 !important;
        padding: 44px 10px 10px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        flex-direction: column !important;
        gap: 2px !important;
        background: #fff !important;
        border: 1px solid rgba(15, 45, 58, 0.08) !important;
        border-radius: 22px !important;
        box-shadow: 0 20px 60px rgba(15, 45, 58, 0.18) !important;
        z-index: 100002 !important;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-menu-close {
        position: absolute;
        top: 14px;
        right: 14px;
        z-index: 2;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        padding: 0;
        border: none;
        border-radius: 14px;
        background: rgba(15, 45, 58, 0.06);
        color: #0F2D3A;
        cursor: pointer;
        transition: background .15s ease;
    }

    .mobile-menu-close svg {
        width: 16px;
        height: 16px;
    }

    .mobile-menu-close:hover {
        background: rgba(249, 168, 38, 0.16);
    }

    .tmc-mobile-menu.open,
    .tmc-mobile-menu.mobile-menu-popover.open {
        display: flex !important;
        position: fixed !important;
        top: 72px !important;
        right: 16px !important;
        left: auto !important;
        bottom: auto !important;
        inset: auto 16px auto auto !important;
        transform: none !important;
        translate: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: min(360px, calc(100vw - 32px)) !important;
        max-width: 360px !important;
        height: auto !important;
        max-height: calc(100vh - 96px) !important;
    }

    .tmc-mobile-menu.open .tmc-nav-link {
        display: flex !important;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
        padding: 12px 14px !important;
        margin: 0 !important;
        border: none !important;
        border-bottom: none !important;
        border-radius: 14px !important;
        color: #0F2D3A !important;
        text-decoration: none !important;
        font-size: 0.94rem !important;
        font-weight: 650 !important;
        line-height: 1.25 !important;
        background: transparent;
        transition: background .15s ease;
    }

    .tmc-mobile-menu.open .tmc-nav-link:hover {
        background: #F7F9FA !important;
    }

    .tmc-mobile-menu.open .tmc-nav-link--active {
        background: rgba(249, 168, 38, 0.14) !important;
        font-weight: 750 !important;
    }

    .tmc-mobile-menu.open .tmc-nav-link--cta {
        margin-top: 8px !important;
        justify-content: center;
        border: 1px solid rgba(15, 45, 58, 0.12) !important;
        background: #fff !important;
        box-shadow: 0 2px 8px rgba(15, 45, 58, 0.04);
    }

    .tmc-mobile-menu.open .tmc-nav-link--cta.tmc-nav-link--active {
        background: rgba(249, 168, 38, 0.12) !important;
    }

    .tmc-mobile-menu.open .mobile-lang-section {
        margin-top: 10px;
        padding: 4px 0 0;
    }

    .tmc-mobile-menu.open .mobile-lang-toggle {
        width: 100%;
        justify-content: space-between;
        box-sizing: border-box;
    }

    .tmc-mobile-menu.open .mobile-lang-opts {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
}

@media screen and (max-width: 768px) {
    .tmc-mobile-menu.open,
    .tmc-mobile-menu.mobile-menu-popover.open {
        top: 60px !important;
        right: 14px !important;
        left: auto !important;
        bottom: auto !important;
        inset: auto 14px auto auto !important;
        transform: none !important;
        translate: none !important;
        width: min(360px, calc(100vw - 28px)) !important;
        max-height: calc(100vh - 80px) !important;
    }
}

/* ── Mobile language section ─────────────────────────────── */
.mobile-lang-section {
    margin-top: 12px;
    padding: 8px 0 0;
    border-top: none;
}

.mobile-lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid rgba(15, 45, 58, 0.12);
    border-radius: 14px;
    cursor: pointer;
    color: #0F2D3A;
    font-size: 0.82rem;
    font-weight: 650;
    font-family: inherit;
    transition: background .15s, border-color .15s;
}

.mobile-lang-toggle:hover {
    background: rgba(249, 168, 38, 0.08);
    border-color: rgba(249, 168, 38, 0.28);
}

.mobile-lang-toggle-inner {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.mobile-lang-code {
    letter-spacing: 0.02em;
    font-weight: 700;
}

.mobile-lang-chevron {
    transition: transform .2s ease;
    flex-shrink: 0;
}

.mobile-lang-opts {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
    background: #F7F9FA;
    border: 1px solid rgba(15, 45, 58, 0.08);
    border-radius: 14px;
    margin-top: 8px;
    width: fit-content;
    min-width: 190px;
}

.mobile-lang-opts.open {
    max-height: min(320px, 40vh);
    overflow-y: auto;
}

.mobile-lang-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    text-decoration: none;
    color: #0F2D3A;
    font-size: 0.84rem;
    font-weight: 650;
    border-bottom: none;
    transition: background .12s ease;
    min-height: 40px;
    white-space: nowrap;
}

.mobile-lang-opt:hover {
    background: rgba(249, 168, 38, 0.08);
}

.mobile-lang-opt.active {
    font-weight: 750;
    background: rgba(249, 168, 38, 0.14);
}

.mobile-lang-flag {
    font-size: 0.95em;
    line-height: 1;
    flex-shrink: 0;
}

.mobile-lang-check {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--tmc-accent, #FDBB3A);
    font-weight: 900;
}

@media (max-width: 1199px) {
    .lang-switcher {
        display: none !important;
    }

    .tmc-desktop-nav {
        display: none !important;
    }

    .tmc-mobile-menu-btn {
        display: inline-flex !important;
    }
}

@media (min-width: 1200px) {
    .tmc-desktop-nav {
        display: flex !important;
    }

    .tmc-mobile-menu-btn {
        display: none !important;
    }

    .mobile-menu-backdrop {
        display: none !important;
    }

    .tmc-mobile-menu:not(.open) {
        display: none !important;
    }
}

/* ── Mobile popover anchor lock (right under hamburger) ─── */
@media (max-width: 1199px) {
    body .tmc-header #mobileMenu,
    body .tmc-header .tmc-mobile-menu,
    body .tmc-header .mobile-menu-popover,
    body #mobileMenu.tmc-mobile-menu.mobile-menu-popover,
    body #mobileMenu.tmc-mobile-menu.mobile-menu-popover.open {
        position: fixed !important;
        top: 72px !important;
        right: 16px !important;
        left: auto !important;
        bottom: auto !important;
        inset: auto 16px auto auto !important;
        transform: none !important;
        translate: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: min(360px, calc(100vw - 32px)) !important;
        max-width: 360px !important;
        height: auto !important;
        max-height: calc(100vh - 96px) !important;
        overflow-y: auto !important;
    }
}

@media (max-width: 768px) {
    body .tmc-header #mobileMenu,
    body .tmc-header .tmc-mobile-menu.mobile-menu-popover.open,
    body #mobileMenu.tmc-mobile-menu.mobile-menu-popover.open {
        top: 60px !important;
        right: 14px !important;
        inset: auto 14px auto auto !important;
        max-height: calc(100vh - 80px) !important;
    }
}
