/* 基础变量 */
:root {
    /* 亮色主题 */
    --primary-color: #3b82f6;
    --secondary-color: #10b981;
    --text-color: #1f2937;
    --bg-color: #ffffff;
    --card-bg: #f9fafb;
    --border-color: #e5e7eb;
    --code-bg: #282c34;
    --heading-color: #111827;
    --nav-bg: rgba(255, 255, 255, 0.8);
}

/* 暗色主题 */
.dark-theme {
    --primary-color: #60a5fa;
    --secondary-color: #34d399;
    --text-color: #e5e7eb;
    --bg-color: #111827;
    --card-bg: #1f2937;
    --border-color: #374151;
    --code-bg: #282c34;
    --heading-color: #f9fafb;
    --nav-bg: rgba(17, 24, 39, 0.8);
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* 导航栏 */
.navbar {
    background-color: var(--nav-bg);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--heading-color);
}

.logo-icon {
    margin-right: 0.5rem;
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
    background-color: var(--card-bg);
}

/* 主页英雄区 */
.hero {
    padding: 8rem 0 4rem;
    text-align: center;
    background: linear-gradient(to bottom, var(--bg-color), var(--card-bg));
}

.gradient-text {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.lead {
    font-size: 1.5rem;
    color: var(--text-color);
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.secondary {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 特性卡片 */
.features {
    padding: 4rem 0;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-card {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    color: var(--heading-color);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* 课程内容 */
.course-content {
    padding: 4rem 0;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.chapter-section h3 {
    color: var(--heading-color);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.chapter-section ul {
    list-style: none;
}

.chapter-section li {
    margin-bottom: 0.5rem;
}

.chapter-section a {
    color: var(--text-color);
    text-decoration: none;
    display: block;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s;
}

.chapter-section a:hover {
    color: var(--primary-color);
    background-color: var(--card-bg);
    transform: translateX(5px);
}

/* 作者信息 */
.author {
    padding: 4rem 0;
    background-color: var(--card-bg);
    border-radius: 1rem;
    margin: 2rem 0;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
}

.author-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.author-bio h3 {
    color: var(--heading-color);
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background-color: var(--bg-color);
    transition: all 0.3s;
}

.social-link:hover {
    transform: translateY(-2px);
    color: var(--primary-color);
}

.social-link img {
    width: 20px;
    height: 20px;
}

/* CTA区域 */
.cta {
    text-align: center;
    padding: 4rem 0;
    background: linear-gradient(to bottom, var(--card-bg), var(--bg-color));
    border-radius: 1rem;
    margin: 2rem 0;
}

.cta h2 {
    color: var(--heading-color);
    margin-bottom: 1rem;
}

/* 页脚 */
.footer {
    background-color: var(--card-bg);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--heading-color);
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: var(--text-color);
    text-decoration: none;
    display: block;
    padding: 0.5rem 0;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* 主题切换按钮 */
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s;
}

.theme-toggle:hover {
    background-color: var(--card-bg);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        height: auto;
        padding: 1rem;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
    }

    .hero {
        padding: 6rem 0 3rem;
    }

    .gradient-text {
        font-size: 2.5rem;
    }

    .lead {
        font-size: 1.25rem;
    }

    .author-info {
        flex-direction: column;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }
}

/* 代码高亮 */
pre {
    background-color: var(--code-bg);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}

code {
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feature-card,
.chapter-section,
.author-info {
    animation: fadeIn 0.6s ease-out forwards;
}

/* 章节页面样式 */
.chapter-page {
    padding-top: 70px;
}

.chapter-container {
    min-height: calc(100vh - 70px - 400px);
    padding: 2rem 0;
}

.breadcrumb {
    margin-bottom: 2rem;
    color: var(--text-color);
    opacity: 0.8;
}

.breadcrumb a {
    color: var(--text-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.chapter-content {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 3rem;
}

.chapter-sidebar {
    position: sticky;
    top: 90px;
    height: calc(100vh - 90px);
    overflow-y: auto;
}

.sidebar-content {
    background-color: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
}

.chapter-list {
    list-style: none;
    margin-top: 1rem;
}

.chapter-list li {
    margin-bottom: 0.5rem;
}

.chapter-list a {
    color: var(--text-color);
    text-decoration: none;
    display: block;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s;
}

.chapter-list a:hover,
.chapter-list a.active {
    color: var(--primary-color);
    background-color: var(--bg-color);
}

.chapter-main {
    background-color: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
}

.chapter-title {
    color: var(--heading-color);
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

.chapter-text {
    font-size: 1.1rem;
    line-height: 1.8;
}

.chapter-text h2 {
    color: var(--heading-color);
    font-size: 1.8rem;
    margin: 2.5rem 0 1.5rem;
}

.chapter-text h3 {
    color: var(--heading-color);
    font-size: 1.4rem;
    margin: 2rem 0 1rem;
}

.chapter-text p {
    margin-bottom: 1.5rem;
}

.chapter-text ul,
.chapter-text ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.chapter-text li {
    margin-bottom: 0.5rem;
}

.chapter-text code {
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 0.3rem;
    font-size: 0.9em;
}

.chapter-text pre {
    margin: 1.5rem 0;
    padding: 1.5rem;
    border-radius: 0.5rem;
    overflow-x: auto;
}

.chapter-text pre code {
    padding: 0;
    background-color: transparent;
}

.chapter-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.nav-button {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: var(--bg-color);
    transition: all 0.3s;
    max-width: 300px;
}

.nav-button:hover {
    transform: translateY(-2px);
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-button.prev {
    padding-right: 2rem;
}

.nav-button.next {
    padding-left: 2rem;
}

.nav-text {
    display: flex;
    flex-direction: column;
}

.nav-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.2rem;
}

.nav-title {
    font-weight: 500;
}

.nav-arrow {
    font-size: 1.2rem;
    margin: 0 1rem;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .chapter-content {
        grid-template-columns: 200px 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .chapter-content {
        grid-template-columns: 1fr;
    }

    .chapter-sidebar {
        position: static;
        height: auto;
        margin-bottom: 2rem;
    }

    .chapter-navigation {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-button {
        max-width: none;
    }
} 