/* Mega Menu Styles - Mobile Optimized */

/* Base header styles - REMOVED to use glass-header-advanced from index.css */
/* .mega-menu-header styles now handled by glass-header-advanced */

/* Desktop navigation item */
.desktop-nav > div {
  position: relative;
}

/* Scrolled state - REMOVED to use glass-header-scrolled from index.css */
/* .mega-menu-header.scrolled styles now handled by glass-header-scrolled */

/* Desktop dropdown animation */
.mega-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  min-width: 600px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-out;
  pointer-events: none;
}

.mega-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

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

/* Mobile menu panel */
.mobile-menu-panel {
  position: fixed;
  right: 0;
  top: 0;
  height: 100%;
  width: 100%;
  max-width: 24rem;
  background: white;
  box-shadow: -4px 0 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.3s ease-out;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

/* Mobile menu accordion */
.mobile-menu-section {
  border-bottom: 1px solid #e5e7eb;
}

.mobile-menu-section:last-child {
  border-bottom: none;
}

.mobile-menu-trigger {
  width: 100%;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  text-align: left;
  font-weight: 600;
  color: #111827;
  transition: background-color 0.2s ease;
}

.mobile-menu-trigger:hover {
  background-color: #f9fafb;
}

.mobile-menu-trigger-icon {
  transition: transform 0.3s ease;
}

.mobile-menu-trigger.active .mobile-menu-trigger-icon {
  transform: rotate(180deg);
}

.mobile-menu-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.mobile-menu-content.active {
  max-height: 1000px; /* Adjust as needed */
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem 0.75rem 2rem;
  color: #4b5563;
  text-decoration: none;
  transition: all 0.2s ease;
}

.mobile-menu-link:hover {
  background-color: #f3f4f6;
  color: #2563eb;
}

.mobile-menu-link-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* Mobile menu actions */
.mobile-menu-actions {
  padding: 1.5rem 1rem;
  border-top: 1px solid #e5e7eb;
}

.mobile-menu-button {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: 0.5rem;
  font-weight: 500;
  text-align: center;
  transition: all 0.2s ease;
}

.mobile-menu-button-primary {
  background: linear-gradient(to right, #059669, #047857);
  color: white;
  border: none;
}

.mobile-menu-button-primary:hover {
  background: linear-gradient(to right, #047857, #065f46);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.mobile-menu-button-secondary {
  background: white;
  color: #2563eb;
  border: 2px solid #2563eb;
}

.mobile-menu-button-secondary:hover {
  background: #eff6ff;
}

/* Responsive breakpoints */
@media (max-width: 1024px) {
  .desktop-nav {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
}

@media (min-width: 1025px) {
  .mobile-menu-overlay,
  .mobile-menu-panel,
  .mobile-menu-toggle {
    display: none !important;
  }
}

/* Accessibility improvements */
.mobile-menu-panel:focus {
  outline: none;
}

.mobile-menu-trigger:focus,
.mobile-menu-link:focus,
.mobile-menu-button:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .mega-menu-header {
    background: rgba(17, 24, 39, 0.9);
    border-bottom-color: rgba(55, 65, 81, 0.5);
  }
  
  .mobile-menu-panel {
    background: #111827;
  }
  
  .mobile-menu-trigger {
    color: #f9fafb;
  }
  
  .mobile-menu-trigger:hover {
    background-color: #1f2937;
  }
  
  .mobile-menu-link {
    color: #d1d5db;
  }
  
  .mobile-menu-link:hover {
    background-color: #1f2937;
    color: #60a5fa;
  }
  
  .mobile-menu-section {
    border-bottom-color: #374151;
  }
  
  .mobile-menu-actions {
    border-top-color: #374151;
  }
}

/* Animation performance optimization */
@media (prefers-reduced-motion: reduce) {
  .mega-dropdown,
  .mobile-menu-overlay,
  .mobile-menu-panel,
  .mobile-menu-content,
  .mobile-menu-trigger-icon {
    transition: none !important;
  }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
  .mobile-menu-trigger,
  .mobile-menu-link {
    min-height: 48px;
  }
  
  .mobile-menu-button {
    min-height: 44px;
  }
}

/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}
/* Mobile Menu Fix - Comprehensive Mobile Experience */

/* Mobile-only styles */
@media (max-width: 1023px) {
  /* Ensure proper header height on mobile */
  .glass-header-advanced {
    height: 64px;
    position: fixed !important;
    z-index: 9999 !important;
  }
  
  /* Mobile navigation container */
  .glass-header-advanced nav {
    height: 100%;
  }
  
  /* Mobile menu button styling */
  .glass-header-advanced button[aria-label*="menu"] {
    position: relative;
    z-index: 10001;
    padding: 0.75rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Mobile menu panel - Framer Motion AnimatePresence compatible */
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    z-index: 9998;
  }
  
  /* Mobile menu content container */
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] > div {
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  /* Mobile menu items */
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] a,
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] button {
    display: block;
    width: 100%;
    text-align: left;
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Prevent body scroll when menu is open */
  body:has(.glass-header-advanced [aria-expanded="true"]) {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }
  
  /* Hero section padding adjustment for mobile */
  .glass-hero {
    padding-top: 64px !important;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
  }
  
  /* Other sections padding for mobile */
  main > *:not(.glass-hero) {
    padding-top: calc(64px + 1rem);
  }
  
  /* Ensure dropdown animations work on mobile */
  @supports (animation: slide-down 0.2s) {
    .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] {
      animation: slide-down 0.2s ease-out;
    }
  }
  
  @keyframes slide-down {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  /* Mobile touch feedback */
  .glass-header-advanced a:active,
  .glass-header-advanced button:active {
    opacity: 0.7;
    transition: opacity 0.1s ease;
  }
  
  /* Ensure mobile menu is visible */
  .glass-header-advanced .lg\\:hidden {
    display: flex !important;
  }
  
  /* Hide desktop navigation on mobile */
  .glass-header-advanced .hidden.lg\\:flex {
    display: none !important;
  }
  
  /* Mobile language switcher styling */
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] .px-4.py-2 {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }
  
  /* Mobile CTA buttons container */
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] .px-4.space-y-2.pt-4.border-t {
    background: rgba(0, 0, 0, 0.02);
    padding: 1rem;
  }
  
  /* Fix for iOS Safari */
  @supports (-webkit-touch-callout: none) {
    .glass-header-advanced {
      -webkit-transform: translateZ(0);
    }
    
    .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] {
      -webkit-transform: translateZ(0);
      -webkit-overflow-scrolling: touch;
    }
  }
  
  /* Android specific fixes */
  @supports not (-webkit-touch-callout: none) {
    .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] {
      will-change: transform;
    }
  }
  
  /* Ensure proper stacking context */
  .glass-header-advanced,
  .glass-header-advanced * {
    transform-style: preserve-3d;
  }
  
  /* Improved mobile menu item hover states */
  @media (hover: none) and (pointer: coarse) {
    .glass-header-advanced a:hover,
    .glass-header-advanced button:hover {
      background-color: rgba(0, 0, 0, 0.03);
    }
  }
  
  /* Fix for viewport height on mobile browsers */
  :root {
    --vh: 1vh;
  }
  
  @supports (height: 100dvh) {
    .glass-hero {
      min-height: 100dvh !important;
    }
  }
}

/* Landscape mobile adjustments */
@media (max-width: 1023px) and (orientation: landscape) {
  .glass-header-advanced {
    height: 56px;
  }
  
  .glass-hero {
    padding-top: 56px !important;
  }
  
  main > *:not(.glass-hero) {
    padding-top: calc(56px + 1rem);
  }
  
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] > div {
    max-height: calc(100vh - 56px);
  }
}

/* High-resolution mobile displays */
@media (max-width: 1023px) and (-webkit-min-device-pixel-ratio: 2) {
  .glass-header-advanced {
    border-bottom-width: 0.5px;
  }
  
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] {
    border-bottom-width: 0.5px;
  }
}

/* Dark mode support for mobile menu */
@media (max-width: 1023px) and (prefers-color-scheme: dark) {
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] {
    background: rgba(17, 24, 39, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }
  
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] a,
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] button {
    color: rgba(255, 255, 255, 0.9);
  }
  
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] .px-4.py-2 {
    border-bottom-color: rgba(255, 255, 255, 0.05);
  }
  
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] .px-4.space-y-2.pt-4.border-t {
    background: rgba(255, 255, 255, 0.02);
    border-top-color: rgba(255, 255, 255, 0.05);
  }
}

/* Performance optimizations */
@media (max-width: 1023px) {
  .glass-header-advanced,
  .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] {
    contain: layout style paint;
  }
  
  /* Reduce motion for accessibility */
  @media (prefers-reduced-motion: reduce) {
    .glass-header-advanced [role="navigation"][aria-label="Mobile navigation"] {
      animation: none;
      transition: none;
    }
  }
}
