/* =============================================
   MENU HAMBURGER - LISTE PILULES GLASS
   Version: 2025-11-30 - Style Pills Vertical + Glassmorphism
   ============================================= */

/* =============================================
   BOUTON HAMBURGER
   ============================================= */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 99999;
  position: relative;
}

.hamburger-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger-btn span:nth-child(1) { margin-bottom: 6px; }
.hamburger-btn span:nth-child(3) { margin-top: 6px; }

/* Animation X quand ouvert */
.hamburger-btn.is-active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}
.hamburger-btn.is-active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}
.hamburger-btn.is-active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}

/* =============================================
   CACHER LE HEADER QUAND MENU OUVERT
   ============================================= */
body.menu-open .site-header {
  opacity: 0;
  pointer-events: none;
}

/* =============================================
   MENU OVERLAY FULLSCREEN - Fond Flou Premium
   ============================================= */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;

  /* Fond opaque - aucun contenu visible derrière */
  background: rgba(8, 8, 20, 0.95);
  backdrop-filter: blur(60px);
  -webkit-backdrop-filter: blur(60px);

  z-index: 99990;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 40px 20px;
  padding-top: calc(40px + env(safe-area-inset-top, 0));
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0));

  /* Hidden par defaut - Animation droite vers gauche */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(100%);

  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1),
              opacity 0.3s ease,
              visibility 0.3s ease;
}

/* Bloquer le scroll de l'arrière-plan */
body.menu-open {
  overflow: hidden !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  touch-action: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Empêcher tout débordement sur mobile quand menu ouvert */
html.menu-open {
  overflow: hidden !important;
  height: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
}

/* Gradient ambient - plus marqué pour effet flou sur toutes les pages */
.menu-overlay::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 149, 0, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(138, 43, 226, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 30%, rgba(78, 124, 216, 0.10) 0%, transparent 45%),
    radial-gradient(ellipse at 20% 70%, rgba(255, 180, 100, 0.08) 0%, transparent 45%);
  pointer-events: none;
  animation: ambientShift 15s ease-in-out infinite;
}

@keyframes ambientShift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, 1%) rotate(1deg); }
  66% { transform: translate(-1%, 2%) rotate(-1deg); }
}

.menu-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}

/* =============================================
   BOUTON FERMER - Style Glass Premium
   ============================================= */
.menu-close {
  position: absolute;
  top: 24px;
  right: 24px;
  top: calc(24px + env(safe-area-inset-top, 0));
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  opacity: 0;
  transform: scale(0.5) rotate(-180deg);
  z-index: 10;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.menu-overlay.is-open .menu-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  transition-delay: 0.15s;
}

.menu-close:hover {
  background: rgba(255, 149, 0, 0.2);
  border-color: rgba(255, 149, 0, 0.4);
  transform: scale(1.1);
}

.menu-close:active {
  transform: scale(0.95);
}

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

/* =============================================
   HEADER DU MENU - Cache
   ============================================= */
.menu-header {
  display: none;
}

.menu-logo {
  display: none;
}

/* =============================================
   NAVIGATION - Liste Verticale
   ============================================= */
.menu-nav {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 4px;
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  max-height: 100%;
}

.menu-nav::-webkit-scrollbar {
  display: none;
}

/* =============================================
   ITEMS DE MENU - Pilules Glass Premium
   ============================================= */
.menu-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 60px;
  text-decoration: none;
  color: #fff;
  position: relative;
  cursor: pointer;
  padding: 14px 20px;
  box-sizing: border-box;

  /* Style Pilule Glass Ultra Arrondie */
  border-radius: 50px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.02) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  /* Ombre douce */
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.2),
    0 0 40px rgba(255, 149, 0, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);

  /* Animation entree - de droite vers gauche */
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Effet de brillance au survol */
.menu-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.menu-item:hover::before {
  opacity: 1;
}

.menu-overlay.is-open .menu-item {
  opacity: 1;
  transform: translateX(0);
}

/* Delais cascade fluide - effet vague */
.menu-overlay.is-open .menu-item:nth-child(1) { transition-delay: 0.05s; }
.menu-overlay.is-open .menu-item:nth-child(2) { transition-delay: 0.08s; }
.menu-overlay.is-open .menu-item:nth-child(3) { transition-delay: 0.11s; }
.menu-overlay.is-open .menu-item:nth-child(4) { transition-delay: 0.14s; }
.menu-overlay.is-open .menu-item:nth-child(5) { transition-delay: 0.17s; }
.menu-overlay.is-open .menu-item:nth-child(6) { transition-delay: 0.20s; }
.menu-overlay.is-open .menu-item:nth-child(7) { transition-delay: 0.23s; }
.menu-overlay.is-open .menu-item:nth-child(8) { transition-delay: 0.26s; }
.menu-overlay.is-open .menu-item:nth-child(9) { transition-delay: 0.29s; }
.menu-overlay.is-open .menu-item:nth-child(10) { transition-delay: 0.32s; }
.menu-overlay.is-open .menu-item:nth-child(11) { transition-delay: 0.35s; }
.menu-overlay.is-open .menu-item:nth-child(12) { transition-delay: 0.38s; }

/* Hover effect premium */
.menu-item:hover {
  transform: translateX(-8px) scale(1.02);
  background: linear-gradient(
    135deg,
    rgba(255, 149, 0, 0.18) 0%,
    rgba(255, 149, 0, 0.08) 50%,
    rgba(255, 200, 100, 0.05) 100%
  );
  border-color: rgba(255, 149, 0, 0.35);
  box-shadow:
    0 8px 32px rgba(255, 149, 0, 0.15),
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.menu-item:hover .menu-item-icon {
  color: #ff9500;
  transform: scale(1.15) rotate(-5deg);
}

.menu-item:hover .menu-item-text {
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 149, 0, 0.5);
}

.menu-item:active {
  transform: translateX(-4px) scale(0.98);
  transition-duration: 0.1s;
}

/* Etat actif / page courante */
.menu-item.is-current {
  background: linear-gradient(
    135deg,
    rgba(255, 149, 0, 0.22) 0%,
    rgba(255, 149, 0, 0.12) 50%,
    rgba(255, 180, 80, 0.08) 100%
  );
  border-color: rgba(255, 149, 0, 0.4);
  box-shadow:
    0 6px 28px rgba(255, 149, 0, 0.2),
    0 0 50px rgba(255, 149, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.menu-item.is-current .menu-item-icon {
  color: #ff9500;
}

.menu-item.is-current .menu-item-text {
  color: #ffb347;
  font-weight: 700;
}

/* =============================================
   ICONE - Circle Glass
   ============================================= */
.menu-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  background: rgba(255, 149, 0, 0.25);
  border: 1px solid rgba(255, 149, 0, 0.35);
  color: rgba(255, 255, 255, 0.95);
  transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  flex-shrink: 0;
}

.menu-item-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
  display: block;
}

/* =============================================
   TEXTE
   ============================================= */
.menu-item-text {
  flex: 1;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.3s ease;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* =============================================
   FOOTER DU MENU - MASQUÉ PARTOUT
   ============================================= */
.menu-footer {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.menu-footer-text {
  display: none !important;
}

/* =============================================
   RESPONSIVE - Tablettes
   ============================================= */
@media (min-width: 600px) {
  .menu-overlay {
    padding: 0 30px;
  }

  .menu-nav {
    max-width: 500px;
    gap: 12px;
    padding: 25px 10px;
  }

  .menu-item {
    min-height: 68px;
    padding: 16px 24px;
    gap: 18px;
  }

  .menu-item-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
  }

  .menu-item-icon svg {
    width: 26px;
    height: 26px;
  }

  .menu-item-text {
    font-size: 16px;
  }
}

/* =============================================
   RESPONSIVE - Desktop
   ============================================= */
@media (min-width: 1024px) {
  .menu-overlay {
    padding: 0 30px;
    background: rgba(8, 8, 20, 0.95);
    backdrop-filter: blur(250px);
    -webkit-backdrop-filter: blur(250px);
  }

  .menu-nav {
    max-width: 500px;
    gap: 12px;
    padding: 25px 10px;
    justify-content: flex-start;
  }

  .menu-item {
    min-height: 68px;
    padding: 16px 24px;
    gap: 18px;
    border-radius: 50px;
  }

  .menu-item-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
  }

  .menu-item-icon svg {
    width: 26px;
    height: 26px;
  }

  .menu-item-text {
    font-size: 16px;
    font-weight: 600;
  }

  .menu-close {
    width: 52px;
    height: 52px;
    top: 28px;
    right: 32px;
  }

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

/* =============================================
   RESPONSIVE - Grands écrans
   ============================================= */
@media (min-width: 1400px) {
  .menu-overlay {
    background: rgba(8, 8, 20, 0.95);
    backdrop-filter: blur(300px);
    -webkit-backdrop-filter: blur(300px);
  }
}

/* =============================================
   RESPONSIVE - Petits mobiles
   ============================================= */
@media (max-width: 380px) {
  .menu-overlay {
    padding: 0 12px;
  }

  .menu-nav {
    gap: 8px;
    padding: 15px 2px;
  }

  .menu-item {
    min-height: 54px;
    padding: 12px 16px;
    gap: 12px;
    border-radius: 40px;
  }

  .menu-item-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .menu-item-icon svg {
    width: 18px;
    height: 18px;
  }

  .menu-item-text {
    font-size: 13px;
  }

  .menu-close {
    width: 42px;
    height: 42px;
    top: 16px;
    right: 12px;
  }

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

/* =============================================
   RESPONSIVE - Écrans courts
   ============================================= */
@media (max-height: 650px) {
  .menu-overlay {
    padding: 0 10px;
  }

  .menu-nav {
    gap: 6px;
    padding: 10px 2px;
  }

  .menu-item {
    min-height: 48px;
    padding: 10px 14px;
    gap: 10px;
    border-radius: 35px;
  }

  .menu-item-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .menu-item-icon svg {
    width: 16px;
    height: 16px;
  }

  .menu-item-text {
    font-size: 12px;
  }

  .menu-footer {
    display: none;
  }

  .menu-close {
    width: 38px;
    height: 38px;
    top: 12px;
    right: 10px;
  }

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

/* =============================================
   SAFE AREAS (iPhone)
   ============================================= */
@supports (padding-top: env(safe-area-inset-top)) {
  .menu-overlay {
    padding-top: calc(40px + env(safe-area-inset-top));
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }

  .menu-close {
    top: calc(24px + env(safe-area-inset-top));
  }
}

/* =============================================
   PWA STANDALONE MODE - Fullscreen fix
   ============================================= */
@media (display-mode: standalone) {
  .menu-overlay {
    height: 100% !important;
    min-height: 100% !important;
  }

  body.menu-open {
    height: 100% !important;
    min-height: 100% !important;
  }
}

/* Fix pour iOS Safari et PWA - aucun espace en bas */
html.menu-open,
html.menu-open body {
  height: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  overflow: hidden !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
}

/* =============================================
   REDUCED MOTION
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  .menu-overlay,
  .menu-item,
  .hamburger-btn span,
  .menu-close,
  .menu-footer,
  .menu-item-icon,
  .menu-overlay::before {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}

/* =============================================
   RESET ANCIEN MENU
   ============================================= */
body.force-mobile .main-nav,
body.force-mobile nav.main-nav,
body.force-mobile #main-nav {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.nav-backdrop,
#nav-backdrop {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.force-mobile .nav-toggle {
  display: none !important;
}

/* =============================================
   SPHÈRE PED'IA - GARDER VISIBLE MÊME QUAND MENU OUVERT
   ============================================= */
/* La sphère reste visible et accessible même quand le menu est ouvert */
body.menu-open #pedia-floating-container,
body.menu-open .pedia-floating-container {
  z-index: 99999 !important;
}
