/* 数字时代学堂 - 样式文件 */
/* 页面风格: tutorial (教程风格) */
/* 强调色: #20c997 */

/* CSS 变量 */
:root {
  --accent-color: #20c997;
  --accent-dark: #1ba87e;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f8f9fa;
  --bg-card: #fff;
  --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;
  --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 {
  text-decoration: none;
  color: var(--accent-color);
  transition: color 0.2s;
}

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

ul {
  list-style: none;
}

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 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
}

.logo span {
  color: var(--text-primary);
}

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

.nav a {
  color: var(--text-secondary);
  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-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 8px 16px;
  gap: 8px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 180px;
  font-size: 14px;
}

.search-box button {
  border: none;
  background: var(--accent-color);
  color: #fff;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.search-box button:hover {
  background: var(--accent-dark);
}

/* Hero 区域 */
.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;
  font-weight: 700;
}

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

.hero-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
}

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

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

.btn-primary:hover {
  background: rgba(255,255,255,0.9);
  color: var(--accent-dark);
}

.btn-secondary {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.5);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: #fff;
}

/* 统计卡片 */
.stats-section {
  padding: 40px 0;
  background: var(--bg-primary);
}

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

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

.stat-card .number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-color);
  display: block;
}

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

/* 内容区域 */
.section {
  padding: 60px 0;
}

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

/* 课程卡片 */
.course-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

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

.course-card .cover {
  height: 160px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 3rem;
}

.course-card .content {
  padding: 20px;
}

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

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

.course-card .progress-bar {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.course-card .progress-fill {
  height: 100%;
  background: var(--accent-color);
  border-radius: 3px;
}

.course-card .progress-text {
  font-size: 13px;
  color: var(--text-secondary);
}

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

/* 列表布局 */
.course-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.course-list .course-card {
  display: flex;
}

.course-list .course-card .cover {
  width: 200px;
  height: auto;
  flex-shrink: 0;
}

.course-list .course-card .content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* 状态标签 */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

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

.status-reading {
  background: #fff3cd;
  color: #856404;
}

.status-toread {
  background: #e2e3e5;
  color: #383d41;
}

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

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

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

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

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

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

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

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

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

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

.category-header h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.category-header p {
  color: var(--text-secondary);
}

/* 文章页面 */
.article-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

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

.article-header h1 {
  font-size: 2rem;
  margin-bottom: 16px;
  line-height: 1.3;
}

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

.article-cover {
  width: 100%;
  height: 300px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
  border-radius: var(--radius);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 4rem;
}

.article-content {
  background: var(--bg-card);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.article-content h2 {
  font-size: 1.5rem;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

.article-content h3 {
  font-size: 1.25rem;
  margin: 24px 0 12px;
  color: var(--text-primary);
}

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

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

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

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

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

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

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

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

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

.code-demo pre {
  padding: 20px;
  overflow-x: auto;
  color: #d4d4d4;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 14px;
  line-height: 1.6;
}

/* 练习题框 */
.exercise-box {
  background: #f0f9ff;
  border-left: 4px solid var(--accent-color);
  padding: 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 24px 0;
}

.exercise-box h4 {
  color: var(--accent-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.exercise-box p {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.exercise-box .answer {
  background: var(--bg-primary);
  padding: 16px;
  border-radius: var(--radius);
  margin-top: 12px;
}

/* 章节导航 */
.chapter-nav {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.chapter-nav h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

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

.chapter-nav li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}

.chapter-nav li:hover,
.chapter-nav li.active {
  background: var(--bg-secondary);
}

.chapter-nav li.active {
  color: var(--accent-color);
  font-weight: 500;
}

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

.chapter-nav li.active .chapter-num,
.chapter-nav li.completed .chapter-num {
  background: var(--accent-color);
  color: #fff;
}

/* 进度条 */
.progress-section {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

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

.progress-header h3 {
  font-size: 1rem;
}

.progress-header .status {
  color: var(--accent-color);
  font-weight: 500;
}

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

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

/* 侧边栏 */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 推荐文章 */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.article-item:hover {
  box-shadow: var(--shadow-hover);
}

.article-item .thumb {
  width: 80px;
  height: 60px;
  background: var(--bg-secondary);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  font-size: 1.5rem;
}

.article-item .info {
  flex: 1;
  min-width: 0;
}

.article-item h4 {
  font-size: 14px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* 三栏布局 */
.three-column {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.column-section h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text-secondary);
  font-weight: 600;
}

.column-section ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.column-section li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.column-section li::before {
  content: '•';
  color: var(--accent-color);
}

/* 两栏布局 */
.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* 主内容 + 侧边栏布局 */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
}

/* 页脚 */
.footer {
  background: var(--text-primary);
  color: #fff;
  padding: 60px 0 24px;
  margin-top: 60px;
}

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

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

.footer-brand p {
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  line-height: 1.8;
}

.footer-column h4 {
  font-size: 14px;
  margin-bottom: 16px;
  color: #fff;
}

.footer-column ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.footer-column 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: 14px;
}

/* 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-content {
  max-width: 500px;
}

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

.error-title {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

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

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

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

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

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

  .search-box {
    display: none;
  }

  .hero {
    padding: 60px 0;
  }

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

  .hero p {
    font-size: 1rem;
  }

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

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

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

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

  .three-column {
    grid-template-columns: 1fr;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

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

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

  .article-content {
    padding: 24px;
  }

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

@media (max-width: 480px) {
  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .filter-bar {
    gap: 8px;
  }

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