/* 
 * Mobile Navigation Fixes
 * Improves mobile navigation display and behavior
 */

/* Prevent scroll when menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Add overlay when menu is open */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 98;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none; /* Allow clicks to pass through when inactive */
}

body.menu-open::after {
    visibility: visible;
    opacity: 1;
    pointer-events: auto; /* Capture clicks when active */
}

/* Ensure header stays on top */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: auto;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Logo size adjustment for mobile */
@media (max-width: 768px) {
    .logo img {
        max-height: 40px;
        transition: max-height 0.3s ease;
    }
    
    .header-container {
        padding: 0.8rem 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: relative;
    }
}

/* Mobile navigation improvements */
@media (max-width: 768px) {
    /* Improved mobile menu positioning */
    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background-color: #002B49;
        z-index: 999;
        transition: right 0.3s ease-in-out;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
        padding: 80px 0 30px 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .nav.active {
        right: 0;
    }
    
    /* Improved menu icon */
    .nav-trigger {
        display: block;
        cursor: pointer;
        font-size: 1.5rem;
        z-index: 1001; /* Higher than nav to stay clickable */
        padding: 10px;
        margin: -10px;
        border-radius: 4px;
        transition: all 0.3s ease;
        color: #002B49;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }
    
    .nav-trigger:hover {
        background-color: rgba(0, 43, 73, 0.1);
    }
    
    /* Animation for menu icon */
    .nav-trigger i {
        transition: transform 0.3s ease, color 0.3s ease;
    }
    
    .nav.active ~ .nav-trigger i.fa-times {
        color: white;
    }
    
    /* Better navigation list styling */
    .nav-list {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 1.5rem;
        margin: 0;
        width: 100%;
        height: 100%;
        overflow-y: auto;
    }
    
    .nav-list li {
        width: 100%;
        margin: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-list li:last-child {
        border-bottom: none;
    }
    
    /* Enhanced link styling */
    .nav-link,
    .dropdown-item {
        display: block;
        padding: 1rem 0;
        color: white;
        width: 100%;
        font-size: 1rem;
        font-weight: 500;
        letter-spacing: 0.5px;
        transition: color 0.2s ease;
    }
    
    .nav-link:hover,
    .dropdown-item:hover {
        color: rgba(255, 255, 255, 0.8);
    }
    
    .nav-link.active,
    .dropdown-item.active {
        color: #ffffff;
        font-weight: 600;
    }
    
    /* Dropdown improvements */
    .dropdown {
        width: 100%;
    }
    
    .dropdown-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 1rem 0;
        cursor: pointer;
    }
    
    .dropdown-toggle i {
        transition: transform 0.3s ease;
        margin-left: 5px;
        font-size: 0.8rem;
    }
    
    .dropdown.active .dropdown-toggle i {
        transform: rotate(180deg);
    }
    
    .dropdown-menu {
        position: static;
        background: transparent;
        box-shadow: none;
        width: 100%;
        padding: 0;
        margin: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease, padding 0.3s ease;
        border-left: 1px solid rgba(255, 255, 255, 0.2);
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    
    .dropdown.active .dropdown-menu {
        max-height: 500px;
        padding: 0.2rem 0 0.5rem 1rem;
    }
    
    .dropdown-item {
        padding: 0.8rem 0;
        border-bottom: none;
        font-size: 0.95rem;
        opacity: 0.9;
    }
    
    /* Add extra padding at bottom for scrolling */
    .nav::after {
        content: '';
        display: block;
        height: 50px;
    }
    
    /* Touch-friendly adjustments */
    .nav-link, 
    .dropdown-toggle, 
    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Logo position fix when menu is open */
    .nav.active ~ .logo {
        position: relative;
        z-index: 1000;
    }
}

/* Also hide mobile menu properly on larger screens */
@media (min-width: 769px) {
    .nav-trigger {
        display: none;
    }
    
    .nav {
        position: static;
        height: auto;
        background-color: transparent;
        padding: 0;
        box-shadow: none;
        overflow: visible;
    }
    
    .nav-list {
        flex-direction: row;
        align-items: center;
    }
    
    .dropdown-menu {
        position: absolute;
    }
} 