/* 家庭影院 - 交互教程风格样式 */

/* CSS 变量定义 */
:root {
  --accent-color: #9c27b0;
  --accent-light: #ba68c8;
  --accent-dark: #7b1fa2;
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #0f3460;
  --text-primary: #eaeaea;
  --text-secondary: #a0a0a0;
  --text-muted: #6c757d;
  --border-color: #2d3748;
  --success: #28a745;
  --warning: #ffc107;
  --error: #dc3545;
  --code-bg: #2d2d2d;
  --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
  --radius: 8px;
  --radius-lg: 12px;
}

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

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

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

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

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

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

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

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 600;
  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;
  font-size: 1.5rem;
}

.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-light);
  border-bottom-color: var(--accent-color);
}

.search-box {
  position: relative;
}

.search-box input {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px 16px 10px 40px;
  color: var(--text-primary);
  width: 280px;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.2);
}

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

/* Hero 区域 */
.hero {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  padding: 80px 0;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

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

.hero-search input {
  width: 100%;
  padding: 16px 24px;
  font-size: 1rem;
  background-color: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
}

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

/* 快捷链接 */
.quick-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.2s;
}

.quick-link:hover {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--text-primary);
  transform: translateY(-2px);
}

/* 内容区块 */
.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: linear-gradient(180deg, var(--accent-color), var(--accent-light));
  border-radius: 2px;
}

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

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.card-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
}

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

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

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

.article-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.article-item:hover {
  border-color: var(--accent-color);
  background-color: rgba(156, 39, 176, 0.1);
}

.article-number {
  width: 32px;
  height: 32px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-light);
  flex-shrink: 0;
}

.article-info {
  flex: 1;
}

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

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

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

.column {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.column-header {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-list {
  list-style: none;
}

.column-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.column-list a {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-list a::before {
  content: "•";
  color: var(--accent-color);
}

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

/* 面包屑 */
.breadcrumb {
  padding: 20px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

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

.breadcrumb span {
  margin: 0 8px;
}

/* 分类页面 */
.category-header {
  padding: 40px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 40px;
}

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

.category-desc {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* 模块列表 */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 40px;
}

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

.module-item:hover {
  border-color: var(--accent-color);
}

.module-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.module-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.module-name {
  font-size: 1.125rem;
  font-weight: 600;
}

.module-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding-left: 64px;
}

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

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

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

.sidebar-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.toc {
  list-style: none;
}

.toc li {
  margin-bottom: 8px;
}

.toc a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  display: block;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: all 0.2s;
}

.toc a:hover,
.toc a.active {
  background-color: rgba(156, 39, 176, 0.1);
  color: var(--accent-light);
}

/* 文章内容 */
.article-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.article-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

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

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

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

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

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

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

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

.code-header {
  background-color: var(--bg-secondary);
  padding: 12px 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-header::before {
  content: "📄";
}

.code-content {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-primary);
}

/* 参数表格 */
.params-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

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

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

.params-table td {
  color: var(--text-secondary);
}

.param-name {
  font-family: var(--font-mono);
  color: var(--accent-light);
}

.param-type {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background-color: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
}

/* 提示框 */
.tip-box {
  background-color: rgba(156, 39, 176, 0.1);
  border-left: 4px solid var(--accent-color);
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.tip-box-title {
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* 404 页面 */
.error-page {
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 24px;
}

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

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
  color: var(--text-primary);
  border-radius: var(--radius);
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: var(--text-primary);
}

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

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-left {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  gap: 24px;
}

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

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

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

  .sidebar-left,
  .sidebar-right {
    position: static;
    display: none;
  }

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

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

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 16px;
  }

  .search-box {
    order: 2;
  }

  .search-box input {
    width: 200px;
  }

  .hero {
    padding: 40px 0;
  }

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

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

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

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

  .article-content {
    padding: 24px;
  }

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

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

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

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

  .section {
    padding: 40px 0;
  }

  .column {
    padding: 16px;
  }

  .module-item {
    padding: 16px;
  }

  .module-desc {
    padding-left: 0;
    margin-top: 12px;
  }
}
