/*--------------------------------------------------
 # Mobile Menu Styles - Naery Website
 # 
 # This stylesheet contains all styles for the mobile navigation menu
 # including hamburger button, sliding panel, overlay, and animations.
 #
 # @version 1.0.0
 # @author Cascade AI
 # @last-updated 2025-08-06
--------------------------------------------------*/

/* ==============================================
 * Hamburger Button
 * Mobile menu toggle button with animated lines
 * ============================================== */
.hamburger-btn {
  display: none;
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: none;
  outline: none;
  cursor: pointer;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-left: 10px;
  transition: all 0.3s ease;
}

.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Hamburger button lines - animated on toggle */
.hamburger-btn .line {
  display: block;
  width: 22px;
  height: 2px;
  margin: 4px auto;
  background-color: white;
  transition: all 0.3s ease-in-out;
  border-radius: 2px;
}

/* ==============================================
 * Mobile Menu Overlay
 * Darkened background that appears behind the menu
 * High z-index ensures visibility above all content
 * ============================================== */
.mobile-menu-overlay {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.7) !important;
  z-index: 9999990 !important;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transform: translateZ(0);
  isolation: isolate;
  pointer-events: auto !important;
}

/* ==============================================
 * Mobile Menu Panel
 * Main sliding menu container that appears from left
 * Contains logo, navigation links and contact button
 * Uses maximum z-index and isolation for stacking context
 * ============================================== */
.mobile-menu {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  left: -100% !important;
  width: 280px !important;
  height: 100vh !important;
  background-color: #5A2C82 !important;
  display: flex !important;
  flex-direction: column !important;
  transform: translateZ(999999px) !important;
  isolation: isolate !important;
  z-index: 9999999 !important;
  transition: left 0.3s ease-in-out !important;
  overflow-y: auto !important;
  justify-content: space-between !important;
  padding-bottom: 20px !important;
}

/* Background grid pattern for visual depth */
.mobile-menu::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.8;
  z-index: -1;
}

/* En-tête du menu mobile */
.mobile-menu-header {
  padding: 20px 20px 15px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  margin-bottom: 5px;
}

/* Logo dans le menu mobile */
.mobile-menu-logo {
  width: 90px;
  height: auto;
  margin: 0 auto 10px;
  display: block;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
  transition: all 0.3s ease;
  animation: logoEntranceEffect 1s ease-out forwards, logoFloating 3s ease-in-out infinite 1s;
}

/* Animation d'entrée et effet de flottement léger de haut en bas pour le logo */
@keyframes logoEntranceEffect {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logoFloating {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}

/* Slogan */
.mobile-menu-slogan {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  margin: 0;
  letter-spacing: 1px;
  font-weight: 400;
  animation: sloganFadeIn 1.2s ease-out forwards;
  opacity: 0;
}

/* Animation du slogan avec effet de flottement léger */
@keyframes sloganFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sloganFloat {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
  100% {
    transform: translateY(0);
  }
}

/* ==============================================
 * Close Button
 * X button in top-right corner of mobile menu
 * Includes hover animation (rotation)
 * ============================================== */
.mobile-menu-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mobile-menu-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

/* ==============================================
 * Mobile Navigation Container
 * Main navigation area with flexible spacing
 * ============================================== */
.mobile-menu-nav {
  padding: 25px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: auto;
}

/* Menu links and submenu buttons with hover and active states */
.mobile-menu-nav a,
.mobile-menu-nav .submenu-toggle {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: white;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  border-radius: 10px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.mobile-menu-nav a:hover,
.mobile-menu-nav .submenu-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Navigation icons and their animations */
.mobile-menu-nav a i,
.mobile-menu-nav .submenu-toggle i {
  margin-right: 10px;
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.3s ease;
}

.mobile-menu-nav a:hover i,
.mobile-menu-nav .submenu-toggle:hover i {
  color: white;
  transform: translateX(2px);
}

/* ==============================================
 * Submenu Container & Toggle
 * Dropdown functionality for "Nos réalisations"
 * ============================================== */
.mobile-menu-nav .has-submenu {
  position: relative;
  flex-direction: column;
  align-items: flex-start;
}

.mobile-menu-nav .has-submenu > .submenu-toggle {
  display: flex;
  width: 100%;
  justify-content: space-between;
}

/* Indicateur visuel pour le sous-menu */
.mobile-menu-nav .has-submenu > .submenu-toggle::after {
  content: '\f107'; /* Font Awesome chevron down */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-left: 8px;
  transition: transform 0.3s ease;
}

/* Rotation du chevron quand le sous-menu est ouvert */
.mobile-menu-nav .has-submenu > .submenu-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
  align-items: center;
}

.mobile-menu-nav .has-submenu > a::after {
  content: "\f107";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  margin-left: 5px;
  transition: all 0.3s ease;
}

.mobile-menu-nav .has-submenu.active > a::after {
  transform: rotate(180deg);
}

/* ==============================================
 * Submenu Content
 * Hidden by default, shown when parent is active
 * Includes fade-in animation
 * ============================================== */
.mobile-submenu {
  display: none;
  padding-left: 15px;
  margin-top: 8px;
  margin-bottom: 5px;
  width: 100%;
}

.mobile-submenu.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.mobile-submenu a {
  padding: 10px 12px;
  font-size: 15px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.03);
}

/* ==============================================
 * Contact Button
 * Special styled button at bottom of menu
 * Features gradient background and shine effect
 * ============================================== */
.mobile-menu-contact {
  padding: 15px 20px;
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-contact-btn a {
  background: linear-gradient(45deg, #8e5bda, #a764e5);
  text-align: center;
  justify-content: center;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.mobile-contact-btn a::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: rotate(30deg);
  transition: all 0.6s ease;
}

.mobile-contact-btn a:hover {
  background: linear-gradient(45deg, #9c6aec, #b575f1);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.mobile-contact-btn a:hover::before {
  left: 100%;
}

/* Styles appliqués lorsque le menu est ouvert */
body.menu-open .mobile-menu {
  left: 0;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
  position: fixed !important;
  z-index: 99999 !important;
}

body.menu-open .mobile-menu-overlay {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 99990 !important;
  position: fixed !important;
}

/* Classes pour l'état actif du menu */
body.menu-open {
  overflow: hidden;
}

/* Lien actif */
.mobile-menu-nav a.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

/* Media queries */
@media (max-width: 991px) {
  .hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  .navbar .contact-btn {
    display: none;
  }
}

/* Optimisations pour différents iPhone */
/* iPhone SE (320-375px) */
@media screen and (max-width: 375px) {
  .mobile-menu {
    width: 260px;
  }
  
  .mobile-menu-header {
    padding: 15px 15px;
  }
  
  .mobile-menu-logo {
    width: 80px;
    margin-bottom: 10px;
  }
  
  .mobile-menu-nav a {
    font-size: 15px;
    padding: 12px 14px;
  }
  
  .mobile-submenu a {
    padding: 8px 10px;
    font-size: 14px;
  }
}

/* iPhone XR, 11, 12, 14 (375-414px) */
@media screen and (min-width: 376px) and (max-width: 414px) {
  .mobile-menu {
    width: 280px;
  }
  
  .mobile-menu-nav a {
    padding: 14px 15px;
  }
}

/* Safe area inset pour les iPhone avec notch */
@supports (padding-top: env(safe-area-inset-top)) {
  .mobile-menu {
    padding-top: env(safe-area-inset-top);
    height: calc(100% - env(safe-area-inset-top));
  }
  
  .mobile-menu-header {
    padding-top: max(25px, env(safe-area-inset-top));
  }
}
