/* ============================================
   学习计划咨询 - 样式表
   风格: 交互教程风格 (tutorial-interactive)
   主色调: #9c27b0
   ============================================ */

/* CSS 变量定义 */
:root {
  --primary-color: #9c27b0;
  --primary-light: #d05ce3;
  --primary-dark: #6a0080;
  --secondary-color: #f3e5f5;
  --text-primary: #212121;
  --text-secondary: #757575;
  --text-light: #ffffff;
  --bg-white: #ffffff;
  --bg-gray: #f5f5f5;
  --border-color: #e0e0e0;
  --code-bg: #263238;
  --code-text: #aed581;
  --accent-color: #9c27b0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
}

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

html {
  scroll-behavior: smooth;
}

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-color: var(--bg-gray);
}

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

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

ul {
  list-style: none;
}

/* ============================================
   页头 Header
   ============================================ */
.header {
  background-color: var(--bg-white);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  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(--primary-color);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 18px;
}

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

.nav a {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 15px;
}

.nav a:hover {
  color: var(--primary-color);
}

.search-box {
  position: relative;
}

.search-box input {
  width: 280px;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  background-color: var(--bg-gray);
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: var(--bg-white);
}

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

/* ============================================
   主要内容区域
   ============================================ */
.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
}

/* ============================================
   Hero 区域
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  text-align: center;
  color: var(--text-light);
  margin-bottom: 40px;
}

.hero h1 {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 16px;
}

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

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

.hero-search input {
  width: 100%;
  padding: 16px 24px 16px 52px;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 16px;
  box-shadow: var(--shadow-lg);
}

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

/* ============================================
   快捷链接 Quick Links
   ============================================ */
.quick-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

.quick-card {
  background: var(--bg-white);
  padding: 32px 24px;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s;
  border: 1px solid var(--border-color);
}

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

.quick-card-icon {
  width: 56px;
  height: 56px;
  background: var(--secondary-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
}

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

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

/* ============================================
   热门主题 Topics
   ============================================ */
.section {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-sm);
}

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

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

.section-more {
  font-size: 14px;
  color: var(--primary-color);
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topic-item {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.topic-item:hover {
  background-color: var(--secondary-color);
}

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

.topic-item:hover .topic-icon {
  background: var(--primary-color);
}

.topic-info h4 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

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

.topic-arrow {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 20px;
}

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

.article-column {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.article-column h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-color);
  display: inline-block;
}

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

.article-list li a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

.article-list li a::before {
  content: "•";
  color: var(--primary-color);
  font-weight: bold;
}

.article-list li a:hover {
  color: var(--primary-color);
}

/* ============================================
   面包屑 Breadcrumb
   ============================================ */
.breadcrumb {
  background: var(--bg-white);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 14px;
}

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

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

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

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

/* ============================================
   分类页内容
   ============================================ */
.category-header {
  background: var(--bg-white);
  padding: 40px;
  border-radius: var(--radius-md);
  margin-bottom: 32px;
  text-align: center;
}

.category-header h1 {
  font-size: 32px;
  margin-bottom: 12px;
}

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

.module-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 40px;
}

.module-card {
  background: var(--bg-white);
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary-color);
  transition: all 0.2s;
}

.module-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.module-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

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

/* 类列表 */
.class-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.class-card {
  background: var(--bg-white);
  padding: 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}

.class-icon {
  width: 48px;
  height: 48px;
  background: var(--secondary-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.class-info h4 {
  font-size: 16px;
  margin-bottom: 4px;
}

.class-info span {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============================================
   文章详情页
   ============================================ */
.article-container {
  display: grid;
  grid-template-columns: 240px 1fr 240px;
  gap: 32px;
}

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

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

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

.sidebar-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--secondary-color);
  color: var(--primary-color);
}

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

.article-content h1 {
  font-size: 32px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.article-content h2 {
  font-size: 24px;
  margin: 32px 0 16px;
  color: var(--primary-color);
}

.article-content h3 {
  font-size: 20px;
  margin: 24px 0 12px;
}

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

.article-content ul {
  list-style: disc;
  margin: 16px 0;
  padding-left: 24px;
}

.article-content li {
  margin-bottom: 8px;
}

/* 代码块样式 */
.code-block {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 20px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  overflow-x: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 14px;
  line-height: 1.6;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

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

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

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

.param-table th {
  background: var(--bg-gray);
  font-weight: 600;
  font-size: 14px;
}

.param-table td {
  font-size: 14px;
}

.param-table code {
  background: var(--secondary-color);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  color: var(--primary-color);
}

/* 右侧目录 */
.toc {
  position: sticky;
  top: 88px;
  height: fit-content;
}

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

.toc ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 0;
  list-style: none;
}

.toc a {
  display: block;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  padding-left: 12px;
}

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

/* ============================================
   推荐文章区域
   ============================================ */
.recommended {
  margin-top: 40px;
}

.recommended-header {
  margin-bottom: 20px;
}

.recommended-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.recommended-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

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

.tag:hover {
  background: var(--primary-color);
  color: var(--text-light);
  border-color: var(--primary-color);
}

/* ============================================
   页脚 Footer
   ============================================ */
.footer {
  background: var(--text-primary);
  color: var(--text-light);
  padding: 48px 24px 24px;
  margin-top: 60px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

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

.footer-brand h3 {
  font-size: 20px;
  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;
  font-weight: 600;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

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

.footer-column a:hover {
  color: var(--text-light);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  text-align: center;
  font-size: 14px;
  color: rgba(255,255,255,0.5);
}

/* ============================================
   404 页面
   ============================================ */
.error-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
}

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

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

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

.btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--primary-color);
  color: var(--text-light);
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all 0.2s;
}

.btn:hover {
  background: var(--primary-dark);
  color: var(--text-light);
  transform: translateY(-2px);
}

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

  .sidebar-left,
  .toc {
    display: none;
  }

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

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

  .nav {
    display: none;
  }

  .search-box {
    display: none;
  }

  .hero {
    padding: 40px 24px;
  }

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

  .quick-links {
    grid-template-columns: 1fr;
  }

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

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

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

  .code-block {
    overflow-x: auto;
    white-space: pre;
  }
}

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

  .section {
    padding: 20px;
  }

  .article-content {
    padding: 24px;
  }

  .article-content h1 {
    font-size: 24px;
  }
}
