
/* 整个页面的基础样式设置 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif; /* 使用现代无衬线字体 */
    background: linear-gradient(135deg, #1A237E 70%, #E0E0E0 25%, #388E3C 5%);
    color: #333333;
    line-height: 1.6;
    transition: background 0.5s ease;
}

/* 顶部导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(26, 35, 126, 0.9); /* 深蓝色半透明背景 */
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

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

.navbar .nav-links a:hover {
    color: #FF9800; /* 橙色用于高亮 */
}

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    left: -250px; /* 初始隐藏位置 */
    top: 0;
    width: 250px;
    height: 100%;
    background-color: #E0E0E0; /* 银灰色背景 */
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
}

.sidebar.open {
    left: 0; /* 打开侧边栏 */
}

.sidebar a {
    display: block;
    color: #333333;
    text-decoration: none;
    margin: 15px 0;
    font-size: 1em;
    transition: color 0.3s ease;
}

.sidebar a:hover {
    color: #388E3C; /* 电光绿用于高亮 */
}

/* 主内容区域样式 */
.main-content {
    margin-top: 80px; /* 为导航栏留出空间 */
    padding: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* 文章章节样式 */
article {
    background-color: rgba(224, 224, 224, 0.8); /* 半透明银灰色背景 */
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin-bottom: 40px;
}

article h2, article h3, article h4 {
    color: #1A237E; /* 深蓝色标题 */
    margin-bottom: 15px;
}

article h2 {
    font-size: 2em;
}

article h3 {
    font-size: 1.5em;
}

article p {
    font-size: 1em;
    margin-bottom: 20px;
}

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

.article-image:hover {
    transform: scale(1.05); /* 悬停放大效果 */
    box-shadow: 0 8px 12px rgba(0,0,0,0.2);
}

/* 代码块样式 */
pre {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.9em;
    position: relative;
    margin-bottom: 20px;
}

pre::before {
    content: "CSS3 示例代码";
    position: absolute;
    top: -20px;
    left: 0;
    background-color: #388E3C;
    color: white;
    padding: 5px 10px;
    border-radius: 4px 4px 0 0;
    font-size: 0.8em;
}

/* 渐变线条分隔 */
.section-divider {
    height: 4px;
    background: linear-gradient(to right, #1A237E, #388E3C);
    margin: 40px 0;
    border: none;
    border-radius: 2px;
}

/* 按钮样式 */
.button {
    background-color: #388E3C; /* 电光绿按钮 */
    border: none;
    color: white;
    padding: 12px 24px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 1em;
    border-radius: 5px;
    transition: background-color 0.3s ease, transform 0.3s ease;
    cursor: pointer;
}

.button:hover {
    background-color: #1A237E; /* 深蓝色悬停 */
    transform: scale(1.05);
}

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

    .navbar .nav-links {
        display: none; /* 隐藏导航链接，使用侧边栏 */
    }

    .sidebar a {
        font-size: 1.2em;
    }

    .main-content {
        padding: 10px;
    }

    article {
        padding: 20px;
    }
}

/* 动画关键帧 */
@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 应用于背景的动画 */
body {
    background-size: 400% 400%;
    animation: gradientAnimation 15s ease infinite;
}

/* 导航栏按钮动画 */
.nav-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.5em;
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
}

/* 提示信息样式 */
.reference-note {
    background-color: #FF9800; /* 橙色背景 */
    color: white;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    font-size: 1.1em;
    margin-bottom: 30px;
}

/* 章节导航系统样式 */
.chapter-nav {
    position: sticky;
    top: 100px;
    background-color: rgba(224, 224, 224, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

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

.chapter-nav ul li a {
    color: #1A237E;
    text-decoration: none;
    font-size: 1em;
    transition: color 0.3s ease;
}

.chapter-nav ul li a:hover {
    color: #388E3C;
}

/* 精致边框效果 */
.decorative-border {
    border: 2px solid #388E3C;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 20px;
}

/* 卡片式布局 */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.2);
}

/* 精美的悬浮效果 */
.hover-effect {
    position: relative;
    overflow: hidden;
}

.hover-effect::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(56, 142, 60, 0.3);
    transition: left 0.3s ease;
}

.hover-effect:hover::after {
    left: 0;
}

/* 列表样式 */
ul.custom-list {
    list-style-type: none;
    padding: 0;
}

ul.custom-list li::before {
    content: "•";
    color: #388E3C;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

/* 分割线样式 */
hr.divider {
    border: 0;
    height: 2px;
    background: linear-gradient(to right, #1A237E, #388E3C);
    margin: 40px 0;
}

/* 其他细节样式根据需求继续添加 */
/* ... */


