/* ========== RESET & BASE ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0e1a;
  --bg-card: #111827;
  --bg-card-hover: #1a2236;
  --bg-sidebar: #0d1220;
  --bg-code: #0d1117;
  --border: #1e293b;
  --border-bright: #334155;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.15);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --purple: #a855f7;
  --purple-dim: rgba(168, 85, 247, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --orange: #f59e0b;
  --orange-dim: rgba(245, 158, 11, 0.12);
  --cyan: #06b6d4;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-width: 280px;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: #e06c75;
}

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

.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar-header {
  padding: 20px 20px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.brand-link { text-decoration: none !important; }
.brand { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-key { color: #fff; }
.brand-aux { color: var(--blue); }
.brand-docs { color: var(--text-muted); font-weight: 500; font-size: 0.9rem; }

.badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--blue-dim);
  color: var(--blue);
  padding: 3px 8px;
  border-radius: 4px;
}

.sidebar-search {
  padding: 12px 16px;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.sidebar-search svg {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.sidebar-search input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px 8px 36px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
}
.sidebar-search input:focus { border-color: var(--blue); }
.sidebar-search input::placeholder { color: var(--text-muted); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 20px;
}

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

.nav-group-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 16px 20px 6px;
}

.nav-link {
  display: block;
  padding: 6px 20px 6px 24px;
  font-size: 0.82rem;
  color: var(--text-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.nav-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
  text-decoration: none;
}
.nav-link.active {
  color: var(--blue);
  border-left-color: var(--blue);
  background: var(--blue-dim);
  font-weight: 500;
}

/* ========== MOBILE ========== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  align-items: center;
  gap: 12px;
  z-index: 90;
}

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

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

@media (max-width: 900px) {
  .mobile-header { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main { margin-left: 0; padding-top: 56px; }
}

/* ========== CONTENT ========== */
.doc-section {
  border-bottom: 1px solid var(--border);
}

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

@media (max-width: 900px) {
  .section-content { padding: 32px 20px; }
}

h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: #fff;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 32px 0 12px;
  color: #fff;
}

h4 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 24px 0 10px;
}

p { margin-bottom: 16px; color: var(--text-dim); }
.intro-text { font-size: 1.05rem; color: var(--text-dim); }

/* ========== CARDS ========== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.2s, transform 0.2s;
}
.info-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.info-card h3 { margin: 14px 0 8px; font-size: 1rem; }
.info-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

.info-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.info-card-icon.blue { background: var(--blue-dim); color: var(--blue); }
.info-card-icon.green { background: var(--green-dim); color: var(--green); }
.info-card-icon.purple { background: var(--purple-dim); color: var(--purple); }

/* ========== ENDPOINT HEADER ========== */
.endpoint-block {
  margin: 28px 0;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.endpoint-block p { margin-bottom: 12px; }
.endpoint-block h4 { margin-top: 16px; }

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.method {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.method.get { background: var(--green-dim); color: var(--green); }
.method.post { background: var(--blue-dim); color: var(--blue); }
.method.put { background: var(--orange-dim); color: var(--orange); }
.method.delete { background: var(--red-dim); color: var(--red); }

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
  font-weight: 500;
}

.auth-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(168, 85, 247, 0.12);
  color: var(--purple);
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: auto;
}

/* ========== TAGS ========== */
.tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}
.tag-blue { background: var(--blue-dim); color: var(--blue); }
.tag-green { background: var(--green-dim); color: var(--green); }
.tag-purple { background: var(--purple-dim); color: var(--purple); }

/* ========== TABLES ========== */
.doc-table, .param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 0.85rem;
}
.doc-table th, .param-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.doc-table td, .param-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.doc-table tr:last-child td, .param-table tr:last-child td { border-bottom: none; }
.doc-table tr:hover td, .param-table tr:hover td { background: rgba(255,255,255,0.02); }

.param-table td:first-child { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text); }
td.req { color: var(--red); font-weight: 600; font-size: 0.8rem; }

/* ========== CODE BLOCKS ========== */
.code-block {
  margin: 16px 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-code);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.copy-btn:hover { color: var(--text); border-color: var(--border-bright); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

.code-block pre {
  padding: 16px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.65;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: none;
  border: none;
  padding: 0;
  color: #abb2bf;
}

.status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
}
.status-badge.ok { background: var(--green-dim); color: var(--green); }
.status-badge.err { background: var(--red-dim); color: var(--red); }

/* ========== CALLOUTS ========== */
.callout {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 16px 0;
  font-size: 0.88rem;
  line-height: 1.6;
  border-left: 3px solid;
}
.callout strong { display: inline; }
.callout code { font-size: 0.8rem; }

.callout-info {
  background: var(--blue-dim);
  border-color: var(--blue);
  color: var(--text-dim);
}
.callout-warn {
  background: var(--orange-dim);
  border-color: var(--orange);
  color: var(--text-dim);
}
.callout-danger {
  background: var(--red-dim);
  border-color: var(--red);
  color: var(--text-dim);
}

/* ========== FOOTER ========== */
.docs-footer {
  border-top: 1px solid var(--border);
  padding: 32px 40px;
}

.footer-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-inner p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-muted); font-size: 0.85rem; text-decoration: none; }
.footer-links a:hover { color: var(--text); }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* ========== SCROLL SPY HIGHLIGHT ========== */
.doc-section:target {
  animation: section-flash 0.6s ease;
}

@keyframes section-flash {
  0% { background: rgba(59, 130, 246, 0.05); }
  100% { background: transparent; }
}

/* ========== PRINT ========== */
@media print {
  .sidebar, .mobile-header, .sidebar-overlay { display: none !important; }
  .main { margin-left: 0 !important; }
  .code-block { break-inside: avoid; }
}
