
/* 基本变量定义 */
:root {
  --main-green: #228B22; /* 主色调：森林绿 */
  --tech-blue: #1E90FF;  /* 科技蓝 */
  --light-gray: #F5F5F5; /* 辅助色：浅灰 */
  --beige: #FFF8DC;      /* 辅助色：米色 */
  --accent-color: #FF4500; /* 点缀色：橙红 */
  --font-family: 'Roboto', sans-serif; /* 全局字体 */
}

/* 全局样式调整 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, var(--light-gray) 70%, var(--beige) 30%);
  color: var(--main-green);
  line-height: 1.6;
  padding: 20px;
}

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

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

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

/* 侧边导航栏样式 */
.sidebar {
  position: fixed;
  top: 70px;
  left: 0;
  width: 200px;
  height: 100%;
  background-color: var(--light-gray);
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar a {
  display: block;
  color: var(--main-green);
  text-decoration: none;
  margin: 10px 0;
  font-size: 16px;
  transition: color 0.3s ease;
}

.sidebar a:hover {
  color: var(--tech-blue);
}

/* 主内容区样式 */
.content {
  margin-left: 220px;
  padding: 80px 40px 40px 40px;
}

h1 {
  font-size: 2.5em;
  color: var(--tech-blue);
  margin-bottom: 20px;
  text-align: center;
}

h2, h3, h4 {
  color: var(--main-green);
  margin-bottom: 15px;
  font-size: 1.8em;
}

p {
  margin-bottom: 20px;
  font-size: 17px;
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* 图片样式 */
img {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* 卡片式设计 */
.card {
  background-color: var(--beige);
  border-radius: 15px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  padding: 20px;
  margin-bottom: 30px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.3);
}

/* 渐变线条分隔 */
.separator {
  height: 2px;
  background: linear-gradient(to right, var(--main-green), var(--tech-blue));
  margin: 40px 0;
  border: none;
}

/* 按钮样式 */
.button {
  background-color: var(--main-green);
  color: #fff;
  padding: 10px 25px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.button:hover {
  background-color: var(--tech-blue);
  transform: scale(1.05);
}

/* 代码块样式 */
code {
  background-color: #f4f4f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 16px;
}

/* 预格式化文本样式 */
pre {
  background-color: #f4f4f4;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 20px;
}

/* 文章内部链接 */
.content a[rel="nofollow"] {
  color: var(--accent-color);
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .sidebar {
    width: 180px;
  }

  .content {
    margin-left: 200px;
    padding: 80px 30px 30px 30px;
  }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .sidebar {
    display: none;
  }

  .content {
    margin-left: 0;
    padding: 80px 20px 20px 20px;
  }

  h1 {
    font-size: 2em;
  }

  h2, h3, h4 {
    font-size: 1.6em;
  }

  p, a, .button {
    font-size: 15px;
  }
}

/* 动画效果 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 1s ease-in-out;
}

/* 章节导航样式 */
.chapter-nav {
  position: sticky;
  top: 20px;
  background-color: var(--light-gray);
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chapter-nav a {
  display: block;
  color: var(--main-green);
  text-decoration: none;
  margin-bottom: 10px;
  font-size: 16px;
  transition: color 0.3s ease;
}

.chapter-nav a:hover {
  color: var(--tech-blue);
}

/* 强调文本 */
strong {
  color: var(--tech-blue);
  font-weight: bold;
}

/* 列表样式 */
ul {
  list-style-type: disc;
  margin-left: 20px;
  margin-bottom: 20px;
}

ol {
  list-style-type: decimal;
  margin-left: 20px;
  margin-bottom: 20px;
}

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

table, th, td {
  border: 1px solid var(--light-gray);
}

th, td {
  padding: 10px;
  text-align: left;
}

th {
  background-color: var(--tech-blue);
  color: #fff;
}

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

/* 表单样式（尽管不使用，预留） */
input, textarea, select {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid var(--light-gray);
  border-radius: 5px;
  font-size: 16px;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--tech-blue);
  outline: none;
}

