/**
 * Menu Mobile Amélioré - Météo Belge
 * Design moderne slide-in avec icônes météo
 */

/* ============================================
   ICÔNES MÉTÉO DANS LE MENU
   ============================================ */
.menu-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* Icônes avec remplissage */
.menu-icon.icon-filled svg {
  fill: currentColor;
  stroke: none;
}

/* Couleurs spéciales pour certaines icônes */
.menu-icon.icon-sun { color: #E3B320; }
.menu-icon.icon-cloud { color: #64748b; }
.menu-icon.icon-rain { color: #3b82f6; }
.menu-icon.icon-snow { color: #06b6d4; }
.menu-icon.icon-storm { color: #f59e0b; }
.menu-icon.icon-wind { color: #8b5cf6; }
.menu-icon.icon-alert { color: #ef4444; }
.menu-icon.icon-temp { color: #f97316; }
.menu-icon.icon-air { color: #22c55e; }

/* ============================================
   MENU DESKTOP - ICÔNES
   ============================================ */
.main-nav .nav-link,
.main-nav .dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.main-nav .dropdown-content a {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main-nav .menu-icon {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

/* ============================================
   OVERLAY MOBILE
   ============================================ */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 34, 51, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 998;
}

.mobile-menu-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   MENU MOBILE SLIDE-IN
   ============================================ */
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: calc(100vw - 60px);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

/* En-tête du menu mobile */
.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}

.mobile-menu-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu-title .menu-icon {
  color: var(--brand-blue);
}

.mobile-menu-close {
  width: 40px;
  height: 40px;
  border: none;
  background: #f1f5f9;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s ease;
}

.mobile-menu-close:hover,
.mobile-menu-close:active {
  background: #e2e8f0;
  color: var(--brand-dark);
}

.mobile-menu-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
}

/* Contenu scrollable */
.mobile-menu-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  -webkit-overflow-scrolling: touch;
}

/* Items du menu */
.mobile-menu-item {
  margin: 4px 12px;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.mobile-menu-link:hover,
.mobile-menu-link:active {
  background: rgba(30, 144, 255, 0.08);
  color: var(--brand-blue);
}

.mobile-menu-link .menu-icon {
  width: 22px;
  height: 22px;
  opacity: 0.9;
}

.mobile-menu-link .menu-label {
  flex: 1;
}

.mobile-menu-link .menu-arrow {
  width: 16px;
  height: 16px;
  color: #94a3b8;
  transition: transform 0.25s ease;
}

/* Dropdown ouvert */
.mobile-menu-item.is-open > .mobile-menu-link {
  background: rgba(30, 144, 255, 0.08);
  color: var(--brand-blue);
}

.mobile-menu-item.is-open > .mobile-menu-link .menu-arrow {
  transform: rotate(180deg);
}

/* Sous-menu */
.mobile-submenu {
  display: none;
  padding: 8px 0 8px 20px;
  margin: 0;
}

.mobile-menu-item.is-open > .mobile-submenu {
  display: block;
  animation: slideDown 0.25s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mobile-submenu-item {
  margin: 2px 0;
}

.mobile-submenu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #475569;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  border-radius: 10px;
  border-left: 3px solid transparent;
  margin-left: 12px;
  transition: all 0.2s ease;
}

.mobile-submenu-link:hover,
.mobile-submenu-link:active {
  background: rgba(30, 144, 255, 0.06);
  border-left-color: var(--brand-blue);
  color: var(--brand-blue);
}

.mobile-submenu-link .menu-icon {
  width: 18px;
  height: 18px;
  opacity: 0.75;
}

/* Séparateur */
.mobile-menu-separator {
  height: 1px;
  background: #e5e7eb;
  margin: 12px 20px;
}

/* Pied du menu */
.mobile-menu-footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}

/* Liens du footer mobile */
.mobile-footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.mobile-footer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #475569;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.mobile-footer-link:hover,
.mobile-footer-link:active {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--brand-dark);
}

.mobile-footer-link .menu-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.mobile-menu-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--brand-blue) 0%, #0066cc 100%);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(30, 144, 255, 0.3);
  transition: all 0.25s ease;
}

.mobile-menu-cta:hover,
.mobile-menu-cta:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(30, 144, 255, 0.4);
}

.mobile-menu-cta .menu-icon {
  width: 20px;
  height: 20px;
}

/* ============================================
   BURGER AMÉLIORÉ
   ============================================ */
.burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1000;
}

.burger:hover {
  background: #f8fafc;
  border-color: var(--brand-blue);
}

.burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--brand-dark);
  border-radius: 2px;
  position: relative;
  transition: background 0.2s ease;
}

.burger span::before,
.burger span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: var(--brand-dark);
  border-radius: 2px;
  transition: transform 0.3s ease, top 0.3s ease;
}

.burger span::before { top: -6px; }
.burger span::after { top: 6px; }

.burger[aria-expanded="true"] {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
}

.burger[aria-expanded="true"] span {
  background: transparent;
}

.burger[aria-expanded="true"] span::before,
.burger[aria-expanded="true"] span::after {
  background: #fff;
}

.burger[aria-expanded="true"] span::before {
  top: 0;
  transform: rotate(45deg);
}

.burger[aria-expanded="true"] span::after {
  top: 0;
  transform: rotate(-45deg);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 980px) {
  .burger {
    display: inline-flex;
  }
  
  .main-nav {
    display: none;
  }
}

@media (max-width: 400px) {
  .mobile-menu {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
  }
  
  .mobile-menu-link {
    padding: 16px;
  }
  
  .mobile-submenu-link {
    padding: 14px 16px;
  }
}

/* ============================================
   ANIMATIONS BODY
   ============================================ */
body.mobile-menu-open {
  overflow: hidden;
}

/* Safe area pour iPhone */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mobile-menu-footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  
  .mobile-menu-content {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
