:root {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --sidebar-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-light: rgba(37, 99, 235, 0.08);
  --gradient: linear-gradient(135deg, #2563eb, #7c3aed);
  --border: #e2e8f0;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

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

/* ======================= SIDEBAR ======================= */
.sidebar {
  width: 270px;
  min-width: 270px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding: 0 0 2rem 0;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.brand {
  font-size: 1.3rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-weight: 500;
}

.search-box {
  padding: 0 1.25rem 1rem;
}
.search-box input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  font-size: 0.85rem;
  color: var(--text);
  background: #f1f5f9;
  outline: none;
  transition: all 0.2s;
}
.search-box input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-light);
}

.nav { padding: 0 0.75rem; }

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 600;
  padding: 0.75rem 0.75rem 0.4rem;
}

.nav-link {
  display: block;
  padding: 0.55rem 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 0.4rem;
  margin-bottom: 0.15rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-link:hover { background: var(--accent-light); color: var(--accent); }
.nav-link.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

/* ======================= CONTENT ======================= */
.content { flex: 1; max-width: 960px; padding: 2.5rem 3.5rem 4rem; overflow-x: hidden; }

/* ======================= TABS ======================= */
.tab { display: none; animation: fadeUp 0.25s ease; }
.tab.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ======================= PAGE HEADER ======================= */
.page-header { margin-bottom: 2rem; }
.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.lead { font-size: 1rem; color: var(--text-muted); }

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; margin-top: 1.5rem; }
h4 { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); margin: 1.25rem 0 0.5rem; text-transform: uppercase; letter-spacing: 0.04em; }

p { color: var(--text-muted); margin-bottom: 1rem; }

/* ======================= CARD ======================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card h3 { margin-top: 0; }

/* ======================= ALERT ======================= */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.alert-info { background: #eff6ff; border-left: 4px solid var(--info); color: #1e40af; }
.alert-danger { background: #fef2f2; border-left: 4px solid var(--danger); color: #991b1b; }

/* ======================= TWO COLUMN GRID ======================= */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 2rem; }

/* ======================= DEV CARDS ======================= */
.dev-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}
.dev-badge {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: white;
}
.dev-a { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.dev-b { background: linear-gradient(135deg, #7c3aed, #a855f7); }

.dev-card ul { color: var(--text-muted); font-size: 0.875rem; list-style: none; padding: 0; margin-top: 0.5rem; }
.dev-card li { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }

/* ======================= STEPS ======================= */
.steps { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.step {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}
.step-num {
  width: 32px; height: 32px; min-width: 32px;
  background: var(--gradient);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
}
.step p { margin: 0.25rem 0 0; }

/* ======================= ENDPOINT ======================= */
.endpoint {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  margin-bottom: 1.75rem;
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}
.ep-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.ep-path { font-family: 'Fira Code', monospace; font-size: 0.95rem; font-weight: 600; color: var(--text); }
.ep-desc { color: var(--text-muted); font-size: 0.85rem; margin-left: auto; }
.ep-body { padding: 1.25rem 1.5rem; }

/* ======================= BADGES ======================= */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  font-family: 'Fira Code', monospace;
  min-width: 60px;
  text-align: center;
}
.badge.get { background: #dcfce7; color: var(--success); }
.badge.post { background: #dbeafe; color: var(--accent); }
.badge.put { background: #fef9c3; color: var(--warning); }
.badge.del { background: #fee2e2; color: var(--danger); }

.req { color: var(--danger); font-weight: 700; }

/* ======================= TABLE ======================= */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.table th {
  padding: 0.65rem 0.75rem;
  text-align: left;
  background: #f1f5f9;
  color: var(--text);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.table code {
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  color: var(--danger);
  font-size: 0.82rem;
}

/* ======================= PRE / CODE ======================= */
pre {
  background: #0f172a;
  padding: 1.25rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1rem 0;
}
pre code { font-family: 'Fira Code', monospace; font-size: 0.85rem; color: #f8fafc; line-height: 1.6; background: transparent; padding: 0; }
code { font-family: 'Fira Code', monospace; font-size: 0.85rem; background: #f1f5f9; padding: 0.15rem 0.3rem; border-radius: 4px; color: #e11d48; }

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ======================= MARKDOWN RICH STYLES (.markdown-body) ======================= */
.markdown-body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  line-height: 1.65;
}
.markdown-body h1 { font-size: 2rem; font-weight: 800; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; margin-top: 2rem; margin-bottom: 1rem; }
.markdown-body h2 { font-size: 1.5rem; font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; margin-top: 2rem; margin-bottom: 1rem; }
.markdown-body h3 { font-size: 1.25rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.75rem; }
.markdown-body h4 { font-size: 1rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.75rem; }
.markdown-body p { margin-bottom: 1rem; color: var(--text); }
.markdown-body ul, .markdown-body ol { padding-left: 2rem; margin-bottom: 1rem; color: var(--text); }
.markdown-body li { margin-bottom: 0.25rem; }
.markdown-body strong, .markdown-body b { font-weight: 700; color: var(--text); }
.markdown-body em, .markdown-body i { font-style: italic; }
.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body blockquote { border-left: 4px solid var(--accent); padding-left: 1rem; margin: 1.5rem 0; color: var(--text-muted); background: #f8fafc; padding: 1rem; border-radius: 0.25rem; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.markdown-body table th { padding: 0.75rem; background: #f1f5f9; font-weight: 600; text-align: left; border: 1px solid var(--border); }
.markdown-body table td { padding: 0.75rem; border: 1px solid var(--border); }
.markdown-body img { max-width: 100%; border-radius: 0.5rem; box-shadow: var(--shadow-sm); }
.markdown-body pre { background: #0f172a; padding: 1.25rem; border-radius: 0.5rem; overflow-x: auto; margin: 1rem 0; }
.markdown-body pre code { color: #f8fafc; background: transparent; padding: 0; font-family: 'Fira Code', monospace; }
.markdown-body code { font-family: 'Fira Code', monospace; background: #f1f5f9; padding: 0.2rem 0.4rem; border-radius: 4px; font-size: 0.85em; color: #e11d48; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 1.5rem; max-width: 100%; }
  .two-col { grid-template-columns: 1fr; }
}
