/* 书法练习 - 样式表 */
/* 基于教程风格 (tutorial) - 主色调: #20c997 */

/* ===== CSS 变量 ===== */
:root {
  --accent-color: #20c997;
  --accent-dark: #1ba87e;
  --accent-light: #e6f9f3;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f8f9fa;
  --bg-dark: #2c3e50;
  --border-color: #e9ecef;
  --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;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", 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;
  transition: color 0.2s;
}

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

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

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

/* ===== 头部导航 ===== */
.header {
  background: var(--bg-primary);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-color);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
}

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

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

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

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 6px 16px;
  gap: 8px;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 0.875rem;
  width: 160px;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

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

.breadcrumb ol {
  display: flex;
  list-style: none;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

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

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

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

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

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

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

/* ===== 统计卡片 ===== */
.stats-section {
  padding: 40px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.stat-card {
  background: var(--bg-primary);
  padding: 32px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1;
}

.stat-label {
  color: var(--text-secondary);
  margin-top: 8px;
  font-size: 0.875rem;
}

/* ===== 区块标题 ===== */
.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;
}

/* ===== 卡片组件 ===== */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.card-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 12px;
}

.card-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
}

/* ===== 进度条 ===== */
.progress-bar {
  background: var(--border-color);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}

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

.progress-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ===== 课程卡片 ===== */
.course-card {
  display: flex;
  gap: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.course-card:hover {
  box-shadow: var(--shadow-hover);
}

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

.course-info {
  flex: 1;
}

.course-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.course-author {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.course-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent-dark);
}

.course-status.completed {
  background: #d4edda;
  color: #155724;
}

/* ===== 文章列表 ===== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.article-bullet {
  width: 6px;
  height: 6px;
  background: var(--accent-color);
  border-radius: 50%;
  flex-shrink: 0;
}

.article-title {
  flex: 1;
  color: var(--text-primary);
  font-size: 0.9375rem;
}

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

.article-date {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ===== 网格布局 ===== */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

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

.filter-tab {
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover,
.filter-tab.active {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

/* ===== 文章详情页 ===== */
.article-header {
  background: var(--bg-primary);
  padding: 40px 0;
  border-bottom: 1px solid var(--border-color);
}

.article-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  gap: 24px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

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

.article-cover {
  width: 100%;
  max-width: 400px;
  height: 280px;
  background: var(--accent-light);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  font-size: 4rem;
  margin: 24px auto;
}

.article-content {
  background: var(--bg-primary);
  padding: 40px 0;
}

.article-body {
  max-width: 800px;
  margin: 0 auto;
}

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-light);
}

.article-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 24px 0 12px;
}

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

.article-body ul,
.article-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

.article-body li {
  margin-bottom: 8px;
}

/* ===== 笔记区域 ===== */
.notes-section {
  background: var(--bg-secondary);
  padding: 24px;
  border-radius: var(--radius-lg);
  margin: 24px 0;
}

.note-item {
  padding: 12px 0;
  border-bottom: 1px dashed var(--border-color);
}

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

.note-text {
  color: var(--text-secondary);
  font-style: italic;
}

/* ===== 相关推荐 ===== */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.related-card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.related-card:hover {
  box-shadow: var(--shadow-hover);
}

.related-thumb {
  height: 120px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  font-size: 2.5rem;
}

.related-info {
  padding: 16px;
}

.related-title {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 4px;
}

.related-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ===== 底部区域 ===== */
.bottom-section {
  background: var(--bg-primary);
  padding: 40px 0;
  border-top: 1px solid var(--border-color);
}

/* ===== 页脚 ===== */
.footer {
  background: var(--bg-dark);
  color: #fff;
  padding: 48px 0 24px;
}

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

.footer-brand p {
  color: rgba(255,255,255,0.7);
  margin-top: 12px;
  font-size: 0.9375rem;
}

.footer-title {
  font-weight: 600;
  margin-bottom: 16px;
  font-size: 1rem;
}

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

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

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

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

.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;
}

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

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

.error-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 16px 0;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.2s;
}

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

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

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

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

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

  .search-box {
    display: none;
  }

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

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

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

  .course-card {
    flex-direction: column;
  }

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

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

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

  .article-meta {
    flex-wrap: wrap;
    gap: 12px;
  }

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

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .card {
    padding: 16px;
  }

  .section-title {
    font-size: 1.25rem;
  }
}
