
/* 根元素颜色变量定义 */
:root {
    --primary-color: #0B2447; /* 主色调-深蓝 */
    --secondary-color: #333333; /* 辅色-碳灰 */
    --accent-color: #FFA500; /* 点缀色-亮橙 */
    --background-gradient: linear-gradient(135deg, #0B2447, #0F52BA); /* 背景渐变 */
    --font-family: 'Roboto', sans-serif; /* 字体 */
    --main-text-color: #FFFFFF; /* 正文字体颜色 */
    --header-text-color: #FFFFFF; /* 头部字体颜色 */
    --nav-background: rgba(11, 36, 71, 0.9); /* 导航栏背景 */
    --nav-link-color: #FFA500; /* 导航链接颜色 */
    --nav-link-hover: #3CB371; /* 导航链接悬停颜色 */
    --feature-bg: #333333; /* 功能模块背景 */
    --feature-hover-bg: #0B2447; /* 功能模块悬停背景 */
    --button-bg: #3CB371; /* 按钮背景 */
    --button-hover-bg: #FFA500; /* 按钮悬停背景 */
    --code-bg: #1E1E1E; /* 代码块背景 */
    --code-text: #D4D4D4; /* 代码文字颜色 */
    --tooltip-bg: #555555; /* 提示框背景 */
    --tooltip-text: #FFFFFF; /* 提示框文本颜色 */
}

/* 全局样式 */
body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background: var(--background-gradient);
    color: var(--main-text-color);
    line-height: 1.6;
    transition: background 0.5s ease-in-out;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--nav-background);
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5em;
    font-weight: bold;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--nav-link-color);
    text-decoration: none;
    font-size: 1em;
    position: relative;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--nav-link-hover);
}

/* 主内容样式 */
.container {
    max-width: 1200px;
    margin: 100px auto 50px auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 40px;
}

.sidebar {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1em;
    transition: color 0.3s;
}

.sidebar a:hover {
    color: var(--nav-link-hover);
}

.content {
    background: rgba(51, 51, 51, 0.8);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* 文章标题样式 */
.content h2, .content h3, .content h4 {
    color: var(--accent-color);
    margin-top: 30px;
    margin-bottom: 15px;
}

.content h2 {
    font-size: 1.8em;
}

.content h3 {
    font-size: 1.6em;
}

.content h4 {
    font-size: 1.4em;
}

/* 代码块样式 */
.content pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 0.9em;
    margin: 20px 0;
}

.content code {
    font-family: 'Courier New', Courier, monospace;
}

/* 强调代码内容 */
.content code.language-css::before {
    content: "CSS代码示例：";
    display: block;
    color: var(--accent-color);
    margin-bottom: 5px;
    font-weight: bold;
}

/* 段落样式 */
.content p {
    font-size: 1em;
    margin-bottom: 20px;
    text-indent: 2em;
}

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

.content img:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

/* 关键帧动画-渐显 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* 按钮样式 */
.button-primary {
    background-color: var(--button-bg);
    color: var(--main-text-color);
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
    position: relative;
}

.button-primary:hover {
    background-color: var(--button-hover-bg);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* 提示框样式 */
.tooltip {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
    background-color: var(--tooltip-bg);
    color: var(--tooltip-text);
    padding: 5px 10px;
    border-radius: 3px;
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.button-primary:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* 折叠区域样式 */
.collapsible {
    background-color: var(--secondary-color);
    color: var(--main-text-color);
    cursor: pointer;
    padding: 10px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 1em;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.active, .collapsible:hover {
    background-color: var(--accent-color);
}

.content-collapsible {
    padding: 0 18px;
    display: none;
    background-color: rgba(51, 51, 51, 0.9);
    overflow: hidden;
    border-radius: 5px;
    margin-bottom: 20px;
}

.content-collapsible p {
    margin: 10px 0;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .container {
        grid-template-columns: 1fr 2fr;
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    .container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        gap: 10px;
    }
    .content img {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 20px;
    }
    .navbar-brand {
        font-size: 1.2em;
    }
    .nav-links a {
        font-size: 0.9em;
    }
    .content h2 {
        font-size: 1.5em;
    }
    .content h3 {
        font-size: 1.3em;
    }
    .content h4 {
        font-size: 1.1em;
    }
}

