
/* 基本布局样式 */
body {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif;
  background-color: #1e1e1e; /* 主背景色，避免使用白色 */
  color: #f5f5f5; /* 主文字颜色 */
}

/* 主导航栏样式 */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: linear-gradient(90deg, #2c3e50, #34495e);
  padding: 20px;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar ul {
  list-style: none;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 0;
}

.navbar li {
  margin: 0 15px;
}

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

.navbar a:hover {
  color: #3498db; /* 辅助色，淡蓝色 */
}

/* 页面主要内容区 */
.container {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-gap: 30px;
  padding: 100px 60px 60px 60px; /* 顶部预留导航栏空间 */
  max-width: 1920px;
  margin: 0 auto;
}

/* 侧边导航栏 */
.sidebar {
  grid-column: span 3;
  position: sticky;
  top: 100px;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar li {
  margin-bottom: 15px;
}

.sidebar a {
  color: #bdc3c7;
  text-decoration: none;
  font-size: 16px;
  transition: color 0.3s;
}

.sidebar a:hover {
  color: #3498db;
}

/* 主内容区 */
.main-content {
  grid-column: span 9;
}

/* 章节导航系统 */
.chapter-nav {
  position: fixed;
  right: 20px;
  top: 120px;
  background: rgba(44, 62, 80, 0.8);
  padding: 15px;
  border-radius: 8px;
}

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

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

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

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

/* 文章标题样式 */
h2, h3, h4 {
  color: #ecf0f1;
  margin-top: 40px;
  margin-bottom: 20px;
}

h2 {
  font-size: 24px;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
}

h3 {
  font-size: 20px;
  border-bottom: 1px solid #3498db;
  padding-bottom: 5px;
}

h4 {
  font-size: 18px;
}

/* 段落样式 */
p {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* 图片样式 */
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, box-shadow 0.3s;
}

img.decorative:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

/* 代码块样式 */
pre {
  background-color: #2c3e50;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 20px;
}

code {
  color: #ecf0f1;
  font-family: 'Courier New', Courier, monospace;
}

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

table thead {
  background-color: #34495e;
}

table th, table td {
  padding: 12px 15px;
  border: 1px solid #2c3e50;
  text-align: left;
}

table tbody tr:nth-child(even) {
  background-color: #2c3e50;
}

/* 按钮样式 */
.button {
  background: linear-gradient(45deg, #6b8ce6, #a0c4ff);
  border: none;
  color: #ffffff;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.3s ease;
  border-radius: 5px;
  font-size: 16px;
}

.button:hover {
  background: linear-gradient(45deg, #a0c4ff, #6b8ce6);
}

/* 折叠区域样式 */
.collapsible {
  background-color: #34495e;
  color: #ecf0f1;
  cursor: pointer;
  padding: 10px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 16px;
  margin-bottom: 10px;
  border-radius: 5px;
  transition: background 0.3s;
}

.collapsible:hover {
  background-color: #3d566e;
}

.content {
  padding: 0 15px;
  display: none;
  background-color: #2c3e50;
  overflow: hidden;
  border-radius: 5px;
  margin-bottom: 20px;
}

/* 提示信息样式 */
.alert {
  background-color: #e74c3c;
  color: #ffffff;
  padding: 15px;
  border-radius: 5px;
  text-align: center;
  margin-bottom: 30px;
  font-size: 18px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .container {
    grid-template-columns: repeat(8, 1fr);
    padding: 100px 40px 40px 40px;
  }

  .sidebar {
    grid-column: span 2;
  }

  .main-content {
    grid-column: span 6;
  }

  .chapter-nav {
    display: none;
  }
}

@media (max-width: 768px) {
  .container {
    grid-template-columns: repeat(4, 1fr);
    padding: 100px 20px 20px 20px;
  }

  .sidebar {
    grid-column: span 4;
  }

  .main-content {
    grid-column: span 4;
  }

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

  .navbar li {
    margin: 10px 0;
  }
}

/* 代码块中特殊样式 */
.language-css {
  color: #1abc9c;
}

.background-animation {
  background: linear-gradient(270deg, #f0f0f0, #e0e0e0, #f0f0f0);
  background-size: 600% 600%;
  animation: gradientMove 15s ease infinite;
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

