/* Khaos Documentation — Dark Theme */
:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #1a1a1a;
  --bg-code: #141414;
  --border: #262626;
  --border-light: #333333;
  --accent: #7c3aed;
  --accent-light: #8b5cf6;
  --accent-dim: #5b21b6;
  --text-primary: #e4e4e7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  --info: #3b82f6;
  --sidebar-width: 280px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: white;
}

.sidebar-logo h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-logo span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.sidebar-nav a:hover {
  background: rgba(124, 58, 237, 0.08);
  color: var(--text-primary);
}

.sidebar-nav a.active {
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-light);
}

.sidebar-nav a .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  opacity: 0.7;
}

.sidebar-nav a.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* Main content */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

.content {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* Mobile hamburger */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
}

/* Typography */
h1, h2, h3, h4 {
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.6;
}

h2 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

h4 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

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

a:hover {
  text-decoration: underline;
}

ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

li {
  margin-bottom: 6px;
}

strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.card-icon.purple { background: rgba(124, 58, 237, 0.15); color: var(--accent-light); }
.card-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.card-icon.green { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.card-icon.yellow { background: rgba(234, 179, 8, 0.15); color: var(--warning); }
.card-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.card h3 {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 16px;
}

.card p:last-child {
  margin-bottom: 0;
}

/* Grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

/* Stats */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-light);
  margin-bottom: 4px;
}

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

/* Code blocks */
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  font-size: 13px;
}

code:not(pre code) {
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-light);
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 20px;
  line-height: 1.5;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-secondary);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

tr:hover td {
  background: rgba(124, 58, 237, 0.03);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge.purple { background: rgba(124, 58, 237, 0.15); color: var(--accent-light); }
.badge.blue { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.badge.green { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge.yellow { background: rgba(234, 179, 8, 0.15); color: var(--warning); }
.badge.red { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* Severity badges */
.severity-critical { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.severity-high { background: rgba(249, 115, 22, 0.2); color: #fb923c; }
.severity-medium { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.severity-low { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }

/* ASCII diagram */
.diagram {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  white-space: pre;
}

.diagram .highlight {
  color: var(--accent-light);
  font-weight: 600;
}

/* File tree */
.file-tree {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
}

.file-tree .dir {
  color: var(--accent-light);
  font-weight: 600;
}

.file-tree .file {
  color: var(--text-secondary);
}

.file-tree .comment {
  color: var(--text-muted);
  font-style: italic;
}

/* Callout */
.callout {
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  background: rgba(124, 58, 237, 0.05);
  border-radius: 0 8px 8px 0;
  margin-bottom: 20px;
}

.callout.warning {
  border-left-color: var(--warning);
  background: rgba(234, 179, 8, 0.05);
}

.callout.danger {
  border-left-color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
}

.callout.success {
  border-left-color: var(--success);
  background: rgba(34, 197, 94, 0.05);
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Flow steps */
.flow-steps {
  position: relative;
  padding-left: 32px;
  margin-bottom: 24px;
}

.flow-steps::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.flow-step {
  position: relative;
  padding-bottom: 20px;
}

.flow-step::before {
  content: '';
  position: absolute;
  left: -25px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
}

.flow-step:last-child {
  padding-bottom: 0;
}

.flow-step h4 {
  margin-top: 0;
  color: var(--text-primary);
}

.flow-step p {
  font-size: 14px;
}

/* Tech stack badges */
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tech-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

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

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

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

  .mobile-toggle {
    display: flex;
  }

  .mobile-overlay.show {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .content {
    padding: 80px 20px 60px;
  }

  .page-title {
    font-size: 26px;
  }

  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 8px 10px;
  }

  .diagram, .file-tree {
    font-size: 11px;
    padding: 16px;
  }
}
