/* ============================================================
   CodeSleuth AI Docs — styles.css
   ============================================================ */

/* Google Fonts loaded via HTML <link> */

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

  /* Colors */
  --color-bg: #ffffff;
  --color-sidebar-bg: #111827;
  --color-sidebar-border: #1f2937;
  --color-sidebar-text: #9ca3af;
  --color-sidebar-text-hover: #f3f4f6;
  --color-sidebar-active-bg: rgba(59, 130, 246, 0.12);
  --color-sidebar-active-text: #60a5fa;
  --color-sidebar-active-border: #3b82f6;
  --color-sidebar-group: #4b5563;
  --color-header-bg: #ffffff;
  --color-header-border: #e5e7eb;
  --color-text: #111827;
  --color-text-secondary: #6b7280;
  --color-text-muted: #9ca3af;
  --color-accent: #3b82f6;
  --color-accent-dark: #2563eb;
  --color-accent-light: #eff6ff;
  --color-border: #e5e7eb;
  --color-code-bg: #f3f4f6;
  --color-code-text: #e11d48;
  --color-pre-bg: #1e2030;
  --color-pre-text: #cdd6f4;
  --color-table-header: #f9fafb;
  --color-table-hover: #f3f4f6;
  --color-card-border: #e5e7eb;
  --color-card-hover-border: #3b82f6;

  /* Callout colors */
  --color-info-bg: #eff6ff;
  --color-info-border: #3b82f6;
  --color-info-text: #1e40af;
  --color-warning-bg: #fffbeb;
  --color-warning-border: #f59e0b;
  --color-warning-text: #92400e;
  --color-danger-bg: #fff1f2;
  --color-danger-border: #f43f5e;
  --color-danger-text: #9f1239;
  --color-success-bg: #f0fdf4;
  --color-success-border: #22c55e;
  --color-success-text: #14532d;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Spacing */
  --content-max-width: 860px;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
}

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

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

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── Layout ────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-header-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 1000;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.main-layout {
  display: flex;
  padding-top: var(--header-height);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 900;
  padding: 20px 0 40px;
}

.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  background: var(--color-bg);
}

.content-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* ── Sidebar Scrollbar ─────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #374151; border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #4b5563; }

/* ── Header Internal ───────────────────────────────────────── */
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  width: calc(var(--sidebar-width) - 24px);
}

.logo-box {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.header-logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
}

.header-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.header-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.header-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--color-text);
  background: #f9fafb;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.header-search input::placeholder { color: var(--color-text-muted); }

.header-search input:focus {
  border-color: var(--color-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.version-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Search Results Dropdown ───────────────────────────────── */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 2000;
  overflow: hidden;
  display: none;
}

.search-results.active { display: block; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.1s;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--color-accent-light); }

.search-result-title {
  font-size: 13.5px;
  font-weight: 500;
}

.search-result-section {
  font-size: 11.5px;
  color: var(--color-text-muted);
  margin-left: auto;
}

.search-no-results {
  padding: 16px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13.5px;
}

/* ── Sidebar Navigation ────────────────────────────────────── */
.nav-group {
  margin-bottom: 8px;
}

.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-sidebar-group);
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  font-size: 13.5px;
  color: var(--color-sidebar-text);
  text-decoration: none;
  border-right: 3px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--color-sidebar-text-hover);
}

.nav-item.active {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-active-text);
  border-right-color: var(--color-sidebar-active-border);
  font-weight: 500;
}

.nav-item-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* ── Typography ────────────────────────────────────────────── */
h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 16px;
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
  margin-top: 48px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 32px;
  margin-bottom: 8px;
}

h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 24px;
  margin-bottom: 6px;
}

p { margin-bottom: 16px; color: var(--color-text); line-height: 1.75; }

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

ul, ol { padding-left: 24px; margin-bottom: 16px; }
li { margin-bottom: 6px; line-height: 1.7; }
li::marker { color: var(--color-accent); }

strong { font-weight: 600; }
em { font-style: italic; }

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 40px 0;
}

/* ── Inline Code ───────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--color-code-bg);
  color: var(--color-code-text);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
}

/* ── Pre / Code Blocks ─────────────────────────────────────── */
pre {
  background: var(--color-pre-bg);
  color: var(--color-pre-text);
  border-radius: var(--radius);
  padding: 20px 24px;
  overflow-x: auto;
  margin-bottom: 24px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  border: 1px solid #2a2d3e;
  position: relative;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  border: none;
  font-size: inherit;
}

/* Syntax coloring hints */
.pre-label {
  position: absolute;
  top: 10px; right: 14px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: #565f89;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin-bottom: 24px; border-radius: var(--radius); border: 1px solid var(--color-border); }

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

th {
  background: var(--color-table-header);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  line-height: 1.5;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-table-hover); }

/* ── Callouts ──────────────────────────────────────────────── */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 4px solid;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.65;
}

.callout-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.callout-content { flex: 1; }
.callout-content p { margin-bottom: 0; color: inherit; }
.callout-title { font-weight: 600; margin-bottom: 4px; }

.callout-info {
  background: var(--color-info-bg);
  border-color: var(--color-info-border);
  color: var(--color-info-text);
}

.callout-warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: var(--color-warning-text);
}

.callout-danger {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  color: var(--color-danger-text);
}

.callout-success {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
}

/* ── Cards ─────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.card {
  display: block;
  padding: 22px;
  border: 1.5px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.card:hover {
  border-color: var(--color-card-hover-border);
  box-shadow: 0 4px 16px rgba(59,130,246,0.1);
  transform: translateY(-2px);
  text-decoration: none;
}

.card-icon {
  font-size: 26px;
  margin-bottom: 10px;
  display: block;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}

.card-desc {
  font-size: 13.5px;
  color: var(--color-text-secondary);
  line-height: 1.55;
}

/* ── Pipeline Diagram ──────────────────────────────────────── */
.pipeline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin: 32px 0;
  padding: 24px;
  background: #f9fafb;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  justify-content: center;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: default;
}

.pipeline-step-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
  transition: transform 0.2s;
}

.pipeline-step:hover .pipeline-step-circle { transform: scale(1.1); }

.pipeline-step-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
  white-space: nowrap;
}

.pipeline-step-num {
  font-size: 10px;
  color: var(--color-text-muted);
}

.pipeline-arrow {
  font-size: 18px;
  color: #d1d5db;
  margin: 0 6px;
  flex-shrink: 0;
  padding-bottom: 24px;
}

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

.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-gray { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }
.badge-purple { background: #ede9fe; color: #7c3aed; }

/* ── Command Display ───────────────────────────────────────── */
.cmd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  background: #1e2030;
  color: #7dd3fc;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid #2a2d3e;
  white-space: nowrap;
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 64px 24px 48px;
  max-width: 700px;
  margin: 0 auto 48px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, #111827 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  letter-spacing: -1px;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(59,130,246,0.3);
}

.btn-primary:hover {
  background: var(--color-accent-dark);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(59,130,246,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 28px;
}

.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-accent); }
.breadcrumb-sep { color: #d1d5db; }
.breadcrumb-current { color: var(--color-text-secondary); font-weight: 500; }

/* ── Doc Footer ────────────────────────────────────────────── */
.doc-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.doc-footer-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
  max-width: 280px;
  flex: 1;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.doc-footer-link:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px rgba(59,130,246,0.08);
  text-decoration: none;
}

.doc-footer-link.next { text-align: right; }

.doc-footer-dir {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.doc-footer-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--color-accent);
}

/* ── Numbered Steps ────────────────────────────────────────── */
.steps { list-style: none; padding: 0; counter-reset: step; margin-bottom: 32px; }

.step {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  counter-increment: step;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-body { flex: 1; }
.step-title { font-size: 15.5px; font-weight: 700; margin-bottom: 6px; }
.step-desc { color: var(--color-text-secondary); font-size: 14px; }

/* ── Section intro text ────────────────────────────────────── */
.lead {
  font-size: 1.05rem;
  color: var(--color-text-secondary);
  line-height: 1.75;
  margin-bottom: 32px;
}

/* ── Page header tag ───────────────────────────────────────── */
.page-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--color-accent-light);
  color: var(--color-accent);
  border-radius: 20px;
  padding: 3px 10px;
  margin-bottom: 12px;
}

/* ── Domain list ───────────────────────────────────────────── */
.domain-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}

.domain-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f9fafb;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
}

.domain-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-accent);
  background: var(--color-accent-light);
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
}

/* ── Artifact Tree ─────────────────────────────────────────── */
.artifact-tree {
  background: var(--color-pre-bg);
  color: #a6adc8;
  border-radius: var(--radius);
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  margin-bottom: 24px;
  border: 1px solid #2a2d3e;
}

.tree-dir { color: #89b4fa; }
.tree-file { color: #cdd6f4; }
.tree-comment { color: #585b70; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s;
  }
  .content { margin-left: 0; }
  .header-logo { width: auto; }
}

@media (max-width: 600px) {
  .content-inner { padding: 32px 20px 60px; }
  h1 { font-size: 1.6rem; }
  .hero h1 { font-size: 1.8rem; }
  .card-grid { grid-template-columns: 1fr; }
  .pipeline { gap: 4px; }
}

/* ── Utility ───────────────────────────────────────────────── */
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 13px; }
.font-mono { font-family: var(--font-mono); }
