/* ============================================
   Enhanced Header & Mobile Menu Styles
   ============================================ */

/* Header with glassmorphism effect */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.site-header.scrolled {
    background: rgba(17, 24, 39, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Enhanced navbar */
.navbar {
    padding: var(--space-4) 0;
}

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

/* Brand styling */
.nav-brand {
    flex-shrink: 0;
}

.brand-link {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.brand-logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: opacity 0.3s ease;
}

.brand-link:hover .brand-logo {
    opacity: 0.9;
}

/* Enhanced nav menu */
.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* Enhanced nav links */
.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    position: relative;
}

.nav-link .material-icons {
    font-size: 1.1rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

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

.nav-link:hover .material-icons {
    opacity: 1;
}

/* Active link indicator */
.nav-link.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.3);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--color-accent, #6366f1);
    border-radius: 1px;
}

/* Theme toggle button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: var(--space-2);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.theme-toggle .material-icons {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Enhanced mobile toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 12px;
    gap: 6px;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle:active {
    background: rgba(255, 255, 255, 0.1);
}

.nav-toggle-line {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

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

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

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

/* ============================================
   Mobile Styles
   ============================================ */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
        order: 2;
        margin-left: auto;
    }

    /* Hide dark mode toggle on mobile */
    .theme-toggle {
        display: none;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
        background: #111827;
        padding: var(--space-16) var(--space-4) var(--space-8);
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.3s ease, visibility 0.3s ease;
        z-index: 999;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    }

    .nav-menu.active {
        transform: translateX(0);
        visibility: visible;
    }

    .nav-link {
        width: 100%;
        padding: var(--space-4);
        font-size: 1rem;
        justify-content: flex-start;
        border-radius: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

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

    .nav-link .material-icons {
        font-size: 1.2rem;
    }

    .nav-link.active::after {
        display: none;
    }
}

/* Overlay when menu is open */
body.menu-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .nav-link span:not(.material-icons) {
        display: none;
    }

    .nav-link {
        padding: var(--space-2);
    }

    .nav-link .material-icons {
        font-size: 1.3rem;
    }
}

/* Large screens */
@media (min-width: 1025px) {
    .nav-container {
        padding: 0 var(--space-6);
    }
}

/* ============================================
   Dark Mode Overrides
   ============================================ */
[data-theme="dark"] .site-header {
    background: rgba(10, 10, 10, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .site-header.scrolled {
    background: rgba(10, 10, 10, 0.98);
}

[data-theme="dark"] .nav-menu {
    background: rgba(10, 10, 10, 0.98);
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
}
