/* Dave Tech Apis v2.0 — Nexray-style dark docs theme */
:root {
  --bg: #0a0a0c;
  --card: #141418;
  --card2: #1b1b20;
  --border: #23232a;
  --border2: #2e2e36;
  --text: #f5f5f7;
  --text2: #9a9aa5;
  --text3: #5c5c68;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --blue: #4f8cff;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', sans-serif;
  --topbar: 58px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 14px; line-height: 1.5;
  min-height: 100vh; overflow-x: hidden;
}

/* subtle grid background like nexray */
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.045) 1px, transparent 0);
  background-size: 26px 26px;
}
.grid-bg::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(79,140,255,.06), transparent 60%);
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 150; height: var(--topbar);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.4rem;
  background: rgba(10,10,12,.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.logo-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--blue); box-shadow: 0 0 10px rgba(79,140,255,.5); }
.brand-name { font-weight: 700; font-size: .95rem; }
.brand-ver {
  font-family: var(--mono); font-size: .6rem; color: var(--text3);
  background: var(--card); border: 1px solid var(--border2);
  padding: 2px 8px; border-radius: 999px;
}
.topnav { display: flex; align-items: center; gap: .2rem; }
.navlink {
  color: var(--text2); text-decoration: none; font-size: .85rem; font-weight: 500;
  padding: .45rem .85rem; border-radius: 8px; transition: all .15s;
}
.navlink:hover { color: var(--text); background: rgba(255,255,255,.05); }
.navlink.active { color: var(--text); background: var(--card2); }
.hambtn {
  display: none; background: none; border: 1px solid var(--border2); color: var(--text2);
  border-radius: 8px; padding: 6px; cursor: pointer;
}
.hambtn i { font-size: 1.2rem; display: block; }

/* ── Layout ─────────────────────────────────────────── */
.layout { position: relative; z-index: 1; display: flex; min-height: calc(100vh - var(--topbar)); }
.sidebar {
  width: 265px; flex-shrink: 0;
  position: sticky; top: var(--topbar);
  height: calc(100vh - var(--topbar)); overflow-y: auto;
  padding: 1.4rem 1rem;
  border-right: 1px solid var(--border);
}
.sidebar-title {
  font-size: .95rem; font-weight: 700; margin-bottom: .9rem;
}
.sidebtn {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text2); text-decoration: none; font-size: .85rem; font-weight: 500;
  padding: .55rem .7rem; border-radius: 8px; margin-bottom: 1.2rem; transition: all .15s;
}
.sidebtn:hover { background: rgba(255,255,255,.05); color: var(--text); }
.sidebtn i { font-size: 1rem; }
.side-label {
  font-family: var(--mono); font-size: .6rem; color: var(--text3);
  letter-spacing: .1em; text-transform: uppercase; margin-bottom: .45rem; padding-left: .7rem;
}
.catnav { display: flex; flex-direction: column; gap: .1rem; }
.catnav a {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text2); text-decoration: none; font-size: .85rem;
  padding: .5rem .7rem; border-radius: 8px; transition: all .15s;
}
.catnav a:hover { background: rgba(255,255,255,.05); color: var(--text); }
.catnav a.active { background: var(--card2); color: var(--text); }
.catnav a i { font-size: .95rem; color: var(--text3); }
.catnav .cnt { font-family: var(--mono); font-size: .6rem; color: var(--text3); margin-right: .4rem; }

/* ── Main ───────────────────────────────────────────── */
.main { flex: 1; min-width: 0; padding: 1.6rem 1.6rem 3rem; }
.hidden { display: none !important; }

/* Hero */
.hero { margin-bottom: 1.6rem; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); font-weight: 700; letter-spacing: -.02em; margin-bottom: .7rem; }
.hero h1 .ver { font-size: .5em; vertical-align: super; color: var(--text3); font-weight: 600; }
.hero p { color: var(--text2); max-width: 620px; line-height: 1.7; }
.hero-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.chip {
  font-family: var(--mono); font-size: .62rem; color: var(--text2);
  background: var(--card); border: 1px solid var(--border2);
  padding: 3px 11px; border-radius: 999px;
}

/* Category grid (overview) */
.catgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }
.catcard {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.1rem; cursor: pointer;
  transition: all .18s; position: relative; overflow: hidden;
}
.catcard:hover { border-color: var(--border2); transform: translateY(-2px); background: var(--card2); }
.catcard::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--ccolor, var(--blue));
}
.catcard-name { font-weight: 700; font-size: 1rem; margin-bottom: .25rem; }
.catcard-count {
  display: inline-block; font-family: var(--mono); font-size: .6rem;
  background: rgba(255,255,255,.06); border: 1px solid var(--border2);
  color: var(--text2); padding: 2px 9px; border-radius: 999px; margin-bottom: .55rem;
}
.catcard-desc { font-size: .76rem; color: var(--text2); line-height: 1.55; }
.catcard-arrow { position: absolute; bottom: .9rem; right: .9rem; color: var(--text3); font-size: 1.1rem; }

/* Section head (endpoints view) */
.section-head { margin-bottom: 1.2rem; }
.section-head h1 { font-size: 1.3rem; font-weight: 700; display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; }
.pill {
  font-family: var(--mono); font-size: .6rem; background: rgba(34,197,94,.1);
  color: var(--green); border: 1px solid rgba(34,197,94,.25);
  padding: 3px 10px; border-radius: 999px;
}
.section-head p { color: var(--text2); font-size: .85rem; }

/* Search box */
.searchbox {
  display: flex; align-items: center; gap: .6rem;
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 10px; padding: 0 .9rem; margin-bottom: 1rem;
}
.searchbox i { color: var(--text3); font-size: 1.1rem; }
.searchbox input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--sans); font-size: .85rem; padding: .65rem 0;
}
.searchbox input::placeholder { color: var(--text3); }

/* Endpoint list */
.ep-list { display: flex; flex-direction: column; gap: .55rem; }
.ep-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ep-card:hover { border-color: var(--border2); }
.ep-row {
  display: flex; align-items: center; gap: .7rem;
  padding: .85rem 1rem; cursor: pointer; user-select: none;
}
.method {
  font-family: var(--mono); font-size: .58rem; font-weight: 700;
  padding: 3px 10px; border-radius: 6px; flex-shrink: 0;
}
.method.GET { background: rgba(34,197,94,.1); color: var(--green); border: 1px solid rgba(34,197,94,.25); }
.method.POST { background: rgba(234,179,8,.1); color: var(--yellow); border: 1px solid rgba(234,179,8,.25); }
.ep-name { font-weight: 600; font-size: .88rem; flex: 1; min-width: 0; }
.ep-chevron { color: var(--text3); font-size: 1.1rem; transition: transform .2s; }
.ep-card.open .ep-chevron { transform: rotate(180deg); }

/* Expanded body */
.ep-body { display: none; border-top: 1px solid var(--border); padding: 1rem; }
.ep-card.open .ep-body { display: block; }
.path-strip {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: .5rem .8rem; margin-bottom: .85rem;
  font-family: var(--mono); font-size: .72rem; color: var(--text2);
}
.path-strip .p { color: var(--blue); flex: 1; }
.copy-btn {
  background: none; border: 1px solid var(--border2); color: var(--text3);
  border-radius: 6px; padding: 2px 8px; font-size: .6rem; cursor: pointer;
  font-family: var(--mono); transition: all .15s;
}
.copy-btn:hover { color: var(--text); }
.copy-btn.ok { color: var(--green); border-color: var(--green); }

.param-group { margin-bottom: .65rem; }
.param-label {
  font-family: var(--mono); font-size: .62rem; color: var(--text2);
  margin-bottom: .3rem; display: flex; align-items: center; gap: .35rem;
}
.req-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--red); }
.opt-tag { font-size: .56rem; color: var(--text3); }
.param-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: .55rem .8rem;
  font-family: var(--mono); font-size: .72rem; color: var(--text); outline: none;
  transition: border-color .15s;
}
.param-input:focus { border-color: var(--blue); }
.param-input::placeholder { color: var(--text3); }
input[type="file"].param-input { font-family: var(--sans); font-size: .72rem; padding: .45rem .6rem; }

.ep-actions { display: flex; gap: .5rem; margin-top: .8rem; }
.send-btn {
  flex: 1; background: var(--text); color: var(--bg); border: none; border-radius: 8px;
  padding: .6rem 1rem; font-family: var(--sans); font-size: .8rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .4rem;
  transition: all .15s; min-height: 38px;
}
.send-btn:hover { background: #d8d8dc; }
.send-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Result */
.result-wrap { display: none; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.result-wrap.show { display: block; }
.result-bar { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.status-badge {
  font-family: var(--mono); font-size: .6rem; padding: 3px 10px; border-radius: 999px; font-weight: 600;
}
.status-badge.ok { background: rgba(34,197,94,.1); color: var(--green); border: 1px solid rgba(34,197,94,.25); }
.status-badge.err { background: rgba(239,68,68,.1); color: var(--red); border: 1px solid rgba(239,68,68,.25); }
.status-badge.info { background: rgba(154,154,165,.1); color: var(--text2); border: 1px solid rgba(154,154,165,.25); }
.result-time { font-family: var(--mono); font-size: .6rem; color: var(--text3); margin-left: auto; }
.result-pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: .8rem; max-height: 340px; overflow: auto;
  font-family: var(--mono); font-size: .68rem; line-height: 1.6;
  color: var(--text2); white-space: pre-wrap; word-break: break-word;
}
.result-pre .k { color: #79c0ff; }
.result-pre .s { color: #a5d6a7; }
.result-pre .n { color: #f2c55c; }
.result-media { margin-top: .6rem; }
.result-media img, .result-media video, .result-media audio {
  max-width: 100%; border-radius: 8px; border: 1px solid var(--border);
  max-height: 260px;
}
.result-link {
  display: inline-flex; align-items: center; gap: .35rem; margin-top: .6rem; margin-right: .6rem;
  color: var(--blue); font-size: .75rem; text-decoration: none;
  border: 1px solid rgba(79,140,255,.3); border-radius: 6px; padding: .35rem .7rem;
}
.result-link:hover { background: rgba(79,140,255,.08); }

/* Home cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; margin-top: .5rem; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.2rem; cursor: pointer; transition: all .18s;
}
.card:hover { border-color: var(--border2); transform: translateY(-2px); background: var(--card2); }
.card i { color: var(--blue); font-size: 1.5rem; margin-bottom: .6rem; display: block; }
.card h3 { font-size: .95rem; font-weight: 700; margin-bottom: .35rem; }
.card p { font-size: .76rem; color: var(--text2); line-height: 1.55; }
#ping-result { margin-top: 1rem; }
#ping-result .status-badge { font-size: .7rem; padding: 6px 14px; }

/* Footer */
.footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem;
  padding: 2.5rem 1.6rem 1.2rem; margin-top: 2rem;
  font-size: .8rem; color: var(--text2);
}
.foot-col h4 { color: var(--text); font-size: .85rem; margin-bottom: .7rem; }
.foot-col p { line-height: 1.7; }
.foot-col a { display: block; padding: .15rem 0; cursor: pointer; color: var(--text2); text-decoration: none; }
.foot-col a:hover { color: var(--text); }
.foot-full {
  grid-column: 1 / -1; border-top: 1px solid var(--border);
  padding-top: 1rem; text-align: center; font-size: .7rem; color: var(--text3);
}

/* Loading spinner */
.sp {
  width: 14px; height: 14px; border: 2px solid rgba(10,10,12,.3);
  border-top-color: var(--bg); border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-msg { text-align: center; color: var(--text3); padding: 2.5rem 1rem; font-size: .85rem; }

/* ── Mobile ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .hambtn { display: block; }
  .topnav { display: none; }
  .sidebar {
    position: fixed; top: var(--topbar); left: 0; z-index: 140;
    background: rgba(10,10,12,.97); backdrop-filter: blur(14px);
    transform: translateX(-100%); transition: transform .25s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 1.2rem 1rem 3rem; }
  .footer { grid-template-columns: 1fr; gap: 1.4rem; }
}

/* ── Status chip (topbar) ───────────────────────────── */
.status-chip {
  display: flex; align-items: center; gap: .45rem; cursor: pointer;
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 999px; padding: .35rem .85rem .35rem .6rem; transition: all .15s;
}
.status-chip:hover { border-color: var(--border); background: var(--card2); }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text3);
  transition: background .2s;
}
.status-dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(34,197,94,.6); }
.status-dot.err { background: var(--red); box-shadow: 0 0 8px rgba(239,68,68,.6); }
#statusLabel { font-family: var(--mono); font-size: .62rem; color: var(--text2); }

/* ── Category prev/next navigation ──────────────────── */
.cat-head-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.cat-head-left { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.cat-nav-arrows { display: flex; align-items: center; gap: .35rem; }
.arrow-btn {
  background: var(--card); border: 1px solid var(--border2); color: var(--text2);
  border-radius: 8px; width: 30px; height: 30px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.arrow-btn:hover { color: var(--text); border-color: var(--blue); }
.arrow-btn:disabled { opacity: .35; cursor: not-allowed; }
.arrow-btn i { font-size: 1rem; }
.arrow-idx {
  font-family: var(--mono); font-size: .6rem; color: var(--text3);
  min-width: 3.2em; text-align: center;
}

/* ── Developer card ─────────────────────────────────── */
.dev-card { display: flex; gap: .7rem; align-items: flex-start; }
.dev-logo {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #4f8cff, #7c5cff);
  color: #fff; font-weight: 800; font-size: .72rem;
  display: flex; align-items: center; justify-content: center;
}
.dev-name { color: var(--text); font-weight: 700; font-size: .85rem; }
.dev-tag { color: var(--text2); font-size: .7rem; line-height: 1.5; margin-top: .1rem; }
.dev-link { color: var(--blue); font-size: .7rem; text-decoration: none; }
.dev-link:hover { text-decoration: underline; }

/* ── Rich docs block inside ep-body ─────────────────── */
.doc-section { margin-top: .9rem; }
.doc-title {
  font-size: .6rem; font-family: var(--mono); letter-spacing: .08em;
  text-transform: uppercase; color: var(--text3); margin-bottom: .4rem;
}
.param-table { width: 100%; border-collapse: collapse; margin-bottom: .8rem; }
.param-table th {
  text-align: left; font-size: .6rem; font-family: var(--mono); color: var(--text3);
  border-bottom: 1px solid var(--border); padding: .3rem .5rem; text-transform: uppercase;
  letter-spacing: .05em;
}
.param-table td {
  font-size: .72rem; color: var(--text2); border-bottom: 1px solid var(--border);
  padding: .35rem .5rem; vertical-align: top;
}
.param-table td code {
  font-family: var(--mono); color: var(--text); background: rgba(255,255,255,.05);
  border-radius: 4px; padding: 1px 5px; font-size: .68rem;
}
.req-flag { color: var(--red); font-family: var(--mono); font-size: .6rem; }
.opt-flag { color: var(--text3); font-family: var(--mono); font-size: .6rem; }

.example-block {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: .6rem .8rem; margin-bottom: .6rem; position: relative;
}
.example-block .copy-btn { position: absolute; top: 8px; right: 8px; }
.example-block pre {
  font-family: var(--mono); font-size: .66rem; color: var(--text2);
  line-height: 1.6; white-space: pre-wrap; word-break: break-all;
}

/* Playground result extras */
.result-head {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem;
}
.copy-line { display: flex; gap: .4rem; margin-top: .4rem; }
.copy-line .copy-btn { font-size: .6rem; }

@media (max-width: 640px) {
  .status-chip { padding: .3rem .7rem .3rem .5rem; }
  #statusLabel { display: none; }
  .cat-nav-arrows { width: 100%; justify-content: flex-end; margin-top: .3rem; }
}
