/* ================================================================
   QA Performance Testing Knowledge Base — Enterprise Edition
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ----------------------------------------------------------------
   CSS Variables
   ---------------------------------------------------------------- */
:root {
  --sidebar-width: 268px;
  --header-height: 60px;

  /* Brand */
  --primary:        #0f2547;
  --primary-dark:   #08172e;
  --primary-mid:    #1a3a6b;
  --primary-light:  #234e9a;
  --accent:         #3b82f6;
  --accent-dark:    #2563eb;
  --accent-light:   #60a5fa;
  --accent-glow:    rgba(59,130,246,0.18);

  /* Semantic */
  --success:        #10b981;
  --success-light:  #d1fae5;
  --success-dark:   #065f46;
  --warning:        #f59e0b;
  --warning-light:  #fef3c7;
  --warning-dark:   #92400e;
  --danger:         #ef4444;
  --danger-light:   #fee2e2;
  --danger-dark:    #7f1d1d;
  --info:           #06b6d4;
  --info-light:     #cffafe;
  --info-dark:      #164e63;
  --purple:         #8b5cf6;
  --purple-light:   #ede9fe;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #f8fafc;

  /* Backgrounds */
  --bg:             #f1f5f9;
  --bg-card:        #ffffff;
  --bg-sidebar:     #08172e;
  --bg-sidebar-mid: #0f2547;
  --bg-code:        #1e293b;
  --bg-hover:       #f8fafc;

  /* Borders */
  --border:         #e2e8f0;
  --border-mid:     #cbd5e1;
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);
  --shadow-accent: 0 4px 14px rgba(59,130,246,0.25);

  /* Transitions */
  --t-fast: 0.15s ease;
  --t:      0.2s ease;
  --t-slow: 0.35s ease;
}

/* ----------------------------------------------------------------
   Reset & Base
   ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent-dark); }

img { max-width: 100%; }

ul, ol { list-style: none; }

/* ----------------------------------------------------------------
   Layout — Sidebar + Main
   ---------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--t-slow);
  overflow: hidden;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-track { background: transparent; }
.sidebar-inner::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----------------------------------------------------------------
   Sidebar — Brand
   ---------------------------------------------------------------- */
.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-accent);
  flex-shrink: 0;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-version {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-light);
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.25);
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 8px;
}

/* ----------------------------------------------------------------
   Sidebar — Search
   ---------------------------------------------------------------- */
.sidebar-search {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  outline: none;
  font-family: inherit;
  transition: border-color var(--t);
}

.search-box input::placeholder { color: rgba(255,255,255,0.3); }
.search-box input:focus { border-color: rgba(59,130,246,0.5); background: rgba(255,255,255,0.1); }

.search-icon {
  position: absolute;
  left: 10px;
  color: rgba(255,255,255,0.3);
  font-size: 14px;
  pointer-events: none;
}

/* ----------------------------------------------------------------
   Sidebar — Navigation
   ---------------------------------------------------------------- */
.sidebar-nav { flex: 1; padding: 10px 0; }

.nav-section { margin-bottom: 4px; }

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.28);
  padding: 8px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all var(--t-fast);
  border-left: 3px solid transparent;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
  border-left-color: rgba(255,255,255,0.2);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(59,130,246,0.18), transparent);
  color: #ffffff;
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-item.active .nav-icon { color: var(--accent-light); }

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  background: rgba(59,130,246,0.25);
  color: var(--accent-light);
  padding: 1px 7px;
  border-radius: 20px;
}

.nav-badge.new {
  background: rgba(16,185,129,0.2);
  color: #6ee7b7;
}

/* ----------------------------------------------------------------
   Sidebar — Footer
   ---------------------------------------------------------------- */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.sidebar-footer-info {
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  text-align: center;
  line-height: 1.5;
}

/* ----------------------------------------------------------------
   Top Header
   ---------------------------------------------------------------- */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(241,245,249,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.breadcrumb-item { color: var(--text-muted); }
.breadcrumb-sep  { color: var(--border-mid); }
.breadcrumb-item.current { color: var(--text-primary); font-weight: 600; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--success-light);
  color: var(--success-dark);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-secondary);
  font-size: 20px;
}

/* ----------------------------------------------------------------
   Page Content
   ---------------------------------------------------------------- */
.page-content {
  flex: 1;
  padding: 32px;
  width: 100%;
}

/* ----------------------------------------------------------------
   Hero Section (index)
   ---------------------------------------------------------------- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 50%, var(--primary-light) 100%);
  border-radius: var(--radius-xl);
  padding: 56px 48px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(59,130,246,0.25) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -80px; left: 20%;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(139,92,246,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
  background: rgba(59,130,246,0.18);
  border: 1px solid rgba(59,130,246,0.3);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.hero-title {
  font-size: 42px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  margin-bottom: 16px;
  max-width: 600px;
  position: relative;
  z-index: 1;
}

.hero-title span {
  background: linear-gradient(135deg, var(--accent-light), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 16px;
  color: rgba(255,255,255,0.7);
  max-width: 520px;
  line-height: 1.7;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

/* ----------------------------------------------------------------
   Stats Row
   ---------------------------------------------------------------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--accent-light);
}

.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #eff6ff; }
.stat-icon.green  { background: #ecfdf5; }
.stat-icon.amber  { background: #fffbeb; }
.stat-icon.purple { background: #f5f3ff; }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
}

/* ----------------------------------------------------------------
   Section Header
   ---------------------------------------------------------------- */
.section-header {
  margin-bottom: 20px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--border), transparent);
  margin-left: 4px;
}

.section-desc {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------------
   Topic Cards Grid
   ---------------------------------------------------------------- */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.topic-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--accent));
  opacity: 0;
  transition: opacity var(--t);
}

.topic-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--accent-light);
}

.topic-card:hover::before { opacity: 1; }
.topic-card:hover .topic-arrow { transform: translateX(4px); opacity: 1; }

.topic-icon-wrap {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}

.topic-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.topic-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}

.topic-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topic-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.topic-arrow {
  color: var(--accent);
  font-size: 18px;
  transition: all var(--t);
  opacity: 0;
}

/* ----------------------------------------------------------------
   Page Hero (inner pages)
   ---------------------------------------------------------------- */
.page-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  border-radius: var(--radius-xl);
  padding: 40px 40px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(59,130,246,0.2) 0%, transparent 70%);
}

.page-hero-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.page-hero-title {
  font-size: 30px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.page-hero-desc {
  font-size: 15px;
  color: rgba(255,255,255,0.68);
  max-width: 560px;
  line-height: 1.65;
  position: relative;
  z-index: 1;
}

/* ----------------------------------------------------------------
   Cards
   ---------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 24px; }

/* ----------------------------------------------------------------
   Info Boxes
   ---------------------------------------------------------------- */
.info-box {
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}

.info-box-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }

.info-box-body .info-box-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.info-box-body p {
  font-size: 13.5px;
  line-height: 1.6;
}

.info-box.info    { background: var(--info-light);    border-color: rgba(6,182,212,0.3);   color: var(--info-dark);    }
.info-box.success { background: var(--success-light); border-color: rgba(16,185,129,0.3);  color: var(--success-dark); }
.info-box.warning { background: var(--warning-light); border-color: rgba(245,158,11,0.3);  color: var(--warning-dark); }
.info-box.danger  { background: var(--danger-light);  border-color: rgba(239,68,68,0.3);   color: var(--danger-dark);  }
.info-box.purple  { background: var(--purple-light);  border-color: rgba(139,92,246,0.3);  color: #4c1d95; }

/* ----------------------------------------------------------------
   Badges
   ---------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-blue   { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-green  { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-amber  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-red    { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.badge-purple { background: #f5f3ff; color: #4c1d95; border: 1px solid #ddd6fe; }
.badge-gray   { background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }
.badge-cyan   { background: #ecfeff; color: #164e63; border: 1px solid #a5f3fc; }

/* ----------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--t-fast);
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  background: var(--accent-dark);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59,130,246,0.4);
}

.btn-outline {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.25);
}

.btn-outline:hover {
  background: rgba(255,255,255,0.18);
  color: #ffffff;
}

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

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text-primary);
}

.btn-sm { padding: 6px 14px; font-size: 12.5px; }

/* ----------------------------------------------------------------
   Tables
   ---------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead {
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
}

thead th {
  padding: 14px 18px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
}

thead th:first-child { border-radius: 0; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

tbody td {
  padding: 13px 18px;
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody td strong { color: var(--text-primary); }

tbody tr td:first-child {
  font-weight: 600;
  color: var(--text-primary);
}

.check  { color: var(--success); font-size: 16px; }
.cross  { color: var(--danger);  font-size: 16px; }
.partial{ color: var(--warning); font-size: 16px; }

/* ----------------------------------------------------------------
   Code Blocks
   ---------------------------------------------------------------- */
.code-wrap {
  position: relative;
  margin: 20px 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.code-header {
  background: #1a2942;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.code-lang {
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.code-dots {
  display: flex;
  gap: 6px;
}

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

.code-dots span:nth-child(1) { background: #ff5f57; }
.code-dots span:nth-child(2) { background: #febc2e; }
.code-dots span:nth-child(3) { background: #28c840; }

.copy-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: inherit;
}

.copy-btn:hover {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
}

.copy-btn.copied { color: #6ee7b7; border-color: rgba(16,185,129,0.4); }

pre {
  background: var(--bg-code);
  padding: 20px 20px;
  overflow-x: auto;
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

pre::-webkit-scrollbar { height: 4px; }
pre::-webkit-scrollbar-track { background: transparent; }
pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.7;
  color: #e2e8f0;
}

/* Syntax highlight classes */
.kw  { color: #7dd3fc; }  /* keyword */
.fn  { color: #c4b5fd; }  /* function */
.str { color: #86efac; }  /* string */
.num { color: #fda4af; }  /* number */
.cmt { color: #64748b; font-style: italic; }  /* comment */
.var { color: #fde68a; }  /* variable */
.op  { color: #94a3b8; }  /* operator */

/* Inline code */
:not(pre) > code {
  background: #f1f5f9;
  color: var(--accent-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  border: 1px solid #e2e8f0;
}

/* ----------------------------------------------------------------
   Concept Cards
   ---------------------------------------------------------------- */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.concept-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
  position: relative;
  overflow: hidden;
}

.concept-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--card-color, var(--accent));
}

.concept-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.concept-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.concept-icon {
  font-size: 30px;
  flex-shrink: 0;
}

.concept-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.concept-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.concept-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  padding-left: 0;
}

.concept-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

/* ----------------------------------------------------------------
   Tool Cards
   ---------------------------------------------------------------- */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
  margin-bottom: 20px;
}

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

.tool-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tool-logo {
  width: 56px; height: 56px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.tool-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.tool-tagline {
  font-size: 13px;
  color: var(--text-secondary);
}

.tool-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.pros, .cons {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
}

.pros-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--success);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cons-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--danger);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pros li, .cons li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 3px 0;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.pros li::before { content: '✓'; color: var(--success); font-weight: 700; flex-shrink: 0; }
.cons li::before { content: '✗'; color: var(--danger);  font-weight: 700; flex-shrink: 0; }

/* ----------------------------------------------------------------
   Metric Cards
   ---------------------------------------------------------------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.metric-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.metric-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.metric-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 14px;
}

.metric-threshold {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  border: 1px solid var(--border);
}

.threshold-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.threshold-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  font-size: 12px;
}

.threshold-label { color: var(--text-secondary); }
.threshold-value { font-weight: 600; }
.t-good   { color: var(--success); }
.t-warn   { color: var(--warning); }
.t-bad    { color: var(--danger);  }

/* ----------------------------------------------------------------
   Process Steps
   ---------------------------------------------------------------- */
.process-steps {
  position: relative;
  padding-left: 32px;
  margin-bottom: 28px;
}

.process-steps::before {
  content: '';
  position: absolute;
  left: 14px; top: 20px; bottom: 20px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--purple));
}

.process-step {
  position: relative;
  margin-bottom: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 22px 28px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
}

.process-step:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-light);
}

.step-num {
  position: absolute;
  left: -32px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent-light);
}

.step-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.step-checklist {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.step-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.step-checklist li::before {
  content: '☐';
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}

/* ----------------------------------------------------------------
   Glossary
   ---------------------------------------------------------------- */
.glossary-alpha {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 28px;
}

.alpha-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  text-decoration: none;
}

.alpha-btn:hover, .alpha-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.glossary-section { margin-bottom: 24px; }

.glossary-letter {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(59,130,246,0.2);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}

.glossary-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 8px;
  transition: all var(--t-fast);
}

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

.glossary-term {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.glossary-def {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ----------------------------------------------------------------
   Utility
   ---------------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

.mb-4  { margin-bottom: 4px;  }
.mb-8  { margin-bottom: 8px;  }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-28 { margin-bottom: 28px; }
.mt-20 { margin-top: 20px;    }
.mt-28 { margin-top: 28px;    }

.text-sm { font-size: 13px;   }
.text-xs { font-size: 11.5px; }

.font-bold  { font-weight: 700; }
.font-semib { font-weight: 600; }

.text-muted  { color: var(--text-muted);     }
.text-second { color: var(--text-secondary); }
.text-accent { color: var(--accent);         }
.text-success{ color: var(--success);        }
.text-danger { color: var(--danger);         }
.text-warning{ color: var(--warning);        }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

/* ----------------------------------------------------------------
   Footer
   ---------------------------------------------------------------- */
.page-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: auto;
  flex-shrink: 0;
}

.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }

/* ----------------------------------------------------------------
   Sidebar Overlay (mobile)
   ---------------------------------------------------------------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ----------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------- */
@media (max-width: 1100px) {
  .topics-grid  { grid-template-columns: repeat(2,1fr); }
  .metrics-grid { grid-template-columns: repeat(2,1fr); }
  .concept-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .stats-row    { grid-template-columns: repeat(2,1fr); }
  .pros-cons    { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open { display: block; }

  .main-content {
    margin-left: 0;
    min-width: 0;
    overflow-x: hidden;
  }

  .mobile-menu-btn { display: flex; }

  .page-content { padding: 20px 16px; }
  .page-header  { padding: 0 12px; gap: 8px; }

  .header-actions { display: none; }

  .hero { padding: 28px 20px; }
  .hero-title { font-size: 26px; }
  .hero-desc  { font-size: 14px; }
  .hero-actions { flex-wrap: wrap; gap: 10px; }
  .hero-actions .btn { width: 100%; text-align: center; }

  .topics-grid  { grid-template-columns: 1fr; }
  .stats-row    { grid-template-columns: repeat(2,1fr); }
  .metrics-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .topic-desc, .page-hero-desc {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .code-wrap  { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .page-footer { flex-direction: column; gap: 8px; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }
}


/* ----------------------------------------------------------------
   Animations
   ---------------------------------------------------------------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.3); opacity: 0.7; }
}

.fade-in     { animation: fadeInUp 0.5s ease both; }
.fade-in-d1  { animation: fadeInUp 0.5s 0.08s ease both; }
.fade-in-d2  { animation: fadeInUp 0.5s 0.16s ease both; }
.fade-in-d3  { animation: fadeInUp 0.5s 0.24s ease both; }
.fade-in-d4  { animation: fadeInUp 0.5s 0.32s ease both; }
.fade-in-d5  { animation: fadeInUp 0.5s 0.40s ease both; }

/* ----------------------------------------------------------------
   Search highlight
   ---------------------------------------------------------------- */
.highlight { background: #fef3c7; border-radius: 2px; }

/* ----------------------------------------------------------------
   Scroll progress bar (injected by JS)
   ---------------------------------------------------------------- */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  z-index: 9999;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  width: 0;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ----------------------------------------------------------------
   Tooltip (injected by JS)
   ---------------------------------------------------------------- */
.tooltip-text {
  position: absolute;
  background: #0f172a;
  color: #f8fafc;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9000;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  opacity: 0;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.tooltip-text.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ================================================================
   Dark Mode
   ================================================================ */
html[data-theme="dark"] {
  --bg:             #0f172a;
  --bg-card:        #1e293b;
  --bg-hover:       #1e293b;
  --bg-code:        #0f172a;
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --border:         #1e293b;
  --border-mid:     #334155;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
  --success-light:  rgba(16,185,129,0.15);
  --success-dark:   #6ee7b7;
  --warning-light:  rgba(245,158,11,0.15);
  --warning-dark:   #fcd34d;
  --danger-light:   rgba(239,68,68,0.15);
  --danger-dark:    #fca5a5;
  --info-light:     rgba(6,182,212,0.15);
  --info-dark:      #67e8f9;
  --purple-light:   rgba(139,92,246,0.15);
}

html[data-theme="dark"] .page-header {
  background: rgba(15,23,42,0.92);
  border-color: #1e293b;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .topic-card,
html[data-theme="dark"] .tool-card,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .concept-card,
html[data-theme="dark"] .process-step,
html[data-theme="dark"] .stat-card {
  background: var(--bg-card);
  border-color: var(--border-mid);
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .tool-header {
  border-color: var(--border-mid);
}

html[data-theme="dark"] table thead tr {
  background: #1e293b;
}

html[data-theme="dark"] table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}

html[data-theme="dark"] table tbody tr:hover {
  background: rgba(255,255,255,0.04);
}

html[data-theme="dark"] .hero,
html[data-theme="dark"] .page-hero {
  background: linear-gradient(135deg, #0f2547 0%, #1a3a6b 100%);
}

html[data-theme="dark"] .info-box {
  background: var(--bg-card);
  border-color: var(--border-mid);
}

html[data-theme="dark"] .highlight { background: rgba(254,243,199,0.15); }

html[data-theme="dark"] .search-box {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
}

html[data-theme="dark"] .search-box input { color: var(--text-primary); }
html[data-theme="dark"] .search-box input::placeholder { color: var(--text-muted); }

html[data-theme="dark"] .page-footer {
  background: #1e293b;
  border-color: #334155;
}

/* ================================================================
   Header Controls (Theme + Lang + Counter)
   ================================================================ */
.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-mid);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.ctrl-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.ctrl-btn.lang-btn { letter-spacing: 0.5px; }

.ctrl-btn.theme-btn { font-size: 14px; padding: 5px 8px; }

.visit-display {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-mid);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
}

.visit-display .visit-num {
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}

@media (max-width: 768px) {
  .header-controls { gap: 6px; }
  .ctrl-btn { padding: 4px 8px; font-size: 11px; }
  .visit-display { display: none; }
}
