
/* 基本重置样式，确保跨浏览器一致性 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 设置全局字体和背景 */
body {
    font-family: 'Roboto', sans-serif; /* 使用现代无衬线字体 */
    background: linear-gradient(135deg, #0D47A1, #42A5F5); /* 主背景渐变色 */
    color: #FFFFFF; /* 文字颜色为白色 */
    line-height: 1.6; /* 行高设置为1.6，提升可读性 */
    overflow-x: hidden; /* 禁止横向滚动 */
    transition: background 0.5s ease; /* 背景过渡效果 */
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(13, 71, 161, 0.9); /* 半透明深蓝背景 */
    color: #fff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 轻微阴影 */
}

/* 导航链接样式 */
.navbar a {
    color: #fff;
    text-decoration: none;
    margin: 0 15px;
    font-size: 16px;
    position: relative;
    transition: color 0.3s ease;
}

.navbar a:hover {
    color: #FF9800; /* 橙色悬停效果 */
}

/* 侧边菜单样式，仅在移动设备显示 */
.sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: 60px;
    width: 200px;
    height: 100%;
    background: rgba(13, 71, 161, 0.95);
    transition: transform 0.3s ease;
    z-index: 999;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar a {
    display: block;
    padding: 15px 20px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.3s ease;
}

.sidebar a:hover {
    background: rgba(255, 152, 0, 0.2); /* 橙色悬停背景 */
}

/* 主要内容容器 */
.main-content {
    padding: 100px 30px 30px 30px; /* 顶部留出导航栏空间 */
    max-width: 1200px;
    margin: 0 auto;
}

/* 标题样式 */
h2, h3 {
    color: #FF9800; /* 橙色标题 */
    margin-bottom: 15px;
    font-size: 24px;
}

h3 {
    font-size: 20px;
}

/* 段落样式 */
p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    font-size: 16px;
}

/* 代码块样式 */
pre {
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
}

pre code {
    color: #00E676; /* 绿色代码字体 */
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

/* 图片样式 */
img.decorative {
    width: 100%;
    max-width: 320px;
    border-radius: 10px; /* 圆角 */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* 阴影效果 */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

img.decorative:hover {
    transform: scale(1.05); /* 悬停放大 */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* 章节分隔线 */
.section-divider {
    height: 2px;
    background: linear-gradient(90deg, #0D47A1, #42A5F5);
    margin: 40px 0;
    border: none;
}

/* 按钮样式 */
.btn {
    background: linear-gradient(45deg, #FF9800, #F44336); /* 橙色渐变 */
    border: none;
    border-radius: 25px;
    color: #fff;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    font-size: 16px;
}

.btn:hover {
    background: linear-gradient(45deg, #F44336, #FF9800); /* 渐变反转 */
    transform: scale(1.1); /* 放大效果 */
}

/* 导航栏切换按钮，仅在移动设备显示 */
.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.nav-toggle div {
    width: 25px;
    height: 3px;
    background: #fff;
    margin: 4px 0;
    transition: all 0.3s ease;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar a {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .main-content {
        padding: 80px 20px 20px 20px;
    }

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

/* 章节导航样式 */
.chapter-nav {
    position: fixed;
    top: 80px;
    right: 30px;
    background: rgba(13, 71, 161, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

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

.chapter-nav a:hover {
    color: #FF9800;
}

/* 提示文字样式 */
.prominent-note {
    background: rgba(255, 152, 0, 0.2);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 40px;
    font-size: 18px;
    color: #FFFFFF;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 装饰性图片容器样式 */
.image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
}

.image-gallery img {
    flex: 1 1 calc(25% - 20px);
    max-width: calc(25% - 20px);
}

@media (max-width: 1024px) {
    .image-gallery img {
        flex: 1 1 calc(50% - 20px);
        max-width: calc(50% - 20px);
    }
}

@media (max-width: 480px) {
    .image-gallery img {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

/* 动画效果 */
@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;
}

/* 代码块样式区别于正文 */
.code-example {
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 30px;
}

.code-example code {
    color: #00E676;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

/* 高光代码关键词 */
.code-example code .keyword {
    color: #FF9800;
    font-weight: bold;
}

/* 链接样式 */
a {
    color: #42A5F5;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #FF9800;
}

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

table, th, td {
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

th {
    background: rgba(255, 152, 0, 0.3);
}

