
/* 全局样式设置 */
body {
  margin: 0;
  font-family: 'Roboto', sans-serif; /* 使用Roboto字体，确保文本清晰易读 */
  background: linear-gradient(135deg, #1e3c72, #2a5298); /* 主色调渐变，象征科技感与信任感 */
  color: #ffffff; /* 文字颜色设置为白色，确保与深色背景形成对比 */
  overflow-x: hidden; /* 禁止出现水平滚动条，确保响应式布局 */
}

/* 导航栏样式 */
.navbar {
  position: fixed; /* 固定定位，确保导航栏在滚动时始终可见 */
  top: 0;
  width: 100%;
  height: 60px;
  background-color: rgba(30, 60, 114, 0.9); /* 半透明深蓝色背景，增强高级感 */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000; /* 确保导航栏在最上层 */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 添加阴影效果，提升层次感 */
}

.navbar .logo {
  font-size: 1.8em;
  font-weight: bold;
  color: #ffffff;
}

.navbar .nav-links a {
  margin: 0 15px;
  text-decoration: none;
  color: #ffffff;
  position: relative;
  transition: color 0.3s;
}

.navbar .nav-links a::after {
  content: '';
  position: absolute;
  width: 0%;
  height: 2px;
  background: #ffa500; /* 点缀色，橙色用于视觉焦点 */
  left: 0;
  bottom: -5px;
  transition: width 0.3s;
}

.navbar .nav-links a:hover::after {
  width: 100%; /* 悬停时下划线展开，增加互动性 */
}

.navbar .search-box input {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  transition: all 0.3s;
}

.navbar .search-box input:focus {
  outline: none;
  box-shadow: 0 0 5px #ffa500; /* 聚焦时显示橙色阴影，提升用户体验 */
}

/* 主容器样式 */
.container {
  max-width: 1200px;
  margin: 80px auto 50px auto; /* 上部留出导航栏空间 */
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 20px;
}

/* 章节导航系统 */
.chapter-nav {
  background-color: rgba(34, 45, 59, 0.8);
  padding: 15px;
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chapter-nav a {
  text-decoration: none;
  color: #ffffff;
  background-color: #2a5298;
  padding: 10px 15px;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.chapter-nav a:hover {
  background-color: #1e3c72;
}

/* 文章样式 */
article {
  background-color: rgba(255, 255, 255, 0.1); /* 半透明白色背景，增加层次感 */
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

article h2, article h3 {
  color: #ffa500; /* 使用橙色突出标题 */
}

article p {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 15px;
}

article pre {
  background-color: rgba(50, 50, 50, 0.8);
  padding: 15px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 15px;
}

article code {
  color: #28a745; /* 绿色用于代码高亮 */
  font-family: 'Courier New', Courier, monospace;
}

article img {
  width: 100%;
  max-width: 320px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s, box-shadow 0.3s;
}

article img:hover {
  transform: scale(1.05); /* 悬停时放大图像，增强互动性 */
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.5);
}

/* 提示信息样式 */
.notice {
  background: linear-gradient(135deg, #2a5298, #1e3c72);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  font-size: 1.2em;
  margin-bottom: 30px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* 折叠区域样式 */
.collapsible {
  background-color: rgba(34, 45, 59, 0.8);
  color: #ffffff;
  cursor: pointer;
  padding: 10px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 16px;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.collapsible:hover {
  background-color: #2a5298;
}

.content {
  padding: 0 15px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background-color: rgba(50, 50, 50, 0.9);
  border-radius: 0 0 8px 8px;
}

.content p {
  margin: 10px 0;
}

/* 代码块样式 */
.code-sample {
  background-color: rgba(50, 50, 50, 0.9);
  padding: 15px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 20px;
  font-family: 'Courier New', Courier, monospace;
  color: #28a745;
}

/* 响应式设计 */
@media (min-width: 768px) {
  .container {
    grid-template-columns: 1fr 3fr;
  }

  .chapter-nav {
    flex-direction: column;
  }

  article img {
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  .chapter-nav {
    display: none; /* 小屏幕隐藏章节导航，避免占用过多空间 */
  }

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