/* Mobile Navigation Styles */

/* Mobile navigation styles applied regardless of screen size */
.nav-toggle {
    display: none; /* Hidden by default, shown in mobile view */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
    margin-left: auto; /* Push to the right */
}

.hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #fff;
    transition: transform 0.3s ease, opacity 0.3s ease;
    margin: 3px 0; /* Add spacing between lines */
}

.light-mode .hamburger-line {
    background-color: #333;
}

/* Ensure hamburger lines are visible with higher contrast */
.header .hamburger-line {
    background-color: #ffffff;
    height: 3px; /* Slightly thicker for better visibility */
}

.light-mode .header .hamburger-line {
    background-color: #0046AD; /* Use brand blue color for better visibility */
}

/* Hamburger animation */
.nav-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.nav-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Mobile specific styles */
@media (max-width: 768px) {
    /* Show the toggle button in mobile view */
    .nav-toggle {
        display: flex !important; /* Force display with !important */
        margin-left: auto; /* Ensure it's aligned to the right */
        z-index: 1010; /* Ensure it's above other elements */
    }
    
    /* Mobile Menu Wrapper */
    .nav-wrapper {
        position: fixed;
        top: 0;
        right: -300px; /* Start off-screen */
        width: 300px;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        transition: right 0.3s ease;
        z-index: 1000;
        padding-top: 80px;
        overflow-y: auto;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
        display: block; /* Ensure it's always block, not flex */
    }
    
    .light-mode .nav-wrapper {
        background-color: rgba(255, 255, 255, 0.95);
        box-shadow: -5px 0 15px rgba(0, 70, 173, 0.15);
    }
    
    /* Active state - slide in from right */
    .nav-wrapper.active {
        right: 0;
    }
    
    /* Nav Menu Items */
    .nav-menu {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0 1.5rem;
        width: 100%;
    }
    
    .nav-item {
        opacity: 0;
        transform: translateX(20px);
        transition: all 0.3s ease;
        margin-bottom: 1rem;
        width: 100%;
    }
    
    /* Staggered animation for menu items */
    .nav-wrapper.active .nav-item {
        opacity: 1;
        transform: translateX(0);
    }
    
    .nav-wrapper.active .nav-item:nth-child(1) { transition-delay: 0.1s; }
    .nav-wrapper.active .nav-item:nth-child(2) { transition-delay: 0.2s; }
    .nav-wrapper.active .nav-item:nth-child(3) { transition-delay: 0.3s; }
    .nav-wrapper.active .nav-item:nth-child(4) { transition-delay: 0.4s; }
    .nav-wrapper.active .nav-item:nth-child(5) { transition-delay: 0.5s; }
    
    /* Menu Links */
    .nav-menu a {
        display: block;
        padding: 0.75rem 0;
        font-size: 1.2rem;
        color: #fff;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
    }
    
    .light-mode .nav-menu a {
        color: #333;
        border-bottom: 1px solid rgba(0, 70, 173, 0.1);
    }
    
    .nav-menu a:hover,
    .nav-menu a.active {
        color: var(--brand-primary);
    }
    
    /* Prevent page scrolling when menu is open */
    body.menu-open {
        overflow: hidden;
    }
}

/* Ensure the menu is visible on larger screens */
@media (min-width: 769px) {
    .nav-wrapper {
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        padding: 0;
        overflow: visible;
        box-shadow: none;
        right: 0 !important; /* Force it to be visible regardless of active state */
    }
    
    .nav-menu {
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 0 !important;
    }
    
    .nav-item {
        opacity: 1 !important;
        transform: none !important;
        width: auto !important;
        margin: 0 0.5rem !important;
    }
    
    .nav-menu a {
        border-bottom: none !important;
        padding: 0.5rem !important;
        font-size: 1rem !important;
        width: auto !important;
    }
    
    .nav-toggle {
        display: none;
    }
}