/* ==================== 基础变量 ==================== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.25);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.85);
    --accent: #a78bfa;
    --shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #1a1c2c 0%, #4a1942 50%, #1f4068 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ==================== 背景装饰 ==================== */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 8s ease-in-out infinite;
}

.circle.c1 {
    width: 400px;
    height: 400px;
    background: #667eea;
    top: 10%;
    left: -100px;
    animation-delay: 0s;
}

.circle.c2 {
    width: 300px;
    height: 300px;
    background: #f5576c;
    top: 50%;
    right: -80px;
    animation-delay: -3s;
}

.circle.c3 {
    width: 250px;
    height: 250px;
    background: #4facfe;
    bottom: 10%;
    left: 30%;
    animation-delay: -5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

/* ==================== 导航栏 ==================== */
.glass-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, #a78bfa, #f9a8d4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
}

.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.6));
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: #fff;
    border-radius: 3px;
    transition: 0.3s;
}

.main-nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    position: relative;
    padding: 0.5rem 0;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #a78bfa, #f9a8d4);
    transition: width 0.3s;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ==================== 跑马灯 ==================== */
.marquee-bar {
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid var(--glass-border);
    overflow: hidden;
    white-space: nowrap;
    padding: 0.6rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.marquee-track {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 25s linear infinite;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* ==================== 主体容器 ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ==================== 玻璃卡片通用 ==================== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

/* ==================== Hero 区域 ==================== */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.15) 0%, transparent 70%);
    animation: pulse 6s ease-in-out infinite;
    z-index: -1;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 1; }
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, #a78bfa, #f9a8d4, #7dd3fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 30px rgba(167, 139, 250, 0.4);
}

.hero-slogan {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ==================== 课程卡片网格 ==================== */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.course-card {
    padding: 2rem;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(31, 38, 135, 0.45);
}

.course-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--primary-gradient);
}

.card-java::before { background: linear-gradient(90deg, #f093fb, #f5576c); }
.card-c::before { background: linear-gradient(90deg, #4facfe, #00f2fe); }
.card-cpp::before { background: linear-gradient(90deg, #43e97b, #38f9d7); }
.card-more::before { background: linear-gradient(90deg, #fa709a, #fee140); }

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.card-desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tag {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.card-btn {
    display: inline-block;
    text-align: center;
    padding: 0.8rem;
    border-radius: 12px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    color: #fff;
    font-weight: 600;
    transition: all 0.3s;
}

.card-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

/* ==================== 关于区域 ==================== */
.about-section {
    padding: 2.5rem;
    text-align: center;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, #a78bfa, #f9a8d4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.about-section p {
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

/* ==================== 页脚 ==================== */
.site-footer {
    margin-top: 4rem;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.footer-copy {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.footer-beian a {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(90deg, #f093fb, #f5576c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
    font-size: 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    transition: all 0.3s;
}

.footer-beian a:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(240, 147, 251, 0.4);
}

/* ==================== 响应式适配 ==================== */
@media (max-width: 768px) {
    .nav-container {
        padding: 1rem;
    }

    .menu-toggle {
        display: flex;
    }

    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        flex-direction: column;
        background: rgba(26, 28, 44, 0.95);
        backdrop-filter: blur(12px);
        padding: 1rem 2rem;
        gap: 0;
        border-bottom: 1px solid var(--glass-border);
        transform: translateY(-150%);
        transition: transform 0.3s ease-in-out;
        opacity: 0;
        pointer-events: none;
    }

    .main-nav.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-link {
        padding: 1rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-slogan {
        font-size: 1rem;
    }

    .container {
        padding: 1rem;
    }

    .course-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .marquee-track {
        animation-duration: 18s;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .course-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== 课程详情页 ==================== */
.course-container {
    padding-top: 1rem;
}

.course-hero {
    text-align: center;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.course-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--primary-gradient);
}

.course-hero.card-java::before { background: linear-gradient(90deg, #f093fb, #f5576c); }
.course-hero.card-c::before { background: linear-gradient(90deg, #4facfe, #00f2fe); }
.course-hero.card-cpp::before { background: linear-gradient(90deg, #43e97b, #38f9d7); }
.course-hero.card-more::before { background: linear-gradient(90deg, #fa709a, #fee140); }

.course-hero-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.4));
}

.course-hero-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, #a78bfa, #f9a8d4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.course-hero-intro {
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 1.5rem;
    font-size: 1.1rem;
}

/* 课程布局 */
.course-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

.course-sidebar {
    position: sticky;
    top: 90px;
    padding: 1.5rem;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.sidebar-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.chapter-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chapter-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.chapter-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.chapter-link.active {
    background: linear-gradient(90deg, rgba(167, 139, 250, 0.3), rgba(249, 168, 212, 0.3));
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.chapter-num {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.chapter-text {
    font-size: 0.95rem;
    line-height: 1.4;
}

/* 课程内容 */
.course-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.chapter-card {
    padding: 2rem;
    scroll-margin-top: 100px;
}

.chapter-title {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--glass-border);
    background: linear-gradient(90deg, #a78bfa, #f9a8d4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.chapter-body {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
}

.chapter-body p {
    margin-bottom: 1rem;
}

.chapter-body h3,
.chapter-body h4 {
    color: var(--text-primary);
    margin: 1.5rem 0 0.8rem;
}

.chapter-body ul,
.chapter-body ol {
    margin: 1rem 0 1rem 1.5rem;
}

.chapter-body li {
    margin-bottom: 0.5rem;
}

.chapter-body code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #f9a8d4;
    font-size: 0.9em;
}

.chapter-body pre {
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}

.chapter-body pre code {
    background: transparent;
    padding: 0;
    color: #e0e0e0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.code-copy {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
}

.code-copy:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.course-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

/* 课程页响应式 */
@media (max-width: 1024px) {
    .course-layout {
        grid-template-columns: 1fr;
    }

    .course-sidebar {
        position: static;
        max-height: none;
        margin-bottom: 2rem;
    }

    .chapter-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .chapter-link {
        flex: 1;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .course-hero {
        padding: 2rem 1.5rem;
    }

    .course-hero-title {
        font-size: 1.8rem;
    }

    .chapter-card {
        padding: 1.5rem;
    }

    .chapter-title {
        font-size: 1.3rem;
    }

    .chapter-nav {
        flex-direction: column;
    }

    .chapter-link {
        min-width: auto;
    }
}
