/* === Modern Header Styles === */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Dark mode header */
[data-theme="dark"] header {
    background: rgba(22, 27, 34, 0.95);
    border-bottom-color: #30363d;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #1f2937;
    transition: opacity 0.2s ease;
}

[data-theme="dark"] .header-left a {
    color: #f3f4f6;
}

.header-left a:hover {
    opacity: 0.8;
}

.header-logo {
    height: 48px;
    width: auto;
}

.header-left span {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.header-nav {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-link {
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}

[data-theme="dark"] .nav-link {
    color: #9ca3af;
}

.nav-link:hover {
    color: #4f46e5;
}

[data-theme="dark"] .nav-link:hover {
    color: #818cf8;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: #4f46e5;
    transition: width 0.3s ease;
}

[data-theme="dark"] .nav-link::after {
    background: #818cf8;
}

.nav-link:hover::after {
    width: 100%;
}

/* Mobile Navigation Toggle (Hamburger) */
.mobile-nav-toggle {
    display: none; /* Hidden on desktop */
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001; /* Above other elements */
}

.sr-only {
   position: absolute;
   width: 1px;
   height: 1px;
   padding: 0;
   margin: -1px;
   overflow: hidden;
   clip: rect(0,0,0,0);
   border: 0;
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Creates space for animation */
    width: 28px;
    height: 22px;
}

.hamburger-icon .bar {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #1f2937;
    border-radius: 3px;
    transition: transform 0.3s ease-in-out, opacity 0.2s ease-in-out;
}

[data-theme="dark"] .hamburger-icon .bar {
    background-color: #f3f4f6;
}

/* Animate hamburger to 'X' when menu is open */
.mobile-nav-toggle[aria-expanded="true"] .bar:nth-child(1) {
    transform: translateY(9.5px) rotate(45deg);
}
.mobile-nav-toggle[aria-expanded="true"] .bar:nth-child(2) {
    opacity: 0;
}
.mobile-nav-toggle[aria-expanded="true"] .bar:nth-child(3) {
    transform: translateY(-9.5px) rotate(-45deg);
}


@media (max-width: 768px) {
    .header-container {
        padding: 10px 15px;
    }
    
    .header-logo {
        height: 40px;
    }
    
    .header-left span {
        font-size: 1.1rem;
    }
    
    .header-nav {
        /* This is now the dropdown menu */
        display: none; /* Hidden by default */
        position: absolute;
        top: 61px; /* Aligns below header (40px logo + ~20px padding) */
        left: 0;
        right: 0;
        
        flex-direction: column;
        align-items: center;
        gap: 25px; /* Spacing for links */
        padding: 30px 0;
        
        /* Style the dropdown container */
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
        border-top: 1px solid #e5e7eb;
    }

    [data-theme="dark"] .header-nav {
        background: rgba(22, 27, 34, 0.98);
        border-top-color: #30363d;
    }

    /* This rule shows the menu when toggled by JS */
    .header-nav[data-visible="true"] {
        display: flex;
    }
    
    .mobile-nav-toggle {
        display: block; /* Show hamburger on mobile */
    }
}