/* Apiary-inspired API reference */
:root {
  --sidebar-w: 260px;
  --topbar-h: 56px;
  --bg: #fafafa;
  --surface: #fff;
  --border: #e8e8e8;
  --text: #3b4151;
  --muted: #737373;
  --get: #61affe;
  --post: #49cc90;
  --patch: #fca130;
  --delete: #f93e3e;
  --hdr: #9012fe;
  --code-bg: #41444e;
  --code-fg: #e7e9ec;
  --accent: #4990e2;
  --radius: 4px;
  --font: 'Heebo', 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

[dir='ltr'] body { font-family: 'Inter', 'Segoe UI', sans-serif; }

.api-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: #1b1b1b;
  border-bottom: 3px solid var(--accent);
}
.api-topbar__inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.api-topbar__brand { display: flex; align-items: center; gap: 8px; }
.api-topbar__logo { color: #fff; font-weight: 700; font-size: 1.1rem; }
.api-topbar__tag {
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.api-topbar__host {
  color: #89bf04;
  font-family: var(--mono);
  font-size: 0.8rem;
  background: transparent;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.api-topbar__actions { display: flex; gap: 8px; margin-inline-start: auto; }
.api-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.api-btn--primary { background: var(--accent); color: #fff; }
.api-btn--primary:hover { filter: brightness(1.08); }
.api-btn--ghost {
  background: transparent;
  color: #ccc;
  border: 1px solid #555;
}
.api-btn--ghost:hover { color: #fff; border-color: #888; }

.api-layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - var(--topbar-h));
}

.api-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 16px 0;
}
.api-sidebar__search {
  width: calc(100% - 24px);
  margin: 0 12px 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.85rem;
}
.api-sidebar__nav { display: flex; flex-direction: column; }
.api-sidebar__group {
  padding: 12px 16px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.api-sidebar__link {
  display: block;
  padding: 6px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  border-inline-start: 3px solid transparent;
}
.api-sidebar__link--sub { padding-inline-start: 28px; font-size: 0.84rem; color: var(--muted); }
.api-sidebar__link:hover { background: #f0f0f0; color: var(--accent); }
.api-sidebar__link.is-active {
  background: #e8f4fc;
  color: var(--accent);
  border-inline-start-color: var(--accent);
  font-weight: 600;
}
.api-sidebar__link.is-hidden { display: none; }

.api-main {
  flex: 1;
  min-width: 0;
  padding: 24px 32px 64px;
  background: var(--surface);
}

.api-intro { margin-bottom: 40px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.api-intro h1 { margin: 0 0 8px; font-size: 1.75rem; font-weight: 700; }
.api-intro p { margin: 0 0 16px; color: var(--muted); }
.api-callout {
  background: #f7f7f7;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.9rem;
  line-height: 1.7;
}
.api-callout code { font-family: var(--mono); font-size: 0.85em; }

.api-section { margin-bottom: 48px; }
.api-section__title {
  margin: 0 0 20px;
  padding-bottom: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  color: #1a1a1a;
}

.api-endpoint {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid #f0f0f0;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.api-endpoint.is-hidden { display: none; }
.api-endpoint__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.api-method {
  display: inline-block;
  min-width: 72px;
  padding: 6px 10px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
}
.api-method--get { background: var(--get); }
.api-method--post { background: var(--post); }
.api-method--patch { background: var(--patch); }
.api-method--delete { background: var(--delete); }
.api-method--hdr { background: var(--hdr); min-width: 80px; }
.api-path {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  color: #3b4151;
  word-break: break-all;
}
.api-endpoint__desc {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
}
.api-endpoint__desc code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #f0f0f0;
  padding: 1px 5px;
  border-radius: 3px;
}

.api-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .api-panels { grid-template-columns: 1fr; }
}
.api-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.api-panel__head {
  padding: 8px 12px;
  background: #f7f7f7;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.api-code {
  margin: 0;
  padding: 14px 16px;
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  direction: ltr;
  text-align: left;
}
.api-code--json { color: #c5e478; }
.api-code__cmt { color: #6a9955; }

/* Per-endpoint: fields to send */
.api-send,
.api-fields {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.api-send__title,
.api-fields__title {
  padding: 8px 12px;
  background: #f0f4f8;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.api-send-empty {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: var(--muted);
}
.api-endpoint__note {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.api-request,
.api-response {
  margin: 12px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.api-request + .api-response,
.api-response + .api-response { margin-top: 8px; }
.api-request__title {
  padding: 8px 12px;
  background: #1e3a5f;
  border-bottom: 1px solid #2c5282;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #90cdf4;
}
.api-response__title {
  padding: 8px 12px;
  background: #1e1e1e;
  border-bottom: 1px solid #333;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}
.api-request .api-code,
.api-response .api-code {
  border-radius: 0;
}
.api-status {
  display: inline-block;
  min-width: 2.4em;
  padding: 2px 8px;
  margin-inline-end: 8px;
  border-radius: 4px;
  background: #166534;
  color: #fff;
  font-family: var(--mono);
  font-size: 0.85em;
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
}
.api-status--201 { background: #1d4ed8; }
.api-send-empty + .api-request,
.api-send + .api-request,
.api-send-empty + .api-response,
.api-send + .api-response,
.api-request + .api-response,
.api-endpoint__note + .api-response {
  margin-top: 12px;
}
.api-params {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.api-params th {
  padding: 8px 10px;
  text-align: start;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: #555;
  white-space: nowrap;
}
.api-params td {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}
.api-params tr:last-child td { border-bottom: 0; }
.api-params code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 3px;
  direction: ltr;
  unicode-bidi: plaintext;
  display: inline-block;
}
.api-params .col-field { width: 22%; }
.api-params .col-where { width: 14%; font-size: 0.82em; color: #64748b; }
.api-params .col-req { width: 11%; text-align: center; white-space: nowrap; }
.api-params .col-example { width: 22%; }
.api-params .col-desc { min-width: 28%; }
.api-req {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.api-req--yes { background: #fee2e2; color: #991b1b; }
.api-req--no { background: #f3f4f6; color: #64748b; }
html[dir='rtl'] .api-params th,
html[dir='rtl'] .api-params td { text-align: right; }
html[dir='rtl'] .api-params .col-req { text-align: center; }
.api-errors-table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.api-errors-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.api-errors-table th,
.api-errors-table td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--border); }
.api-errors-table th { background: #f7f7f7; font-weight: 600; }
.api-errors-table tr:last-child td { border-bottom: 0; }
.api-errors-table code { font-family: var(--mono); font-size: 0.85em; }

@media (max-width: 768px) {
  .api-layout { flex-direction: column; }
  .api-sidebar {
    width: 100%;
    position: static;
    height: auto;
    max-height: 220px;
    border-inline-end: none;
    border-bottom: 1px solid var(--border);
  }
  .api-main { padding: 16px; }
  .api-topbar__host { display: none; }
}
