/* IT教育指南 - 样式文件 */
/* 查询关键词: IT教育指南 www.youxizhongxin.cn IT教育 技术导学 课程甄选 */

/* ===== CSS 变量 ===== */
:root {
  --accent-color: #20c997;
  --accent-dark: #1ba87e;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --border-color: #dee2e6;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --error-color: #dc3545;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: 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;
  display: block;
}

ul, ol {
  list-style: none;
}

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

/* ===== 头部导航 ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.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: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
}

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

.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;
  gap: 8px;
  background: var(--bg-secondary);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

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

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

/* ===== 面包屑导航 ===== */
.breadcrumb {
  padding: 16px 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

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

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

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

/* ===== Hero 区域 ===== */
.hero {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  padding: 60px 0;
  text-align: center;
  margin-bottom: 40px;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

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

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

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

.stat-card {
  background: var(--bg-primary);
  padding: 24px;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 4px;
}

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

/* ===== 进度条组件 ===== */
.progress-section {
  margin-bottom: 40px;
}

.progress-card {
  background: var(--bg-primary);
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

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

.progress-title {
  font-size: 1.125rem;
  font-weight: 600;
}

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

.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.3s ease;
}

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

/* ===== 内容区块 ===== */
.section {
  margin-bottom: 40px;
}

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

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-more {
  font-size: 0.875rem;
  color: var(--accent-color);
}

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

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

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

.card-image {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 3rem;
}

.card-body {
  padding: 16px;
}

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

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

.card-progress {
  margin-top: 12px;
}

.card-progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

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

.card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  margin-top: 8px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.completed {
  background: var(--success-color);
}

.status-dot.reading {
  background: var(--accent-color);
}

.status-dot.pending {
  background: var(--text-muted);
}

/* ===== 列表组件 ===== */
.list-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

.list-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  padding: 20px;
}

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

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

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

.list-item a {
  color: var(--text-primary);
  font-size: 0.9375rem;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* ===== 分类页样式 ===== */
.category-header {
  text-align: center;
  padding: 40px 0;
  margin-bottom: 32px;
}

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

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

.category-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 8px 16px;
  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: white;
  border-color: var(--accent-color);
}

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

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

.article-meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

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

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

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 32px 0 16px;
  color: var(--text-primary);
}

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  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 ul li {
  list-style: disc;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

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

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

.article-content pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: 16px;
}

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

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

/* ===== 代码演示框 ===== */
.code-demo {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  overflow: hidden;
}

.code-demo-header {
  background: var(--bg-tertiary);
  padding: 12px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-demo-body {
  padding: 16px;
}

.code-demo pre {
  margin: 0;
  background: #1e1e1e;
}

/* ===== 练习题框 ===== */
.exercise-box {
  background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
  border: 1px solid var(--accent-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.exercise-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.exercise-content {
  color: var(--text-secondary);
}

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

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

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

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

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

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

.chapter-item.active .chapter-num {
  background: rgba(255,255,255,0.2);
  color: white;
}

.chapter-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.chapter-name {
  font-size: 0.9375rem;
}

/* ===== 404页面 ===== */
.error-page {
  min-height: calc(100vh - var(--header-height) - 200px);
  display: flex;
  flex-direction: column;
  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;
  margin-bottom: 20px;
  opacity: 0.8;
}

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

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

.error-actions {
  display: flex;
  gap: 12px;
}

/* ===== 按钮样式 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 500;
  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;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
}

/* ===== 页脚 ===== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 40px 0 20px;
  margin-top: 60px;
}

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

.footer-brand {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.footer-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

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

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

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

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

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

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

@media (max-width: 768px) {
  .hero-title {
    font-size: 1.75rem;
  }

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

  .list-section {
    grid-template-columns: 1fr;
  }

  .nav {
    display: none;
  }

  .search-box {
    display: none;
  }

  .article-title {
    font-size: 1.5rem;
  }

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

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

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

  .hero {
    padding: 40px 0;
  }

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

  .filter-tabs {
    justify-content: center;
  }

  .error-actions {
    flex-direction: column;
  }
}
