/**
 * 教程页面共享样式 - 深色主题
 * 与设计系统保持一致
 */

/* ========== 教程页面布局 ========== */
.tutorial-page {
  padding-top: var(--header-height);
  min-height: 100vh;
}

/* 教程头部 Hero */
.tutorial-hero {
  position: relative;
  padding: var(--space-20) 0 var(--space-12);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
}

.tutorial-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-mesh);
  pointer-events: none;
}

.tutorial-hero-content {
  position: relative;
  z-index: 1;
}

.tutorial-hero .section-tag {
  margin-bottom: var(--space-4);
}

.tutorial-hero h1 {
  font-size: var(--text-4xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
  background: linear-gradient(135deg, #fff 0%, var(--brand-300) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tutorial-hero .hero-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
}

.tutorial-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.tutorial-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.tutorial-meta-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* ========== 教程主体布局 ========== */
.tutorial-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-10);
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: var(--space-10) var(--space-6);
}

/* 侧边目录 */
.toc-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-6));
  height: fit-content;
  max-height: calc(100vh - var(--header-height) - var(--space-12));
  overflow-y: auto;
  padding: var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
}

.toc-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

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

.toc-list li {
  margin-bottom: var(--space-1);
}

.toc-list a {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-decoration: none;
  border-radius: var(--radius-md);
  border-left: 2px solid transparent;
  transition: all var(--duration-fast) var(--ease-out);
}

.toc-list a:hover {
  color: var(--text-secondary);
  background: var(--bg-subtle);
}

.toc-list a.active {
  color: var(--brand-300);
  background: rgba(99, 102, 241, 0.1);
  border-left-color: var(--brand-500);
}

.toc-list .toc-h2 { padding-left: var(--space-3); }
.toc-list .toc-h3 { 
  padding-left: var(--space-6); 
  font-size: var(--text-xs);
}

/* ========== 教程内容区 ========== */
.tutorial-content {
  max-width: 800px;
}

.tutorial-content h2 {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: var(--space-10) 0 var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.tutorial-content h2:first-child {
  margin-top: 0;
}

.tutorial-content h3 {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: var(--space-8) 0 var(--space-4);
}

.tutorial-content h4 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: var(--space-6) 0 var(--space-3);
}

.tutorial-content p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
}

.tutorial-content ul,
.tutorial-content ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
  color: var(--text-secondary);
}

.tutorial-content li {
  margin-bottom: var(--space-2);
  line-height: var(--leading-relaxed);
}

.tutorial-content a {
  color: var(--brand-300);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tutorial-content a:hover {
  color: var(--brand-200);
}

/* ========== 代码块 ========== */
.tutorial-content code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  color: var(--brand-300);
}

.tutorial-content pre {
  position: relative;
  margin: var(--space-6) 0;
  padding: var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.tutorial-content pre code {
  padding: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.7;
}

/* 代码块头部 */
.code-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-4);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

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

.code-dot.red { background: #ef4444; }
.code-dot.yellow { background: #f59e0b; }
.code-dot.green { background: #10b981; }

.code-lang {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ========== 信息框 ========== */
.info-box {
  padding: var(--space-5);
  margin: var(--space-6) 0;
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--brand-500);
  background: rgba(99, 102, 241, 0.1);
}

.info-box.warning {
  border-left-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.1);
}

.info-box.tip {
  border-left-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
}

.info-box-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

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

/* ========== 步骤框 ========== */
.step-box {
  position: relative;
  padding: var(--space-6);
  margin: var(--space-6) 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
}

.step-number {
  position: absolute;
  top: calc(var(--space-4) * -1);
  left: var(--space-6);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-brand);
  color: white;
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: var(--radius-full);
}

/* ========== 前置条件卡片 ========== */
.prerequisite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin: var(--space-6) 0;
}

.prerequisite-card {
  padding: var(--space-5);
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.prerequisite-icon {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-3);
}

.prerequisite-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.prerequisite-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ========== 导航按钮 ========== */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-width: 45%;
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out);
}

.nav-btn:hover {
  border-color: var(--border-brand);
  background: var(--bg-overlay);
}

.nav-btn.next {
  text-align: right;
  margin-left: auto;
}

.nav-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-title {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
}

/* ========== 目录切换按钮 (移动端) ========== */
.toc-toggle {
  display: none;
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  background: var(--brand-500);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 100;
}

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

  .toc-sidebar {
    display: none;
  }

  .toc-sidebar.active {
    display: block;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    max-height: none;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    z-index: 200;
  }

  .toc-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .tutorial-hero {
    padding: var(--space-16) 0 var(--space-10);
  }

  .tutorial-hero h1 {
    font-size: var(--text-3xl);
  }

  .tutorial-content {
    padding: 0 var(--space-2);
  }

  .tutorial-content h2 {
    font-size: var(--text-xl);
  }

  .tutorial-content h3 {
    font-size: var(--text-lg);
  }

  .nav-buttons {
    flex-direction: column;
    gap: var(--space-3);
  }

  .nav-btn {
    max-width: 100%;
  }

  .nav-btn.next {
    text-align: left;
  }
}
