/* ============================================================ */
/*  🎨 NAVIGATION — Desktop                                       */
/* ============================================================ */

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink, #1B2A4A);
  flex-shrink: 0;
  min-width: 175px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 48px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-name {
  font-family: var(--serif, 'Source Serif 4', Georgia, serif);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink, #1B2A4A);
  line-height: 1.25;
  text-align: center;
}

.brand-tag {
  font-size: 9px;
  color: var(--slate, #5B6472);
  text-align: center;
  margin-top: 2px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

nav {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

nav ul {
  display: flex;
  gap: 18px;
  list-style: none;
  align-items: center;
  justify-content: center;
}

nav a {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #1B2A4A);
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover {
  color: var(--brass, #A8853F);
}

.profile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  font-size: 12px;
  padding: 0 12px;
  border-left: 1px solid rgba(27, 42, 74, 0.14);
}

.profile-name {
  font-weight: 700;
  color: var(--brass, #A8853F);
  font-size: 12px;
}

.profile-role {
  font-size: 10px;
  color: var(--slate, #5B6472);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ============================================================ */
/*  MENU DÉROULANT OPTIQUE (desktop)                              */
/* ============================================================ */
.optique-item { position: relative; }
.optique-trigger {
  color: #4fc3f7;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.2s;
}
.optique-trigger:hover { background: rgba(79, 195, 247, 0.15); }
.optique-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #ffffff;
  border: 1px solid rgba(27, 42, 74, 0.14);
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  min-width: 220px;
  z-index: 99999;
  padding: 6px 0;
}
.optique-dropdown a {
  display: block;
  padding: 10px 15px;
  color: #1B2A4A;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.optique-dropdown a:hover { background: #f0f9ff; color: #4fc3f7; }
.optique-item:hover .optique-dropdown { display: block; }

/* ============================================================ */
/*  🔬 MENU DÉROULANT LABORATOIRE (desktop)                       */
/* ============================================================ */
.labo-item {
  display: block;
  position: relative;
  z-index: 1001;
}
.labo-trigger {
  color: #A8853F;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.2s;
  white-space: nowrap;
}
.labo-trigger:hover { background: rgba(168, 133, 63, 0.15); }
.labo-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #ffffff;
  border: 1px solid rgba(27, 42, 74, 0.14);
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  min-width: 240px;
  z-index: 99999;
  padding: 8px 0;
}
.labo-dropdown a {
  display: block;
  padding: 10px 15px;
  color: #1B2A4A;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.labo-dropdown a:hover { background: #fdf8ee; color: #A8853F; }
.labo-item:hover .labo-dropdown { display: block; }

/* ============================================================ */
/*  RENFORT Z-INDEX                                               */
/* ============================================================ */
nav, header, .nav-row, nav ul { position: relative; }
nav ul { z-index: 1000; }

/* ============================================================ */
/*  📱 MOBILE — HEADER + MENU PLEINE LARGEUR                      */
/*  ⚠️ TOUT EN !important POUR GAGNER CONTRE LES STYLES INLINE   */
/* ============================================================ */
@media (max-width: 1024px) {

  /* ===== LE CONTENEUR DU HEADER ===== */
  header .wrap.nav-row,
  header .nav-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 16px !important;
    gap: 0 !important;
    height: 84px !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* ===== 1. BURGER À GAUCHE ===== */
  header .menu-toggle,
  header #burger-btn {
    order: 1 !important;
    display: block !important;
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 44px !important;
    font-size: 26px !important;
    line-height: 1 !important;
    color: var(--ink, #1B2A4A) !important;
    cursor: pointer !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: center !important;
    position: relative !important;
    z-index: 10000 !important;
  }

  /* ===== 2. BLOC CENTRAL (logo + texte) ===== */
  /* Le bloc prend TOUT l'espace restant */
  header .brand {
    order: 2 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 0 4px !important;
    overflow: hidden !important;
    text-decoration: none !important;
  }

  /* Le LOGO dans .brand — à gauche du texte */
  header .brand > .brand-mark,
  header .brand .brand-mark {
    order: 1 !important;
    flex: 0 0 36px !important;
    width: 36px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  header .brand .brand-mark img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  /* Le bloc TEXTE dans .brand — centré */
  header .brand > div:not(.brand-mark) {
    order: 2 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* ✅ TEXTE : s'adapte à l'écran, peut passer sur 2-3 lignes */
  header .brand .brand-name {
    font-family: var(--serif, 'Source Serif 4', Georgia, serif) !important;
    font-weight: 700 !important;
    font-size: clamp(11px, 3.4vw, 14px) !important;
    color: var(--ink, #1B2A4A) !important;
    line-height: 1.15 !important;
    text-align: center !important;
    white-space: normal !important;      /* ← AUTORISE le retour à la ligne */
    overflow-wrap: break-word !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  header .brand .brand-tag {
    font-size: clamp(9px, 2.5vw, 10.5px) !important;
    color: var(--slate, #5B6472) !important;
    text-align: center !important;
    white-space: nowrap !important;
    margin: 2px 0 0 0 !important;
    line-height: 1.1 !important;
    display: block !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* ===== 3. NAV — NE PREND PAS DE PLACE MAIS CLICABLE ===== */
  header nav {
    order: 3 !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    flex: 0 0 0 !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }

  header nav ul {
    pointer-events: auto !important;
  }

  /* ===== 4. LOGO À DROITE DU HEADER (s'il existe HORS .brand) ===== */
  header .nav-row > .brand-mark {
    order: 4 !important;
    flex: 0 0 36px !important;
    width: 36px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  header .nav-row > .brand-mark img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  /* ===== 5. LE TIROIR PLEINE LARGEUR ===== */
  header nav ul,
  nav ul {
    display: none !important;
    flex-direction: column !important;
    position: fixed !important;
    top: 84px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    background: #fff !important;
    padding: 12px 16px 24px !important;
    border-bottom: 2px solid rgba(27,42,74,0.14) !important;
    border-right: none !important;
    border-radius: 0 !important;
    gap: 6px !important;
    text-align: left !important;
    box-shadow: 0 12px 25px rgba(0,0,0,0.12) !important;
    margin: 0 !important;
    max-height: none !important;
bottom: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 99999 !important;
    list-style: none !important;
    pointer-events: auto !important;
  }

  header nav ul.show,
  nav ul.show {
    display: flex !important;
  }

  nav ul li,
  header nav ul li {
    width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
  }

  nav ul a,
  nav ul .admin-trigger,
  nav ul .labo-trigger,
  header nav ul a,
  header nav ul .admin-trigger,
  header nav ul .labo-trigger {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 14px 16px !important;
    border-radius: 8px !important;
    background: #f9f7f2 !important;
    text-align: left !important;
    white-space: normal !important;
    font-size: 15px !important;
    min-height: 48px !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
    color: var(--ink, #1B2A4A) !important;
    text-decoration: none !important;
    margin: 0 !important;
  }

  nav ul a:hover,
  nav ul .admin-trigger:hover,
  nav ul .labo-trigger:hover {
    background: #f0f0f0 !important;
  }

  /* ===== 6. SOUS-MENUS EN ACCORDÉON (cachés par défaut) ===== */
  header nav .admin-dropdown,
  header nav .labo-dropdown,
  header nav .optique-dropdown {
    position: static !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: none !important;
    padding: 0 !important;
    margin: 4px 0 0 0 !important;
    background: transparent !important;
  }

   /* Le hover ne s'applique PAS en mobile (on tape, on ne survole pas) */
  header nav .admin-item:hover .admin-dropdown,
  header nav .labo-item:hover .labo-dropdown,
  header nav .optique-item:hover .optique-dropdown {
    display: none !important;
  }

  /* ✅ OUVERTURE AU CLIC — règle renforcée pour gagner contre le hover */
  header nav .admin-item .admin-dropdown.show,
  header nav .labo-item .labo-dropdown.show,
  header nav .optique-item .optique-dropdown.show,
  header nav .admin-dropdown.show,
  header nav .labo-dropdown.show,
  header nav .optique-dropdown.show {
    display: block !important;
  }

  header nav .admin-dropdown a,
  header nav .labo-dropdown a,
  header nav .optique-dropdown a {
    display: block !important;
    padding: 12px 16px 12px 32px !important;
    font-size: 14px !important;
    background: transparent !important;
    border-radius: 6px !important;
    min-height: 44px !important;
    line-height: 1.4 !important;
    white-space: normal !important;
    color: var(--slate, #5B6472) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
  }

  header nav .admin-dropdown a:hover,
  header nav .labo-dropdown a:hover,
  header nav .optique-dropdown a:hover {
    background: #f0f0f0 !important;
    color: var(--ink, #1B2A4A) !important;
  }

  /* ===== 7. PROFIL ET BOUTON CONNEXION ===== */
  nav ul .profile-info {
    border: none !important;
    padding: 14px 16px !important;
    background: #f9f7f2 !important;
    border-radius: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: left !important;
    align-items: flex-start !important;
    display: flex !important;
    flex-direction: column !important;
  }

  nav ul .nav-cta {
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: center !important;
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
  }
}

/* ============================================================ */
/*  📱 Très petits écrans (< 380px) — Texte sur 2-3 lignes        */
/* ============================================================ */
@media (max-width: 380px) {
  header .brand .brand-name {
    font-size: 11px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
  }
  header .brand .brand-tag {
    font-size: 9px !important;
  }
  header .menu-toggle,
  header #burger-btn {
    font-size: 24px !important;
    width: 36px !important;
    flex: 0 0 36px !important;
  }
  header .brand > .brand-mark,
  header .nav-row > .brand-mark {
    width: 32px !important;
    height: 30px !important;
    flex: 0 0 32px !important;
  }
    html, body {
    overscroll-behavior-y: auto !important;
  }
}

/* ============================================================ */
/*  📱 Très très petits écrans (< 320px)                          */
/* ============================================================ */
@media (max-width: 320px) {
  header .brand .brand-name {
    font-size: 10px !important;
    line-height: 1.1 !important;
  }
  header .brand .brand-tag {
    font-size: 8.5px !important;
  }
  header .menu-toggle,
  header #burger-btn {
    font-size: 22px !important;
    width: 32px !important;
    flex: 0 0 32px !important;
  }
  header .brand > .brand-mark,
  header .nav-row > .brand-mark {
    width: 28px !important;
    height: 26px !important;
    flex: 0 0 28px !important;
  }
}

/* ============================================================ */
/*  Masquer visuellement les éléments non désirés du ruban       */
/* ============================================================ */
.contact-info,
.feedback-item {
  display: none !important;
}


/* ==========================================================================
   MODE SOMBRE — Dropdowns du ruban (Pédagogie, Espace pro, etc.)
   ========================================================================== */
[data-theme="dark"] .labo-dropdown,
[data-theme="dark"] .admin-dropdown,
[data-theme="dark"] .optique-dropdown {
  background: #1E2438 !important;
  border: 1px solid rgba(232, 228, 220, 0.15) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .labo-dropdown a,
[data-theme="dark"] .admin-dropdown a,
[data-theme="dark"] .optique-dropdown a {
  color: #E8E4DC !important;
}

[data-theme="dark"] .labo-dropdown a:hover,
[data-theme="dark"] .admin-dropdown a:hover,
[data-theme="dark"] .optique-dropdown a:hover {
  background: #2A3150 !important;
  color: #D4AF5C !important;
}

[data-theme="dark"] .labo-trigger,
[data-theme="dark"] .admin-trigger,
[data-theme="dark"] .optique-trigger {
  color: #E8E4DC !important;
}

[data-theme="dark"] .labo-trigger:hover,
[data-theme="dark"] .admin-trigger:hover,
[data-theme="dark"] .optique-trigger:hover {
  color: #D4AF5C !important;
}