
/* 基础色彩变量定义 */
:root {
  --primary-color: #3498db; /* 主色，用于链接和重要按钮 */
  --secondary-color: #2ecc71; /* 辅色，用于次要按钮和强调元素 */
  --accent-color: #e74c3c; /* 点缀色，用于关键提示和警告 */
  --background-color: #121212; /* 页面整体背景色，深灰至黑色渐变 */
  --text-color: #ecf0f1; /* 主文本颜色，浅灰色 */
  --secondary-text-color: #bdc3c7; /* 次要文本颜色，浅灰中带有蓝色调 */
  --border-color: #2c3e50; /* 边框颜色，深蓝灰色 */
  --hover-background: #34495e; /* 悬停时的背景色变化 */
}

/* 全局样式 */
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, var(--background-color), #000000);
  color: var(--text-color);
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
  transition: background 0.5s ease, color 0.5s ease;
}

/* 导航栏样式 */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(18, 18, 18, 0.9);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.navbar .logo {
  font-size: 1.5em;
  color: var(--primary-color);
  text-decoration: none;
}

.navbar ul {
  list-style: none;
  display: flex;
  gap: 20px;
}

.navbar ul li a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 1em;
  transition: color 0.3s ease;
}

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

/* 主容器样式 */
.container {
  max-width: 1200px;
  margin: 100px auto 50px;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

/* 侧边导航栏样式 */
.sidebar {
  position: fixed;
  top: 70px;
  left: 30px;
  width: 200px;
  background: var(--border-color);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

.sidebar a {
  display: block;
  color: var(--text-color);
  text-decoration: none;
  margin: 10px 0;
  padding: 10px;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.sidebar a:hover {
  background: var(--hover-background);
}

/* 文章内容样式 */
article {
  background: var(--background-color);
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

article h2, article h3, article h4 {
  color: var(--primary-color);
  margin-bottom: 15px;
}

article p {
  color: var(--text-color);
  margin-bottom: 20px;
}

article pre {
  background: #1e1e1e;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

article pre code {
  color: #95a5a6;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.95em;
}

article pre code::before,
article pre code::after {
  content: "";
}

/* 图片样式 */
img.decorative {
  width: 100%;
  max-width: 320px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

img.decorative:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.7);
}

/* 加载动画样式 */
.loader {
  border: 8px solid #f3f3f3;
  border-top: 8px solid var(--primary-color);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 2s linear infinite;
  margin: 50px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

  .sidebar {
    top: 80px;
    left: 50px;
  }
}

@media (max-width: 767px) {
  .navbar ul {
    display: none;
  }

  .sidebar {
    position: relative;
    width: 100%;
    top: 0;
    left: 0;
    margin-bottom: 20px;
    flex-direction: row;
    overflow-x: auto;
  }

  .sidebar a {
    margin: 5px;
    padding: 10px 15px;
  }
}

/* 模块化卡片样式 */
.card {
  background: var(--border-color);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

/* 按钮样式 */
.button {
  display: inline-block;
  padding: 10px 20px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 5px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.3s ease;
}

.button:hover {
  background: var(--secondary-color);
}

/* 工具提示样式 */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 140px;
  background-color: var(--border-color);
  color: var(--text-color);
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -70px;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* 折叠面板样式 */
.collapsible {
  background: var(--border-color);
  color: var(--text-color);
  cursor: pointer;
  padding: 18px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 1em;
  border-radius: 5px;
  transition: background 0.3s ease;
}

.collapsible:hover {
  background: var(--hover-background);
}

.collapsible:after {
  content: '\002B';
  color: var(--text-color);
  font-weight: bold;
  float: right;
  margin-left: 5px;
}

.collapsible.active:after {
  content: "\2212";
}

.content {
  padding: 0 18px;
  max-height: 0;
  overflow: hidden;
  background: var(--background-color);
  transition: max-height 0.3s ease;
  border-left: 2px solid var(--primary-color);
  border-right: 2px solid var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  border-radius: 0 0 5px 5px;
}

.content p {
  padding: 15px 0;
}

/* CSS3代码示例块样式 */
.code-sample {
  background: #1e1e1e;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  margin-bottom: 20px;
}

.code-sample code {
  color: #95a5a6;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.95em;
}

/* 章节导航样式 */
.chapter-nav {
  position: sticky;
  top: 100px;
  background: var(--border-color);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.chapter-nav h3 {
  color: var(--primary-color);
  margin-bottom: 15px;
}

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

.chapter-nav ul li a {
  color: var(--text-color);
  text-decoration: none;
  display: block;
  padding: 8px 0;
  transition: color 0.3s ease;
}

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