/* 全局样式 - 简约学术风 */
:root {
    --primary: #1a365d;
    --primary-light: #2c5282;
    --secondary: #e2e8f0;
    --accent: #3182ce;
    --background: #f7fafc;
    --text: #2d3748;
    --text-light: #718096;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Source Han Sans SC", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
}

/* 导航栏 */
.navbar {
    background: var(--primary);
    color: var(--white);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar .container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar .logo {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--white);
}

.navbar .logo span {
    color: var(--accent);
}

.navbar nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    margin-left: 2rem;
    transition: color 0.2s;
}

.navbar nav a:hover {
    color: var(--white);
}

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

/* 首页英雄区 */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 4rem 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* 章节卡片网格 */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 3rem 0;
}

.chapter-card {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: var(--text);
}

.chapter-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.chapter-card .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.chapter-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.chapter-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.chapter-card .count {
    display: inline-block;
    background: var(--secondary);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* 章节页面 */
.chapter-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 3rem 2rem;
    text-align: center;
}

.chapter-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.chapter-header p {
    opacity: 0.9;
}

/* 知识点列表 */
.topics-list {
    padding: 2rem 0;
}

.topic-item {
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem 2rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s, box-shadow 0.2s;
}

.topic-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

.topic-item h3 {
    color: var(--primary);
    font-size: 1.1rem;
}

.topic-item p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.topic-item .arrow {
    color: var(--accent);
    font-size: 1.5rem;
}

/* 知识点内容页 */
.content-page {
    padding: 2rem 0;
}

.breadcrumb {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.content-article {
    background: var(--white);
    border-radius: 12px;
    padding: 3rem;
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 0 auto;
}

.content-article h1 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--accent);
}

.content-article h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
}

.content-article h3 {
    color: var(--primary-light);
    font-size: 1.2rem;
    margin: 1.5rem 0 0.75rem;
}

.content-article p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.content-article ul,
.content-article ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.content-article li {
    margin-bottom: 0.5rem;
}

/* 公式区域 */
.formula-box {
    background: #edf2f7;
    border-left: 4px solid var(--accent);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
    overflow-x: auto;
}

/* 互动演示区 */
.interactive-section {
    background: #f0f7ff;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

.interactive-section h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.demo-container {
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo-container canvas {
    max-width: 100%;
    border: 1px solid var(--secondary);
    border-radius: 4px;
}

/* 控制按钮 */
.controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: #cbd5e0;
}

/* 滑块控件 */
.slider-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
}

.slider-group label {
    min-width: 100px;
    font-weight: 500;
}

.slider-group input[type="range"] {
    flex: 1;
    max-width: 300px;
}

.slider-group .value {
    min-width: 60px;
    text-align: center;
    font-weight: 600;
    color: var(--accent);
}

/* 视频区域 */
.video-section {
    margin: 2rem 0;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* 提示框 */
.tip-box {
    background: #fffbeb;
    border: 1px solid #f6e05e;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
}

.tip-box::before {
    content: "💡 提示";
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
    color: #975a16;
}

/* 练习题 */
.exercise-section {
    background: #f0fff4;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

.exercise-section h3 {
    color: #276749;
    margin-bottom: 1rem;
}

.exercise-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #c6f6d5;
}

.exercise-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.exercise-item .question {
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.exercise-item .options {
    list-style: none;
    padding: 0;
}

.exercise-item .options li {
    padding: 0.5rem 1rem;
    margin: 0.25rem 0;
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.exercise-item .options li:hover {
    background: #e6ffed;
}

.exercise-item .options li.correct {
    background: #c6f6d5;
    color: #276749;
}

.exercise-item .options li.wrong {
    background: #fed7d7;
    color: #9b2c2c;
}

.show-answer-btn {
    background: #38a169;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.5rem;
}

/* 页脚 */
.footer {
    background: var(--primary);
    color: rgba(255, 255, 255, 0.8);
    padding: 2rem;
    text-align: center;
    margin-top: 4rem;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

/* 返回顶部 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
    transform: translateY(20px);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-light);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .navbar nav a {
        margin: 0 0.5rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .chapters-grid {
        grid-template-columns: 1fr;
    }
    
    .content-article {
        padding: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 打印样式 */
@media print {
    .navbar,
    .back-to-top,
    .video-section,
    .interactive-section {
        display: none;
    }
    
    .content-article {
        box-shadow: none;
        padding: 0;
    }
}
