/* ============================================================
   Mark Cuban CostPlus Drug Company — API Documentation Styles
   ============================================================ */

:root {
  /* ── CPD Brand Colors ── */
  --cpd-blue:         #1B3C82;   /* Primary deep royal blue (nav / hero) */
  --cpd-blue-dark:    #142D64;   /* Hover / active darkened blue */
  --cpd-blue-deeper:  #0D1F46;   /* Very dark navy for code bg */
  --cpd-blue-light:   #4A87D4;   /* Lighter blue accent (the floating + icons) */
  --cpd-orange:       #E05A30;   /* Orange accent (the orange + icons) */

  /* ── Semantic tokens ── */
  --primary:          var(--cpd-blue);
  --primary-dark:     var(--cpd-blue-dark);
  --primary-darker:   var(--cpd-blue-deeper);
  --nav-bg:           var(--cpd-blue);

  /* ── Surface & text ── */
  --sidebar-bg:       #F5F7FB;
  --bg:               #FFFFFF;
  --bg-alt:           #F5F7FB;
  --text:             #111827;
  --text-muted:       #6B7280;
  --border:           #DDE3EF;

  /* ── Code blocks ── */
  --code-bg:          #0A1628;
  --code-text:        #C8D5F0;
  --code-string:      #86EFAC;
  --code-number:      #93C5FD;
  --code-key:         #F9A8D4;

  /* ── Badges ── */
  --badge-yes-bg:     #EEF4FF;
  --badge-yes-text:   #1B3C82;
  --badge-no-bg:      #F1F5F9;
  --badge-no-text:    #475569;

  /* ── Layout ── */
  --nav-height:       64px;
  --sidebar-width:    256px;
  --content-max:      800px;
  --radius:           8px;
  --radius-sm:        4px;
  --font-mono:        'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
a { color: var(--cpd-blue); text-decoration: none; }
a:hover { color: var(--cpd-blue-dark); text-decoration: underline; }

/* ── Top Navigation ────────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--nav-bg);
  display: flex;
  align-items: center;
  padding: 0 28px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

/* ── Logo ── */
.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  margin-right: auto;
  flex-shrink: 0;
}

.nav-logo:hover { text-decoration: none; opacity: 0.9; }

.nav-wordmark {
  height: 30px;
  width: auto;
  display: block;
}

/* ── Nav links ─────────────────────────────────────────────── */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-links a {
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(255,255,255,0.10);
  text-decoration: none;
}

.nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

.nav-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 5px;
  vertical-align: middle;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-badge.cpd  { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.9); }
.nav-badge.tcc  { background: rgba(74,135,212,0.30);  color: #93C5FD; }
.nav-badge.apn  { background: rgba(224,90,48,0.28);   color: #FDBA74; }
.nav-badge.mcp  { background: rgba(109,40,217,0.30);  color: #C4B5FD; }

/* ── Layout ────────────────────────────────────────────────── */
.layout {
  display: flex;
  padding-top: var(--nav-height);
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 24px 0 40px;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-section { padding: 0 16px; margin-bottom: 24px; }

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color 0.1s, background 0.1s;
  line-height: 1.4;
}

.sidebar nav a:hover {
  color: var(--text);
  background: var(--border);
  text-decoration: none;
}

.sidebar nav a.active {
  color: var(--cpd-blue);
  background: rgba(27,60,130,0.07);
  font-weight: 500;
}

.sidebar nav a .method-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(27,60,130,0.10);
  color: var(--cpd-blue);
  flex-shrink: 0;
}

/* ── Main Content ──────────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 80px;
}

.content-section { max-width: var(--content-max); margin: 0 auto; }

/* ── Page Hero ─────────────────────────────────────────────── */
.page-hero {
  border-bottom: 1px solid var(--border);
  padding-bottom: 32px;
  margin-bottom: 40px;
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.channel-pill.cpd { background: rgba(27,60,130,0.08); color: var(--cpd-blue); }
.channel-pill.tcc { background: rgba(74,135,212,0.10); color: #1A5AA8; }
.channel-pill.apn { background: rgba(224,90,48,0.08); color: #B53A10; }
.channel-pill.mcp { background: rgba(109,40,217,0.08); color: #6D28D9; }
.channel-pill.all { background: var(--bg-alt); border: 1px solid var(--border); color: var(--text-muted); }

.channel-pill svg { width: 14px; height: 14px; }

.page-hero h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 12px;
}

.page-hero p {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.6;
}

/* ── Section Headings ──────────────────────────────────────── */
.doc-section {
  margin-bottom: 48px;
  scroll-margin-top: calc(var(--nav-height) + 16px);
}

.doc-section h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--cpd-blue);
}

.doc-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 10px;
}

.doc-section p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.7;
}

.doc-section ul, .doc-section ol { padding-left: 20px; margin-bottom: 12px; }

.doc-section li {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1.6;
}

/* ── Endpoint Block ────────────────────────────────────────── */
.endpoint {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(27,60,130,0.04);
  border-bottom: 1px solid var(--border);
}

.method {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(27,60,130,0.10);
  color: var(--cpd-blue);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.endpoint-desc { padding: 14px 18px 0; font-size: 14px; color: var(--text-muted); }
.endpoint-desc p { margin-bottom: 12px; }

/* ── Code Block ────────────────────────────────────────────── */
.code-block {
  background: var(--code-bg);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px 0;
  position: relative;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.code-block-lang {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

.copy-btn {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.4);
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
}

.copy-btn:hover  { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.06); }
.copy-btn.copied { color: #86EFAC; border-color: rgba(134,239,172,0.3); }

.code-block pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--code-text);
}

.code-block pre::-webkit-scrollbar { height: 4px; }
.code-block pre::-webkit-scrollbar-track { background: transparent; }
.code-block pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* Syntax highlight */
.tok-key  { color: #F9A8D4; }
.tok-str  { color: #86EFAC; }
.tok-num  { color: #93C5FD; }
.tok-bool { color: #FCA5A5; }
.tok-null { color: #94A3B8; }
.tok-url  { color: #7DD3FC; }
.tok-cmd  { color: #A5B4FC; }

/* ── Schema Table ──────────────────────────────────────────── */
.schema-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.schema-table thead { background: rgba(27,60,130,0.04); }

.schema-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.schema-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.schema-table tr:last-child td { border-bottom: none; }
.schema-table tr:hover td { background: rgba(27,60,130,0.02); }

.schema-table .field-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.schema-table .field-type {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cpd-blue);
  background: rgba(27,60,130,0.07);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.badge-yes {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--badge-yes-bg);
  color: var(--badge-yes-text);
}

.badge-no {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--badge-no-bg);
  color: var(--badge-no-text);
}

.badge-cond {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(224,90,48,0.08);
  color: #B53A10;
}

/* ── Param Table ───────────────────────────────────────────── */
.param-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
.param-table tr { border-bottom: 1px solid var(--border); }
.param-table tr:last-child { border-bottom: none; }
.param-table td { padding: 10px 0; vertical-align: top; }
.param-table td:first-child { width: 160px; padding-right: 16px; }

.param-name { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text); display: block; margin-bottom: 4px; }
.param-type { font-size: 11px; color: var(--text-muted); display: block; }
.param-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ── Callout / Info box ────────────────────────────────────── */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.6;
}

.callout.info {
  background: rgba(27,60,130,0.05);
  border: 1px solid rgba(27,60,130,0.18);
  color: var(--cpd-blue-dark);
}

.callout.warn {
  background: rgba(224,90,48,0.05);
  border: 1px solid rgba(224,90,48,0.22);
  color: #8B2800;
}

.callout-icon { font-size: 16px; flex-shrink: 0; line-height: 1.4; }
.callout strong { font-weight: 600; }

/* ── Response Tag ──────────────────────────────────────────── */
.response-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.response-tag.success { background: rgba(27,60,130,0.07); color: var(--cpd-blue); }
.response-tag.error   { background: rgba(224,90,48,0.08); color: #B53A10; }

/* ── Channel Cards on Index ────────────────────────────────── */
.channel-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.channel-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.channel-card:hover {
  border-color: var(--cpd-blue);
  box-shadow: 0 4px 16px rgba(27,60,130,0.12);
  transform: translateY(-1px);
  text-decoration: none;
}

.channel-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}

.channel-card-icon.cpd { background: rgba(27,60,130,0.08); }
.channel-card-icon.tcc { background: rgba(74,135,212,0.10); }
.channel-card-icon.apn { background: rgba(224,90,48,0.10); }
.channel-card-icon.mcp { background: rgba(109,40,217,0.10); }

.channel-card h3 { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.channel-card p  { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 0; }

.channel-card .card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cpd-blue);
  margin-top: 10px;
}

/* ── Info Box ──────────────────────────────────────────────── */
.info-box {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.info-box-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.info-box-row:last-child { border-bottom: none; }
.info-box-label  { font-weight: 600; color: var(--text); min-width: 110px; flex-shrink: 0; }
.info-box-value  { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }

/* ── Footer ────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 48px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

footer a { color: var(--text-muted); }
footer a:hover { color: var(--cpd-blue); text-decoration: none; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { padding: 24px 20px 60px; }
  .top-nav { padding: 0 16px; }
  footer { padding: 20px; }
}

/* ── Utilities ─────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

.inline-code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(27,60,130,0.06);
  color: var(--cpd-blue);
  padding: 2px 6px;
  border-radius: 3px;
}

.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0 !important; }

/* ── Numbered Steps ────────────────────────────────────────── */
.steps {
  list-style: none;
  counter-reset: step;
  margin: 16px 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.steps > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: start;
}

.steps > li::before {
  content: counter(step);
  font-size: 13px;
  font-weight: 700;
  color: var(--cpd-blue);
  background: rgba(27,60,130,0.08);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

.steps h3 { font-size: 14px; font-weight: 600; color: var(--text); margin: 3px 0 4px; }
.steps p { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.6; }

/* ── Scope Grid (what a tool does / doesn't) ──────────────────── */
.scope-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0 20px;
}

@media (max-width: 700px) {
  .scope-grid { grid-template-columns: 1fr; }
}

.scope-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.scope-card h3 { margin-bottom: 10px; }
.scope-card ul { padding-left: 18px; margin: 0; }
.scope-card li { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; line-height: 1.5; }

/* ── Q&A Panel ─────────────────────────────────────────────── */
.qa {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.qa-turn + .qa-turn { padding-top: 16px; border-top: 1px solid var(--border); }
.qa-ask { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.qa-said { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.6; }
