/* Mobile Menu Core Styles */
.mobile-menu-container {
  position: fixed;
  top: 0;
  right: 0;
  width: 85%;
  max-width: 320px;
  height: 100vh;
  height: -webkit-fill-available;
  background: rgba(15, 15, 25, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10000;
  transition: all 0.3s ease;
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transform: translateX(100%);
  /* Hardware acceleration for smoother animations */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-perspective: 1000;
  perspective: 1000;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.mobile-menu-container.open {
  transform: translateX(0);
  -webkit-transform: translateX(0);
  opacity: 1;
  visibility: visible;
}

/* Header */
.mobile-menu-header {
  display: flex;
  justify-content: flex-end;
  padding: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Close Button */
.mobile-menu-close-btn {
  background: none;
  border: none;
  color: #FFD700;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  /* Hardware acceleration */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.mobile-menu-close-btn:hover,
.mobile-menu-close-btn:focus {
  background: rgba(255, 215, 0, 0.1);
  transform: rotate(90deg);
  -webkit-transform: rotate(90deg);
  outline: none;
}

/* Overlay */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: -webkit-fill-available;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  /* Hardware acceleration */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

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

/* Menu Content */
.mobile-menu-content {
  padding: 10px 0;
  /* Fix for iOS scroll bounce */
  -webkit-overflow-scrolling: touch;
}

/* Navigation Items */
.mobile-nav-item {
  display: flex;
  align-items: center;
  padding: 16px 25px;
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  position: relative;
  overflow: hidden;
  opacity: 1;
  transform: translateX(0);
  /* Hardware acceleration */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  /* Prevent text selection on iOS */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item i {
  margin-right: 15px;
  color: #FFD700;
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
  transition: transform 0.2s ease;
  -webkit-transition: transform 0.2s ease;
}

.mobile-nav-item .mobile-nav-arrow {
  margin-left: auto;
  font-size: 0.8rem;
  opacity: 0.7;
  transition: all 0.2s ease;
  -webkit-transition: all 0.2s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
  background: rgba(255, 255, 255, 0.05);
  color: #FFD700;
  border-left-color: #FFD700;
  outline: none;
}

.mobile-nav-item:hover i,
.mobile-nav-item:focus i {
  transform: scale(1.1);
  -webkit-transform: scale(1.1);
}

.mobile-nav-item:hover .mobile-nav-arrow,
.mobile-nav-item:focus .mobile-nav-arrow {
  transform: translateX(3px);
  -webkit-transform: translateX(3px);
  opacity: 1;
}

/* Toggle Button */
#mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 165, 0, 0.15));
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: #FFD700;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  margin-left: 15px;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 48px;
  height: 48px;
  position: relative;
  z-index: 10001;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  /* Hardware acceleration */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  /* Prevent text selection on iOS */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* Subtle glow effect */
  overflow: hidden;
}

#mobile-menu-btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

#mobile-menu-btn:hover::before {
  opacity: 1;
}

#mobile-menu-btn:hover,
#mobile-menu-btn:focus {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 165, 0, 0.25));
  transform: translateY(-2px) scale(1.05);
  -webkit-transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
  border-color: rgba(255, 215, 0, 0.5);
  outline: none;
}

#mobile-menu-btn:active {
  transform: translateY(0px) scale(0.98);
  -webkit-transform: translateY(0px) scale(0.98);
  box-shadow: 0 2px 10px rgba(255, 215, 0, 0.2);
}

/* Hamburger Icon Animation */
#mobile-menu-btn .hamburger {
  width: 24px;
  height: 2px;
  background: #FFD700;
  position: relative;
  transition: all 0.3s ease;
  -webkit-transition: all 0.3s ease;
  border-radius: 2px;
}

#mobile-menu-btn .hamburger::before,
#mobile-menu-btn .hamburger::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background: #FFD700;
  transition: all 0.3s ease;
  -webkit-transition: all 0.3s ease;
  border-radius: 2px;
}

#mobile-menu-btn .hamburger::before {
  transform: translateY(-8px);
  -webkit-transform: translateY(-8px);
}

#mobile-menu-btn .hamburger::after {
  transform: translateY(8px);
  -webkit-transform: translateY(8px);
}

#mobile-menu-btn[aria-expanded="true"] .hamburger {
  background: transparent;
}

#mobile-menu-btn[aria-expanded="true"] .hamburger::before {
  transform: rotate(45deg) translateY(0);
  -webkit-transform: rotate(45deg) translateY(0);
}

#mobile-menu-btn[aria-expanded="true"] .hamburger::after {
  transform: rotate(-45deg) translateY(0);
  -webkit-transform: rotate(-45deg) translateY(0);
}

/* Responsive */
@media (max-width: 992px) {
  #mobile-menu-btn { 
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .desktop-menu { 
    display: none !important; 
  }
  
  /* Smooth transitions for mobile menu */
  .mobile-menu-container {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .mobile-menu-overlay {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

/* Menu Content */
.mobile-menu-content {
  padding: 10px 0;
}

/* Navigation Items */
.mobile-nav-item {
  display: flex;
  align-items: center;
  padding: 16px 25px;
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateX(20px);
}

.mobile-nav-item i {
  margin-right: 15px;
  color: #FFD700;
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.mobile-nav-item .mobile-nav-arrow {
  margin-left: auto;
  font-size: 0.8rem;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
  background: rgba(255, 255, 255, 0.05);
  color: #FFD700;
  border-left-color: #FFD700;
  outline: none;
}

.mobile-nav-item:hover i,
.mobile-nav-item:focus i {
  transform: scale(1.1);
}

.mobile-nav-item:hover .mobile-nav-arrow,
.mobile-nav-item:focus .mobile-nav-arrow {
  transform: translateX(3px);
  opacity: 1;
}

/* Toggle Button */
#mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #FFD700;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  margin-left: 15px;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 44px;
  height: 44px;
  position: relative;
  z-index: 10001;
}

#mobile-menu-btn:hover,
#mobile-menu-btn:focus {
  background: rgba(255, 215, 0, 0.1);
  transform: scale(1.1);
  outline: none;
}

#mobile-menu-btn:active {
  transform: scale(0.95);
}

/* Hamburger Icon Animation */
#mobile-menu-btn .hamburger {
  width: 24px;
  height: 2px;
  background: #FFD700;
  position: relative;
  transition: all 0.3s ease;
}

#mobile-menu-btn .hamburger::before,
#mobile-menu-btn .hamburger::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background: #FFD700;
  transition: all 0.3s ease;
}

#mobile-menu-btn .hamburger::before {
  transform: translateY(-8px);
}

#mobile-menu-btn .hamburger::after {
  transform: translateY(8px);
}

#mobile-menu-btn[aria-expanded="true"] .hamburger {
  background: transparent;
}

#mobile-menu-btn[aria-expanded="true"] .hamburger::before {
  transform: rotate(45deg);
}

#mobile-menu-btn[aria-expanded="true"] .hamburger::after {
  transform: rotate(-45deg);
}

/* Animations */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Apply animations to menu items */
.mobile-menu-container.open .mobile-nav-item {
  animation: slideInRight 0.3s ease forwards;
}

/* Staggered animation delays */
.mobile-menu-container.open .mobile-nav-item:nth-child(1) { animation-delay: 0.1s; }
.mobile-menu-container.open .mobile-nav-item:nth-child(2) { animation-delay: 0.15s; }
.mobile-menu-container.open .mobile-nav-item:nth-child(3) { animation-delay: 0.2s; }
.mobile-menu-container.open .mobile-nav-item:nth-child(4) { animation-delay: 0.25s; }
.mobile-menu-container.open .mobile-nav-item:nth-child(5) { animation-delay: 0.3s; }
.mobile-menu-container.open .mobile-nav-item:nth-child(6) { animation-delay: 0.35s; }
.mobile-menu-container.open .mobile-nav-item:nth-child(7) { animation-delay: 0.4s; }

/* Responsive */
@media (max-width: 992px) {
  #mobile-menu-btn { 
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .desktop-menu { 
    display: none !important; 
  }
  
  /* Smooth transitions for mobile menu */
  .mobile-menu-container {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.4s ease,
                visibility 0.4s ease;
  }
  
  .mobile-menu-overlay {
    transition: opacity 0.4s ease, visibility 0.4s ease;
  }
}

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
  .mobile-menu-container,
  .mobile-menu-overlay {
    /* Ensure hardware acceleration on iOS */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-perspective: 1000;
    perspective: 1000;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  /* Fix for iOS z-index stacking context issues */
  .mobile-menu-container.open {
    -webkit-transform: translateX(0) translateZ(0);
    transform: translateX(0) translateZ(0);
  }
}
