/* ============================================================
   CIMPro API Documentation Center
   Design system inspired by Element UI docs
   ============================================================ */

:root {
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue',
    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', Menlo, Monaco, Consolas, 'Courier New', monospace;

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --content-max-width: 1000px;
  --radius: 4px;
  --radius-sm: 3px;

  /* Spacing (8px-based) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;

  /* Light theme - Element-inspired cool palette */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafc;
  --bg-tertiary: #f5f7fa;
  --bg-code: #fafafa;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f5f7fa;
  --bg-active: #ecf5ff;

  --text-primary: #1f2d3d;
  --text-secondary: #5e6d82;
  --text-tertiary: #8492a6;
  --text-link: #409eff;
  --text-link-hover: #66b1ff;
  --text-code: #1f2d3d;

  --border-primary: #eaeefb;
  --border-secondary: #dcdfe6;
  --border-light: #ebeef5;

  --accent: #409eff;
  --accent-light: #ecf5ff;
  --accent-dark: #3a8ee6;
  --success: #67c23a;
  --warning: #e6a23c;
  --danger: #f56c6c;
  --info: #909399;

  /* Tip / warning boxes */
  --tip-bg: #ecf8ff;
  --tip-border: #50bfff;
  --warn-bg: #fff6f7;
  --warn-border: #fe6c6f;

  /* Shadows - subtle */
  --shadow-sm: 0 0 6px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 0 8px 0 rgba(232, 237, 250, 0.6), 0 2px 4px 0 rgba(232, 237, 250, 0.5);
  --shadow-lg: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --bg-code: #161b29;
  --bg-sidebar: #1a1a2e;
  --bg-card: #1e293b;
  --bg-hover: #1e293b;
  --bg-active: #1e3a5f;

  --text-primary: #e8e8e8;
  --text-secondary: #a0aec0;
  --text-tertiary: #718096;
  --text-link: #409eff;
  --text-link-hover: #66b1ff;
  --text-code: #e8e8e8;

  --border-primary: #2d3748;
  --border-secondary: #4a5568;
  --border-light: #2a3441;

  --accent: #409eff;
  --accent-light: #1a3a5f;
  --accent-dark: #66b1ff;

  --tip-bg: #1a2a3a;
  --tip-border: #409eff;
  --warn-bg: #3a1a1a;
  --warn-border: #f56c6c;

  --shadow-sm: 0 0 6px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 0 8px 0 rgba(0, 0, 0, 0.3), 0 2px 4px 0 rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 2px 12px 0 rgba(0, 0, 0, 0.4);
}

/* ============================================================
   Reset & Base
   ============================================================ */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--text-link);
  text-decoration: none;
}

a:hover {
  color: var(--text-link-hover);
}

/* ============================================================
   App Layout
   ============================================================ */

.app {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   Sidebar - Clean, text-driven (Element style)
   ============================================================ */

.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 20px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  object-fit: contain;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.logo-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.logo-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.sidebar-close:hover {
  background: var(--bg-hover);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 2px;
}

/* Nav sections */
.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  padding: 10px 20px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

/* Simple nav links - text-driven, no left border */
.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 20px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--text-link);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--text-link);
  font-weight: 600;
}

.nav-link-count {
  font-size: 12px;
  padding: 1px 8px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.nav-link.active .nav-link-count {
  background: var(--accent);
  color: white;
}

/* Collapsible groups */
.nav-group {
  margin-bottom: 0;
}

.nav-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 20px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-group-toggle:hover {
  color: var(--text-link);
  background: var(--bg-hover);
}

.nav-group-toggle.active {
  color: var(--text-link);
  font-weight: 600;
}

.nav-group-arrow {
  transition: transform 0.2s ease;
  color: var(--text-tertiary);
}

.nav-group.expanded .nav-group-arrow {
  transform: rotate(90deg);
}

.nav-group-items {
  display: none;
}

.nav-group.expanded .nav-group-items {
  display: block;
}

.nav-sub-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  line-height: 36px;
  padding: 0 20px 0 36px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-sub-link:hover {
  color: var(--text-link);
  background: var(--bg-hover);
}

.nav-sub-link.active {
  color: var(--text-link);
  font-weight: 600;
}

.nav-sub-link-count {
  flex-shrink: 0;
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--bg-hover);
  padding: 0 6px;
  border-radius: 8px;
  line-height: 18px;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.version-badge {
  padding: 2px 8px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 10px;
  font-weight: 600;
}

/* ============================================================
   Main Content Wrapper
   ============================================================ */

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   Top Bar - Slim and functional
   ============================================================ */

.topbar {
  height: var(--topbar-height);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.menu-toggle:hover {
  background: var(--bg-hover);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--text-link);
}

.breadcrumbs .sep {
  color: var(--text-tertiary);
  font-size: 12px;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-tertiary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  height: 32px;
}

.search-trigger:hover {
  border-color: var(--accent);
}

.search-trigger kbd {
  padding: 1px 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}

.topbar-link {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.topbar-link:hover {
  color: var(--text-link);
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--bg-hover);
}

.theme-toggle .moon-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: block;
}

/* ============================================================
   Search Overlay
   ============================================================ */

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}

.search-overlay[hidden] {
  display: none;
}

.search-container {
  width: 100%;
  max-width: 600px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-tertiary);
}

.search-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  font-family: var(--font-sans);
}

.search-input-wrapper input::placeholder {
  color: var(--text-tertiary);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
}

.search-result-item {
  display: block;
  padding: 12px 18px;
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.2s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
  background: var(--bg-hover);
}

.search-result-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.search-result-desc {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Content Area
   ============================================================ */

.content {
  flex: 1;
  display: flex;
  justify-content: center;
}

.content-body {
  width: 100%;
  max-width: var(--content-max-width);
  padding: 32px 40px 80px;
}

/* ============================================================
   Markdown Typography
   ============================================================ */

.markdown-body {
  color: var(--text-primary);
}

.markdown-body > *:first-child {
  margin-top: 0;
}

.markdown-body h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 16px;
  line-height: 1.4;
  color: var(--text-primary);
}

.markdown-body h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  line-height: 1.5;
  color: var(--text-primary);
}

.markdown-body h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 12px;
  line-height: 1.5;
  color: var(--text-primary);
}

.markdown-body h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 10px;
  color: var(--text-primary);
}

.markdown-body p {
  margin: 0 0 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 14px;
  padding-left: 24px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.markdown-body li {
  margin: 4px 0;
}

/* Tip / Warning blocks - Element style */
.markdown-body blockquote {
  margin: 16px 0;
  padding: 8px 16px;
  background: var(--tip-bg);
  border-left: 4px solid var(--tip-border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.markdown-body blockquote p:last-child {
  margin-bottom: 0;
}

.markdown-body blockquote p {
  margin: 4px 0;
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 32px 0;
}

/* Tables - Element style */
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 20px;
  font-size: 13px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.markdown-body th,
.markdown-body td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.markdown-body th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}

.markdown-body tr:last-child td {
  border-bottom: none;
}

.markdown-body tr:hover td {
  background: var(--bg-hover);
}

/* Inline code - Element style */
.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

/* Code blocks - Element style */
.markdown-body pre {
  position: relative;
  background: var(--bg-code);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 0 0 20px;
  overflow-x: auto;
}

.markdown-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-primary);
}

/* Code block with header */
.code-block-wrapper {
  margin-bottom: 20px;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-bottom: -1px;
}

.code-block-lang {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.code-copy-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.code-copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text-link);
}

.code-copy-btn.copied {
  color: var(--success);
}

/* Make pre inside code-block-wrapper have no top border-radius */
.code-block-wrapper pre {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  margin-bottom: 0;
}

/* ============================================================
   Home Page
   ============================================================ */

.home-hero {
  text-align: center;
  padding: 48px 0 40px;
}

.home-hero h1 {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text-primary);
}

.home-hero p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 28px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: white;
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-secondary);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 32px 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-md);
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 40px 0 16px;
}

.section-header h2 {
  margin: 0;
  border: none;
  padding: 0;
  font-size: 20px;
  font-weight: 600;
}

.section-header a {
  font-size: 14px;
  font-weight: 500;
}

/* Module cards */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.module-card {
  display: block;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.2s;
}

.module-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.module-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.module-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.module-card-count {
  font-size: 12px;
  padding: 1px 8px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  color: var(--text-tertiary);
  font-weight: 600;
}

.module-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Guide cards */
.guides-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.guide-card {
  display: block;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.2s;
}

.guide-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.guide-card-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 18px;
}

.guide-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.guide-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================================
   API Page
   ============================================================ */

.api-page-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.api-page-header h1 {
  margin-bottom: 8px;
}

.api-page-meta {
  display: flex;
  gap: 16px;
  color: var(--text-tertiary);
  font-size: 13px;
  margin-top: 8px;
}

.api-page-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* API cards */
.api-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.api-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  scroll-margin-top: 76px;
  transition: box-shadow 0.2s;
}

.api-card:hover {
  box-shadow: var(--shadow-sm);
}

.api-card-header {
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.api-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.api-card-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.api-card-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.api-card-anchor {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}

.api-card:hover .api-card-anchor {
  opacity: 1;
}

.api-card-body {
  padding: 16px 20px;
}

.api-card-body .markdown-body h4 {
  margin-top: 0;
}

/* ============================================================
   Table of Contents (Right Sidebar)
   ============================================================ */

.toc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.toc-card h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin: 0;
}

.toc-list a {
  display: block;
  padding: 4px 0 4px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
  margin-left: -12px;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-list a:hover {
  color: var(--text-link);
}

.toc-list a.active {
  color: var(--text-link);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* ============================================================
   Page Layout with TOC
   ============================================================ */

.page-with-toc {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 32px;
  align-items: start;
}

.page-with-toc .page-main {
  min-width: 0;
}

.page-with-toc .page-sidebar {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
}

.page-with-toc .page-sidebar::-webkit-scrollbar {
  width: 4px;
}

.page-with-toc .page-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 2px;
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  border-top: 1px solid var(--border-light);
  padding: 24px 40px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1024px) {
  .page-with-toc {
    grid-template-columns: 1fr;
  }

  .page-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 240px;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .search-trigger span,
  .search-trigger kbd,
  .topbar-link span {
    display: none;
  }

  .content-body {
    padding: 24px 20px 60px;
  }

  .home-hero h1 {
    font-size: 28px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modules-grid,
  .guides-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }
}

/* ============================================================
   Utilities
   ============================================================ */

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mb-0 {
  margin-bottom: 0 !important;
}
