/* ===== BASE HEADER STYLES ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 15, 30, 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.logo-container {
    flex-shrink: 0;
    z-index: 1002; /* Ensure logo stays above mobile menu */
}

.logo img {
    height: 40px;
    width: auto;
    transition: transform 0.3s ease;
}

.logo:hover img {
    transform: scale(1.05);
}

/* DESKTOP NAVIGATION */
.nav-links-container {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
    justify-content: flex-end;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 0;
    list-style: none;
}

.nav-links a {
    color: white;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    font-size: 1rem;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--cyber-aqua);
    background: rgba(100, 255, 218, 0.1);
}

/* DESKTOP DROPDOWN STYLES */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: rgba(15, 20, 35, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: white;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.dropdown-menu a:hover {
    background: rgba(100, 255, 218, 0.1);
    border-left-color: var(--cyber-aqua);
    padding-left: 2rem;
}

/* ENHANCED SEARCH STYLES WITH AUTOCOMPLETE */
.search-container {
    margin-left: 1rem;
    position: relative;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 0.3rem;
    transition: all 0.3s ease;
    min-width: 250px;
    position: relative;
    z-index: 1002;
}

.search-input-wrapper:focus-within {
    border-color: var(--cyber-aqua);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 20px rgba(100, 255, 218, 0.2);
}

.search-input {
    background: transparent;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    outline: none;
    width: 100%;
    font-size: 0.95rem;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-btn {
    background: linear-gradient(135deg, var(--neon-violet), var(--cyber-aqua));
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.search-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(100, 255, 218, 0.3);
}

/* AUTOCOMPLETE RESULTS STYLES */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(15, 20, 35, 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.autocomplete-results.active {
    display: block;
    animation: slideDown 0.2s ease;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    color: white;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: rgba(100, 255, 218, 0.1);
    color: var(--cyber-aqua);
}

.autocomplete-item i {
    font-size: 0.9rem;
    width: 16px;
    text-align: center;
}

.autocomplete-category {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--cyber-aqua);
    background: rgba(100, 255, 218, 0.05);
    border-bottom: 1px solid rgba(100, 255, 218, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.autocomplete-no-results {
    padding: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Menu Toggle (Hidden on Desktop) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 6px;
    transition: all 0.3s ease;
    z-index: 1002; /* Ensure menu toggle stays above mobile menu */
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.menu-toggle-bar {
    width: 24px;
    height: 2px;
    background: white;
    margin: 3px 0;
    transition: all 0.3s ease;
    transform-origin: center;
    border-radius: 2px;
}

.menu-toggle.active .menu-toggle-bar:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active .menu-toggle-bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .menu-toggle-bar:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ===== MOBILE STYLES - BLURRY TEXT FIXED ===== */
@media screen and (max-width: 1024px) {
    .menu-toggle {
        display: flex;
    }
    
    .nav-links-container {
        position: fixed;
        top: 0;
        right: -100%;
        width: 90%;
        max-width: 450px;
        height: 100vh;
        background: rgba(12, 18, 35, 1);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        flex-direction: column;
        align-items: flex-start;
        padding: 6rem 2rem 2rem;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        z-index: 1001;
        box-shadow: -10px 0 50px rgba(0, 0, 0, 0.5);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        /* BLURRY TEXT FIXES */
        -webkit-font-smoothing: subpixel-antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
        image-rendering: -webkit-optimize-contrast;
    }
    
    .nav-links-container.active {
        right: 0;
    }
    
    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 0;
        margin-bottom: 2rem;
    }
    
    .nav-links a {
        width: 100%;
        padding: 1.2rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 1.1rem;
        justify-content: space-between;
        display: flex;
        align-items: center;
        color: white;
        font-weight: 500;
        /* BLURRY TEXT FIXES */
        -webkit-font-smoothing: subpixel-antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
    
    .nav-links a:hover,
    .nav-links a.active {
        color: var(--cyber-aqua);
        background: rgba(100, 255, 218, 0.1);
    }
    
    .dropdown {
        width: 100%;
    }
    
    .dropdown-toggle {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .dropdown-toggle i {
        transition: transform 0.3s ease;
        font-size: 0.9rem;
    }
    
    .dropdown.active .dropdown-toggle i {
        transform: rotate(180deg);
        color: var(--cyber-aqua);
    }
    
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: rgba(20, 25, 45, 1);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: none;
        padding: 0;
        margin: 0.5rem 0 0.5rem 1rem;
        display: none;
        width: calc(100% - 1rem);
        border-radius: 8px;
        overflow: hidden;
        animation: none;
        /* BLURRY TEXT FIX */
        -webkit-font-smoothing: subpixel-antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .dropdown.active .dropdown-menu {
        display: block;
        animation: slideDown 0.3s ease;
    }
    
    .dropdown-menu a {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        border-left: 3px solid transparent;
        transition: all 0.3s ease;
        color: white;
        /* BLURRY TEXT FIX */
        -webkit-font-smoothing: subpixel-antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .dropdown-menu a:hover {
        padding-left: 2rem;
        background: rgba(100, 255, 218, 0.1);
        border-left-color: var(--cyber-aqua);
    }

    /* Search Bar Mobile */
    .search-container {
        margin: 2rem 0 0;
        width: 100%;
        order: 100;
        position: sticky;
        bottom: 2rem;
        background: rgba(15, 20, 35, 1);
        padding: 1.2rem;
        border-radius: 12px;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: 1px solid rgba(100, 255, 218, 0.2);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
        z-index: 1;
        /* BLURRY TEXT FIX */
        -webkit-font-smoothing: subpixel-antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .search-input-wrapper {
        width: 100%;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 50px;
        padding: 0.4rem;
        transition: all var(--transition-medium) ease;
        min-width: auto;
    }

    .search-input-wrapper:focus-within {
        border-color: var(--cyber-aqua);
        background: rgba(255, 255, 255, 0.15);
        box-shadow: 0 0 25px rgba(100, 255, 218, 0.25);
        transform: scale(1.02);
    }

    .search-input {
        width: 100%;
        flex-grow: 1;
        font-size: 1rem;
        padding: 0.8rem 1.5rem;
        background: transparent;
        color: white;
        border: none;
        outline: none;
        /* BLURRY TEXT FIX */
        -webkit-font-smoothing: subpixel-antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .search-btn {
        width: 46px;
        height: 46px;
        margin-left: 0.5rem;
    }

    /* Mobile Autocomplete Styles */
    .autocomplete-results {
        position: fixed;
        top: auto;
        bottom: calc(100% - 100vh + 2rem);
        left: 2rem;
        right: 2rem;
        max-height: 50vh;
        border-radius: 12px;
        border: 1px solid rgba(100, 255, 218, 0.2);
    }
    
    body.menu-open {
        overflow: hidden;
    }
}

/* Dropdown Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

/* Mobile Backdrop Styles */
.mobile-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
