
/* 
  全局样式设置
  定义颜色变量，确保色彩一致性和易于维护
*/
:root {
  --primary-blue: #003366; /* 主色调，传达信任与专业 */
  --secondary-blue: #00AEEF; /* 辅助色，增强活力与强调 */
  --accent-orange: #FF8800; /* 点缀色，吸引视线 */
  --background-light: #F5F5F5; /* 背景浅色，提升清洁感 */
  --background-white: #FFFFFF; /* 纯白背景，用于内容区块 */
  --text-color: #333333; /* 正文字体颜色 */
  --header-color: var(--secondary-blue); /* 标题颜色 */
  --subheader-color: var(--primary-blue); /* 子标题颜色 */
}

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

/* 
  设置全局字体和背景色
*/
body {
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-light);
  overflow-x: hidden; /* 防止出现水平滚动条 */
}

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

.navbar a {
  color: var(--background-white);
  margin: 0 15px;
  text-decoration: none;
  font-size: 1em;
  transition: color 0.3s ease;
}

.navbar a:hover {
  color: var(--secondary-blue);
}

/* 
  导航栏中的logo样式
*/
.navbar .logo {
  font-size: 1.5em;
  font-weight: bold;
}

/* 
  章节导航系统样式
*/
.chapter-nav {
  margin: 80px 20px 20px;
  background-color: var(--background-white);
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.chapter-nav ul li {
  margin-right: 15px;
}

.chapter-nav ul li a {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
}

.chapter-nav ul li a:hover {
  color: var(--secondary-blue);
}

/* 
  主内容区样式
*/
article {
  max-width: 1200px;
  margin: 20px auto;
  padding: 20px;
  background-color: var(--background-white);
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 
  文章标题样式
*/
article h2 {
  font-size: 2em;
  color: var(--header-color);
  margin-bottom: 20px;
}

article h3 {
  font-size: 1.5em;
  color: var(--subheader-color);
  margin-bottom: 15px;
}

article h4 {
  font-size: 1.2em;
  color: var(--subheader-color);
  margin-bottom: 10px;
}

/* 
  段落和列表样式
*/
article p {
  margin-bottom: 10px;
  line-height: 1.8;
}

article ul, article ol {
  margin-left: 20px;
  margin-bottom: 10px;
}

article li {
  margin-bottom: 5px;
}

/* 
  代码块样式
  使用深色背景与高亮边框，区别于正文
*/
article pre {
  background-color: #2d2d2d;
  color: #f8f8f2;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  margin-bottom: 20px;
}

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

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

article th, article td {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 8px;
}

article th {
  background-color: var(--secondary-blue);
  color: var(--background-white);
}

article tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* 
  图片容器样式
  圆角、阴影与悬浮效果
*/
.image-container {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

.image-container img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-container img:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

/* 
  提示信息样式
  突出显示“这是一个网页样式设计参考”
*/
.prompt-message {
  text-align: center;
  font-size: 1.2em;
  color: var(--accent-orange);
  margin: 20px 0;
  padding: 10px;
  border: 2px dashed var(--accent-orange);
  border-radius: 5px;
  background: linear-gradient(135deg, var(--background-white), var(--background-light));
}

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

.collapsible:hover {
  background-color: var(--secondary-blue);
  color: var(--background-white);
}

.content {
  padding: 0 15px;
  display: none;
  overflow: hidden;
  background-color: var(--background-light);
  border-radius: 5px;
  margin-bottom: 10px;
}

.active + .content {
  display: block;
}

/* 
  响应式布局
  针对不同屏幕尺寸调整布局
*/
@media (max-width: 768px) {
  .chapter-nav ul {
    flex-direction: column;
  }

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

  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .navbar a {
    margin: 5px 0;
  }
}

/* 
  滚动动画效果
*/
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scroll-animate {
  opacity: 0;
  animation: fadeInUp 1s forwards;
}

.scroll-animate.visible {
  opacity: 1;
}

/* 
  按钮样式
  渐变背景与过渡效果
*/
.button {
  background: linear-gradient(45deg, var(--secondary-blue), var(--primary-blue));
  border: none;
  color: var(--background-white);
  padding: 15px 30px;
  font-size: 16px;
  border-radius: 5px;
  transition: background 0.3s ease, transform 0.3s ease;
  cursor: pointer;
}

.button:hover {
  background: linear-gradient(45deg, var(--primary-blue), var(--secondary-blue));
  transform: translateY(-3px);
}

/* 
  加载指示器样式
*/
.loader {
  border: 8px solid var(--background-light);
  border-top: 8px solid var(--secondary-blue);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  margin: 50px auto;
}

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

/* 
  其他装饰性元素
  渐变线条与科技感装饰
*/
.gradient-line {
  height: 4px;
  width: 100%;
  background: linear-gradient(to right, var(--secondary-blue), var(--primary-blue));
  margin: 20px 0;
  border-radius: 2px;
}

/* 
  表单元素样式（如果有）
*/
input, textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid var(--primary-blue);
  border-radius: 5px;
  transition: border 0.3s ease;
}

input:focus, textarea:focus {
  border-color: var(--secondary-blue);
}

/* 
  表单提交按钮样式
*/
.submit-button {
  background: var(--secondary-blue);
  color: var(--background-white);
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.submit-button:hover {
  background: var(--primary-blue);
}

