
/* 基本样式设置 */
:root {
  --primary-color: #0D28A6; /* 主色调，深蓝色，象征权威与信任 */
  --secondary-color: #333333; /* 辅助色，深灰色，增强对比度和层次感 */
  --accent-color-1: #1E90FF; /* 辅助色1，电光蓝，用于突出关键元素 */
  --accent-color-2: #FFA500; /* 辅助色2，橙色，用于警示或重要提示 */
  --background-color: #F5F5F5; /* 背景色，柔和的米白色 */
  --text-color: #333333; /* 正文字体颜色，深灰色 */
  --border-radius: 10px; /* 全局边角圆润度 */
  --transition-speed: 0.3s; /* 全局过渡时间 */
}

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

/* 设置字体和背景 */
body {
  font-family: 'Helvetica Neue', Arial, sans-serif; /* 现代无衬线字体，确保易读性 */
  color: var(--text-color);
  background-color: var(--background-color);
  line-height: 1.6;
  padding: 20px;
}

/* 导航栏样式 */
.navbar {
  position: fixed; /* 固定导航栏，确保始终可见 */
  top: 0;
  width: 100%;
  background-color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 阴影效果，增强层次感 */
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
}

/* 导航栏中的链接 */
.navbar a {
  color: #fff;
  text-decoration: none;
  margin-left: 20px;
  transition: color var(--transition-speed) ease;
}

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

/* 主容器样式 */
.container {
  max-width: 1200px;
  margin: 100px auto 50px; /* 上方留出导航栏空间 */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* 响应式网格布局 */
  gap: 20px;
  padding: 20px;
}

/* 模块样式 */
.module {
  background-color: #fff;
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 卡片式阴影 */
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.module:hover {
  transform: translateY(-10px); /* 悬停上升效果 */
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

/* 标题样式 */
h2, h3 {
  color: var(--primary-color);
  margin-bottom: 10px;
  font-size: 1.5em;
}

h3 {
  font-size: 1.2em;
}

/* 段落样式 */
p {
  margin-bottom: 15px;
  font-size: 16px;
}

/* 按钮样式 */
.button {
  background: linear-gradient(45deg, var(--primary-color), var(--accent-color-1)); /* 渐变背景 */
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.button:hover {
  background: linear-gradient(45deg, var(--accent-color-1), var(--accent-color-2));
  transform: scale(1.05); /* 放大效果 */
}

/* 图片样式 */
.image {
  width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

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

/* 代码块样式 */
pre {
  background-color: #2d2d2d;
  color: #ccc;
  padding: 15px;
  border-radius: var(--border-radius);
  overflow: auto;
  position: relative;
}

pre code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
}

pre code::before {
  content: "代码示例";
  color: #fff;
  position: absolute;
  top: -20px;
  left: 10px;
  font-size: 12px;
}

/* 侧边栏样式 */
.sidebar {
  position: fixed;
  left: 0;
  top: 100px;
  width: 200px;
  background-color: var(--secondary-color);
  padding: 20px;
  border-radius: 0 10px 10px 0;
}

.sidebar a {
  display: block;
  color: #fff;
  margin-bottom: 15px;
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

.sidebar a:hover {
  color: var(--accent-color-2);
}

/* 底部信息区样式 */
.footer {
  background-color: var(--secondary-color);
  color: #fff;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 20px;
  border-radius: var(--border-radius);
}

.footer a {
  color: var(--accent-color-1);
  text-decoration: none;
  margin-right: 15px;
  transition: color var(--transition-speed) ease;
}

.footer a:hover {
  color: var(--accent-color-2);
}

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

  .sidebar {
    display: none; /* 移动设备隐藏侧边栏 */
  }

  .container {
    grid-template-columns: 1fr;
  }
}

/* 夜间模式切换 */
[data-theme="dark"] {
  --background-color: #121212;
  --text-color: #FFFFFF;
  --secondary-color: #444444;
}

body[data-theme="dark"] {
  background-color: var(--background-color);
  color: var(--text-color);
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

