
/* 基础样式设置 */
:root {
    --primary-color: #1976D2; /* 主色调：科技蓝 */
    --secondary-color: #424242; /* 辅助色：深灰 */
    --accent-color: #FFC107; /* 点缀色：金色 */
    --background-color: #f0f4f8; /* 背景色 */
    --text-color: #333333; /* 正文字色 */
    --font-family-primary: 'Roboto', sans-serif; /* 主字体 */
    --font-family-secondary: 'Montserrat', sans-serif; /* 辅助字体 */
}

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

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--font-family-primary);
    line-height: 1.6;
    overflow-x: hidden; /* 防止横向滚动 */
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    z-index: 1000;
    transition: background-color 0.5s ease, box-shadow 0.3s ease;
}

.navbar.scrolled {
    background-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .logo {
    font-family: var(--font-family-secondary);
    font-size: 1.5em;
    color: #ffffff;
    text-decoration: none;
}

.navbar .links a {
    color: #ffffff;
    margin-left: 20px;
    text-decoration: none;
    font-size: 1em;
    position: relative;
    transition: color 0.3s ease;
}

.navbar .links a:hover,
.navbar .links a.active {
    color: var(--accent-color);
}

.navbar .links a::after {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s;
    position: absolute;
    bottom: -5px;
    left: 0;
}

.navbar .links a:hover::after,
.navbar .links a.active::after {
    width: 100%;
}

/* 主要内容布局 */
.section {
    padding: 100px 50px;
    min-height: 100vh;
}

.section:nth-child(even) {
    background-color: #ffffff;
}

.section:nth-child(odd) {
    background-color: var(--background-color);
}

.section h2, .section h3, .section h4 {
    font-family: var(--font-family-secondary);
    color: var(--primary-color);
    margin-bottom: 20px;
}

.section p {
    font-family: var(--font-family-primary);
    font-size: 16px;
    margin-bottom: 15px;
}

.section pre {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.section code {
    font-family: 'Courier New', Courier, monospace;
    color: var(--secondary-color);
}

/* 强调文本 */
.highlight {
    color: var(--accent-color);
    font-weight: bold;
}

/* 图片样式 */
.section img {
    width: 100%;
    max-width: 320px;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 10px;
}

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

/* 代码示例样式 */
.code-example {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    margin-bottom: 20px;
}

.code-example code {
    display: block;
    white-space: pre;
}

/* 章节导航 */
.nav-chapters {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(25,118,210,0.8);
    padding: 10px;
    border-radius: 8px;
    z-index: 999;
}

.nav-chapters a {
    display: block;
    color: #ffffff;
    text-decoration: none;
    margin: 10px 0;
    font-size: 14px;
    transition: color 0.3s ease;
}

.nav-chapters a:hover {
    color: var(--accent-color);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 10px 15px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.back-to-top:hover {
    background-color: var(--accent-color);
    transform: scale(1.1);
}

/* 折叠区域 */
.collapsible {
    background-color: #ffffff;
    color: var(--text-color);
    cursor: pointer;
    padding: 10px 20px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 16px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    margin-bottom: 10px;
}

.collapsible.active, .collapsible:hover {
    background-color: var(--primary-color);
    color: #ffffff;
}

.content {
    padding: 0 20px;
    display: none;
    overflow: hidden;
    background-color: #f9f9f9;
    border-left: 3px solid var(--accent-color);
    margin-bottom: 20px;
}

/* 表单样式 */
.form-container {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.form-container input, .form-container textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    transition: border-color 0.3s ease;
}

.form-container input:focus, .form-container textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

.form-container .submit-button {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 10px 25px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.form-container .submit-button:hover {
    background-color: var(--accent-color);
    transform: scale(1.05);
}

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

    .navbar .links {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .navbar .links a {
        margin: 10px 0;
    }

    .nav-chapters {
        display: none;
    }

    .section {
        padding: 80px 20px;
    }

    .section img {
        max-width: 100%;
    }
}

/* 额外装饰元素 */
.decorative-line {
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    margin: 20px 0;
}

.decorative-gradient {
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
    padding: 30px;
    border-radius: 10px;
    color: #ffffff;
}


