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

/* 设置根字体大小和字体 */
:root {
    --primary-color: #1E90FF; /* 主色调，深蓝色 */
    --secondary-color: #FFA500; /* 辅助色，亮橙色 */
    --accent-color: #32CD32; /* 点缀色，绿色 */
    --background-gradient: linear-gradient(135deg, #f0f4f8, #d9e2ec);
    --font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* 页面背景设置 */
body {
    background: var(--background-gradient);
    font-family: var(--font-family);
    color: #333;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding: 20px;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100%;
    background-color: rgba(30, 144, 255, 0.9);
    padding-top: 60px;
    transition: transform 0.3s ease;
}

.navbar.collapsed {
    transform: translateX(-250px);
}

.navbar ul {
    list-style: none;
}

.navbar ul li {
    margin: 20px 0;
}

.navbar ul li a {
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    padding: 10px 20px;
    display: block;
    transition: background 0.3s ease;
}

.navbar ul li a:hover {
    background-color: var(--secondary-color);
    border-radius: 4px;
}

/* 主内容区域 */
.main-content {
    margin-left: 270px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.navbar.collapsed + .main-content {
    margin-left: 20px;
}

/* 章节导航样式 */
.chapter-nav {
    position: fixed;
    top: 60px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.chapter-nav ul {
    list-style: none;
}

.chapter-nav ul li {
    margin: 10px 0;
}

.chapter-nav ul li a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s ease;
}

.chapter-nav ul li a:hover {
    color: var(--secondary-color);
}

/* 图片样式 */
.image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.image-gallery img {
    width: 320px;
    height: 320px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-gallery img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

/* 代码块样式 */
pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.5;
    font-family: 'Courier New', Courier, monospace;
}

pre code {
    display: block;
}

/* 标题样式 */
h1, h2, h3, h4 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

h1 {
    font-size: 32px;
}

h2 {
    font-size: 28px;
}

h3 {
    font-size: 24px;
}

h4 {
    font-size: 20px;
}

/* 段落样式 */
p {
    margin-bottom: 15px;
    font-size: 16px;
}

/* 按钮样式 */
.button {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--secondary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s ease, transform 0.3s ease;
}

.button:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
}

/* 卡片样式 */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* 悬停效果 */
.hover-effect:hover {
    color: var(--secondary-color);
    transition: color 0.3s ease;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar {
        transform: translateX(-250px);
    }

    .navbar.collapsed + .main-content {
        margin-left: 20px;
    }

    .chapter-nav {
        display: none;
    }

    .image-gallery {
        flex-direction: column;
        align-items: center;
    }

    .main-content {
        margin-left: 20px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    h3 {
        font-size: 18px;
    }

    h4 {
        font-size: 16px;
    }

    p {
        font-size: 14px;
    }

    .image-gallery img {
        width: 100%;
        height: auto;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* 视频和音频元素样式 */
video, audio {
    width: 100%;
    max-width: 600px;
    margin: 20px 0;
    border-radius: 8px;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

table, th, td {
    border: 1px solid #ddd;
}

th, td {
    padding: 12px;
    text-align: left;
}

th {
    background-color: var(--primary-color);
    color: #fff;
}

/* 链接样式 */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

/* 特殊提示样式 */
.alert {
    padding: 15px;
    background-color: var(--accent-color);
    color: #fff;
    border-radius: 8px;
    margin: 20px 0;
}

