/* ===== HEADER (maquette : fixe, transparent → navy flouté au scroll) ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  transition: background .3s, backdrop-filter .3s, box-shadow .3s;
}

.header.scrolled {
  background: rgba(0, 0, 38, .72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}

header {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

/* ===== NAV : logo à gauche, liens centrés, compte à droite ===== */
.nav-center {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 12px 30px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-auth {
  display: flex;
  align-items: center;
  justify-self: end;
}

.nav-link {
  color: #fff;
  text-decoration: none;
  font-family: 'Roboto Flex', system-ui, sans-serif;
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 6px 0;
  position: relative;
  transition: color .2s;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: #FFDE00;
  transition: width .25s cubic-bezier(.4, 0, .2, 1);
}

.nav-link:hover {
  color: #FFDE00;
}

.nav-link:hover::after {
  width: 100%;
}

.nav-link-admin {
  color: #83F379 !important;
}

.nav-link-admin::after {
  background: #83F379;
}

.nav-link-admin:hover {
  color: #2AC255 !important;
}

/* ===== ICÔNES AUTH (login / logout) ===== */
/* Cercle au repos → pilule jaune au survol, le libellé se déploie avec un ressort */
.nav-icon-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  min-width: 40px;
  padding: 0 9px;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  overflow: hidden;
  transition: background .7s cubic-bezier(.22, 1, .36, 1),
              color .7s ease,
              box-shadow .7s ease,
              padding .85s cubic-bezier(.22, 1, .36, 1),
              transform .15s ease;
}

.nav-icon-link svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

.nav-icon-label {
  font-family: 'Roboto Flex', system-ui, sans-serif;
  font-weight: 600;
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  transition: max-width .85s cubic-bezier(.22, 1, .36, 1),
              margin-left .85s cubic-bezier(.22, 1, .36, 1),
              opacity .5s ease,
              transform .85s cubic-bezier(.22, 1, .36, 1);
}

.nav-icon-link:hover,
.nav-icon-link:focus-visible {
  background: #FFDE00;
  color: #00007C;
  box-shadow: 0 6px 22px rgba(255, 222, 0, .35);
}

.nav-icon-link:focus-visible {
  outline: 2px solid #FFDE00;
  outline-offset: 3px;
}

.nav-icon-link:hover .nav-icon-label,
.nav-icon-link:focus-visible .nav-icon-label {
  max-width: 140px;
  margin-left: 8px;
  opacity: 1;
  transform: none;
  transition-delay: 0s, 0s, .25s, 0s; /* le texte apparaît une fois la pilule entamée */
}

.nav-icon-link:active {
  transform: scale(.94);
}

/* Petit salut de l'icône à l'arrivée du survol */
@keyframes navIconHello {
  0%   { transform: none; }
  35%  { transform: translateY(-3px) rotate(-8deg) scale(1.1); }
  70%  { transform: translateY(1px) rotate(4deg); }
  100% { transform: none; }
}

.nav-icon-link:hover svg {
  animation: navIconHello .9s cubic-bezier(.34, 1.56, .64, 1);
}

.nav-icon-register {
  position: relative;
}

/* Logout : accent rose, et la flèche sort de la porte au survol */
.nav-logout-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.nav-logout-btn svg polyline,
.nav-logout-btn svg line {
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
}

.nav-logout-btn:hover,
.nav-logout-btn:focus-visible {
  background: rgba(239, 92, 161, .16);
  color: #EF5CA1;
  box-shadow: none;
}

.nav-logout-btn:focus-visible {
  outline-color: #EF5CA1;
}

.nav-logout-btn:hover svg {
  animation: none; /* pas de salut ici : c'est la flèche qui bouge */
}

.nav-logout-btn:hover svg polyline,
.nav-logout-btn:hover svg line {
  transform: translateX(3px);
}

/* Compte : avatar à initiale, le pseudo se déploie au survol */
.nav-account-link {
  padding: 0;
}

.nav-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, #FFDE00 0%, #FEC00E 55%, #ED0980 135%);
  color: #00007C;
  font-family: 'Classica', Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1), box-shadow .5s ease;
  overflow: hidden;
}

/* Photo de profil (Google) — remplit le cercle de l'avatar */
.nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Pilule verre sombre (le jaune reste réservé à la connexion) */
.nav-account-link:hover,
.nav-account-link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  box-shadow: 0 6px 22px rgba(0, 0, 38, 0.35);
  padding-right: 16px;
}

.nav-account-link:focus-visible {
  outline-color: #fff;
}

.nav-account-link:hover .nav-avatar,
.nav-account-link:focus-visible .nav-avatar {
  transform: scale(1.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35),
              0 0 0 3px rgba(255, 222, 0, 0.25); /* halo */
}

@keyframes logoutLeave {
  0%   { transform: translateX(0)  scale(1);    opacity: 1; color: #ffd400; }
  30%  { transform: translateX(2px) scale(1.2); opacity: 1; color: #ff6b6b; }
  100% { transform: translateX(18px) scale(0.7); opacity: 0; color: #ff6b6b; }
}

.nav-logout-btn--leaving svg {
  animation: logoutLeave .55s ease-in forwards;
}

.mobile-logout-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: 'Classica', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  transition: color .2s;
}
.mobile-logout-btn:hover {
  color: rgba(255,255,255,0.9);
}

/* ===== LOGO ===== */
.nav-logo-link {
  display: block;
  justify-self: start;
}

.logo {
  display: block;
  height: 64px;
  width: auto;
  transition: height .3s cubic-bezier(.4, 0, .2, 1);
}

.header.scrolled .logo {
  height: 48px;
}

/* ===== AUTH (intégré au groupe droit de la nav) ===== */
.auth-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ===== HAMBURGER (caché sur desktop) ===== */
.hamburger-menu {
  display: none;
}

/* ===== OVERLAY ===== */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 10, 0.65);
  z-index: 1998;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.mobile-overlay.active {
  display: block;
  opacity: 1;
}

/* ===== PANNEAU MENU MOBILE ===== */
.mobile-menu {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  width: min(82vw, 340px);
  height: 100dvh;
  background: #000026;
  z-index: 1999;
  padding: 0;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.mobile-menu.active {
  transform: translateX(0);
}

/* Logo */
.mobile-menu-logo {
  padding: 36px 32px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.4s ease 0.2s, transform 0.4s ease 0.2s;
}

.mobile-menu.active .mobile-menu-logo {
  opacity: 1;
  transform: translateY(0);
}

.mobile-menu-logo img {
  height: 80px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

/* Nav items */
.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  padding: 32px 32px 24px;
  gap: 4px;
  flex: 1;
}

.mobile-nav-item {
  font-family: 'Classica', sans-serif;
  font-size: clamp(1.6rem, 6vw, 2rem);
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  opacity: 0;
  transform: translateX(-24px);
  transition: color 0.2s,
              opacity 0.4s ease calc(0.25s + var(--i) * 0.07s),
              transform 0.4s ease calc(0.25s + var(--i) * 0.07s);
}

.mobile-menu.active .mobile-nav-item {
  opacity: 1;
  transform: translateX(0);
}

.mobile-nav-item:hover { color: #FFDE00; }

.mobile-nav-admin { color: #83F379 !important; }
.mobile-nav-admin:hover { color: #2AC255 !important; }

/* Auth */
.mobile-menu-auth {
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease 0.5s, transform 0.4s ease 0.5s;
}

.mobile-menu.active .mobile-menu-auth {
  opacity: 1;
  transform: translateY(0);
}

.mobile-username {
  font-family: 'Classica', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}
.mobile-username-link {
  text-decoration: none;
  transition: color .2s;
}
.mobile-username-link:hover {
  color: rgba(255,255,255,0.7);
}

.mobile-auth-link {
  font-family: 'Classica', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  transition: color 0.2s;
}

.mobile-auth-link:hover { color: #fff; }

.mobile-auth-register {
  font-family: 'Classica', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #000026;
  background: #FFDE00;
  text-decoration: none;
  padding: 10px 20px;
  text-align: center;
  transition: background 0.2s;
}

.mobile-auth-register:hover { background: #FEC00E; }

/* Footer */
.mobile-menu-footer {
  padding: 20px 32px 32px;
  border-top: 1px solid rgba(255,255,255,0.07);
  opacity: 0;
  transition: opacity 0.4s ease 0.6s;
}

.mobile-menu.active .mobile-menu-footer {
  opacity: 1;
}

.mobile-menu-socials {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.mobile-menu-socials a {
  color: rgba(255,255,255,0.4);
  transition: color 0.2s;
}

.mobile-menu-socials a:hover { color: #fff; }

.mobile-menu-socials svg {
  width: 22px;
  height: 22px;
}

.mobile-menu-copy {
  font-family: 'Classica', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.2);
  text-transform: uppercase;
}

/* Bloquer le scroll quand menu ouvert */
body.menu-open { overflow: hidden; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .nav-links,
  .nav-auth {
    display: none;
  }

  .nav-center {
    display: flex;
    justify-content: flex-start;
    padding: 12px 20px;
  }

  .logo { height: 56px; }
  .header.scrolled .logo { height: 46px; }

  .hamburger-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2000;
  }

  .hamburger-menu span {
    display: block;
    width: 24px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform 0.3s, opacity 0.3s, background 0.3s;
  }

  .hamburger-menu.open span { background: #fff; }

  .hamburger-menu.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .hamburger-menu.open span:nth-child(2) { opacity: 0; }
  .hamburger-menu.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ── Mouvement réduit : on coupe les animations décoratives de la nav ── */
@media (prefers-reduced-motion: reduce) {
  .nav-icon-link,
  .nav-icon-label,
  .nav-avatar,
  .nav-logout-btn svg polyline,
  .nav-logout-btn svg line {
    transition: none;
  }

  .nav-account-link:hover .nav-avatar {
    transform: none;
  }

  .nav-icon-link:hover svg {
    animation: none;
  }

  .nav-logout-btn:hover svg polyline,
  .nav-logout-btn:hover svg line {
    transform: none;
  }

  .nav-icon-link:active {
    transform: none;
  }
}
