/* ==========================================================================
   appnav.css — barre de navigation de l'espace client Merics
   Charge par mods/head.php : elle est presente sur TOUTES les pages du FOM.
   Les ecrans d'auth (mods/toplogin.php) n'affichent pas cette barre.

   Deux composants, une seule liste d'entrees :
     .mnav  — le haut de page : logo, les 5 entrees (desktop), cloche, avatar
     .mtabs — la barre du bas : les memes 5 entrees, mobile uniquement

   Hauteur du header : 69px, comme l'ancien. Les pages du FOM reservent leur
   marge haute en dur (166px sur le dashboard, 130px sur les parcours) : la
   changer casserait toutes les pages d'un coup.

   Daltonisme (Remi) : l'onglet actif ne se distingue JAMAIS par la seule
   teinte — libelle en gras + trait epais sous (ou au-dessus de) l'onglet.
   ========================================================================== */

:root {
    /* Barre compacte, comme une app : 56px sur desktop, 52px sur telephone.
       Avant le 2026-09-07 (2e passe) le header faisait 69px, et 74px sous
       768px a cause du `padding: 20px 0` que merge.css met sur
       .tg-header__area-four — c'est pour ca que .mnav le remet a zero. */
    --mnav-h: 56px;
    --mnav-bar-h: 56px;
    --mnav-ink: var(--tg-theme-primary-800, #0e104b);
    --mnav-ink-soft: var(--tg-theme-primary-300, #6568af);
    --mnav-accent: var(--tg-theme-primary-500, #191d88);
    --mnav-line: #e8e4ee;
}

/* Les icones : Material Symbols Rounded est charge par head.php sur toutes
   les pages, contrairement a la police « Material Icons » que seules
   certaines vues appellent. D'ou une classe a nous. */
.mnav .mi,
.mtabs .mi {
    font-family: 'Material Symbols Rounded', 'Material Icons';
    font-weight: 400; font-style: normal; font-size: 22px; line-height: 1;
    letter-spacing: normal; text-transform: none; display: inline-block;
    white-space: nowrap; word-wrap: normal; direction: ltr;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

/* ─── HAUT DE PAGE ─────────────────────────────────────────────────────── */

/* merge.css ajoute 20px de padding vertical au header sous 768px : la barre
   passait a 74px. On la veut a hauteur fixe, geree par --mnav-h. */
.mnav { padding: 0 !important; }
/* Meme raison que .mtabs plus bas : un debordement horizontal ne doit pas
   etirer la barre du haut au-dela de l'ecran. */
.mnav__wrap { max-width: 100vw; }

.mnav__wrap {
    display: flex; align-items: center; gap: 10px;
    min-height: var(--mnav-h); padding: 0 20px;
}
.mnav__brand { display: flex; align-items: center; line-height: 0; }
.mnav__logo { max-height: 26px; width: auto; }
.mnav__wtw {
    max-height: 22px; width: auto; margin-left: 12px;
    padding-left: 12px; border-left: 1px solid var(--mnav-line);
}

/* Les 5 entrees, desktop seulement : sur mobile c'est la barre du bas. */
.mnav__tabs { display: none; align-items: center; gap: 4px; margin: 0 auto; }
.mnav__tab {
    position: relative; display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 12px; border-radius: 9px; text-decoration: none;
    font-family: var(--tg-body-font-family); font-size: 13.5px; font-weight: 500;
    color: var(--mnav-ink-soft); white-space: nowrap;
}
.mnav__tab:hover { background: #f4f2f8; color: var(--mnav-ink); }
.mnav__tab .mi { font-size: 19px; }
.mnav__tab.is-active { color: var(--mnav-accent); font-weight: 700; }
.mnav__tab.is-active::after {
    content: ''; position: absolute; left: 12px; right: 12px; bottom: 0;
    height: 3px; border-radius: 3px; background: currentColor;
}

.mnav__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Cloche */
.mnav__icobtn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    border: 1.5px solid var(--mnav-line); background: #fff;
    color: var(--mnav-ink); text-decoration: none; cursor: pointer;
}
.mnav__icobtn:hover { border-color: #cfc9db; background: #faf9fc; }
.mnav__icobtn .mi { font-size: 20px; }
.mnav__icobtn.is-active { border-color: var(--mnav-accent); border-width: 2px; }

/* Pastille chiffree. La couleur ne porte pas l'information : c'est le
   nombre qui compte, et l'element n'existe pas quand il n'y a rien. */
.mnav__badge {
    position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
    padding: 0 4px; border-radius: 9px; background: var(--mnav-accent);
    color: #fff; font-family: var(--tg-body-font-family);
    font-size: 11px; font-weight: 700; font-style: normal; line-height: 18px;
    text-align: center; border: 2px solid #fff; box-sizing: content-box;
}

/* Avatar : initiales si connecte, bonhomme sinon */
.mnav__acct { position: relative; }
.mnav__avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0; border-radius: 50%;
    border: 1.5px solid var(--mnav-line); background: var(--tg-theme-primary-50, #ecf6fa);
    color: var(--mnav-accent); cursor: pointer;
    font-family: var(--tg-heading-font-family); font-size: 13px; font-weight: 800;
    letter-spacing: .5px; text-decoration: none;
}
.mnav__avatar:hover { border-color: var(--mnav-accent); }
.mnav__avatar .mi { font-size: 21px; }
.mnav__avatar[aria-expanded="true"] { border-color: var(--mnav-accent); border-width: 2px; }

/* Menu du compte */
.mnav__menu {
    position: absolute; top: calc(100% + 10px); right: 0; z-index: 120;
    min-width: 232px; padding: 8px; background: #fff;
    border: 1px solid var(--mnav-line); border-radius: 14px;
    box-shadow: 0 12px 34px rgba(14,16,75,.14);
}
.mnav__menu[hidden] { display: none; }
.mnav__who {
    padding: 8px 10px 10px; border-bottom: 1px solid var(--mnav-line); margin-bottom: 6px;
}
.mnav__who-name {
    font-family: var(--tg-heading-font-family); font-size: 14px; font-weight: 700;
    color: var(--mnav-ink); word-break: break-word;
}
.mnav__who-mail {
    font-family: var(--tg-body-font-family); font-size: 12px;
    color: var(--mnav-ink-soft); word-break: break-all;
}
.mnav__mi {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px;
    border-radius: 9px; text-decoration: none;
    font-family: var(--tg-body-font-family); font-size: 13.5px; font-weight: 500;
    color: var(--mnav-ink);
}
.mnav__mi:hover { background: #f4f2f8; color: var(--mnav-ink); }
.mnav__mi .mi { font-size: 19px; color: var(--mnav-ink-soft); }
.mnav__sep { height: 1px; background: var(--mnav-line); margin: 6px 4px; }
.mnav__lngs { display: flex; gap: 6px; padding: 4px 10px 8px; }
.mnav__lng {
    flex: 1 1 auto; text-align: center; padding: 7px 0; border-radius: 8px;
    border: 1.5px solid var(--mnav-line); text-decoration: none;
    font-family: var(--tg-body-font-family); font-size: 12px; font-weight: 600;
    color: var(--mnav-ink-soft); text-transform: uppercase;
}
.mnav__lng:hover { border-color: #cfc9db; color: var(--mnav-ink); }
.mnav__lng.is-active { border-color: #111; border-width: 2px; color: var(--mnav-ink); font-weight: 800; }

@media (min-width: 992px) {
    .mnav__tabs { display: flex; }
}
/* Sous 1200px, le logo partenaire ne tient plus a cote de 5 entrees. */
@media (max-width: 1199.98px) {
    .mnav__wtw { display: none; }
}
@media (max-width: 991.98px) {
    .mnav__wrap { padding: 0 14px; gap: 8px; }
}
@media (max-width: 767.98px) {
    :root { --mnav-h: 52px; }
    .mnav__logo { max-height: 24px; }
}

/* ─── BARRE DU BAS (mobile) ────────────────────────────────────────────── */

.mtabs, .mtabs__spacer { display: none; }

@media (max-width: 991.98px) {
    /* La cale evite d'ajouter un padding au body : les vues ont chacune leur
       propre <body>, et un :has() n'est pas garanti sur les vieux Safari. */
    .mtabs__spacer {
        display: block;
        height: calc(var(--mnav-bar-h) + env(safe-area-inset-bottom, 0px));
    }
    .mtabs {
        /* width:100vw et pas right:0 : quand une page deborde en largeur
           (un titre trop long, un tableau), le viewport de mise en page
           devient plus large que l'ecran et un element cale sur `right:0`
           s'etire avec lui — le 5e onglet (Account) partait hors ecran.
           100vw reste la largeur de l'ecran. */
        position: fixed; left: 0; bottom: 0; z-index: 99;
        width: 100vw; max-width: 100vw;
        display: flex; align-items: stretch;
        background: #fff; border-top: 1px solid var(--mnav-line);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -2px 14px rgba(14,16,75,.06);
    }
    .mtabs__item {
        position: relative; flex: 1 1 0; min-width: 0;
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 2px; padding: 7px 2px 6px; text-decoration: none;
        color: var(--mnav-ink-soft); font-family: var(--tg-body-font-family);
    }
    .mtabs__lbl {
        font-size: 10.5px; font-weight: 500; line-height: 1.15;
        text-align: center; max-width: 100%;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .mtabs__item .mi { font-size: 22px; }
    .mtabs__item.is-active { color: var(--mnav-accent); }
    .mtabs__item.is-active .mtabs__lbl { font-weight: 800; }
    /* Le trait, pas la teinte : c'est lui qui dit l'onglet actif. */
    .mtabs__item.is-active::before {
        content: ''; position: absolute; top: 0; left: 18%; right: 18%;
        height: 3px; border-radius: 0 0 3px 3px; background: currentColor;
    }
    .mtabs__ico { position: relative; display: inline-flex; }
    .mtabs__badge {
        position: absolute; top: -3px; right: -9px; min-width: 16px; height: 16px;
        padding: 0 3px; border-radius: 8px; background: var(--mnav-accent);
        color: #fff; font-size: 10px; font-weight: 700; font-style: normal;
        line-height: 16px; text-align: center; border: 2px solid #fff;
        box-sizing: content-box;
    }
    /* Ce qui flotte en bas doit remonter au-dessus de la barre. */
    #chatbot-toggler { bottom: calc(var(--mnav-bar-h) + 24px + env(safe-area-inset-bottom, 0px)) !important; }
    .advisor-fab     { bottom: calc(var(--mnav-bar-h) + 46px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ─── ESPACEMENT SOUS LA BARRE ─────────────────────────────────────────────
   Le header est en position absolue (.transparent-header de merge.css) : il
   ne prend pas de place dans le flux, donc chaque page reserve sa marge
   haute elle-meme. Elles le faisaient toutes differemment — 130px, 166px,
   100px, 50px — pour un header de 69px : trop d'air en haut, et parfois du
   contenu passant dessous.

   Une seule convention ici : le contenu commence 18px sous la barre. Le
   !important est assume, il gagne contre les <style> des vues et evite de
   rouvrir vingt-cinq fichiers a chaque changement de hauteur.

   PAS dans la liste : .section-offerlogin et les ecrans d'auth, qui
   utilisent mods/toplogin.php — la, l'en-tete est dans le flux. */
.appsec,
.section-dashboard, .section-claim, .section-policy,
.section-health, .section-motor, .section-details, .section-plan,
.section-expat, .section-expat-plan, .section-confirmation,
.section-housing, .section-question, .section-travelers,
.section-travel, .section-pricing,
.payment-result-section {
    padding-top: calc(var(--mnav-h) + 18px) !important;
}
