/* Navigation and Header Components */

/* Standardized Navigation */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(15, 23, 42, 0.9);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(250, 204, 21, 0.2);
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1rem;
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
}

/* Logo Styles */
.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.nav-logo img {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    transition: transform 0.3s ease;
}

.nav-logo:hover img {
    transform: rotate(12deg);
}

.nav-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-yellow);
    font-family: var(--font-heading);
}

/* Desktop Navigation */
.nav-desktop {
    display: none;
    align-items: center;
    gap: 2rem;
}

.nav-desktop .nav-link {
    color: #f3f4f6; /* Direct color value for better contrast */
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
    display: inline-block; /* Ensure links are visible */
}

.nav-desktop .nav-link:hover {
    color: #facc15; /* Direct primary yellow value */
    transform: scale(1.05);
    background-color: rgba(250, 204, 21, 0.1);
}

.nav-desktop .nav-link.active {
    color: #facc15; /* Direct primary yellow value */
    font-weight: 600;
    background-color: rgba(250, 204, 21, 0.15);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: block; /* Show by default (mobile first) */
    background: none;
    border: none;
    color: #ffffff; /* Direct white color */
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s ease;
    /* Enhanced cross-browser consistency */
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0.25rem;
}

.mobile-menu-btn:hover {
    color: #facc15; /* Direct primary yellow */
    background-color: rgba(250, 204, 21, 0.1);
}

.mobile-menu-btn:focus {
    outline: 2px solid #facc15;
    outline-offset: 2px;
}

.mobile-menu-btn svg {
    width: 1.5rem;
    height: 1.5rem;
    transition: transform 0.3s ease;
    /* Ensure consistent SVG rendering */
    display: block;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-menu-btn:hover svg {
    transform: scale(1.1);
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    background: rgba(15, 23, 42, 0.98);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(250, 204, 21, 0.2);
    padding: 1rem;
}

.mobile-menu.active {
    display: block;
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-menu .nav-link {
    display: block;
    color: var(--text-white);
    text-decoration: none;
    padding: 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mobile-menu .nav-link:hover {
    color: var(--primary-yellow);
    background: rgba(250, 204, 21, 0.1);
}

.mobile-menu .nav-link.active {
    color: var(--primary-yellow);
    background: rgba(250, 204, 21, 0.1);
}

/* Responsive Design */
@media (min-width: 768px) {
    .nav-desktop {
        display: flex !important; /* Force display for desktop */
    }
    
    .mobile-menu-btn {
        display: none !important; /* Hide mobile button on desktop */
    }
    
    .mobile-menu {
        display: none !important; /* Hide mobile menu on desktop */
    }
}

/* Enhanced Mobile Menu Animation */
@media (max-width: 767px) {
    .nav-desktop {
        display: none !important; /* Hide desktop nav on mobile */
    }
    
    .mobile-menu-btn {
        display: block !important; /* Show mobile button on mobile */
    }
    
    .mobile-menu {
        transform: translateY(-10px);
        opacity: 0;
        transition: all 0.3s ease;
    }
    
    .mobile-menu.active {
        transform: translateY(0);
        opacity: 1;
    }
    
    /* Improve mobile burger menu visibility */
    .mobile-menu-btn {
        background: rgba(250, 204, 21, 0.1);
        border-radius: 0.375rem;
        padding: 0.75rem;
    }
    
    .mobile-menu-btn:hover {
        background: rgba(250, 204, 21, 0.2);
    }
}

/* Additional Responsive Improvements */
@media (max-width: 480px) {
    .nav-content {
        height: 3.5rem;
        padding: 0 0.5rem;
    }
    
    .nav-logo img {
        width: 2rem;
        height: 2rem;
    }
    
    .nav-logo-text {
        font-size: 1.125rem;
    }
    
    .mobile-menu {
        padding: 0.75rem;
    }
    
    .mobile-menu .nav-link {
        padding: 0.625rem;
        font-size: 0.875rem;
    }
}

/* Legacy styles for compatibility */
.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-white);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Legacy Mobile Menu for backward compatibility */
.legacy-mobile-menu {
    position: fixed;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.98);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 2rem;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 40;
}

.legacy-mobile-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Additional Navigation Utilities */
.navbar {
    background: var(--dark-space);
    padding: 1rem 0;
    border-bottom: 1px solid rgba(250, 204, 21, 0.2);
}

.navbar-transparent {
    background: transparent;
    border-bottom: none;
}

.navbar-blur {
    background: rgba(15, 23, 42, 0.8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.breadcrumb a {
    color: var(--text-gray-400);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: var(--primary-yellow);
}

.breadcrumb-separator {
    color: var(--text-gray-400);
}

.breadcrumb .current {
    color: var(--text-white);
    font-weight: 500;
}

/* Active Navigation States */
.nav-link-active-enhanced {
    color: var(--primary-yellow) !important;
    border-bottom: 2px solid var(--primary-yellow);
    font-weight: 600;
}

.nav-link-active-enhanced::before {
    width: 100%;
}

/* Additional navigation utilities for responsive behavior */
#mobile-menu {
    transition: all 0.3s ease;
    will-change: transform, opacity;
    transform: translateZ(0); /* Force hardware acceleration */
}

#mobile-menu.hidden {
    display: none;
}

#mobile-menu:not(.hidden) {
    display: block;
}

/* Enhanced mobile menu positioning and animation */
@media (max-width: 768px) {
    .mobile-menu {
        position: fixed;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(15, 23, 42, 0.98);
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
        border-top: 1px solid rgba(250, 204, 21, 0.2);
        z-index: 50;
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
        box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-menu.translate-x-full {
        transform: translateX(100%);
    }
    
    .mobile-menu.translate-x-0 {
        transform: translateX(0);
    }
    
    .mobile-menu.-translate-y-full {
        transform: translateY(-100%);
    }
    
    .mobile-menu.translate-y-0 {
        transform: translateY(0);
    }
    
    .mobile-menu.opacity-0 {
        opacity: 0;
    }
    
    .mobile-menu.opacity-100 {
        opacity: 1;
    }
}

/* Navbar scroll state improvements */
.navbar-scrolled {
    background: rgba(15, 23, 42, 0.95) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(250, 204, 21, 0.3) !important;
    transition: all 0.3s ease !important;
}

.main-nav.scrolled {
    background: rgba(15, 23, 42, 0.95);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(250, 204, 21, 0.2);
    transition: all 0.3s ease;
}

.main-nav.at-top {
    background: rgba(15, 23, 42, 0.1);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

/* Additional mobile menu spacing */
.mobile-menu .space-y-2 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0.5rem;
}

/* Touch device optimizations */
.touch-device .nav-link,
.touch-device .mobile-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
}

.touch-device .mobile-menu-btn {
    min-width: 44px;
    min-height: 44px;
}

/* Focus management for accessibility */
.nav-link:focus,
.mobile-menu a:focus {
    outline: 2px solid #facc15;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Improved mobile menu button animation */
.mobile-menu-btn svg {
    transition: transform 0.3s ease;
}

.mobile-menu-btn[aria-expanded="true"] svg {
    transform: rotate(90deg);
}

/* Viewport height CSS custom property support */
.mobile-menu {
    max-height: calc(var(--vh, 1vh) * 100 - 4rem);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .main-nav {
        border-bottom: 2px solid #facc15;
    }
    
    .nav-link {
        border: 1px solid transparent;
    }
    
    .nav-link:hover,
    .nav-link:focus {
        border-color: #facc15;
        background: rgba(250, 204, 21, 0.1);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .main-nav,
    .mobile-menu,
    .nav-link,
    .mobile-menu-btn svg {
        transition: none !important;
        animation: none !important;
    }
}
