/* Header Variant 5: Gradient Underline Animation */

/* Google Fonts - Chewy - 强制加载 */
@import url('https://fonts.googleapis.com/css2?family=Chewy&display=block');

header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 247, 250, 0.9) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: none;
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 1000;
    position: relative;
}

header::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(43, 90, 237, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(0, 193, 212, 0.05) 0%, transparent 50%);
    animation: ambientGlow 10s ease-in-out infinite;
    z-index: -1;
}

@keyframes ambientGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        #2B5AED 0%,
        #00C1D4 25%,
        #2B5AED 50%,
        #00C1D4 75%,
        #2B5AED 100%);
    background-size: 300% 100%;
    animation: gradientSlide 8s linear infinite;
    z-index: 1;
    display: none;
}

@keyframes gradientSlide {
    0% { background-position: 0% 0%; }
    100% { background-position: 300% 0%; }
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 0;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
}

.logo::before {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #2B5AED, #00C1D4);
    transition: width 0.4s ease;
    border-radius: 2px;
}

.logo:hover::before {
    width: 100%;
}

.logo:hover {
    transform: translateY(-2px);
}

.logo svg {
    margin-right: 20px;
    transform: translateY(2px);
}

.nav-links {
    display: flex;
    gap: 45px;
    list-style: none;
}

.nav-links a {
    color: #2D3748;
    text-decoration: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
    transition: all 0.3s;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    position: relative;
    padding: 8px 0;
}

.nav-links a::before {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #2B5AED, #00C1D4, #2B5AED);
    background-size: 200% 100%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
    border-radius: 2px;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(43, 90, 237, 0.3), rgba(0, 193, 212, 0.3));
    filter: blur(4px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links a:hover::before {
    width: 100%;
    animation: shimmer 1.5s linear infinite;
}

.nav-links a:hover::after {
    width: 110%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.nav-links a.active {
    color: var(--primary);
}

.nav-links a.active::before {
    width: 100%;
    background: linear-gradient(90deg, #2B5AED, #00C1D4);
}

.nav-links a.active::after {
    width: 110%;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-content {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    transform: translateY(15px);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    min-width: 220px;
    box-shadow: 0 12px 40px rgba(43, 90, 237, 0.15);
    z-index: 1;
    border-radius: 12px;
    padding: 12px;
    margin-top: 18px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    border: 1px solid rgba(43, 90, 237, 0.1);
    overflow: hidden;
}

.nav-dropdown-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2B5AED, #00C1D4, #2B5AED);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

.nav-dropdown-content::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 30px;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-bottom-color: rgba(255, 255, 255, 0.96);
}

.nav-dropdown-content a {
    display: block;
    padding: 12px 15px;
    white-space: nowrap;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.nav-dropdown-content a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, #2B5AED, #00C1D4);
    transition: width 0.3s ease;
}

.nav-dropdown-content a::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(43, 90, 237, 0.05), rgba(0, 193, 212, 0.05));
    opacity: 0;
    transition: opacity 0.3s;
}

.nav-dropdown-content a:hover {
    padding-left: 20px;
    color: var(--primary);
}

.nav-dropdown-content a:hover::before {
    width: 4px;
}

.nav-dropdown-content a:hover::after {
    opacity: 1;
}

.nav-dropdown:hover .nav-dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-arrow {
    margin-left: 8px;
    transition: all 0.3s ease;
    color: var(--gray);
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.dropdown-arrow path {
    stroke-width: 2;
}

.nav-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
    color: var(--primary);
}

.mobile-menu-btn {
    display: none;
    font-size: 24px;
    background: none;
    border: none;
    color: var(--dark);
    cursor: pointer;
}

/* Normalize header container padding across pages */
header .container {
    padding: 0 40px;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 10px 30px rgba(43, 90, 237, 0.15);
        text-align: center;
        gap: 15px;
        z-index: 1000;
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-menu-btn {
        display: block;
    }
}
