/* ═══════════════════════════════════════════════════════════
   NXPH FHIR Facade — API Documentation Stylesheet
   ═══════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* NexaPoint Health brand light theme (code blocks remain dark) */
  --bg:            #ffffff;
  --bg-surface:    #e6edf5;   /* one shade darker than page — gives cards 3D lift */
  --bg-card:       #ffffff;
  --bg-code:       #020617;   /* near-black navy — deeper code container */
  --sidebar-bg:    #f7fafc;
  --border:        #e2e8f0;
  --border-subtle: #edf2f7;
  --text:          #0f1a2c;   /* dark navy body text */
  --text-muted:    #475569;
  --text-dim:      #94a3b8;
  --accent:        #0284c7;   /* NexaPoint sky blue (sky-600 — readable on white) */
  --accent-hover:  #0369a1;
  --accent-glow:   rgba(2,132,199,.10);
  --green:         #34d399;
  --green-dim:     rgba(52,211,153,.12);
  --orange:        #f59e0b;
  --orange-dim:    rgba(245,158,11,.12);
  --red:           #ef4444;
  --red-dim:       rgba(239,68,68,.10);
  --cyan:          #22d3ee;
  --purple:        #a78bfa;
  --on-dark:       #ffffff;    /* text color for elements on dark/accent bg */
  --sidebar-w:     280px;
  --header-h:      0px;
  --radius:        8px;
  --radius-lg:     12px;
  --shadow:        0 2px 6px rgba(15,26,44,.06), 0 1px 2px rgba(15,26,44,.04);
  --transition:    .18s ease;
}

html { scroll-behavior: smooth; font-size: 15px; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ── Minimal scrollbars (page-wide) ───────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(15,26,44,.18) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(15,26,44,.18);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(15,26,44,.32);
  background-clip: padding-box;
  border: 2px solid transparent;
}
/* Scrollbars inside dark code surfaces — light thumb on dark track */
.card-body, .modal-body, pre {
  scrollbar-color: rgba(255,255,255,.18) transparent;
}
.card-body::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.18);
  background-clip: padding-box;
  border: 2px solid transparent;
}
.card-body::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.32);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* ── Layout ───────────────────────────────────────────────── */
.doc-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 100;
  display: flex; flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: inline-flex; align-items: center;
  text-decoration: none;
  transition: opacity var(--transition);
}
.sidebar-logo:hover { opacity: .85; }
.sidebar-logo img {
  display: block;
  width: auto;
  max-width: 180px;
  height: 36px;
}
.sidebar-badge {
  margin-top: 6px; font-size: .7rem; font-weight: 600;
  color: var(--green); background: var(--green-dim);
  padding: 2px 8px; border-radius: 4px; display: inline-block;
}

.sidebar-nav { padding: 12px 0; flex: 1; }
.sidebar-nav .nav-group-title {
  padding: 16px 20px 6px;
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-dim);
}
.sidebar-nav a {
  display: block; padding: 7px 20px 7px 20px;
  font-size: .85rem; color: var(--text-muted);
  border-left: 2px solid transparent;
  transition: all var(--transition);
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--accent-hover); background: var(--accent-glow);
  border-left-color: var(--accent);
}
.sidebar-nav a.sub { padding-left: 36px; font-size: .8rem; }

.sidebar-nav .nav-group-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 7px 20px;
  font-size: .85rem; color: var(--text-muted);
  background: none; border: none; border-left: 2px solid transparent;
  font-family: inherit; cursor: pointer; text-align: left;
  transition: all var(--transition);
}
.sidebar-nav .nav-group-toggle:hover {
  color: var(--accent-hover); background: var(--accent-glow);
  border-left-color: var(--accent);
}
.sidebar-nav .nav-caret {
  font-size: .7rem; transition: transform .18s ease;
  display: inline-block;
}
.sidebar-nav .nav-group-toggle[aria-expanded="true"] .nav-caret {
  transform: rotate(90deg);
}
.sidebar-nav .nav-collapsible {
  overflow: hidden; max-height: 0;
  transition: max-height .25s ease;
}
.sidebar-nav .nav-collapsible.open {
  max-height: 4000px;
}

.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid var(--border);
  font-size: .72rem; color: var(--text-dim);
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; min-width: 0;
  padding: 48px 56px 96px;
  max-width: 1400px;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4 { color: var(--text); font-weight: 700; letter-spacing: -.3px; }
h1 {
  font-size: 2.25rem; margin-bottom: 14px; line-height: 1.2;
  font-weight: 800;
}
/* Section H2 — brand-blue vertical accent bar on the left, no bottom border */
h2 {
  position: relative;
  font-size: 1.6rem;
  margin: 64px 0 20px;
  padding: 4px 0 4px 18px;
  line-height: 1.3;
  font-weight: 800;
}
h2::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 4px;
  background: var(--accent);
  border-radius: 3px;
}
h3 { font-size: 1.15rem; margin: 36px 0 10px; color: var(--text); }
h4 { font-size: .95rem; margin: 24px 0 8px; color: var(--text); }
p { margin-bottom: 14px; }
.subtitle { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 32px; line-height: 1.6; }

ul, ol { margin: 0 0 16px 20px; }
li { margin-bottom: 6px; }

hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

/* ── Badges / Pills ───────────────────────────────────────── */
.badge {
  display: inline-block; font-size: .7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 4px; vertical-align: middle;
}
.badge-get  { background: var(--green-dim); color: var(--green); }
.badge-post { background: var(--accent-glow); color: var(--accent); }
.badge-del  { background: var(--red-dim); color: var(--red); }
.badge-put  { background: var(--orange-dim); color: var(--orange); }
.badge-required { background: var(--red-dim); color: var(--red); }
.badge-optional { background: rgba(139,143,167,.12); color: var(--text-muted); }

/* ── Code ─────────────────────────────────────────────────── */
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .82em; background: var(--accent-glow);
  padding: 2px 7px; border-radius: 4px;
  border: 1px solid rgba(2,132,199,.18);
  color: var(--accent);
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 12px 0 20px;
  line-height: 1.55;
  position: relative;
}
pre code {
  background: none; border: none; padding: 0;
  font-size: .82rem; color: #e4e6f0; /* light text — pre bg is always dark code navy */
}
pre .comment { color: #94a3b8; }
pre .key     { color: #67d6f7; }   /* bright cyan — readable on dark code bg */
pre .string  { color: #34d399; }   /* green */
pre .number  { color: #fbbf24; }   /* amber */
pre .bool    { color: #c4b5fd; }   /* light purple */
pre .null    { color: #f87171; }

.code-label {
  position: absolute; top: 0; right: 0;
  background: var(--border); color: var(--text-muted);
  font-size: .65rem; font-weight: 600;
  padding: 3px 10px; border-radius: 0 var(--radius) 0 var(--radius);
  text-transform: uppercase; letter-spacing: .6px;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 12px 0 24px; }
table {
  width: 100%; border-collapse: collapse;
  font-size: .85rem;
}
thead th {
  text-align: left; padding: 10px 14px;
  background: var(--bg-card); color: var(--text-muted);
  font-weight: 600; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 2px solid var(--border);
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
tbody tr:hover { background: var(--accent-glow); }

/* ── Info / Warning Boxes ─────────────────────────────────── */
.callout {
  padding: 14px 18px; border-radius: var(--radius);
  margin: 16px 0 20px; font-size: .88rem;
  border-left: 3px solid;
}
.callout-info  { background: var(--accent-glow); border-color: var(--accent); }
.callout-warn  { background: var(--orange-dim); border-color: var(--orange); }
.callout-ok    { background: var(--green-dim); border-color: var(--green); }
.callout-error { background: var(--red-dim); border-color: var(--red); }
.callout strong { color: var(--text); }

/* ── Endpoint Card ────────────────────────────────────────── */
.endpoint {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin: 16px 0 24px;
}
.endpoint-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.endpoint-method {
  font-family: 'JetBrains Mono', monospace;
  font-size: .75rem; font-weight: 700;
  padding: 3px 10px; border-radius: 4px;
  text-transform: uppercase;
}
.method-get    { background: var(--green-dim); color: var(--green); }
.method-post   { background: var(--accent-glow); color: var(--accent); }
.method-delete { background: var(--red-dim); color: var(--red); }
.endpoint-path {
  font-family: 'JetBrains Mono', monospace;
  font-size: .9rem; color: var(--text);
}
.endpoint-desc { color: var(--text-muted); font-size: .88rem; }

/* ── Section anchor offset ────────────────────────────────── */
section[id] { scroll-margin-top: 24px; }

/* ── Responsive ───────────────────────────────────────────── */
.mobile-toggle {
  display: none; position: fixed; top: 12px; left: 12px;
  z-index: 200; background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: var(--radius);
  cursor: pointer; font-size: 1.1rem;
}

@media (max-width: 860px) {
  .mobile-toggle { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 56px 20px 80px; }
}

/* ── Flow diagram ─────────────────────────────────────────── */
.flow-steps {
  display: flex; flex-direction: column; gap: 0;
  margin: 16px 0 24px; position: relative;
  padding-left: 28px;
}
.flow-steps::before {
  content: ''; position: absolute; left: 11px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.flow-step {
  position: relative; padding: 10px 0 10px 20px;
}
.flow-step::before {
  content: attr(data-step);
  position: absolute; left: -22px; top: 10px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.flow-step strong { color: var(--text); }

/* ── Version pill in headings ─────────────────────────────── */
.version-pill {
  font-size: .7rem; font-weight: 600;
  background: var(--accent-glow); color: var(--accent);
  padding: 2px 8px; border-radius: 4px;
  vertical-align: middle; margin-left: 8px;
}

/* ── Split Pane Layout (Two-Column Developer Docs) ────── */
.split-pane {
  display: flex;
  gap: 40px;
  margin: 32px 0 64px;
}
.pane-left {
  flex: 1 1 50%;
  min-width: 0;
}
.pane-right {
  flex: 0 0 450px;
  min-width: 320px;
}

@media (max-width: 1100px) {
  .split-pane {
    flex-direction: column;
    gap: 24px;
  }
  .pane-right {
    flex: 1 1 auto;
    width: 100%;
  }
}

/* ── Interactive Method/URL bar ──────────────────────── */
.http-url-bar {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .85rem;
  margin: 16px 0 24px;
  gap: 12px;
  position: relative;
  box-shadow: 0 1px 2px rgba(15,26,44,.04);
}
.http-url-bar .url-text { color: var(--text); }
.url-verb {
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  font-size: .78rem;
  letter-spacing: .4px;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--accent-glow);
}
.url-text {
  color: var(--text-muted);
  overflow-x: auto;
  white-space: nowrap;
  flex: 1;
  scrollbar-width: none;
}
.url-text::-webkit-scrollbar { display: none; }
.url-copy-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
}
.url-copy-btn:hover {
  color: var(--accent-hover);
}

/* ── Parameter details list ───────────────────────────── */
.params-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  letter-spacing: .8px;
  margin-top: 32px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.param-row {
  display: grid;
  grid-template-columns: 140px 100px 1fr;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: .88rem;
  gap: 12px;
  align-items: center;
}
.param-name {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.param-type {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.param-placeholder {
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.param-placeholder::-webkit-scrollbar {
  display: none;
}

/* ── Code Card Containers (Right Column) ──────────────── */
.code-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(15,26,44,.05), 0 1px 3px rgba(15,26,44,.04);
  overflow: hidden;
}
.card-header {
  background: var(--bg-surface);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-title {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
}
.card-meta {
  font-size: .7rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.card-sub-header {
  background: var(--bg-surface);
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-tabs {
  display: flex;
  gap: 16px;
}
.card-tab {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition);
}
.card-tab:hover { color: var(--text); }
.card-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.card-copy {
  color: var(--text-dim);
  cursor: pointer;
  font-size: .8rem;
}
.card-body {
  padding: 16px 18px;
  background: var(--bg-code);
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
}
.card-body pre {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}
.card-body pre code {
  font-size: .8rem;
}
.card-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  vertical-align: middle;
}

/* ── Modal Styles ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 11, 15, 0.82);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  display: none;
  transition: opacity .22s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  display: flex;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-container {
  width: 90%;
  max-width: 800px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  transform: scale(0.95) translateY(10px);
  transition: transform .22s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.open .modal-container {
  transform: scale(1) translateY(0);
}
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}
.modal-title {
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color var(--transition);
  line-height: 1;
}
.modal-close-btn:hover {
  color: var(--text);
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  overflow-x: auto;
  background: var(--bg-code);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  flex: 1;
}
.modal-body pre {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}
.modal-body pre code {
  font-size: .85rem;
  color: #e4e6f0;
}

/* ── Code Card View More Overlay ────────────────────────── */
.response-body-wrap {
  position: relative;
  max-height: 250px;
  overflow: hidden;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}
.response-body-wrap .card-body {
  max-height: 250px;
  overflow: hidden;
  padding-bottom: 50px; /* Allow space so text does not clip ugly under button */
}
.response-fade {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 90px;
  background: linear-gradient(to bottom, rgba(17,19,24,0) 0%, var(--bg-code) 100%);
  pointer-events: none;
  z-index: 5;
}
.view-more-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--on-dark);
  padding: 7px 16px;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  gap: 6px;
}
.view-more-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.view-more-btn:active {
  transform: translateY(0);
}

/* ── Resource Example Cards ───────────────────────────────── */
.resource-example {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 16px 0 20px;
}
.resource-example h4 {
  margin: 0 0 8px 0;
  font-size: .95rem;
  color: var(--accent-hover);
}
.example-desc {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.response-note {
  font-size: .8rem;
  color: var(--text-dim);
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(139,143,167,.08);
  border-radius: 4px;
  border-left: 2px solid var(--accent);
}

