/* Mobile Navigation Fixes */

/* CSS Variables for mobile navigation */
:root {
  --transition: all 0.3s ease;
  --border-color: #e2e8f0;
  --light-grey: #f8fafc;
  --light-color: #ffffff;
  --dark-color: #1e293b;
  --primary-color: #4a6cf7;
  --primary-hover: #3b5bdb;
  --secondary-color: #16213e;
  --border-radius: 0.5rem;
  --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --box-shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
}

/* Force mobile toggle to be visible on mobile */
@media (max-width: 992px) {
  .mobile-toggle {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* Additional mobile navigation improvements */
@media (max-width: 768px) {
  .main-nav {
    max-width: 100%;
    right: -100%;
  }
  
  .nav-list > li > a {
    font-size: 1.1rem;
    padding: 1.25rem 0;
  }
  
  .dropdown-menu li a,
  .mega-menu-list a {
    font-size: 1rem;
    padding: 0.75rem 1rem 0.75rem 2rem;
  }
  
  .nav-cta {
    font-size: 1rem;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .main-nav {
    padding: 70px 1rem 2rem;
  }
  
  .nav-list > li > a {
    font-size: 1.05rem;
    padding: 1rem 0;
  }
}

/* Fix for mobile navigation touch interactions */
@media (max-width: 992px) {
  .nav-list > li > a {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  
  .dropdown-toggle {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  
  .mobile-toggle {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}

/* Ensure mobile navigation is properly positioned */
@media (max-width: 992px) {
  .header {
    position: relative;
  }
  
  .header-content {
    position: relative;
  }
  
  .mobile-toggle {
    position: relative;
    z-index: 1002;
  }
}

/* Improved mobile toggle button */
@media (max-width: 992px) {
  .mobile-toggle {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 0;
    position: relative;
  }

  .mobile-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--dark-color);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
  }

  .mobile-toggle.active span:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
  }

  .mobile-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
  }

  .mobile-toggle.active span:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
  }
}

/* Fix mobile navigation menu positioning */
@media (max-width: 992px) {
  .main-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background-color: var(--light-color);
    flex-direction: column;
    padding: 80px 1.5rem 2rem;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    overflow-y: auto;
    z-index: 1001;
    border-radius: 0;
  }

  .main-nav.active {
    right: 0;
  }

  .nav-list {
    flex-direction: column;
    width: 100%;
    align-items: stretch;
    gap: 0;
  }

  .nav-list > li {
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
  }

  .nav-list > li > a {
    padding: 1rem 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .nav-list > li > a::after {
    display: none;
  }

  /* Mobile Dropdowns */
  .dropdown-menu,
  .mega-menu-wrapper {
    position: static !important;
    opacity: 1;
    visibility: visible;
    transform: none !important;
    box-shadow: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: var(--light-grey);
    border-radius: 0;
    width: 100%;
    /* Override any desktop positioning */
    left: auto !important;
    right: auto !important;
    top: auto !important;
    --mega-menu-left: auto !important;
    --mega-menu-transform: none !important;
    transform-style: flat !important;
    backface-visibility: visible !important;
    perspective: none !important;
    animation: none !important;
  }

  .dropdown.active .dropdown-menu,
  .mega-dropdown.active .mega-menu-wrapper {
    max-height: 500px;
    padding: 0.5rem 0;
  }

  .dropdown-toggle i {
    margin-left: auto;
    transition: var(--transition);
  }

  .dropdown.active .dropdown-toggle i,
  .mega-dropdown.active .dropdown-toggle i {
    transform: rotate(180deg);
  }

  .dropdown-menu li a {
    padding-left: 2rem;
  }

  .mega-menu {
    flex-direction: column;
    gap: 0;
  }

  .mega-menu-title {
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
  }

  .mega-menu-list a {
    padding: 0.5rem 1rem 0.5rem 2rem;
  }

  .nav-actions {
    width: 100%;
    margin-top: 2rem;
    flex-direction: column;
  }

  .nav-cta {
    width: 100%;
    text-align: center;
    padding: 0.75rem;
  }

  /* Overlay */
  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 998;
  }

  body.nav-open::before {
    opacity: 1;
    visibility: visible;
  }

  body.nav-open {
    overflow: hidden;
  }
}

/* Additional fixes for better mobile experience */
@media (max-width: 992px) {
  /* Ensure proper text decoration */
  .nav-list > li > a,
  .dropdown-menu li a,
  .mega-menu-list a {
    text-decoration: none;
    color: var(--dark-color);
  }
  
  /* Better touch targets */
  .nav-list > li > a,
  .dropdown-toggle,
  .mobile-toggle {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  /* Prevent text selection on mobile */
  .nav-list > li > a,
  .dropdown-toggle {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  
  /* Ensure mobile menu is above overlay */
  .main-nav {
    z-index: 1001 !important;
  }
  
  /* Ensure overlay is below menu but above content */
  body::before {
    z-index: 1000 !important;
  }
  
  /* Make sure menu items are clickable */
  .nav-list > li > a,
  .dropdown-toggle,
  .dropdown-menu li a,
  .mega-menu-list a {
    pointer-events: auto;
    cursor: pointer;
  }
  
  /* Ensure dropdowns work properly */
  .dropdown-menu,
  .mega-menu-wrapper {
    pointer-events: auto;
  }
}

/* Debug styles for troubleshooting */
.mobile-toggle {
  border: 1px solid transparent;
}

.mobile-toggle:hover {
  border-color: #ccc;
}

@media (max-width: 992px) {
  .mobile-toggle {
    border-color: red;
  }
  
  .main-nav {
    border: 1px solid blue;
  }
  
  .main-nav.active {
    border-color: green;
  }
} 