/*
 * WaDesk API reference — self-contained, brand-exact styling.
 * Tokens mirror resources/css/app.css @theme so this matches the dashboard
 * (paper / wa-deep palette, Fraunces serif, Plus Jakarta sans, JetBrains mono)
 * WITHOUT depending on the compiled Tailwind build — the endpoint markup is
 * injected at runtime from the OpenAPI spec, so utility-class purging can't
 * reach it. Everything here is plain semantic CSS instead.
 */
:root {
    --paper-0: #FBFAF6;
    --paper-50: #F5F3EC;
    --paper-100: #EFEBE0;
    --paper-200: #E5DFD0;
    --paper-300: #D4CCB6;
    --ink-400: #9AA8A4;
    --ink-500: #6B807C;
    --ink-600: #3A5A55;
    --ink-700: #1F4540;
    --ink-800: #13312D;
    --ink-900: #0B1F1C;
    --wa-deep: #075E54;
    --wa-teal: #128C7E;
    --wa-green: #25D366;
    --wa-mint: #DCF8C6;
    --wa-bubble: #E7FFDB;
    --coral: #E87A5D;
    --amber: #E5A04E;
    --sky: #3E7AA1;
    --plum: #5B3D8A;

    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-serif: 'Fraunces', Georgia, serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

    --sidebar-w: 268px;
    --shadow-card: 0 1px 2px rgba(11, 31, 28, .04), 0 4px 16px rgba(11, 31, 28, .05);
    --shadow-soft: 0 8px 30px rgba(11, 31, 28, .10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--ink-900);
    background: var(--paper-0);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

code, pre { font-family: var(--font-mono); }

/* ---------- Top bar ---------- */
.api-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 22px;
    background: rgba(251, 250, 246, .85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--paper-200);
}
.api-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.api-brand .mark {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--wa-deep); color: var(--paper-0);
    display: grid; place-items: center; flex: none;
}
.api-brand .mark svg { width: 19px; height: 19px; }
.api-brand .name { font-family: var(--font-serif); font-size: 18px; font-weight: 600; line-height: 1; }
.api-brand .name em { color: var(--wa-deep); font-style: italic; }
.api-brand .ver {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em;
    color: var(--wa-deep); background: var(--wa-mint);
    border: 1px solid rgba(37, 211, 102, .4);
    padding: 2px 7px; border-radius: 999px; margin-left: 4px;
}
.api-topbar .actions { display: flex; align-items: center; gap: 10px; }
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 12.5px; font-weight: 600; line-height: 1;
    padding: 9px 14px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--paper-200); background: var(--paper-0); color: var(--ink-700);
    transition: .15s;
}
.btn:hover { text-decoration: none; border-color: var(--wa-deep); }
.btn-primary { background: var(--wa-deep); color: var(--paper-0); border-color: var(--wa-deep); }
.btn-primary:hover { background: var(--wa-teal); border-color: var(--wa-teal); color: var(--paper-0); }
.btn svg { width: 14px; height: 14px; }

/* ---------- Layout ---------- */
.api-shell { display: flex; align-items: flex-start; margin: 0 auto; }

.api-sidebar {
    position: sticky; top: 59px;
    width: var(--sidebar-w); flex: none;
    height: calc(100vh - 59px);
    overflow-y: auto;
    padding: 22px 14px 60px 22px;
    border-right: 1px solid var(--paper-200);
}
.api-sidebar .search {
    width: 100%; padding: 9px 12px; margin-bottom: 16px;
    border: 1px solid var(--paper-200); border-radius: 10px;
    background: var(--paper-0); font-family: var(--font-sans); font-size: 12.5px; color: var(--ink-900);
}
.api-sidebar .search:focus { outline: none; border-color: var(--wa-deep); box-shadow: 0 0 0 4px rgba(7, 94, 84, .08); }

.nav-group { margin-bottom: 18px; }
.nav-group > .label {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
    color: var(--ink-500); margin: 0 0 8px 8px;
}
.nav-link {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 8px; margin-bottom: 1px;
    font-size: 12.5px; color: var(--ink-700); cursor: pointer;
}
.nav-link:hover { background: var(--paper-100); text-decoration: none; }
.nav-link.active { background: var(--wa-mint); color: var(--wa-deep); font-weight: 600; }
.nav-link .verb {
    font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: .03em;
    width: 42px; flex: none; text-align: right;
}
.nav-link .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* verb colours */
.v-get { color: var(--wa-teal); }
.v-post { color: var(--wa-green); }
.v-put { color: var(--amber); }
.v-patch { color: var(--amber); }
.v-delete { color: var(--coral); }

/* ---------- Main ---------- */
.api-main { flex: 1; min-width: 0; padding: 32px 40px 120px; }

.hero { margin-bottom: 40px; }
.hero .eyebrow {
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
    color: var(--ink-500); margin-bottom: 10px;
}
.hero h1 { font-family: var(--font-serif); font-size: 38px; font-weight: 600; line-height: 1.05; margin: 0 0 14px; letter-spacing: -.01em; }
.hero h1 em { color: var(--wa-deep); font-style: italic; }
.hero p.lead { font-size: 15px; color: var(--ink-600); max-width: 680px; margin: 0 0 22px; }

.card {
    background: var(--paper-0); border: 1px solid var(--paper-200);
    border-radius: 16px; padding: 22px; box-shadow: var(--shadow-card); margin-bottom: 22px;
}
.card h2 { font-family: var(--font-serif); font-size: 21px; font-weight: 600; margin: 0 0 6px; }
.card h3 { font-size: 14px; font-weight: 700; color: var(--ink-800); margin: 18px 0 8px; }
.card p { color: var(--ink-600); margin: 0 0 12px; }

.kv { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.copybox {
    display: flex; align-items: center; gap: 10px; flex: 1; min-width: 280px;
    background: var(--ink-900); border-radius: 10px; padding: 11px 14px;
}
.copybox code { color: #DCF8C6; font-size: 12.5px; flex: 1; overflow-x: auto; white-space: nowrap; }
.copybtn {
    flex: none; cursor: pointer; border: 0; background: rgba(255, 255, 255, .08); color: #fff;
    border-radius: 7px; padding: 6px 8px; display: inline-grid; place-items: center;
}
.copybtn:hover { background: rgba(255, 255, 255, .18); }
.copybtn svg { width: 14px; height: 14px; }

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-mono); font-size: 11px; padding: 3px 9px; border-radius: 999px;
    background: var(--paper-100); color: var(--ink-700); border: 1px solid var(--paper-200);
}
.pill .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--wa-green); }

/* feature/answer grid on intro */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 6px; }
.feature {
    border: 1px solid var(--paper-200); border-radius: 12px; padding: 14px; background: var(--paper-50);
}
.feature .t { font-weight: 700; font-size: 13px; color: var(--ink-800); display: flex; align-items: center; gap: 7px; }
.feature .t svg { width: 15px; height: 15px; color: var(--wa-deep); }
.feature .d { font-size: 12px; color: var(--ink-500); margin-top: 4px; }

/* ---------- Endpoint blocks ---------- */
.group-head { margin: 46px 0 14px; }
.group-head h2 { font-family: var(--font-serif); font-size: 26px; font-weight: 600; margin: 0; }
.group-head .sub { color: var(--ink-500); font-size: 13px; margin-top: 2px; }

.endpoint {
    border: 1px solid var(--paper-200); border-radius: 14px; background: var(--paper-0);
    box-shadow: var(--shadow-card); margin-bottom: 18px; overflow: hidden; scroll-margin-top: 76px;
}
.endpoint > .head {
    display: flex; align-items: center; gap: 12px; padding: 15px 18px; cursor: pointer;
    border-bottom: 1px solid transparent;
}
.endpoint.open > .head { border-bottom-color: var(--paper-200); }
.endpoint > .head:hover { background: var(--paper-50); }
.verb-badge {
    font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .04em;
    padding: 4px 9px; border-radius: 7px; flex: none; color: #fff; text-transform: uppercase;
}
.b-get { background: var(--wa-teal); }
.b-post { background: var(--wa-green); }
.b-put, .b-patch { background: var(--amber); }
.b-delete { background: var(--coral); }
.endpoint .path { font-family: var(--font-mono); font-size: 13.5px; color: var(--ink-900); font-weight: 600; }
.endpoint .path .pre { color: var(--ink-400); }
.endpoint .summary { color: var(--ink-500); font-size: 12.5px; margin-left: auto; text-align: right; }
.endpoint .chev { flex: none; transition: transform .2s; color: var(--ink-400); }
.endpoint.open .chev { transform: rotate(90deg); }

.endpoint > .body { padding: 0 18px 18px; display: none; }
.endpoint.open > .body { display: block; }
.endpoint .desc { color: var(--ink-600); font-size: 13px; margin: 14px 0 4px; }

.sec-label {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
    color: var(--ink-500); margin: 18px 0 8px;
}

table.params { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.params th {
    text-align: left; font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ink-500); font-weight: 500; padding: 7px 10px; border-bottom: 1px solid var(--paper-200);
}
table.params td { padding: 8px 10px; border-bottom: 1px solid var(--paper-100); vertical-align: top; }
table.params td .pname { font-family: var(--font-mono); font-weight: 600; color: var(--ink-900); }
table.params td .ptype { font-family: var(--font-mono); color: var(--sky); font-size: 11.5px; }
table.params .req { color: var(--coral); font-size: 10px; font-family: var(--font-mono); }
table.params td .pdesc { color: var(--ink-500); }

pre.code {
    background: var(--ink-900); color: #E8F0EE; border-radius: 10px; padding: 14px 16px;
    overflow-x: auto; font-size: 12.5px; line-height: 1.6; margin: 6px 0 0; position: relative;
}
pre.code .tok-key { color: #9CDCFE; }
pre.code .tok-str { color: #CE9178; }
pre.code .tok-num { color: #B5CEA8; }
pre.code .tok-bool { color: #569CD6; }
.code-wrap { position: relative; }
.code-wrap .copybtn { position: absolute; top: 9px; right: 9px; }

.resp-block { margin: 0 0 12px; }
.resp-block .code-wrap { margin-top: 5px; }
.resp-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 12.5px; }
.resp-code {
    font-family: var(--font-mono); font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 6px;
}
.resp-2xx { background: var(--wa-mint); color: var(--wa-deep); }
.resp-4xx { background: #FBE6DF; color: var(--coral); }
.resp-5xx { background: #FBE6DF; color: var(--coral); }
.resp-row .resp-desc { color: var(--ink-500); }

.foot { text-align: center; color: var(--ink-400); font-size: 12px; margin-top: 50px; }

.loading, .errbox { padding: 60px 20px; text-align: center; color: var(--ink-500); }
.errbox { color: var(--coral); }

/* tag-group accent colours cycle */
.acc-0 { --accent: var(--wa-deep); }
.acc-1 { --accent: var(--sky); }
.acc-2 { --accent: var(--plum); }
.acc-3 { --accent: var(--amber); }

@media (max-width: 920px) {
    .api-sidebar { display: none; }
    .api-main { padding: 24px 18px 100px; }
    .hero h1 { font-size: 30px; }
}
