/* ============================================
   福建初中生物中考复习资料 · 样式系统
   ============================================ */

/* ===== CSS 变量 ===== */
:root {
  /* 主题色 */
  --primary: #2f855a;
  --primary-light: #48bb78;
  --primary-dark: #276749;
  --primary-bg: #f0fff4;
  --primary-border: #9ae6b4;

  /* 辅助色 */
  --accent-blue: #3182ce;
  --accent-blue-bg: #ebf8ff;
  --accent-orange: #dd6b20;
  --accent-orange-bg: #fffaf0;
  --accent-purple: #805ad5;
  --accent-purple-bg: #faf5ff;
  --accent-red: #e53e3e;
  --accent-red-bg: #fff5f5;
  --accent-yellow: #d69e2e;
  --accent-yellow-bg: #fffff0;

  /* 中性色 */
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --bg-body: #f7fafc;
  --bg-card: #ffffff;
  --bg-code: #edf2f7;
  --border-color: #e2e8f0;
  --border-light: #edf2f7;

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --shadow-hover: 0 8px 30px rgba(47,133,90,0.15);

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* 字号 */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 1.875rem;
  --fs-4xl: 2.25rem;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
}

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

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

img, svg { max-width: 100%; display: block; }

/* ===== 顶栏导航 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
}

.topbar-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-subtitle {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-left: 4px;
}

.topbar-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.topbar-nav a {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.topbar-nav a:hover,
.topbar-nav a.active {
  background: var(--primary-bg);
  color: var(--primary-dark);
}

/* ===== 主布局 ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
}

/* 侧边栏 */
.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.sidebar-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 8px 12px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-menu { list-style: none; }

.sidebar-menu li a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-bottom: 2px;
  transition: all 0.15s;
}

.sidebar-menu li a:hover {
  background: var(--primary-bg);
  color: var(--primary-dark);
}

.sidebar-menu li a.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

/* 主内容区 */
.main-content {
  min-width: 0;
}

/* ===== 英雄区（首页） ===== */
.hero {
  background: linear-gradient(135deg, #2f855a 0%, #48bb78 50%, #68d391 100%);
  border-radius: var(--radius-xl);
  padding: 60px 48px;
  color: white;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.hero h1 {
  font-size: var(--fs-4xl);
  font-weight: 700;
  margin-bottom: 12px;
  position: relative;
}

.hero p {
  font-size: var(--fs-lg);
  opacity: 0.92;
  max-width: 600px;
  position: relative;
  line-height: 1.8;
}

.hero-stats {
  display: flex;
  gap: 40px;
  margin-top: 32px;
  position: relative;
}

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

.hero-stat-num {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.hero-stat-label {
  font-size: var(--fs-sm);
  opacity: 0.85;
}

/* ===== 模块卡片网格（首页） ===== */
.section-title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.section-desc {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: var(--fs-sm);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.module-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border-light);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary-border);
}

.module-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 16px;
}

.module-card h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.module-card p {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
}

.module-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.module-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: var(--fs-xs);
  font-weight: 500;
}

/* 卡片颜色变体 */
.mod-green .module-card-icon { background: var(--primary-bg); }
.mod-green .module-tag { background: var(--primary-bg); color: var(--primary-dark); }
.mod-blue .module-card-icon { background: var(--accent-blue-bg); }
.mod-blue .module-tag { background: var(--accent-blue-bg); color: var(--accent-blue); }
.mod-orange .module-card-icon { background: var(--accent-orange-bg); }
.mod-orange .module-tag { background: var(--accent-orange-bg); color: var(--accent-orange); }
.mod-purple .module-card-icon { background: var(--accent-purple-bg); }
.mod-purple .module-tag { background: var(--accent-purple-bg); color: var(--accent-purple); }
.mod-red .module-card-icon { background: var(--accent-red-bg); }
.mod-red .module-tag { background: var(--accent-red-bg); color: var(--accent-red); }

/* 辅助资料卡片 */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.tool-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.25s;
}

.tool-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
  transform: translateY(-2px);
}

.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.tool-info h4 {
  font-size: var(--fs-base);
  font-weight: 600;
  margin-bottom: 2px;
}

.tool-info p {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ===== 内容页 ===== */
.content-page {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.page-header {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 2px solid var(--border-light);
}

.page-header h1 {
  font-size: var(--fs-3xl);
  font-weight: 700;
  margin-bottom: 10px;
}

.page-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.page-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== 标题层级 ===== */
.content-page h2 {
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin: 40px 0 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-bg);
  color: var(--primary-dark);
  scroll-margin-top: 80px;
}

.content-page h3 {
  font-size: var(--fs-xl);
  font-weight: 600;
  margin: 28px 0 14px;
  color: var(--text-primary);
  scroll-margin-top: 80px;
}

.content-page h4 {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin: 20px 0 10px;
  color: var(--text-secondary);
}

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

.content-page strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== 表格 ===== */
.content-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 24px;
  font-size: var(--fs-sm);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.content-page th {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
}

.content-page td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.content-page tbody tr:hover {
  background: var(--primary-bg);
}

.content-page tbody tr:last-child td {
  border-bottom: none;
}

/* ===== 提示框 ===== */
.callout {
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 18px 0;
  display: flex;
  gap: 12px;
  line-height: 1.7;
}

.callout-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1.5;
}

.callout-content { flex: 1; }
.callout-content p:last-child { margin-bottom: 0; }

.callout-warning {
  background: var(--accent-yellow-bg);
  border-left: 4px solid var(--accent-yellow);
  color: #744210;
}

.callout-danger {
  background: var(--accent-red-bg);
  border-left: 4px solid var(--accent-red);
  color: #742a2a;
}

.callout-tip {
  background: var(--primary-bg);
  border-left: 4px solid var(--primary);
  color: #22543d;
}

.callout-info {
  background: var(--accent-blue-bg);
  border-left: 4px solid var(--accent-blue);
  color: #2a4365;
}

/* ===== 折叠面板 ===== */
.accordion {
  margin: 16px 0;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.accordion-item {
  border-bottom: 1px solid var(--border-light);
}

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

.accordion-header {
  padding: 14px 20px;
  background: var(--bg-body);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  transition: background 0.2s;
  user-select: none;
}

.accordion-header:hover {
  background: var(--primary-bg);
}

.accordion-header .arrow {
  transition: transform 0.25s;
  color: var(--text-muted);
}

.accordion-item.open .accordion-header .arrow {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.accordion-item.open .accordion-body {
  max-height: 5000px;
}

.accordion-body-inner {
  padding: 16px 20px;
}

/* ===== 示意图容器 ===== */
.diagram-box {
  background: var(--bg-body);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 20px 0 28px;
  text-align: center;
  overflow-x: auto;
}

.diagram-box svg {
  margin: 0 auto;
  max-width: 100%;
}

.diagram-caption {
  margin-top: 12px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-style: italic;
}

/* ===== 代码/公式块 ===== */
.formula-box {
  background: var(--accent-blue-bg);
  border: 1px solid #bee3f8;
  border-radius: var(--radius-md);
  padding: 16px 24px;
  margin: 16px 0 24px;
  text-align: center;
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--accent-blue);
}

/* ===== 列表 ===== */
.content-page ul,
.content-page ol {
  margin: 12px 0 18px 24px;
  color: var(--text-secondary);
}

.content-page li {
  margin-bottom: 6px;
  line-height: 1.7;
}

.content-page li::marker {
  color: var(--primary);
  font-weight: 600;
}

/* ===== 进度条 ===== */
.progress-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ===== 标签徽章 ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-right: 6px;
}

.badge-green { background: var(--primary-bg); color: var(--primary-dark); }
.badge-blue { background: var(--accent-blue-bg); color: var(--accent-blue); }
.badge-orange { background: var(--accent-orange-bg); color: var(--accent-orange); }
.badge-red { background: var(--accent-red-bg); color: var(--accent-red); }
.badge-purple { background: var(--accent-purple-bg); color: var(--accent-purple); }

/* ===== 卡片网格（内容内） ===== */
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 16px 0 24px;
}

.info-card {
  background: var(--bg-body);
  border-radius: var(--radius-md);
  padding: 18px;
  border: 1px solid var(--border-light);
  transition: all 0.25s;
}

.info-card:hover {
  border-color: var(--primary-border);
  background: var(--primary-bg);
}

.info-card-title {
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--text-primary);
  margin-bottom: 6px;
}

.info-card-desc {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== 返回顶部 ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 99;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  border-top: 1px solid var(--border-light);
  margin-top: 40px;
}

/* ===== 响应式 ===== */
@media (max-width: 960px) {
  .container {
    grid-template-columns: 1fr;
    padding: 20px 16px;
  }

  .sidebar {
    display: none;
  }

  .content-page {
    padding: 24px 20px;
  }

  .hero {
    padding: 40px 28px;
  }

  .hero h1 { font-size: var(--fs-3xl); }

  .hero-stats { gap: 24px; }

  .topbar-nav { display: none; }
}

@media (max-width: 640px) {
  .module-grid {
    grid-template-columns: 1fr;
  }

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

  .hero-stats {
    flex-wrap: wrap;
    gap: 16px;
  }

  .content-page h2 { font-size: var(--fs-xl); }
  .content-page h3 { font-size: var(--fs-lg); }

  .content-page table {
    font-size: var(--fs-xs);
  }

  .content-page th,
  .content-page td {
    padding: 8px 10px;
  }
}

/* ===== SVG 图解画廊 ===== */
.svg-gallery {
  background: linear-gradient(135deg, #f0fff4, #ebf8ff);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 32px;
}

.svg-gallery h2 {
  margin-top: 0 !important;
  border-bottom: none !important;
}

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

.diagram-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.diagram-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.diagram-svg svg {
  width: 100%;
  height: auto;
  max-height: 360px;
}

.diagram-caption {
  margin-top: 14px;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== 打印样式 ===== */
@media print {
  .topbar, .sidebar, .back-to-top, .footer, .accordion-header {
    display: none !important;
  }
  .container { display: block; padding: 0; }
  .content-page { box-shadow: none; border: none; padding: 0; }
  .accordion-body { max-height: none !important; }
  .svg-gallery { page-break-inside: avoid; }
}
