/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --text-dark: #1a202c;
    --text-light: #718096;
    --bg-light: #f7fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-white);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 顶部导航栏 */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.nav-links a:hover {
    opacity: 0.8;
}

/* 布局容器 - 侧边栏布局 */
.layout-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* 侧边栏头部 */
.sidebar-header {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

/* 侧边栏导航 */
.sidebar-nav {
    padding: 1rem 0;
}

.nav-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-tree > li {
    margin-bottom: 0.5rem;
}

/* 导航分类 */
.nav-category {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.75rem 1.5rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 子导航 */
.sub-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sub-nav li {
    padding: 0;
}

.sub-nav a {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.6rem 1.5rem 0.6rem 2rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sub-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: rgba(255, 255, 255, 0.5);
}

.sub-nav a.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: white;
    font-weight: 600;
}

/* 主内容区 */
.main-content {
    flex: 1;
    background: var(--bg-light);
    min-width: 0;
}

/* Hero区域 */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    text-align: center;
    padding: 120px 20px 80px;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.hero h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    opacity: 0.95;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn.secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

/* 特性网格 */
.features {
    padding: 80px 20px;
    background: var(--bg-light);
}

.features h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-dark);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

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

.feature-card h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 0.8rem;
}

.feature-card p {
    color: var(--text-light);
}

/* 章节样式 */
.section {
    padding: 80px 20px;
}

.section.alt-bg {
    background: var(--bg-light);
}

.section h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--text-dark);
}

/* 主题列表 */
.topic-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.topic-item {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.topic-item h3 {
    color: var(--text-dark);
    font-size: 1.5rem;
    margin-bottom: 0.8rem;
}

.topic-item p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.topic-item ul {
    list-style: none;
    padding-left: 0;
}

.topic-item li {
    padding: 0.5rem 0;
    color: var(--text-light);
    padding-left: 1.5rem;
    position: relative;
}

.topic-item li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.topic-item li strong {
    color: var(--text-dark);
    font-weight: 600;
}

.topic-item li ul {
    list-style: none;
    padding-left: 0;
    margin-top: 0.5rem;
}

.topic-item li ul li {
    padding-left: 1.5rem;
    padding: 0.3rem 0;
    font-size: 0.95rem;
}

.topic-item li ul li:before {
    content: "•";
    color: var(--secondary-color);
}

/* 编解码器网格 */
.codec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.codec-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.codec-card:hover {
    transform: scale(1.05);
}

.codec-card.featured {
    border: 2px solid var(--primary-color);
}

.codec-card h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.codec-card .tag {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.codec-card .tag.hot {
    background: #fef3c7;
    color: #d97706;
}

.codec-card .tag.latest {
    background: #dbeafe;
    color: #2563eb;
}

.codec-card .tag {
    background: #f3e8ff;
    color: #7c3aed;
}

.codec-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.codec-card .spec {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.codec-card .spec span {
    background: var(--bg-light);
    padding: 0.3rem 0.8rem;
    border-radius: 5px;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* 对比表格 */
.comparison-table {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.comparison-table h3 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-weight: 600;
}

.comparison-table tr:hover {
    background: var(--bg-light);
}

/* AI部分 */
.ai-section {
    margin-bottom: 3rem;
}

.ai-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.ai-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.ai-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.ai-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.8rem;
}

.ai-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.ai-card ul {
    list-style: none;
    padding-left: 0;
}

.ai-card li {
    padding: 0.4rem 0;
    color: var(--text-light);
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.9rem;
}

.ai-card li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.ai-frameworks {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.ai-frameworks h3 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.framework-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.framework {
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.framework strong {
    display: block;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.framework p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* 工具类别 */
.tool-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.tool-categories .category {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.tool-categories h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.tool-categories ul {
    list-style: none;
}

.tool-categories li {
    padding: 0.6rem 0;
    color: var(--text-light);
}

.tool-categories strong {
    color: var(--text-dark);
}

/* 资源部分 */
.resource-section {
    margin-bottom: 2rem;
}

.resource-section h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.resource-list {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.resource-list li {
    padding: 0.8rem 0;
    color: var(--text-light);
    border-bottom: 1px solid var(--border-color);
}

.resource-list li:last-child {
    border-bottom: none;
}

.resource-list strong {
    color: var(--text-dark);
}

/* 提示网格 */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.tip {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
}

.tip strong {
    display: block;
    margin-bottom: 0.5rem;
}

.tip p {
    opacity: 0.95;
}

/* 时间线 */
.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline:before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.timeline-item:nth-child(odd) {
    flex-direction: row-reverse;
    text-align: right;
}

.timeline-item .year {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 80px;
    text-align: center;
}

.timeline-item .event {
    flex: 1;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    color: var(--text-dark);
}


/* 代码示例部分 */
.code-section {
    margin-bottom: 3rem;
}

.code-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    font-size: 2rem;
}

.code-block {
    background: #000000;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    overflow-x: auto;
    border: 1px solid #333;
}

.code-block h4 {
    color: #4af626;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.code-block pre {
    margin: 0;
    padding: 0;
}

.code-block code {
    display: block;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #4af626;
    overflow-x: auto;
}

/* 代码高亮样式 */
.code-block .keyword {
    color: #c792ea;
}

.code-block .string {
    color: #c3e88d;
}

.code-block .comment {
    color: #546e7a;
}

.code-block .function {
    color: #82aaff;
}

.code-block .number {
    color: #f78c6c;
}

/* 代码技巧 */
.code-tips {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.code-tips h3 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.code-tips .tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.code-tips .tip {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
}

.code-tips .tip strong {
    display: block;
    margin-bottom: 0.5rem;
}

.code-tips .tip p {
    opacity: 0.95;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .layout-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        max-height: 300px;
    }

    .feature-grid,
    .codec-grid,
    .ai-grid,
    .framework-list,
    .tool-categories,
    .tips-grid,
    .code-tips .tips-grid {
        grid-template-columns: 1fr;
    }

    .code-block {
        padding: 1rem;
    }

    .code-block code {
        font-size: 0.75rem;
    }

    .code-block pre {
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    .timeline:before {
        left: 20px;
    }

    .timeline-item {
        padding-left: 60px;
    }

    .timeline-item:nth-child(odd) {
        flex-direction: row;
        text-align: left;
    }

    .cta-buttons {
        flex-direction: column;
        gap: 1rem;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero {
        padding: 80px 20px 60px;
    }

    .features,
    .section {
        padding: 40px 15px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    opacity: 0.8;
}