/* =========================================================
 * HEADER MODERNE (CLEAN)
 * ========================================================= */

/* Fix Sticky Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1050;
  width: 100%;
  background: var(--surface); /* Fond solide */
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s ease;
}
.site-header.scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

/* Container Flex */
.nav-container {
  max-width: var(--container-w, 1200px);
  margin: 0 auto;
  padding: 0 20px;
  height: var(--header-height, 80px); /* Hauteur fixe confortable */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* --- 1. BRAND / LOGO --- */
.site-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo {
  height: 42px; /* Hauteur maîtrisée */
  width: auto;
  display: block;
  /* Optionnel : filtre pour Dark Mode si le SVG est noir par défaut */
  /* filter: invert(0); */
  transition: transform 0.2s ease;
}
:root[data-theme="dark"] .brand-logo {
  /* Si logo noir, on l'inverse en blanc pour le dark mode */
  /* filter: invert(1); */
}

.site-brand:hover .brand-logo {
  transform: scale(1.05);
}

/* --- 2. NAVIGATION DESKTOP --- */
#nav {
flex: 1;
display: flex;
justify-content: center; /* Menu centré */
}

#nav ul {
list-style: none; margin: 0; padding: 0;
display: flex; align-items: center; gap: 30px;
}

.nav-link {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  padding: 8px 0;
  position: relative;
  transition: color 0.2s ease;
  cursor: pointer;
}

/* Effet souligné moderne */
.nav-link::after {
  content: "";
  position: absolute; bottom: 0; left: 0; width: 0%; height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-link:hover { color: var(--accent); }
.nav-link:hover::after { width: 100%; }
.nav-link.disabled { opacity: 0.5; cursor: not-allowed; }

/* Flèche sous-menu */
.submenu-arrow {
  font-size: 0.7em; margin-left: 6px;
  transition: transform 0.2s;
  color: var(--muted);
}
.has-submenu:hover .submenu-arrow { transform: rotate(180deg); color: var(--accent); }

/* SOUS-MENU Dropdown */
.has-submenu { position: relative; }

.submenu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(10px);
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  opacity: 0; visibility: hidden;
  transition: all 0.2s ease;
  padding: 8px 0;
  z-index: 100;
}

.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu {
  opacity: 1; visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.submenu li a {
  display: block;
  padding: 10px 20px;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s;
  white-space: nowrap;
}
.submenu li a:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}

/* --- 3. ACTIONS (Theme / Burger) --- */
.header-actions {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.1rem;
}
.icon-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* * IMPORTANT : MASQUAGE STRICT DES ÉLÉMENTS MOBILES EN DESKTOP
 * Cela empêche le burger, le panel ou le toggle mobile d'apparaître sur grand écran.
 */
.burger,
.nav-panel,
.theme-toggle.mobile {
  display: none !important;
}


/* =========================================================
 * RESPONSIVE (MOBILE / TABLETTE)
 * ========================================================= */
@media (max-width: 980px) {
  #nav { display: none; } /* On cache le menu desktop */

  /* On réactive les éléments mobiles */
  .burger { display: flex !important; }
  .nav-panel { display: flex !important; }
  .theme-toggle.mobile { display: flex !important; }

  /* Backdrop */
  .backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1100;
    animation: fadeIn 0.3s;
  }

  /* Panel Latéral */
  .nav-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 300px; max-width: 85vw;
    background: var(--surface);
    z-index: 1150;
    box-shadow: -10px 0 30px rgba(0,0,0,0.2);
    flex-direction: column; /* Assuré par le flex réactivé plus haut */
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .nav-panel[aria-hidden="false"] { transform: translateX(0); }
  /* Fallback CSS simple si JS ajoute class open */
  .nav-panel.open { transform: translateX(0); }

  /* Panel Header */
  .panel-header {
    padding: 20px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
  }
  .panel-title { font-weight: 800; text-transform: uppercase; font-size: 1.1rem; }
  .panel-actions { display: flex; gap: 10px; }

  /* Mobile List */
  .mobile-menu {
    list-style: none; padding: 0; margin: 0;
    overflow-y: auto; flex: 1;
  }
  .mobile-menu > li { border-bottom: 1px solid var(--border); }

  .mobile-link, .mobile-parent {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    font-size: 1rem; font-weight: 700; color: var(--text);
    text-decoration: none; background: transparent; border: none;
    text-align: left;
  }
  .mobile-link:active { background: rgba(0,0,0,0.05); }

  /* Submenu Mobile */
  .mobile-submenu {
    background: color-mix(in srgb, var(--bg) 50%, var(--surface));
    list-style: none; padding: 0; margin: 0;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.03);
  }
  .mobile-submenu li a {
    display: block; padding: 12px 30px;
    font-size: 0.95rem; color: var(--muted); text-decoration: none;
    border-top: 1px solid var(--border);
  }
  .mobile-submenu li a:hover { color: var(--accent); }

  /* On cache le toggle desktop en mobile */
  .theme-toggle.desktop { display: none; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
