/* ============================================
   宠物训练 - 教程风格样式表
   主色调: #20c997 (青绿色)
   ============================================ */

/* CSS 变量定义 */
:root {
  --accent-color: #20c997;
  --accent-dark: #1ba87e;
  --accent-light: #d1f5e9;
  --text-primary: #2c3e50;
  --text-secondary: #5a6c7d;
  --text-muted: #8b9aab;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --border-color: #dee2e6;
  --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;
  --transition: all 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
}

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

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

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

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

ul, ol {
  list-style: none;
}

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

.section {
  padding: 60px 0;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-align: center;
}

.section-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 40px;
}

/* ============================================
   页头 Header
   ============================================ */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

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

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-color);
  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 {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: 24px;
  padding: 8px 16px;
  width: 240px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}

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

.search-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}

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

.hero-title {
  font-size: 42px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.3;
}

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

.hero-desc {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-cta {
  display: inline-flex;
  gap: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
  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-secondary {
  background: white;
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

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

/* ============================================
   统计卡片
   ============================================ */
.stats-bar {
  background: var(--bg-primary);
  padding: 40px 0;
  border-bottom: 1px solid var(--border-color);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 800px;
  margin: 0 auto;
}

.stat-card {
  text-align: center;
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.stat-number {
  font-size: 36px;
  font-weight: 800;
  color: var(--accent-color);
  line-height: 1;
  margin-bottom: 8px;
}

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

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

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

.progress-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

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

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

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

.progress-text {
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
}

/* ============================================
   课程/内容卡片
   ============================================ */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.content-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}

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

.card-image {
  height: 160px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 48px;
}

.card-body {
  padding: 20px;
}

.card-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--accent-color);
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
  font-weight: 500;
}

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

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

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

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

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

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

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chapter-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  transition: var(--transition);
}

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

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

.chapter-item.completed::before {
  content: "✓";
  margin-right: 10px;
  color: var(--accent-color);
  font-weight: bold;
}

.chapter-item.active.completed::before {
  color: white;
}

.chapter-number {
  width: 28px;
  height: 28px;
  background: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  margin-right: 12px;
}

.chapter-item.active .chapter-number {
  background: rgba(255,255,255,0.3);
}

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

.breadcrumb-list {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

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

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

.breadcrumb-list .separator {
  color: var(--text-muted);
}

.breadcrumb-list .current {
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================
   分类页样式
   ============================================ */
.category-header {
  background: var(--bg-secondary);
  padding: 48px 0;
  text-align: center;
}

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

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

.category-stats {
  display: inline-flex;
  gap: 24px;
  font-size: 14px;
  color: var(--text-muted);
}

.filter-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

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

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

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

/* ============================================
   文章页样式
   ============================================ */
.article-container {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  gap: 40px;
  padding: 40px 0;
}

.article-sidebar-left {
  position: sticky;
  top: 90px;
  height: fit-content;
}

.article-main {
  max-width: 100%;
}

.article-header {
  margin-bottom: 32px;
}

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

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

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

.article-content {
  font-size: 16px;
  line-height: 1.9;
  color: var(--text-primary);
}

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

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

.article-content ul li {
  list-style: disc;
  margin-bottom: 8px;
}

.article-content ol li {
  list-style: decimal;
  margin-bottom: 8px;
}

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

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

.article-content pre {
  background: #2d3748;
  color: #e2e8f0;
  padding: 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 24px 0;
}

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

.article-sidebar-right {
  position: sticky;
  top: 90px;
  height: fit-content;
}

.toc {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.toc-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toc-list a {
  font-size: 14px;
  color: var(--text-secondary);
  display: block;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
}

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

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

/* ============================================
   练习框组件
   ============================================ */
.exercise-box {
  background: linear-gradient(135deg, #fff9e6 0%, #fff5d6 100%);
  border: 1px solid #f0d78c;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 24px 0;
}

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

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

.exercise-content ol {
  padding-left: 20px;
}

.exercise-content ol li {
  list-style: decimal;
  margin-bottom: 8px;
}

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

.code-header {
  background: #2d3748;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.code-dot.red { background: #fc8181; }
.code-dot.yellow { background: #f6e05e; }
.code-dot.green { background: #68d391; }

.code-title {
  font-size: 13px;
  color: #a0aec0;
  margin-left: 8px;
}

.code-content {
  padding: 20px;
  color: #e2e8f0;
  font-family: "SF Mono", Monaco, monospace;
  font-size: 14px;
  line-height: 1.8;
  overflow-x: auto;
}

/* ============================================
   侧边栏组件
   ============================================ */
.sidebar-widget {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.widget-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.widget-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.widget-item {
  display: flex;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.widget-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.widget-thumb {
  width: 60px;
  height: 60px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 24px;
}

.widget-info {
  flex: 1;
}

.widget-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.widget-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================
   列表组件
   ============================================ */
.list-section {
  margin-bottom: 48px;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.list-title {
  font-size: 20px;
  font-weight: 600;
}

.list-more {
  font-size: 14px;
  color: var(--accent-color);
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-list-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.article-list-item:hover {
  background: var(--accent-light);
}

.article-list-number {
  width: 32px;
  height: 32px;
  background: var(--accent-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.article-list-content {
  flex: 1;
}

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

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

/* ============================================
   页脚 Footer
   ============================================ */
.footer {
  background: var(--text-primary);
  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: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

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

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-links a {
  color: var(--text-muted);
  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: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-muted);
}

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

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

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

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

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

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

  .article-sidebar-left,
  .article-sidebar-right {
    position: static;
    order: 2;
  }

  .article-main {
    order: 1;
  }

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

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

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 12px;
    gap: 20px;
  }

  .search-box {
    width: auto;
    flex: 1;
    margin-left: 16px;
  }

  .hero-title {
    font-size: 28px;
  }

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

  .hero-cta {
    flex-direction: column;
    width: 100%;
    padding: 0 20px;
  }

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

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

  .filter-tabs {
    flex-wrap: wrap;
  }

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

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

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

  .section {
    padding: 40px 0;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 60px 0 40px;
  }

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

  .section-title {
    font-size: 22px;
  }

  .category-title {
    font-size: 28px;
  }

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