/* ========================================
   Navigation Styles
   ======================================== */

/* Glass Navigation */
.glass-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
    
    padding: 0;
    padding-top: env(safe-area-inset-top);
    border-radius: 0;
}

.glass-nav:hover {
    transform: none;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md) var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo */
.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.logo-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eebd2b, #d4a820);
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    color: #1a1a1a;
    box-shadow: 0 4px 15px rgba(238, 189, 43, 0.3);
}

.nav-logo span {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    gap: var(--spacing-xs);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
    position: relative;
}

.nav-link i {
    font-size: 0.875rem;
    opacity: 0.7;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, #eebd2b, #d4a820);
    border-radius: 2px;
}

/* Navigation Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Burger Menu */
.nav-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-normal);
}

.nav-burger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: var(--transition-normal);
}

.nav-burger:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-burger.active span:nth-child(2) {
    opacity: 0;
}

.nav-burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: calc(var(--z-fixed) - 1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: var(--transition-normal);
}

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

/* Responsive Navigation */
@media (max-width: 1024px) {
    .nav-burger {
        display: flex;
        position: relative;
        z-index: calc(var(--z-fixed) + 2);
    }
    
    /*
     * FIX: backdrop-filter on .glass-nav creates a containing block for
     * position:fixed descendants (per CSS Filter Effects Level 2 spec).
     * This made "top:72px; bottom:0" resolve relative to the ~72px nav,
     * giving the menu 0 height.
     *
     * Solution: use position:absolute + top:100% so the menu starts at
     * the bottom of the nav, and explicit height with viewport units
     * (which always resolve against the viewport, not the containing block).
     */
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        height: calc(100vh - 72px);
        height: calc(100dvh - 72px); /* dynamic viewport height for mobile browser chrome */
        background: rgba(0, 0, 0, 0.92);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        flex-direction: column;
        padding: var(--spacing-xl);
        gap: var(--spacing-sm);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: calc(var(--z-fixed) + 1);
    }
    
    .nav-menu.active {
        display: flex;
        animation: slideDown 0.3s ease forwards;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .nav-link {
        padding: var(--spacing-lg);
        font-size: 1.1rem;
        border-radius: var(--radius-lg);
        border: 1px solid transparent;
        min-height: 48px;
    }
    
    .nav-link:hover,
    .nav-link.active {
        border-color: var(--glass-border);
    }
    
    .nav-link.active::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .nav-logo span {
        display: none;
    }
    
    .logo-icon {
        width: 40px;
        height: 40px;
    }
}
