
/* 定义CSS变量，便于全局颜色管理 */
:root {
  --primary-dark: #0A2342; /* 主色调深蓝 */
  --primary-light: #2E3A59; /* 主色调青灰 */
  --accent-orange: #FF6F00; /* 点缀色橙色 */
  --accent-green: #4CAF50; /* 点缀色绿色 */
  --background-gradient: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  --font-family: 'Roboto', sans-serif; /* 全局字体 */
}

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

body {
  font-family: var(--font-family);
  background: var(--background-gradient);
  color: #FFFFFF;
  line-height: 1.6;
  padding-top: 80px; /* 为固定导航栏预留空间 */
}

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

.navbar ul {
  list-style: none;
  display: flex;
  gap: 30px;
}

.navbar a {
  color: #FFFFFF;
  text-decoration: none;
  font-size: 18px;
  transition: color 0.3s ease;
}

.navbar a:hover {
  color: var(--accent-orange);
}

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

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

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

.chapter-nav a {
  color: #FFFFFF;
  text-decoration: none;
  font-size: 16px;
  transition: color 0.3s ease;
}

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

/* 主要内容区样式 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 20px;
}

section {
  margin-bottom: 60px;
  padding: 40px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  position: relative;
}

section h2, section h3, section h4 {
  color: #FFFFFF;
  margin-bottom: 20px;
}

section p {
  font-size: 17px;
  margin-bottom: 20px;
}

section pre {
  background-color: rgba(0, 0, 0, 0.5);
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
}

section pre code {
  font-family: 'Courier New', Courier, monospace;
  color: #00FF00;
}

/* 图片样式 */
img.decorative {
  width: 320px;
  height: 320px;
  border-radius: 16px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  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.3);
}

/* 按钮样式 */
.button {
  background-color: var(--accent-green);
  color: #FFFFFF;
  padding: 12px 25px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.button:hover {
  background-color: var(--accent-orange);
}

/* 折叠区域样式 */
.collapsible {
  background-color: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  cursor: pointer;
  padding: 15px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 18px;
  margin-bottom: 10px;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

.collapsible:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.content {
  padding: 0 15px;
  display: none;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
}

/* 代码示例样式 */
.code-example {
  background-color: rgba(0, 0, 0, 0.6);
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 30px;
}

.code-example code {
  color: #00FF00;
  font-family: 'Courier New', Courier, monospace;
}

/* 渐显动画 */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 实时加载指示器 */
.loader {
  border: 4px solid var(--primary-light);
  border-top: 4px solid var(--accent-green);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 数据仪表盘样式 */
.dashboard {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.chart {
  flex: 1 1 45%;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 20px;
  position: relative;
}

.chart::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px solid var(--accent-green);
  border-radius: 8px;
  box-sizing: border-box;
}

/* 鼠标减少动画的用户偏好 */
@media (prefers-reduced-motion: reduce) {
  .fade-in {
    transition: none;
  }

  .navbar a, .chapter-nav a {
    transition: none;
  }

  .button, .collapsible {
    transition: none;
  }

  .loader {
    animation: none;
  }

  img.decorative:hover {
    transform: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  }
}

/* 响应式布局调整 */
@media (max-width: 768px) {
  .navbar ul {
    flex-direction: column;
    gap: 15px;
    align-items: center;
  }

  .chapter-nav {
    display: none;
  }

  .container {
    padding: 40px 15px;
  }

  img.decorative {
    width: 100%;
    height: auto;
  }

  .dashboard {
    flex-direction: column;
  }

  .chart {
    flex: 1 1 100%;
  }
}

/* 留白与内容区块分隔 */
.section-divider {
  height: 2px;
  background: var(--accent-orange);
  margin: 40px 0;
  border-radius: 1px;
}

