/* ndxer dark theme for the standalone Swagger page (`/docs/api/`).
 * Loaded after project.css and theme.css; all rules are scoped to
 * `:root[data-bs-theme="dark"]` so light mode stays unchanged. */

:root[data-bs-theme="dark"] {
  color-scheme: dark;
  background: var(--ndx-paper);
  color: var(--ndx-ink);
}

:root[data-bs-theme="dark"] body {
  background: var(--ndx-paper);
  color: var(--ndx-ink);
}

:root[data-bs-theme="dark"] .ndx-swagger-title {
  color: var(--ndx-ink);
}

:root[data-bs-theme="dark"] .ndx-swagger-nav {
  background: var(--ndx-surface);
  border-bottom-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .ndx-swagger-nav a {
  color: var(--ndx-info);
}

/* ============ top-level containers ============ */

:root[data-bs-theme="dark"] .swagger-ui .scheme-container {
  background: var(--ndx-surface);
  border-bottom-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui .opblock {
  background: var(--ndx-surface);
  border-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-section-header,
:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-summary {
  border-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-summary-method {
  /* Method badges keep their saturated dark fills with white text;
     only the surrounding border darkens. */
  border-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-summary-path,
:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-summary-path .highlight {
  background: var(--ndx-sunken);
}

:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-body,
:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-description-wrapper {
  background: var(--ndx-surface);
  border-top-color: var(--ndx-border);
  border-bottom-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui .models,
:root[data-bs-theme="dark"] .swagger-ui .models .model-container {
  background: var(--ndx-sunken);
  border-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui .models .model-container .model {
  background: var(--ndx-sunken);
  border-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui .model-box {
  background: var(--ndx-sunken);
  border-color: var(--ndx-border);
}

/* ============ dialogs & the authorization modal ============ */

:root[data-bs-theme="dark"] .swagger-ui .dialog-ux,
:root[data-bs-theme="dark"] .swagger-ui .modal-ux {
  background: var(--ndx-surface);
  color: var(--ndx-ink);
}

:root[data-bs-theme="dark"] .swagger-ui .modal-ux-header {
  background: var(--ndx-surface);
  border-bottom-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui .dialog-ux .btn,
:root[data-bs-theme="dark"] .swagger-ui .modal-ux .btn {
  background: var(--ndx-surface);
  border-color: var(--ndx-border);
  color: var(--ndx-ink);
}

:root[data-bs-theme="dark"] .swagger-ui .dialog-ux .btn:hover,
:root[data-bs-theme="dark"] .swagger-ui .modal-ux .btn:hover {
  background: var(--ndx-sunken);
}

/* Override the vendor and template text colors on dark surfaces. */
:root[data-bs-theme="dark"] .swagger-ui .info .title,
:root[data-bs-theme="dark"] .swagger-ui .info p,
:root[data-bs-theme="dark"] .swagger-ui .info li,
:root[data-bs-theme="dark"] .swagger-ui .info a,
:root[data-bs-theme="dark"] .swagger-ui .info .link,
:root[data-bs-theme="dark"] .swagger-ui a.nostyle,
:root[data-bs-theme="dark"] .swagger-ui .opblock-tag,
:root[data-bs-theme="dark"] .swagger-ui .opblock-tag small,
:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-summary-description,
:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-summary-path,
:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-summary-path__deprecated,
:root[data-bs-theme="dark"] .swagger-ui .parameter__name,
:root[data-bs-theme="dark"] .swagger-ui .parameter__type,
:root[data-bs-theme="dark"] .swagger-ui .parameter__in,
:root[data-bs-theme="dark"] .swagger-ui .prop-type,
:root[data-bs-theme="dark"] .swagger-ui .prop-format,
:root[data-bs-theme="dark"] .swagger-ui .model,
:root[data-bs-theme="dark"] .swagger-ui .model-title,
:root[data-bs-theme="dark"] .swagger-ui section.models h4,
:root[data-bs-theme="dark"] .swagger-ui .response-col_status,
:root[data-bs-theme="dark"] .swagger-ui .response-col_links,
:root[data-bs-theme="dark"] .swagger-ui .tab li,
:root[data-bs-theme="dark"] .swagger-ui table thead tr th,
:root[data-bs-theme="dark"] .swagger-ui table thead tr td,
:root[data-bs-theme="dark"] .swagger-ui .scheme-container .schemes>label,
:root[data-bs-theme="dark"] .swagger-ui .servers-title,
:root[data-bs-theme="dark"] .swagger-ui .markdown p,
:root[data-bs-theme="dark"] .swagger-ui .markdown code,
:root[data-bs-theme="dark"] .swagger-ui .renderedMarkdown p {
  color: var(--ndx-ink);
}

/* ============ borders ============ */

:root[data-bs-theme="dark"] .swagger-ui .opblock,
:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-summary,
:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-section-header,
:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-body,
:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-description-wrapper,
:root[data-bs-theme="dark"] .swagger-ui .models,
:root[data-bs-theme="dark"] .swagger-ui .models .model-container,
:root[data-bs-theme="dark"] .swagger-ui .models .model-container .model,
:root[data-bs-theme="dark"] .swagger-ui .model-box,
:root[data-bs-theme="dark"] .swagger-ui .table-container,
:root[data-bs-theme="dark"] .swagger-ui .models h4 {
  border-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui table thead tr th,
:root[data-bs-theme="dark"] .swagger-ui table thead tr td,
:root[data-bs-theme="dark"] .swagger-ui table tbody td,
:root[data-bs-theme="dark"] .swagger-ui .parameter {
  border-color: var(--ndx-border);
}

/* ============ table rows ============ */

:root[data-bs-theme="dark"] .swagger-ui table {
  background: var(--ndx-surface);
  color: var(--ndx-ink);
}

:root[data-bs-theme="dark"] .swagger-ui table thead tr {
  background: var(--ndx-sunken);
}

:root[data-bs-theme="dark"] .swagger-ui table tbody tr {
  background: var(--ndx-surface);
}

:root[data-bs-theme="dark"] .swagger-ui table tbody tr:nth-child(2n) {
  background: var(--ndx-sunken);
}

:root[data-bs-theme="dark"] .swagger-ui table tbody tr:hover {
  background: var(--ndx-sunken);
  outline-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui table tbody td {
  color: var(--ndx-ink);
}

/* ============ parameters & schema fields ============ */

:root[data-bs-theme="dark"] .swagger-ui .parameter,
:root[data-bs-theme="dark"] .swagger-ui .prop {
  background: var(--ndx-surface);
}

:root[data-bs-theme="dark"] .swagger-ui .parameter .in,
:root[data-bs-theme="dark"] .swagger-ui .prop .in {
  color: var(--ndx-ink-muted);
}

:root[data-bs-theme="dark"] .swagger-ui .prop-item,
:root[data-bs-theme="dark"] .swagger-ui .prop .prop-item {
  background: var(--ndx-sunken);
}

/* ============ code & highlighted blocks ============ */

:root[data-bs-theme="dark"] .swagger-ui .opblock pre,
:root[data-bs-theme="dark"] .swagger-ui .highlight-code,
:root[data-bs-theme="dark"] .swagger-ui .opblock pre code,
:root[data-bs-theme="dark"] .swagger-ui .highlight-code code {
  background: var(--ndx-sunken);
  color: var(--ndx-ink);
  border-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui .highlight-code {
  background-image: none;
}

/* The syntax-highlighting palette stays (coloured on the dark ground it
   was designed for); only the un-highlighted default text becomes ink. */

:root[data-bs-theme="dark"] .swagger-ui .markdown code,
:root[data-bs-theme="dark"] .swagger-ui .renderedMarkdown code,
:root[data-bs-theme="dark"] .swagger-ui .opblock-summary-description code {
  background: var(--ndx-sunken);
  border-color: var(--ndx-border);
  color: var(--ndx-info);
}

/* ============ buttons & form fields ============ */

:root[data-bs-theme="dark"] .swagger-ui .btn {
  background: var(--ndx-surface);
  border-color: var(--ndx-border);
  color: var(--ndx-ink);
}

:root[data-bs-theme="dark"] .swagger-ui .btn:hover {
  background: var(--ndx-sunken);
}

/* The method badges (GET/POST/PUT/DELETE/PATCH) keep their saturated
   dark fills and white text from the inline rules; only their borders
   follow the theme. */

:root[data-bs-theme="dark"] .swagger-ui select,
:root[data-bs-theme="dark"] .swagger-ui input[type=text],
:root[data-bs-theme="dark"] .swagger-ui input[type=password],
:root[data-bs-theme="dark"] .swagger-ui input[type=email],
:root[data-bs-theme="dark"] .swagger-ui input[type=number],
:root[data-bs-theme="dark"] .swagger-ui textarea {
  background: var(--ndx-sunken);
  border-color: var(--ndx-border);
  color: var(--ndx-ink);
}

:root[data-bs-theme="dark"] .swagger-ui input:focus,
:root[data-bs-theme="dark"] .swagger-ui textarea:focus,
:root[data-bs-theme="dark"] .swagger-ui select:focus {
  border-color: var(--ndx-accent);
  outline-color: var(--ndx-accent);
}

/* ============ links ============ */

:root[data-bs-theme="dark"] .swagger-ui a,
:root[data-bs-theme="dark"] .swagger-ui .renderedMarkdown a,
:root[data-bs-theme="dark"] .swagger-ui .response-control-media-type__accept-message {
  color: var(--ndx-info);
}

/* ============ authorization: semantic success, readable on dark ============ */

:root[data-bs-theme="dark"] .swagger-ui .btn.authorize,
:root[data-bs-theme="dark"] .swagger-ui .btn.authorize span {
  color: var(--ndx-success);
  border-color: var(--ndx-success);
}

:root[data-bs-theme="dark"] .swagger-ui .btn.authorize svg {
  fill: var(--ndx-success);
}

/* ============ response status badges: semantic, readable ============ */

:root[data-bs-theme="dark"] .swagger-ui .response-col_status {
  background: var(--ndx-sunken);
}

:root[data-bs-theme="dark"] .swagger-ui .response-success,
:root[data-bs-theme="dark"] .swagger-ui .response .response-success .status_code,
:root[data-bs-theme="dark"] .swagger-ui .response-success .response-body {
  color: var(--ndx-success);
}

:root[data-bs-theme="dark"] .swagger-ui .response-error,
:root[data-bs-theme="dark"] .swagger-ui .response .response-error .status_code {
  color: var(--ndx-danger);
}

/* ============ svg icons ============ */

:root[data-bs-theme="dark"] .swagger-ui svg {
  fill: var(--ndx-ink);
}

:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-summary-method svg,
:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-summary-method .opblock .opblock-summary-method svg {
  fill: #ffffff;
}

/* ============ misc backgrounds the bundle hard-codes white ============ */

:root[data-bs-theme="dark"] .swagger-ui .info {
  background: var(--ndx-surface);
  border-color: var(--ndx-border);
}

:root[data-bs-theme="dark"] .swagger-ui .info .version-stamp,
:root[data-bs-theme="dark"] .swagger-ui .info .title small:not(.version-stamp) {
  background-color: var(--ndx-sunken);
  color: var(--ndx-ink);
}

:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-summary-method {
  /* Keep the saturated badge colours from the inline rules; only the
     border follows the theme. */
  color: #ffffff;
}

:root[data-bs-theme="dark"] .swagger-ui .scheme-container,
:root[data-bs-theme="dark"] .swagger-ui .scheme-container label,
:root[data-bs-theme="dark"] .swagger-ui .servers,
:root[data-bs-theme="dark"] .swagger-ui .opblock-tag-section,
:root[data-bs-theme="dark"] .swagger-ui .models h4,
:root[data-bs-theme="dark"] .swagger-ui .models-wrapper,
:root[data-bs-theme="dark"] .swagger-ui .tab,
:root[data-bs-theme="dark"] .swagger-ui .tab li,
:root[data-bs-theme="dark"] .swagger-ui .responses-wrapper,
:root[data-bs-theme="dark"] .swagger-ui .response-body {
  background: var(--ndx-surface);
}

:root[data-bs-theme="dark"] .swagger-ui .tab li.active,
:root[data-bs-theme="dark"] .swagger-ui .tab li:hover {
  background: var(--ndx-sunken);
}

:root[data-bs-theme="dark"] .swagger-ui .models h4 {
  background: var(--ndx-sunken);
}

:root[data-bs-theme="dark"] .swagger-ui .opblock .opblock-section-header,
:root[data-bs-theme="dark"] .swagger-ui .dialog-ux .modal-ux-content {
  background: var(--ndx-surface);
  color: var(--ndx-ink);
}

:root[data-bs-theme="dark"] .swagger-ui label,
:root[data-bs-theme="dark"] .swagger-ui .opblock-section-header h4,
:root[data-bs-theme="dark"] .swagger-ui .dialog-ux .modal-ux-header h3,
:root[data-bs-theme="dark"] .swagger-ui .dialog-ux .modal-ux-content h4,
:root[data-bs-theme="dark"] .swagger-ui .dialog-ux .modal-ux-content p {
  color: var(--ndx-ink);
}
