/* Enhanced shrink header on scroll effect */
header.shrink {
    height: 52px !important;
    padding: 8px 20px !important;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.96) 0%, 
        rgba(252, 254, 255, 0.94) 15%,
        rgba(248, 252, 255, 0.92) 30%,
        rgba(245, 250, 255, 0.94) 45%,
        rgba(248, 252, 255, 0.92) 60%,
        rgba(252, 254, 255, 0.94) 75%,
        rgba(255, 255, 255, 0.96) 100%);
    backdrop-filter: blur(25px) saturate(1.2);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.06),
        0 8px 12px rgba(0, 0, 0, 0.04),
        0 16px 24px rgba(0, 0, 0, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

header.shrink .header-logo {
    height: 32px !important;
    transition: height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

header.shrink .header-titles-wrapper .site-name {
    font-size: 1.35rem !important;
    transition: font-size 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

header.shrink .header-titles-wrapper .tagline {
    display: none !important;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
header {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.98) 0%, 
        rgba(252, 254, 255, 0.96) 15%,
        rgba(248, 252, 255, 0.95) 30%,
        rgba(245, 250, 255, 0.96) 45%,
        rgba(248, 252, 255, 0.95) 60%,
        rgba(252, 254, 255, 0.96) 75%,
        rgba(255, 255, 255, 0.98) 100%);
    backdrop-filter: blur(20px) saturate(1.1);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 4px 6px rgba(0, 0, 0, 0.04),
        0 10px 20px rgba(0, 0, 0, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    box-sizing: border-box;
    height: 68px;
    overflow: visible;
    gap: 20px;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateZ(0);
    will-change: transform;
}

/* Subtle shining animation overlay */
header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
    animation: headerShine 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes headerShine {
    0% {
        left: -100%;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        left: 100%;
        opacity: 0;
    }
}

/* Pause animation on hover for better UX */
header:hover::before {
    animation-play-state: paused;
}

/* Language Dropdown Styling */
.language-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.language-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.language-btn:hover {
    background: var(--surface-color);
    border-color: var(--primary-color);
}

.language-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.language-dropdown.active .language-dropdown-menu {
    display: block;
}

.language-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s ease;
    font-size: 14px;
}

.language-dropdown-item:hover {
    background: var(--surface-color);
}

.language-dropdown-item.active {
    background: var(--primary-color);
    color: white;
}

/* Hide language dropdown on small screens */
@media (max-width: 768px) {
    .language-dropdown {
        display: none;
    }
}

/* Remove all sidebar-specific adjustments - header spans full width on all screens */

.header-logo {
    height: 42px;
    margin-right: 12px;
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.3s ease;
    background: transparent;
    box-shadow: none;
}

.header-logo:hover {
    transform: scale(1.05);
    box-shadow: none;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    min-width: 0;
    position: relative;
    z-index: 2;
}

.header-brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 12px;
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 4px 8px;
}

.header-brand-link:hover,
.header-brand-link:focus,
.header-brand-link:active {
    text-decoration: none;
    background: rgba(102, 126, 234, 0.05);
    transform: translateY(-1px);
}

.header-titles-wrapper {
    text-align: center;
}

.header-titles-wrapper .site-name {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
    font-size: 1.85rem;
    margin: 0;
    font-weight: 700;
    background: linear-gradient(135deg, #1e293b, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
    line-height: 1.1;
    transition: all 0.3s ease;
}

.header-titles-wrapper .tagline {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
    font-size: 0.7rem;
    color: #64748b;
    margin: -2px 0 0 0;
    opacity: 0.9;
    font-weight: 500;
    line-height: 1.0;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
}

/* Subjects Dropdown */
.subjects-dropdown {
    position: relative;
    display: none; /* Hidden by default */
    z-index: 2;
}

/* Show subjects dropdown on large screens */
@media (min-width: 1025px) {
    .subjects-dropdown {
        display: block !important; /* Force show on large screens */
    }
}

/* Hide subjects dropdown on mobile screens */
@media (max-width: 1024px) {
    .subjects-dropdown {
        display: none !important; /* Force hide on mobile screens */
    }
}

.subjects-btn {
    background: linear-gradient(135deg, 
        #667eea 0%, 
        #764ba2 25%, 
        #667eea 50%, 
        #f093fb 75%, 
        #667eea 100%);
    background-size: 300% 300%;
    border: 1px solid rgba(102, 126, 234, 0.3);
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.95rem;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 2px 4px rgba(102, 126, 234, 0.2),
        0 4px 8px rgba(102, 126, 234, 0.1);
    animation: gradientFlow 8s ease infinite;
    letter-spacing: 0.3px;
    backdrop-filter: blur(10px);
}

.subjects-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s ease;
    z-index: 0;
}

.subjects-btn:hover::before,
.subjects-btn:focus::before {
    left: 100%;
}

.subjects-btn:hover,
.subjects-btn:focus {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 4px 8px rgba(102, 126, 234, 0.25),
        0 8px 16px rgba(102, 126, 234, 0.15),
        0 16px 32px rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.4);
    animation-duration: 4s;
    outline: none;
}

.subjects-btn:active {
    transform: translateY(-1px) scale(0.98);
    animation-duration: 2s;
}

body.dark-theme .subjects-btn {
    background: linear-gradient(120deg, #0f2027 0%, #2c5364 100%);
    color: #e0e6f8;
    border: 1px solid #22344a;
    box-shadow: 0 2px 10px rgba(30,30,60,0.18);
}
body.dark-theme .subjects-btn:hover,
body.dark-theme .subjects-btn:focus {
    background: linear-gradient(120deg, #36d1c4 0%, #3a7bd5 100%);
    color: #fff;
    border-color: #36d1c4;
    box-shadow: 0 4px 15px rgba(30,30,60,0.22);
}
body.dark-theme .subjects-btn:active {
    background: linear-gradient(120deg, #3a7bd5 0%, #36d1c4 100%);
    color: #fff;
    border-color: #3a7bd5;
}

.dropdown-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.subjects-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.subjects-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.98) 0%, 
        rgba(248, 250, 252, 0.95) 50%, 
        rgba(241, 245, 249, 0.98) 100%);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: 20px;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 10px 15px rgba(0, 0, 0, 0.06),
        0 20px 25px rgba(0, 0, 0, 0.04),
        0 25px 50px rgba(102, 126, 234, 0.15);
    min-width: 220px;
    z-index: 1003;
    display: none;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 8px;
    padding: 8px;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.subjects-dropdown.active .subjects-dropdown-menu {
    display: block;
    animation: slideDown 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.subjects-dropdown-item {
    display: block;
    padding: 12px 16px;
    color: #475569 !important;
    text-decoration: none;
    font-size: 0.95rem;
    border: none;
    border-radius: 12px;
    margin: 2px 0;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    position: relative;
    overflow: hidden;
    font-weight: 500;
    background: transparent !important;
    letter-spacing: 0.2px;
}

.subjects-dropdown-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(102, 126, 234, 0.1), 
        transparent);
    transition: left 0.5s ease;
    z-index: 0;
}

.subjects-dropdown-item:hover::before,
.subjects-dropdown-item:focus::before {
    left: 100%;
}

.subjects-dropdown-item:hover,
.subjects-dropdown-item:focus {
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.08), 
        rgba(118, 75, 162, 0.08)) !important;
    color: #1e293b !important;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    outline: none;
}

.subjects-dropdown-item:active {
    transform: translateX(2px) scale(0.98);
}

.subjects-dropdown-item:last-child {
    border-bottom: none;
}

body.dark-theme .subjects-dropdown-menu {
    background: linear-gradient(120deg, #0f2027 0%, #2c5364 100%) !important;
    border: 1px solid #22344a;
    box-shadow: 0 4px 18px rgba(30,30,60,0.18);
}
body.dark-theme .subjects-dropdown-item {
    color: #e0e6f8 !important;
    background: transparent !important;
}
body.dark-theme .subjects-dropdown-item:hover,
body.dark-theme .subjects-dropdown-item:focus {
    background: linear-gradient(120deg, #36d1c4 0%, #3a7bd5 100%) !important;
    color: #fff !important;
}
body.dark-theme .subjects-dropdown-item:active {
    background: linear-gradient(120deg, #3a7bd5 0%, #36d1c4 100%) !important;
    color: #fff !important;
}

.header-search-form {
    flex: 1;
    margin: 0 20px;
    position: relative;
    max-width: 400px;
    min-width: 200px;
    z-index: 1001;
    transform: translateZ(0);
    will-change: transform;
    isolation: isolate;
}

#header-search-input {
    width: 100%;
    padding: 10px 50px 10px 12px; /* Removed left padding for search icon, added right padding for Google button */
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 25px;
    font-size: 0.9rem;
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(10px);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    height: 40px;
    font-weight: 400;
}

#header-search-input:focus {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.05),
        0 0 0 3px rgba(102, 126, 234, 0.1),
        0 4px 12px rgba(102, 126, 234, 0.15);
    outline: none;
    transform: translateY(-1px);
}

#header-search-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* Enhanced Search Results Dropdown */
.header-search-results-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.98) 0%, 
        rgba(248, 250, 252, 0.95) 100%);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: 16px;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 10px 15px rgba(0, 0, 0, 0.06),
        0 20px 25px rgba(0, 0, 0, 0.04);
    z-index: 1002;
    display: none;
    max-height: 350px;
    overflow-y: auto;
    margin-top: 8px;
    padding: 8px;
    animation: slideDown 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    isolation: isolate;
    transform: translateZ(0);
    will-change: transform;
    contain: layout style paint;
}

.header-search-results-container.show {
    display: block;
}

/* Header Actions (Share Button) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.share-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 50%;
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.05);
}

.share-btn:hover {
    transform: translateY(-1px) scale(1.05);
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(245, 250, 255, 1) 100%);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.share-btn:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.feedback-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 50%;
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.05);
}

.feedback-btn:hover {
    transform: translateY(-1px) scale(1.05);
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(240, 255, 240, 1) 100%);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
    text-decoration: none;
}

.feedback-btn:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.beta-testing-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 50%;
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.05);
}

.beta-testing-btn:hover {
    transform: translateY(-1px) scale(1.05);
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(240, 245, 255, 1) 100%);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
    text-decoration: none;
}

.beta-testing-btn:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Header Right Container */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 6px;
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(248, 250, 252, 0.9) 100%);
    cursor: pointer;
    display: none; /* Hidden by default, shown on mobile */
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    color: #64748b;
}

.mobile-menu-btn:hover {
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(245, 250, 255, 1) 100%);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

/* Mobile Actions Menu */
.mobile-actions-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.1),
        0 20px 48px rgba(0, 0, 0, 0.06);
    min-width: 160px;
    z-index: 3000;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: none; /* Hidden by default, shown on mobile */
}

.mobile-actions-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.mobile-action-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    margin: 2px;
}

.mobile-action-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.mobile-action-item:first-child {
    border-radius: 10px 10px 8px 8px;
}

.mobile-action-item:last-child {
    border-radius: 8px 8px 10px 10px;
}

.search-result-item {
    display: block;
    padding: 12px 16px;
    color: #475569;
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(241, 245, 249, 0.8);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    cursor: pointer;
    border-radius: 8px;
    margin: 2px 0;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(102, 126, 234, 0.08), 
        transparent);
    transition: left 0.4s ease;
    z-index: 0;
}

.search-result-item:hover::before,
.search-result-item.highlighted::before {
    left: 100%;
}

.search-result-item:hover,
.search-result-item.highlighted {
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.06), 
        rgba(118, 75, 162, 0.06));
    color: #1e293b;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    border-bottom-color: transparent;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    font-weight: 500;
}

/* Enhanced Header Controls */
.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.hamburger, .theme-toggle {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.9), 
        rgba(248, 250, 252, 0.8));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    color: #475569;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding: 10px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.hamburger::before, .theme-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(102, 126, 234, 0.1), 
        transparent);
    transition: left 0.4s ease;
    z-index: 0;
}

.hamburger:hover::before, .theme-toggle:hover::before {
    left: 100%;
}

.hamburger {
    display: flex !important; /* Show hamburger by default (mobile) */
}

/* Hide hamburger on large screens, show subjects dropdown instead */
@media (min-width: 1025px) {
    .hamburger {
        display: none !important; /* Hide hamburger on large screens */
    }
}

.hamburger:hover, .theme-toggle:hover {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95), 
        rgba(241, 245, 249, 0.9));
    border-color: rgba(102, 126, 234, 0.4);
    color: #1e293b;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* Remove mobile-specific styles since header is consistent across all screens */
body {
    padding-top: 48px; /* Space for fixed header only */
}

/* Mobile screens */
@media (max-width: 768px) {
    .header-left {
        flex: 0 0 auto; /* Don't expand beyond content */
        min-width: 0;
        gap: 6px; /* Reduce gap between hamburger and logo */
    }
    
    .header-brand-link {
        min-width: 0;
        flex: 0 0 auto; /* Don't expand beyond content */
    }

    .hamburger {
        width: 36px;
        height: 36px;
        font-size: 16px;
        padding: 6px;
        flex-shrink: 0;
    }

    .header-logo {
        height: 32px;
        margin-right: 6px;
        flex-shrink: 0;
    }
    
    .header-titles-wrapper {
        display: none; /* Hide title and tagline on mobile */
    }
    
    .header-search-form {
        flex: 1; /* Expand to fill available space */
        max-width: none; /* Remove max-width constraint */
        min-width: 140px; /* Ensure minimum usable width */
        margin: 0 8px; /* Balanced margins */
    }

    /* Mobile Layout Changes */
    .header-actions {
        display: none; /* Hide desktop share button on mobile */
    }

    .subjects-dropdown {
        display: none; /* Hide desktop subjects dropdown on mobile */
    }

    .header-controls {
        gap: 6px;
        flex-shrink: 0; /* Prevent controls from shrinking */
        min-width: 0;
    }

    .mobile-menu-btn {
        display: flex; /* Show mobile menu button */
        flex-shrink: 0; /* Prevent button from shrinking */
    }

    .mobile-actions-menu {
        display: block; /* Enable mobile actions menu */
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
        font-size: 14px;
        flex-shrink: 0; /* Prevent theme button from shrinking */
    }
}

/* Medium-small screens (phones in landscape, small tablets) */
@media (max-width: 480px) {
    header {
        padding: 6px 8px;
        height: 46px;
    }
    
    .header-left {
        gap: 3px;
    }
    
    .hamburger {
        width: 30px;
        height: 30px;
        font-size: 14px;
        padding: 3px;
    }
    
    .header-logo {
        height: 26px;
        margin-right: 4px;
    }
    
    .header-search-form {
        margin: 0 6px;
        min-width: 120px;
    }

    #header-search-input {
        padding: 4px 6px 4px 28px;
        font-size: 0.85rem;
        height: 28px;
    }

    .mobile-menu-btn {
        width: 28px;
        height: 28px;
        font-size: 15px;
        flex-shrink: 0;
        min-width: 28px;
    }

    .theme-toggle {
        width: 28px;
        height: 28px;
        font-size: 12px;
        flex-shrink: 0;
        min-width: 28px;
    }

    .header-controls {
        gap: 4px;
        min-width: 60px;
    }
}

/* Extra small screens (iPhone SE and similar) */
@media (max-width: 375px) {
    header {
        padding: 6px 6px; /* Reduce padding further */
        height: 44px; /* Smaller height */
    }
    
    .header-left {
        gap: 2px; /* Minimal gap */
        min-width: 0;
        flex: 0 0 auto;
    }
    
    .hamburger {
        width: 28px; /* Smaller hamburger */
        height: 28px;
        font-size: 14px;
        margin-right: 2px;
        padding: 2px;
        flex-shrink: 0;
    }
    
    .header-logo {
        height: 24px; /* Smaller logo */
        margin-right: 4px;
        flex-shrink: 0;
    }
    
    .header-brand-link {
        display: flex;
        align-items: center;
        min-width: 0;
        flex: 0 0 auto;
    }
    
    .header-titles-wrapper {
        display: none; /* Hide title and tagline on small mobile */
    }
    
    .header-search-form {
        margin: 0 4px; /* Minimal margins */
        min-width: 100px;
        max-width: none;
        flex: 1;
    }

    #header-search-input {
        padding: 4px 30px 4px 6px; /* Updated padding for Google button */
        font-size: 0.8rem;
        height: 26px; /* Smaller height */
    }

    .mobile-menu-btn {
        width: 26px; /* Smaller mobile menu button */
        height: 26px;
        font-size: 14px;
        flex-shrink: 0; /* Critical: prevent shrinking */
        min-width: 26px; /* Ensure minimum width */
    }

    .theme-toggle {
        width: 26px; /* Smaller theme button */
        height: 26px;
        font-size: 11px;
        flex-shrink: 0; /* Critical: prevent shrinking */
        min-width: 26px; /* Ensure minimum width */
    }

    #google-search-btn {
        width: 22px; /* Compact mobile size */
        height: 22px;
        right: 4px;
        top: 50%;
        transform: translateY(-50%);
    }

    #google-search-btn svg {
        width: 12px;
        height: 12px;
    }

    .header-controls {
        gap: 3px; /* Minimal gap */
        flex-shrink: 0;
        min-width: 55px; /* Ensure minimum width for both buttons */
    }

    .mobile-actions-menu {
        min-width: 130px; /* Smaller menu */
        right: -2px; /* Adjust position */
    }

    .mobile-action-item {
        padding: 8px 12px; /* Smaller padding */
        font-size: 12px;
    }

    /* Ensure proper spacing for all buttons */
    .header-controls {
        gap: 3px;
        flex-shrink: 0;
        min-width: 55px; /* Reserve space for both buttons */
    }
    
    .mobile-menu-btn,
    .theme-toggle {
        flex-shrink: 0; /* Prevent any shrinking */
        min-width: 26px; /* Guarantee minimum width */
    }

    .subjects-dropdown {
        display: none !important; /* Hide subjects dropdown on very small screens */
    }

    .theme-toggle {
        width: 28px;
        height: 28px;
        font-size: 1rem;
        padding: 4px;
    }

    body {
        padding-top: 48px; /* Adjust for smaller mobile header */
    }
}

/* Very small screens (iPhone SE 320px) */
@media (max-width: 320px) {
    header {
        padding: 6px 4px;
        height: 44px; /* Reduced since no title text */
        gap: 4px;
    }
    
    .header-left {
        gap: 2px;
        flex: 0 0 auto; /* Don't expand beyond content */
        min-width: 0;
    }
    
    .hamburger {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
        margin-right: 2px;
        padding: 2px;
        flex-shrink: 0;
    }
    
    .header-logo {
        height: 22px;
        margin-right: 4px;
        flex-shrink: 0;
    }
    
    .header-brand-link {
        display: flex;
        align-items: center;
        min-width: 0;
        flex: 0 0 auto; /* Don't expand beyond content */
    }
    
    .header-titles-wrapper {
        display: none; /* Hide title and tagline on very small mobile */
    }
    
    .header-search-form {
        margin: 0 6px;
        min-width: 100px;
        max-width: none; /* Remove max-width constraint to allow expansion */
        flex: 1; /* Expand to fill available space */
    }
    
    #header-search-input {
        padding: 3px 30px 3px 6px; /* Updated padding for Google button */
        font-size: 0.75rem;
        height: 24px;
        border-radius: 4px;
    }

    #google-search-btn {
        width: 20px; /* Very compact for smallest screens */
        height: 20px;
        right: 3px;
        top: 50%;
        transform: translateY(-50%);
    }

    #google-search-btn svg {
        width: 10px;
        height: 10px;
    }
    
    .header-controls {
        gap: 1px;
        flex-shrink: 0;
    }
    
    .theme-toggle {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
        padding: 2px;
    }
    
    body {
        padding-top: 44px; /* Adjust for very small mobile header */
    }
}

/* Enhanced Dark Theme Support for Modern Header */
body.dark-theme .header {
    background: linear-gradient(135deg, 
        rgba(17, 24, 39, 0.95), 
        rgba(31, 41, 55, 0.9));
    border-bottom-color: rgba(75, 85, 99, 0.6);
}

body.dark-theme .header-search-container {
    background: linear-gradient(135deg, 
        rgba(31, 41, 55, 0.9), 
        rgba(17, 24, 39, 0.8));
    border-color: rgba(75, 85, 99, 0.6);
}

body.dark-theme .header-search-input {
    background: rgba(17, 24, 39, 0.6);
    border-color: rgba(75, 85, 99, 0.5);
    color: #f1f5f9;
}

body.dark-theme .header-search-input::placeholder {
    color: #94a3b8;
}

/* Dark theme styles for share button */
body.dark-theme .share-btn {
    background: linear-gradient(145deg, 
        rgba(31, 41, 55, 0.9) 0%, 
        rgba(17, 24, 39, 0.8) 100%);
    border-color: rgba(75, 85, 99, 0.6);
    color: #f1f5f9;
}

body.dark-theme .share-btn:hover {
    background: linear-gradient(145deg, 
        rgba(31, 41, 55, 1) 0%, 
        rgba(17, 24, 39, 0.9) 100%);
    border-color: rgba(59, 130, 246, 0.4);
}

/* Dark theme styles for feedback button */
body.dark-theme .feedback-btn {
    background: linear-gradient(145deg, 
        rgba(31, 41, 55, 0.9) 0%, 
        rgba(17, 24, 39, 0.8) 100%);
    border-color: rgba(75, 85, 99, 0.6);
    color: #f1f5f9;
}

body.dark-theme .feedback-btn:hover {
    background: linear-gradient(145deg, 
        rgba(31, 41, 55, 1) 0%, 
        rgba(17, 24, 39, 0.9) 100%);
    border-color: rgba(34, 197, 94, 0.4);
    color: #22c55e;
}

/* Dark theme styles for beta testing button */
body.dark-theme .beta-testing-btn {
    background: linear-gradient(145deg, 
        rgba(31, 41, 55, 0.9) 0%, 
        rgba(17, 24, 39, 0.8) 100%);
    border-color: rgba(75, 85, 99, 0.6);
    color: #f1f5f9;
}

body.dark-theme .beta-testing-btn:hover {
    background: linear-gradient(145deg, 
        rgba(31, 41, 55, 1) 0%, 
        rgba(17, 24, 39, 0.9) 100%);
    border-color: rgba(59, 130, 246, 0.4);
    color: #3b82f6;
}

/* Dark theme styles for mobile elements */
body.dark-theme .mobile-menu-btn {
    background: linear-gradient(145deg, 
        rgba(31, 41, 55, 0.9) 0%, 
        rgba(17, 24, 39, 0.8) 100%);
    border-color: rgba(75, 85, 99, 0.6);
    color: #94a3b8;
}

body.dark-theme .mobile-menu-btn:hover {
    background: linear-gradient(145deg, 
        rgba(31, 41, 55, 1) 0%, 
        rgba(17, 24, 39, 0.9) 100%);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

body.dark-theme .mobile-actions-menu {
    background: rgba(17, 24, 39, 0.98);
    border-color: rgba(75, 85, 99, 0.6);
}

body.dark-theme .mobile-action-item {
    color: #e2e8f0;
}

body.dark-theme .mobile-action-item:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

/* Dark Theme Language Dropdown */
body.dark-theme .language-btn {
    background: linear-gradient(135deg, 
        rgba(31, 41, 55, 0.9), 
        rgba(17, 24, 39, 0.8));
    border-color: rgba(75, 85, 99, 0.6);
    color: #e2e8f0;
}

body.dark-theme .language-btn:hover {
    background: linear-gradient(135deg, 
        rgba(45, 55, 72, 0.95), 
        rgba(26, 32, 44, 0.9));
    border-color: rgba(102, 126, 234, 0.4);
    color: #f8fafc;
}

body.dark-theme .language-dropdown-menu {
    background: linear-gradient(145deg, 
        rgba(17, 24, 39, 0.98), 
        rgba(31, 41, 55, 0.95));
    border-color: rgba(75, 85, 99, 0.6);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 
                0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

body.dark-theme .language-dropdown-item {
    color: #e2e8f0;
}

body.dark-theme .language-dropdown-item:hover {
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.1), 
        rgba(118, 75, 162, 0.1));
    color: #f8fafc;
}

body.dark-theme .language-dropdown-item.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

body.dark-theme .subjects-dropdown-btn {
    background: linear-gradient(135deg, 
        rgba(31, 41, 55, 0.9), 
        rgba(17, 24, 39, 0.8));
    border-color: rgba(75, 85, 99, 0.6);
    color: #f1f5f9;
}

body.dark-theme .header-search-results-container {
    background: linear-gradient(145deg, 
        rgba(17, 24, 39, 0.98), 
        rgba(31, 41, 55, 0.95));
    border-color: rgba(75, 85, 99, 0.6);
}

body.dark-theme .search-result-item {
    color: #e2e8f0;
    border-bottom-color: rgba(75, 85, 99, 0.4);
}

body.dark-theme .search-result-item:hover,
body.dark-theme .search-result-item.highlighted {
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.1), 
        rgba(118, 75, 162, 0.1));
    color: #f8fafc;
}

body.dark-theme .hamburger, 
body.dark-theme .theme-toggle {
    background: linear-gradient(135deg, 
        rgba(31, 41, 55, 0.9), 
        rgba(17, 24, 39, 0.8));
    border-color: rgba(75, 85, 99, 0.6);
    color: #e2e8f0;
}

body.dark-theme .hamburger:hover, 
body.dark-theme .theme-toggle:hover {
    background: linear-gradient(135deg, 
        rgba(45, 55, 72, 0.95), 
        rgba(26, 32, 44, 0.9));
    border-color: rgba(102, 126, 234, 0.4);
    color: #f8fafc;
}

/* Modern Animation Keyframes */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Additional responsive enhancements */
@media (max-width: 480px) {
    .header-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .subjects-dropdown-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}