/* ===== 基础变量 ===== */
:root {
  --accent-color: #4caf50;
  --accent-light: #e8f5e9;
  --accent-dark: #2e7d32;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f8f9fa;
  --bg-muted: #f0f0f0;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
}

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

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

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

a:hover {
  color: var(--accent-dark);
}

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

ul {
  list-style: none;
}

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

/* ===== Header ===== */
.header {
  background: var(--bg-primary);
  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(--accent-color);
}

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

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

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

.search-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-dark) 100%);
  color: #fff;
  padding: 80px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

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

/* ===== Section 标题 ===== */
.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--accent-color);
  border-radius: 2px;
}

/* ===== 系列卡片 ===== */
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.series-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  border: 1px solid var(--border-color);
}

.series-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.series-card h3 {
  font-size: 1.125rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.series-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.series-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.series-meta .count {
  background: var(--accent-light);
  color: var(--accent-color);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
}

/* ===== 特色系列 ===== */
.featured-series {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 48px;
}

.featured-series .series-header {
  display: flex;
  gap: 32px;
  margin-bottom: 24px;
}

.featured-series .series-cover {
  width: 200px;
  height: 140px;
  background: var(--accent-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  font-size: 3rem;
  flex-shrink: 0;
}

.featured-series .series-info h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.featured-series .series-info p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ===== 文章列表 ===== */
.article-list {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.article-item {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: background 0.2s;
}

.article-item:last-child {
  border-bottom: none;
}

.article-item:hover {
  background: var(--bg-secondary);
}

.article-item .part-num {
  width: 36px;
  height: 36px;
  background: var(--accent-light);
  color: var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.article-item .part-num.completed {
  background: var(--accent-color);
  color: #fff;
}

.article-item .part-num.completed::after {
  content: '✓';
}

.article-item .article-info {
  flex: 1;
}

.article-item h4 {
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.article-item .article-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ===== 内容区块 ===== */
.section {
  padding: 48px 0;
}

.section-alt {
  background: var(--bg-primary);
}

/* ===== 三栏推荐 ===== */
.three-col-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.col-list h4 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.col-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.col-list li:last-child {
  border-bottom: none;
}

.col-list a {
  color: var(--text-primary);
  display: block;
  transition: color 0.2s;
}

.col-list a:hover {
  color: var(--accent-color);
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  background: var(--bg-primary);
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

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

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

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

.breadcrumb li:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== 页面标题区 ===== */
.page-header {
  background: var(--bg-primary);
  padding: 48px 0;
  text-align: center;
}

.page-header h1 {
  font-size: 2rem;
  margin-bottom: 12px;
}

.page-header .subtitle {
  color: var(--text-secondary);
}

/* ===== 系列详情页 ===== */
.series-detail {
  background: var(--bg-primary);
  padding: 48px 0;
}

.series-intro {
  display: flex;
  gap: 48px;
  margin-bottom: 48px;
}

.series-intro .cover {
  width: 300px;
  height: 200px;
  background: linear-gradient(135deg, var(--accent-light) 0%, #c8e6c9 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  font-size: 4rem;
  flex-shrink: 0;
}

.series-intro .info {
  flex: 1;
}

.series-intro .info h1 {
  font-size: 1.75rem;
  margin-bottom: 16px;
}

.series-intro .info p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.8;
}

.series-stats {
  display: flex;
  gap: 32px;
}

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

.stat-item .num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
}

.stat-item .label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ===== 文章详情页 ===== */
.article-header {
  background: var(--bg-primary);
  padding: 48px 0 32px;
  text-align: center;
}

.article-header .series-tag {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent-color);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.article-header h1 {
  font-size: 1.875rem;
  margin-bottom: 12px;
}

.article-header .article-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ===== 文章导航 ===== */
.article-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 32px;
}

.article-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.article-nav a:hover {
  color: var(--accent-color);
}

.article-nav .prev::before {
  content: '◄';
}

.article-nav .next::after {
  content: '►';
}

/* ===== 文章内容 ===== */
.article-content {
  background: var(--bg-primary);
  padding: 48px 0;
}

.article-body {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.0625rem;
  line-height: 1.8;
}

.article-body h2 {
  font-size: 1.5rem;
  margin: 48px 0 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-light);
}

.article-body h3 {
  font-size: 1.25rem;
  margin: 32px 0 16px;
  color: var(--text-primary);
}

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

.article-body ul,
.article-body ol {
  margin-bottom: 20px;
  padding-left: 24px;
}

.article-body li {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.article-body ul li {
  list-style: disc;
}

.article-body ol li {
  list-style: decimal;
}

.article-body .featured-img {
  width: 100%;
  height: 300px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* ===== 进度指示器 ===== */
.progress-section {
  background: var(--bg-secondary);
  padding: 32px;
  border-radius: var(--radius-lg);
  margin: 48px 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.875rem;
}

.progress-bar {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-color);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ===== 更多系列内容 ===== */
.more-series {
  margin-top: 48px;
}

.more-series h3 {
  font-size: 1.125rem;
  margin-bottom: 20px;
}

.mini-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.mini-item {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.mini-item .part {
  font-size: 0.75rem;
  color: var(--accent-color);
  font-weight: 500;
  margin-bottom: 4px;
}

.mini-item h4 {
  font-size: 0.9375rem;
  color: var(--text-primary);
}

/* ===== 推荐文章区 ===== */
.recommend-section {
  background: var(--bg-primary);
  padding: 48px 0;
  border-top: 1px solid var(--border-color);
}

.related-tags {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.related-tags a {
  background: var(--bg-secondary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.related-tags a:hover {
  background: var(--accent-light);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

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

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

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

.error-content h1 {
  font-size: 1.75rem;
  margin-bottom: 16px;
}

.error-content p {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--accent-color);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.2s;
}

.btn:hover {
  background: var(--accent-dark);
  color: #fff;
}

/* ===== Footer ===== */
.footer {
  background: var(--text-primary);
  color: #fff;
  padding: 48px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-brand .logo {
  margin-bottom: 16px;
}

.footer-brand p {
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
  line-height: 1.6;
}

.footer-col h4 {
  font-size: 1rem;
  margin-bottom: 16px;
}

.footer-col li {
  margin-bottom: 12px;
}

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

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

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

/* ===== 响应式设计 ===== */
@media (max-width: 992px) {
  .three-col-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .two-col-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

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

  .series-intro {
    flex-direction: column;
  }

  .series-intro .cover {
    width: 100%;
    height: 180px;
  }
}

@media (max-width: 768px) {
  .nav {
    display: none;
  }

  .hero {
    padding: 48px 0;
  }

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

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

  .featured-series .series-header {
    flex-direction: column;
  }

  .featured-series .series-cover {
    width: 100%;
    height: 160px;
  }

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

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

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