/* ===== 基础变量 ===== */
:root {
  --accent-color: #9e9e9e;
  --primary-color: #2c3e50;
  --secondary-color: #34495e;
  --text-color: #333;
  --text-light: #666;
  --text-muted: #999;
  --bg-color: #f5f5f5;
  --bg-white: #fff;
  --border-color: #e0e0e0;
  --link-color: #2980b9;
  --link-hover: #1a5276;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --error-color: #e74c3c;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 4px;
  --radius-lg: 8px;
  --max-width: 1200px;
  --header-height: 60px;
}

/* ===== 重置样式 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background: var(--bg-color);
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--link-hover);
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

/* ===== 布局容器 ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== 页头 ===== */
.header {
  background: var(--bg-white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.logo span {
  color: var(--accent-color);
}

.nav {
  display: flex;
  gap: 30px;
}

.nav a {
  color: var(--text-color);
  font-weight: 500;
  padding: 5px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.nav a:hover,
.nav a.active {
  color: var(--link-color);
  border-bottom-color: var(--link-color);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 200px;
  font-size: 0.9rem;
}

.search-box input:focus {
  outline: none;
  border-color: var(--link-color);
}

.search-box button {
  padding: 8px 16px;
  background: var(--link-color);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.search-box button:hover {
  background: var(--link-hover);
}

/* ===== 面包屑 ===== */
.breadcrumb {
  background: var(--bg-white);
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.breadcrumb li:not(:last-child)::after {
  content: ">";
  margin-left: 8px;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-light);
}

.breadcrumb a:hover {
  color: var(--link-color);
}

.breadcrumb li:last-child {
  color: var(--text-muted);
}

/* ===== Hero 区域 ===== */
.hero {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: #fff;
  padding: 60px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  font-weight: 700;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== 快捷链接 ===== */
.quick-links {
  background: var(--bg-white);
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.quick-links .container {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

.quick-links a {
  color: var(--text-light);
  font-size: 0.95rem;
  padding: 5px 15px;
  border-radius: var(--radius);
  transition: all 0.2s;
}

.quick-links a:hover {
  background: var(--bg-color);
  color: var(--link-color);
}

/* ===== 主要内容区 ===== */
.main {
  padding: 40px 0;
}

.section-title {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title span {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: normal;
}

/* ===== 站点地图树 ===== */
.sitemap-tree {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow);
}

.tree-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.tree-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.tree-header {
  background: var(--bg-color);
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--primary-color);
}

.tree-header .count {
  background: var(--accent-color);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
}

.tree-content {
  padding: 15px;
}

.tree-content li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-content li:last-child {
  border-bottom: none;
}

.tree-content li::before {
  content: "•";
  color: var(--accent-color);
}

.tree-content a {
  color: var(--text-color);
  flex: 1;
}

.tree-content a:hover {
  color: var(--link-color);
}

/* ===== 统计信息 ===== */
.stats {
  background: var(--bg-white);
  padding: 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-top: 30px;
  display: flex;
  justify-content: center;
  gap: 60px;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--link-color);
}

.stat-label {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 5px;
}

/* ===== 文章列表 ===== */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 30px;
}

.article-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.article-card h3 {
  font-size: 1rem;
  color: var(--primary-color);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.article-card ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.article-card li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.9rem;
}

.article-card li::before {
  content: "•";
  color: var(--accent-color);
  flex-shrink: 0;
}

.article-card a {
  color: var(--text-color);
  line-height: 1.5;
}

.article-card a:hover {
  color: var(--link-color);
}

/* ===== 分类页特殊样式 ===== */
.category-header {
  background: var(--bg-white);
  padding: 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.category-header h1 {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin-bottom: 10px;
}

.category-header p {
  color: var(--text-light);
}

.category-structure {
  background: var(--bg-white);
  padding: 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.tree-nested {
  margin-left: 20px;
  border-left: 2px solid var(--border-color);
  padding-left: 15px;
  margin-top: 10px;
}

.tree-nested li {
  padding: 5px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-nested li::before {
  content: "└─";
  color: var(--accent-color);
}

.page-list {
  background: var(--bg-white);
  padding: 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.page-list ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.page-list li {
  padding: 10px 15px;
  background: var(--bg-color);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-list li::before {
  content: "📄";
  font-size: 0.9rem;
}

.page-list a {
  color: var(--text-color);
  flex: 1;
}

.page-list a:hover {
  color: var(--link-color);
}

/* ===== 文章页特殊样式 ===== */
.article-header {
  background: var(--bg-white);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.article-header h1 {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 15px;
  line-height: 1.3;
}

.article-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  color: var(--text-light);
  font-size: 0.9rem;
}

.article-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.article-content {
  background: var(--bg-white);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.article-content h2 {
  font-size: 1.4rem;
  color: var(--primary-color);
  margin: 30px 0 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.article-content h2:first-child {
  margin-top: 0;
}

.article-content p {
  margin-bottom: 15px;
  color: var(--text-light);
  line-height: 1.8;
}

.article-content ul {
  margin: 15px 0;
  padding-left: 20px;
}

.article-content ul li {
  list-style: disc;
  margin-bottom: 8px;
  color: var(--text-light);
}

.page-info {
  background: var(--bg-color);
  padding: 20px;
  border-radius: var(--radius);
  margin: 20px 0;
}

.page-info li {
  padding: 8px 0;
  display: flex;
  gap: 10px;
}

.page-info strong {
  color: var(--primary-color);
  min-width: 120px;
}

.related-pages {
  background: var(--bg-white);
  padding: 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.related-pages ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.related-pages li {
  padding: 10px 15px;
  background: var(--bg-color);
  border-radius: var(--radius);
}

.related-pages a {
  color: var(--text-color);
}

.xml-sitemap {
  background: var(--bg-white);
  padding: 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.btn-group {
  display: flex;
  gap: 15px;
  margin-top: 15px;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--link-color);
  color: #fff;
}

.btn-primary:hover {
  background: var(--link-hover);
}

.btn-secondary {
  background: var(--bg-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

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

/* ===== 404 页面 ===== */
.error-page {
  min-height: calc(100vh - var(--header-height) - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
}

.error-content {
  max-width: 500px;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1;
  margin-bottom: 20px;
}

.error-title {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin-bottom: 15px;
}

.error-desc {
  color: var(--text-light);
  margin-bottom: 30px;
}

.error-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== 页脚 ===== */
.footer {
  background: var(--primary-color);
  color: #fff;
  padding: 40px 0 20px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  margin-bottom: 30px;
}

.footer-section h4 {
  font-size: 1rem;
  margin-bottom: 15px;
  color: #fff;
}

.footer-section ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-section a {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
}

.footer-section a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 20px;
  text-align: center;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .header .container {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 20px;
    gap: 10px;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
  }

  .search-box {
    order: 2;
  }

  .search-box input {
    width: 150px;
  }

  .hero {
    padding: 40px 0;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .stats {
    gap: 30px;
  }

  .tree-list {
    grid-template-columns: 1fr;
  }

  .page-list ul {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .article-header,
  .article-content {
    padding: 25px;
  }

  .article-header h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .quick-links .container {
    gap: 15px;
  }

  .quick-links a {
    font-size: 0.85rem;
    padding: 5px 10px;
  }

  .error-code {
    font-size: 5rem;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
