/* ===== NODIKA Docs – Global Styles ===== */
:root {
  --primary: #1e293b;
  --accent: #dc2626;
  --accent-light: #fee2e2;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --code-bg: #f1f5f9;
  --sidebar-w: 260px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --primary: #f1f5f9;
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --code-bg: #334155;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 0 0 2rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.sidebar-logo .wordmark {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.sidebar-logo .sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-section {
  padding: 1rem 1.5rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.45rem 1.5rem;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-light);
}

[data-theme="dark"] .sidebar nav a:hover,
[data-theme="dark"] .sidebar nav a.active {
  background: rgba(220, 38, 38, 0.1);
}

/* ── Content ── */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  max-width: 900px;
  padding: 2.5rem 3rem;
}

/* ── Top bar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
}

.topbar .role-badge {
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Section headings ── */
h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  color: var(--text);
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

/* ── Callouts ── */
.callout {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin: 1.25rem 0;
  border-left: 4px solid;
  font-size: 0.9rem;
}

.callout.info    { background: #eff6ff; border-color: #3b82f6; color: #1e40af; }
.callout.warning { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
.callout.success { background: #f0fdf4; border-color: #22c55e; color: #166534; }
.callout.danger  { background: #fef2f2; border-color: #ef4444; color: #991b1b; }

[data-theme="dark"] .callout.info    { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .callout.warning { background: #3d2e0a; color: #fcd34d; }
[data-theme="dark"] .callout.success { background: #052e16; color: #86efac; }
[data-theme="dark"] .callout.danger  { background: #3d0a0a; color: #fca5a5; }

/* ── Step cards (Flows) ── */
.steps { display: flex; flex-direction: column; gap: 0.75rem; margin: 1rem 0; }

.step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.step-num {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.step-body strong { display: block; margin-bottom: 0.2rem; color: var(--text); }
.step-body p, .step-body ul { font-size: 0.875rem; color: var(--text-muted); }

/* ── Button/UI element previews ── */
.ui-element {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0.1rem;
  white-space: nowrap;
}

.btn-primary { background: #1e293b; color: white; }
.btn-red     { background: #dc2626; color: white; }
.btn-green   { background: #16a34a; color: white; }
.btn-gray    { background: #e2e8f0; color: #374151; }
.btn-blue    { background: #2563eb; color: white; }
.btn-outline { border: 2px solid #e2e8f0; background: transparent; color: var(--text); }

/* ── Field table ── */
.field-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.875rem; }
.field-table th {
  background: var(--code-bg);
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.field-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}
.field-table tr:last-child td { border-bottom: none; }
.field-table tr:hover td { background: var(--code-bg); }

code {
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--accent);
}

/* ── Status badges ── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-yellow  { background: #fef3c7; color: #92400e; }
.badge-green   { background: #d1fae5; color: #065f46; }
.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }
.badge-gray    { background: #f3f4f6; color: #374151; }
.badge-red     { background: #fee2e2; color: #991b1b; }

/* ── Screenshot container ── */
.screenshot-container {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.screenshot-caption {
  background: var(--code-bg);
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.screenshot-container img { width: 100%; display: block; }

/* ── Dark mode toggle ── */
.theme-toggle {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Mobile hamburger ── */
.hamburger {
  display: none;
  position: fixed;
  top: 1rem; left: 1rem;
  z-index: 200;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 1.2rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s;
  }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding: 1.25rem; }
  .content { padding-top: 4rem; }
}

/* ── TOC (Table of Contents) ── */
.toc {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}
.toc h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 0.5rem; }
.toc ol { padding-left: 1.25rem; }
.toc li { margin: 0.2rem 0; }
.toc a { color: var(--text-muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }

/* ── Flow diagram (horizontal) ── */
.flow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.flow-node {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  min-width: 90px;
}

.flow-node.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.flow-arrow { color: var(--text-muted); font-size: 1.2rem; }

/* ── Bottom nav (prev/next) ── */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.page-nav a {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: all 0.15s;
}

.page-nav a:hover { color: var(--accent); border-color: var(--accent); }

p { margin-bottom: 0.75rem; color: var(--text); }
ul, ol { padding-left: 1.5rem; margin-bottom: 0.75rem; }
li { margin-bottom: 0.3rem; color: var(--text); }
