/* 古董瓷器 - 交互教程风格样式表 */
/* 主色调: #9c27b0 (紫色) */

/* ===== CSS 变量 ===== */
:root {
  --accent-color: #9c27b0;
  --accent-light: #ba68c8;
  --accent-dark: #7b1fa2;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f8f9fa;
  --bg-code: #f5f5f5;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 8px;
  --radius-sm: 4px;
  --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-primary);
}

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

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

ul {
  list-style: none;
}

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

/* ===== 页头 ===== */
.header {
  height: var(--header-height);
  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: 100%;
}

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

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}

.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 {
  position: relative;
}

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

.search-box input:focus {
  outline: none;
  border-color: var(--accent-color);
  width: 280px;
}

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

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

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

.hero p {
  font-size: 20px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
}

.hero-search {
  max-width: 560px;
  margin: 0 auto 40px;
}

.hero-search input {
  width: 100%;
  height: 56px;
  padding: 0 24px;
  border: 2px solid var(--border-color);
  border-radius: 28px;
  font-size: 16px;
  background: var(--bg-primary);
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.hero-search input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: var(--shadow-hover);
}

.quick-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.quick-link {
  padding: 12px 24px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.quick-link:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: var(--shadow);
}

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

.section-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 32px;
  text-align: center;
}

/* ===== 主题列表 ===== */
.topic-list {
  max-width: 600px;
  margin: 0 auto;
}

.topic-item {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: all 0.2s;
}

.topic-item:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow);
}

.topic-icon {
  width: 48px;
  height: 48px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  font-size: 24px;
}

.topic-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.topic-content p {
  font-size: 14px;
  color: var(--text-secondary);
}

.topic-arrow {
  margin-left: auto;
  color: var(--text-muted);
}

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

.article-column h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
}

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

.article-item {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.article-item:hover {
  background: var(--bg-primary);
  border-left-color: var(--accent-color);
  box-shadow: var(--shadow);
}

.article-item a {
  color: var(--text-primary);
  font-weight: 500;
}

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

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

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

.breadcrumb .container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

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

/* ===== 页面标题区 ===== */
.page-header {
  padding: 48px 0;
  background: var(--bg-secondary);
  text-align: center;
}

.page-header h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
}

.page-header p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ===== 模块列表 ===== */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.module-card {
  padding: 24px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.module-card:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow);
}

.module-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--accent-color);
}

.module-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.module-meta {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== 文章详情布局 ===== */
.article-layout {
  display: grid;
  grid-template-columns: 240px 1fr 240px;
  gap: 40px;
  padding: 40px 0;
}

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

.sidebar-left h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-left .module-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.sidebar-left .module-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

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

.sidebar-right h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.toc-list a {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 6px 0;
  border-left: 2px solid var(--border-color);
  padding-left: 12px;
  transition: all 0.2s;
}

.toc-list a:hover,
.toc-list a.active {
  color: var(--accent-color);
  border-left-color: var(--accent-color);
}

/* ===== 文章正文 ===== */
.article-main {
  min-width: 0;
}

.article-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

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

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

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

.article-content p {
  margin-bottom: 16px;
}

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

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

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

/* ===== 代码块 ===== */
.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin: 20px 0;
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #e8e8e8;
  border-bottom: 1px solid var(--border-color);
}

.code-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.code-lang {
  font-size: 12px;
  padding: 4px 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.code-block pre {
  padding: 20px;
  overflow-x: auto;
  font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}

.code-block code {
  font-family: inherit;
}

/* ===== 参数表格 ===== */
.param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

.param-table th,
.param-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.param-table th {
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.param-name {
  font-family: monospace;
  color: var(--accent-color);
  font-weight: 500;
}

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

/* ===== 提示框 ===== */
.tip-box {
  padding: 16px 20px;
  background: #f3e5f5;
  border-left: 4px solid var(--accent-color);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
}

.tip-box-title {
  font-weight: 600;
  color: var(--accent-dark);
  margin-bottom: 8px;
}

.tip-box p {
  margin: 0;
  color: var(--text-secondary);
}

/* ===== 推荐文章 ===== */
.recommended-section {
  background: var(--bg-secondary);
  padding: 48px 0;
}

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

.recommended-links {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-color);
}

.recommended-links a {
  padding: 8px 16px;
  background: var(--bg-primary);
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

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

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

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

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

.footer-brand p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

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

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

.footer-column a {
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.footer-column a:hover {
  color: #fff;
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== 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: 480px;
}

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

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

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

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

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

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

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

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

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

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

  .sidebar-left {
    display: none;
  }
}

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

  .search-box {
    display: none;
  }

  .hero {
    padding: 48px 0;
  }

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

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

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

  .article-layout {
    grid-template-columns: 1fr;
  }

  .sidebar-right {
    display: none;
  }

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

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

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

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

  .quick-links {
    flex-direction: column;
    align-items: center;
  }

  .quick-link {
    width: 100%;
    max-width: 280px;
    text-align: center;
  }

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

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

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

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

/* ===== 代码横向滚动 (移动端) ===== */
@media (max-width: 768px) {
  .code-block pre {
    white-space: pre;
    word-wrap: normal;
  }
}
