/* 攀岩 - 专业攀岩健身与培训平台 */
/* 教程风格 CSS - accent-color: #20c997 */

/* ===== CSS 变量定义 ===== */
:root {
  --accent-color: #20c997;
  --accent-dark: #1ba87e;
  --accent-light: #e6f9f3;
  --text-primary: #2c3e50;
  --text-secondary: #5a6c7d;
  --text-muted: #8a9aa8;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-dark: #1a1a2e;
  --border-color: #e9ecef;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --max-width: 1200px;
  --header-height: 64px;
  --progress-height: 4px;
}

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

html {
  scroll-behavior: smooth;
}

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-primary);
}

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

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

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

/* ===== 进度条 ===== */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--progress-height);
  background: var(--border-color);
  z-index: 1001;
}

.progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-dark));
  transition: width 0.1s;
}

/* ===== 页头 ===== */
.header {
  position: fixed;
  top: var(--progress-height);
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

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

.nav a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 15px;
}

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

.search-box {
  position: relative;
}

.search-box input {
  width: 240px;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  font-size: 14px;
  background: var(--bg-secondary);
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: var(--bg-primary);
}

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.5;
}

/* ===== 主内容区 ===== */
.main {
  padding-top: calc(var(--header-height) + var(--progress-height));
}

/* ===== Hero 区域 ===== */
.hero {
  background: linear-gradient(135deg, var(--bg-dark) 0%, #16213e 100%);
  color: white;
  padding: 80px 24px;
  text-align: center;
}

.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
}

.hero p {
  font-size: 20px;
  color: rgba(255,255,255,0.8);
  max-width: 600px;
  margin: 0 auto 40px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 60px;
  margin-top: 48px;
}

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

.stat-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--accent-color);
}

.stat-label {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-dark);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
}

.btn-outline:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

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

.section {
  padding: 60px 0;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

.stat-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}

.stat-card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-card-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== 进度卡片 ===== */
.progress-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.progress-title {
  font-size: 18px;
  font-weight: 600;
}

.progress-meta {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.progress-badge {
  padding: 4px 12px;
  background: var(--accent-light);
  color: var(--accent-dark);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

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

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

.progress-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

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

.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

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

.card-image {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, var(--accent-light), #d1f2e8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.card-body {
  padding: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.card-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-meta {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== 列表 ===== */
.list {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

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

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

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

.list-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.list-content {
  flex: 1;
}

.list-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.list-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.list-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

/* ===== 面包屑 ===== */
.breadcrumb {
  padding: 20px 0;
  font-size: 14px;
  color: var(--text-muted);
}

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

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

.breadcrumb span {
  margin: 0 8px;
  color: var(--border-color);
}

/* ===== 分类头部 ===== */
.category-header {
  padding: 40px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 32px;
}

.category-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
}

.category-desc {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 600px;
}

.category-stats {
  display: flex;
  gap: 24px;
  margin-top: 20px;
}

.category-stat {
  font-size: 14px;
  color: var(--text-muted);
}

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

/* ===== 筛选标签 ===== */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover {
  background: var(--border-color);
}

.filter-tab.active {
  background: var(--accent-color);
  color: white;
}

/* ===== 文章页 ===== */
.article-header {
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 32px;
}

.article-title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--text-muted);
}

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

.article-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 0 60px;
}

.article-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 40px 0 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.article-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 32px 0 16px;
}

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

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

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

.article-content blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: 20px;
  margin: 24px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.article-content code {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 14px;
  color: var(--accent-dark);
}

.article-content pre {
  background: var(--bg-dark);
  color: white;
  padding: 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 24px 0;
}

.article-content pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* ===== 章节导航 ===== */
.chapter-nav {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}

.chapter-nav-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

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

.chapter-item {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.chapter-item:hover {
  background: var(--bg-primary);
}

.chapter-item.active {
  background: var(--accent-light);
  color: var(--accent-dark);
  font-weight: 600;
}

.chapter-number {
  width: 24px;
  height: 24px;
  background: var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.chapter-item.active .chapter-number {
  background: var(--accent-color);
  color: white;
}

.chapter-item.completed .chapter-number {
  background: var(--accent-color);
  color: white;
}

/* ===== 练习框 ===== */
.exercise-box {
  background: linear-gradient(135deg, #fff9e6, #fff5d6);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 24px 0;
  border-left: 4px solid #ffc107;
}

.exercise-title {
  font-size: 16px;
  font-weight: 700;
  color: #856404;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.exercise-content {
  color: #856404;
  font-size: 15px;
  line-height: 1.6;
}

/* ===== 代码演示 ===== */
.code-demo {
  background: var(--bg-dark);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 24px 0;
}

.code-header {
  background: rgba(255,255,255,0.05);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.code-dot.red { background: #ff5f56; }
.code-dot.yellow { background: #ffbd2e; }
.code-dot.green { background: #27c93f; }

.code-content {
  padding: 20px;
  color: white;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
}

/* ===== 侧边栏布局 ===== */
.sidebar-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  height: fit-content;
}

/* ===== 相关文章 ===== */
.related-section {
  background: var(--bg-secondary);
  padding: 40px 0;
  margin-top: 40px;
}

/* ===== 页脚 ===== */
.footer {
  background: var(--bg-dark);
  color: white;
  padding: 60px 0 30px;
}

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

.footer-brand {
  max-width: 300px;
}

.footer-logo {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  line-height: 1.6;
}

.footer-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: rgba(255,255,255,0.8);
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: rgba(255,255,255,0.6);
  font-size: 14px;
}

.footer-links a:hover {
  color: var(--accent-color);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: rgba(255,255,255,0.5);
}

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

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

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

.error-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}

.error-desc {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

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

  .sidebar {
    position: static;
    order: 2;
  }

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

@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
  }

  .nav {
    display: none;
  }

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

  .hero {
    padding: 60px 16px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 16px;
  }

  .hero-stats {
    flex-direction: column;
    gap: 24px;
  }

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

  .container {
    padding: 0 16px;
  }

  .section {
    padding: 40px 0;
  }

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

  .article-title {
    font-size: 24px;
  }

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

  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .error-code {
    font-size: 80px;
  }
}

@media (max-width: 480px) {
  .filter-tabs {
    gap: 6px;
  }

  .filter-tab {
    padding: 6px 12px;
    font-size: 13px;
  }

  .category-stats {
    flex-direction: column;
    gap: 8px;
  }
}
