
/* 
  全局样式设置
  设置页面的基本字体、背景渐变以及响应式布局
*/
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #0d47a1 70%, #cfd8dc 25%, #ff9800 5%);
  font-family: 'Roboto', sans-serif;
  color: #ffffff;
  line-height: 1.6;
}

/* 
  导航栏样式
  包括固定顶部导航栏和侧边导航的样式设置
*/
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: rgba(13, 71, 161, 0.9);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar a {
  color: #ffffff;
  text-decoration: none;
  margin: 0 10px;
  font-size: 16px;
  transition: color 0.3s ease;
}

.navbar a:hover {
  color: #ff9800;
}

/* 
  侧边导航栏样式
  包括展开与收起状态的转换
*/
.sidebar {
  position: fixed;
  left: -250px;
  top: 0;
  width: 250px;
  height: 100%;
  background-color: #0d47a1;
  transition: left 0.3s ease;
  padding-top: 60px;
}

.sidebar.open {
  left: 0;
}

.sidebar a {
  display: block;
  padding: 15px 20px;
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
  transition: background 0.3s ease;
}

.sidebar a:hover {
  background-color: #ff9800;
}

/* 
  主内容区域样式
  使用Flexbox和Grid布局实现响应式设计
*/
.container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 100px 30px 30px 30px;
}

.module {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 20px;
  margin: 10px 0;
  flex: 1 1 45%;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.module:hover {
  transform: translateY(-10px);
  box-shadow: 0 8px 12px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
  .module {
    flex: 1 1 100%;
  }
}

/* 
  标题样式
  设置不同层级标题的字体大小和颜色
*/
h2, h3, h4 {
  color: #ffffff;
}

h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

h4 {
  font-size: 18px;
  margin-bottom: 6px;
}

/* 
  按钮样式
  主按钮与次按钮的设计，包括悬停效果
*/
.button-primary {
  background-color: #ff9800;
  border: none;
  padding: 10px 20px;
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
  border-radius: 4px;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.button-primary:hover {
  background-color: #fb8c00;
  transform: scale(1.05);
}

/* 
  图片样式
  设置图片的圆角、阴影和悬停效果
*/
img.decorative {
  width: 100%;
  max-width: 320px;
  border-radius: 10px;
  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);
}

/* 
  代码块样式
  与正文内容区分开的CSS代码示例样式
*/
pre.code-sample {
  background-color: rgba(0, 0, 0, 0.7);
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.5;
}

pre.code-sample code {
  color: #00ff00;
  font-family: 'Courier New', Courier, monospace;
}

/* 
  章节导航样式
  设置导航系统的外观和交互效果
*/
.chapter-nav {
  position: fixed;
  top: 70px;
  right: 30px;
  background-color: rgba(13, 71, 161, 0.9);
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

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

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

/* 
  页脚样式
  设置页脚的布局和样式
*/
footer {
  background-color: rgba(13, 71, 161, 0.9);
  padding: 20px 30px;
  text-align: center;
  color: #ffffff;
}

footer a {
  color: #ff9800;
  text-decoration: none;
  margin: 0 5px;
  transition: color 0.3s ease;
}

footer a:hover {
  color: #ffffff;
}

/* 
  动画效果
  定义页面元素的淡入动画
*/
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeInUp {
  animation: fadeInUp 0.6s ease forwards;
}

/* 
  响应式设计
  针对不同屏幕尺寸调整布局
*/
@media (max-width: 480px) {
  .navbar, .sidebar, .chapter-nav {
    padding: 10px 20px;
  }

  h2 {
    font-size: 20px;
  }

  h3 {
    font-size: 18px;
  }

  .button-primary {
    padding: 8px 16px;
    font-size: 14px;
  }
}

