/* Dark theme for the REST API page (Swagger UI and the local add-ons).
   Active when theme.js sets <html data-theme="dark">. */
html[data-theme="dark"] {
  --dk-bg: #15181e;
  --dk-surface: #1e222a;
  --dk-raised: #262b35;
  --dk-line: #39404d;
  --dk-text: #e4e7ec;
  --dk-muted: #a3abb8;
  --dk-accent: #8fb4ff;
  color-scheme: dark;
}

html[data-theme="dark"] body {
  background: var(--dk-bg);
}

/* Every Swagger rule that uses the default dark-grey text colour */
html[data-theme="dark"] .swagger-ui,
html[data-theme="dark"] .swagger-ui .opblock-tag,
html[data-theme="dark"] .swagger-ui .opblock-tag small,
html[data-theme="dark"] .swagger-ui .parameter__type,
html[data-theme="dark"] .swagger-ui .opblock .opblock-section-header>label,
html[data-theme="dark"] .swagger-ui .opblock .opblock-section-header h4,
html[data-theme="dark"] .swagger-ui .opblock .opblock-summary-operation-id,
html[data-theme="dark"] .swagger-ui .opblock .opblock-summary-path,
html[data-theme="dark"] .swagger-ui .opblock .opblock-summary-path__deprecated,
html[data-theme="dark"] .swagger-ui .opblock .opblock-summary-description,
html[data-theme="dark"] .swagger-ui .tab li,
html[data-theme="dark"] .swagger-ui .opblock-description-wrapper,
html[data-theme="dark"] .swagger-ui .opblock-external-docs-wrapper,
html[data-theme="dark"] .swagger-ui .opblock-title_normal,
html[data-theme="dark"] .swagger-ui .opblock-description-wrapper h4,
html[data-theme="dark"] .swagger-ui .opblock-external-docs-wrapper h4,
html[data-theme="dark"] .swagger-ui .opblock-title_normal h4,
html[data-theme="dark"] .swagger-ui .opblock-description-wrapper p,
html[data-theme="dark"] .swagger-ui .opblock-external-docs-wrapper p,
html[data-theme="dark"] .swagger-ui .opblock-title_normal p,
html[data-theme="dark"] .swagger-ui .responses-inner h4,
html[data-theme="dark"] .swagger-ui .responses-inner h5,
html[data-theme="dark"] .swagger-ui .response-col_status,
html[data-theme="dark"] .swagger-ui .response-col_links,
html[data-theme="dark"] .swagger-ui .scheme-container .schemes>.schemes-server-container>label,
html[data-theme="dark"] .swagger-ui .loading-container .loading:after,
html[data-theme="dark"] .swagger-ui section h3,
html[data-theme="dark"] .swagger-ui .btn,
html[data-theme="dark"] .swagger-ui select,
html[data-theme="dark"] .swagger-ui label,
html[data-theme="dark"] .swagger-ui textarea,
html[data-theme="dark"] .swagger-ui .checkbox p,
html[data-theme="dark"] .swagger-ui .dialog-ux .modal-ux-content p,
html[data-theme="dark"] .swagger-ui .dialog-ux .modal-ux-content h4,
html[data-theme="dark"] .swagger-ui .dialog-ux .modal-ux-header h3,
html[data-theme="dark"] .swagger-ui .model,
html[data-theme="dark"] .swagger-ui .servers>label,
html[data-theme="dark"] .swagger-ui table.headers td,
html[data-theme="dark"] .swagger-ui table thead tr td,
html[data-theme="dark"] .swagger-ui table thead tr th,
html[data-theme="dark"] .swagger-ui .parameter__name,
html[data-theme="dark"] .swagger-ui .info h1,
html[data-theme="dark"] .swagger-ui .info h2,
html[data-theme="dark"] .swagger-ui .info h3,
html[data-theme="dark"] .swagger-ui .info h4,
html[data-theme="dark"] .swagger-ui .info h5,
html[data-theme="dark"] .swagger-ui .info li,
html[data-theme="dark"] .swagger-ui .info p,
html[data-theme="dark"] .swagger-ui .info table,
html[data-theme="dark"] .swagger-ui .info .base-url,
html[data-theme="dark"] .swagger-ui .info .title,
html[data-theme="dark"] .swagger-ui .auth-container .errors,
html[data-theme="dark"] .swagger-ui .scopes h2,
html[data-theme="dark"] .swagger-ui .errors-wrapper .errors h4,
html[data-theme="dark"] .swagger-ui .errors-wrapper hgroup h4,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-keyword--const .json-schema-2020-12-json-viewer__name,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-keyword--const .json-schema-2020-12-json-viewer__value,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12__constraint,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-keyword--default .json-schema-2020-12-json-viewer__name,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-keyword--default .json-schema-2020-12-json-viewer__value,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-keyword--enum .json-schema-2020-12-json-viewer__name,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-keyword--enum .json-schema-2020-12-json-viewer__value,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-keyword--examples .json-schema-2020-12-json-viewer__name,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-keyword--examples .json-schema-2020-12-json-viewer__value,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-property .json-schema-2020-12__title,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-keyword__name--primary,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-keyword__value--primary,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-keyword__value--warning,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12__attribute,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-json-viewer__name--primary,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-json-viewer__value--primary,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-json-viewer__value--warning {
  color: var(--dk-text);
}

/* Secondary text */
html[data-theme="dark"] .swagger-ui section.models h4,
html[data-theme="dark"] .swagger-ui .model-title,
html[data-theme="dark"] .swagger-ui .prop-format,
html[data-theme="dark"] .swagger-ui .model .property,
html[data-theme="dark"] .swagger-ui table.headers .header-example,
html[data-theme="dark"] .swagger-ui .errors-wrapper .errors small,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12__title,
html[data-theme="dark"] .swagger-ui .json-schema-2020-12-expand-deep-button,
html[data-theme="dark"] .swagger-ui .parameter__in,
html[data-theme="dark"] .swagger-ui .parameter__deprecated,
html[data-theme="dark"] .swagger-ui .opblock-tag small,
html[data-theme="dark"] .swagger-ui .response-col_description,
html[data-theme="dark"] .swagger-ui .renderedMarkdown p {
  color: var(--dk-muted);
}

html[data-theme="dark"] .swagger-ui a,
html[data-theme="dark"] .swagger-ui .info a {
  color: var(--dk-accent);
}

/* Surfaces */
html[data-theme="dark"] .swagger-ui .scheme-container,
html[data-theme="dark"] .swagger-ui .dialog-ux .modal-ux,
html[data-theme="dark"] .swagger-ui .auth-container,
html[data-theme="dark"] .swagger-ui section.models,
html[data-theme="dark"] .swagger-ui section.models .model-container {
  background: var(--dk-surface);
  border-color: var(--dk-line);
  box-shadow: none;
}

html[data-theme="dark"] .swagger-ui .opblock .opblock-section-header {
  background: var(--dk-raised);
  box-shadow: none;
}

html[data-theme="dark"] .swagger-ui .opblock-tag,
html[data-theme="dark"] .swagger-ui section.models.is-open h4,
html[data-theme="dark"] .swagger-ui table thead tr td,
html[data-theme="dark"] .swagger-ui table thead tr th,
html[data-theme="dark"] .swagger-ui .dialog-ux .modal-ux-header,
html[data-theme="dark"] .swagger-ui .model-hint {
  border-color: var(--dk-line);
}

html[data-theme="dark"] .swagger-ui .opblock-tag:hover,
html[data-theme="dark"] .swagger-ui section.models .model-container:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Method blocks: keep the method colour, darken the fill */
html[data-theme="dark"] .swagger-ui .opblock.opblock-get { background: rgba(97, 175, 254, 0.08); }
html[data-theme="dark"] .swagger-ui .opblock.opblock-post { background: rgba(73, 204, 144, 0.08); }
html[data-theme="dark"] .swagger-ui .opblock.opblock-put { background: rgba(252, 161, 48, 0.08); }
html[data-theme="dark"] .swagger-ui .opblock.opblock-delete { background: rgba(249, 62, 62, 0.08); }
html[data-theme="dark"] .swagger-ui .opblock.opblock-patch { background: rgba(80, 227, 194, 0.08); }
html[data-theme="dark"] .swagger-ui .opblock.opblock-head,
html[data-theme="dark"] .swagger-ui .opblock.opblock-options { background: rgba(144, 18, 254, 0.08); }
html[data-theme="dark"] .swagger-ui .opblock.opblock-deprecated {
  background: rgba(235, 235, 235, 0.05);
  border-color: var(--dk-line);
}

/* Form controls */
html[data-theme="dark"] .swagger-ui input[type=email],
html[data-theme="dark"] .swagger-ui input[type=file],
html[data-theme="dark"] .swagger-ui input[type=password],
html[data-theme="dark"] .swagger-ui input[type=search],
html[data-theme="dark"] .swagger-ui input[type=text],
html[data-theme="dark"] .swagger-ui textarea,
html[data-theme="dark"] .swagger-ui select {
  background-color: var(--dk-raised);
  border-color: var(--dk-line);
  color: var(--dk-text);
}

html[data-theme="dark"] .swagger-ui select {
  box-shadow: none;
}

html[data-theme="dark"] .swagger-ui .btn {
  border-color: var(--dk-muted);
  background: transparent;
}

html[data-theme="dark"] .swagger-ui .btn.execute {
  color: #fff;
  border-color: #4990e2;
  background: #4990e2;
}

/* Icons (expand arrows, locks, copy) */
html[data-theme="dark"] .swagger-ui svg:not(.api-search-icon) {
  fill: currentColor;
}

html[data-theme="dark"] .swagger-ui .opblock-summary-control,
html[data-theme="dark"] .swagger-ui .expand-operation,
html[data-theme="dark"] .swagger-ui .authorization__btn,
html[data-theme="dark"] .swagger-ui .opblock-control-arrow,
html[data-theme="dark"] .swagger-ui .models-control,
html[data-theme="dark"] .swagger-ui .model-box-control {
  color: var(--dk-text);
}

html[data-theme="dark"] .swagger-ui .model-toggle:after,
html[data-theme="dark"] .swagger-ui .copy-to-clipboard button {
  filter: invert(1);
}

html[data-theme="dark"] .swagger-ui .tab li:first-of-type:after {
  background: var(--dk-line);
}

/* Inline code inside descriptions */
html[data-theme="dark"] .swagger-ui .markdown code,
html[data-theme="dark"] .swagger-ui .renderedMarkdown code {
  background: var(--dk-raised);
  color: #f0b37e;
}

/* Module group headers and tab bar (tag-groups.js) */
html[data-theme="dark"] .swagger-ui .tag-group-header {
  background: #24364d;
}

html[data-theme="dark"] .swagger-ui .tag-group-header:hover,
html[data-theme="dark"] .swagger-ui .tag-group-header:focus-visible {
  background: #2d4562;
}

html[data-theme="dark"] .swagger-ui .tag-tabs {
  background: var(--dk-bg);
  border-color: var(--dk-line);
}

html[data-theme="dark"] .swagger-ui .tag-tab {
  background: var(--dk-surface);
  border-color: var(--dk-line);
  color: var(--dk-text);
}

html[data-theme="dark"] .swagger-ui .tag-tab:hover {
  background: var(--dk-raised);
}

html[data-theme="dark"] .swagger-ui .tag-tab[aria-selected="true"],
html[data-theme="dark"] .swagger-ui .tag-tab[aria-selected="true"]:hover {
  background: var(--dk-accent);
  border-color: var(--dk-accent);
  color: #15181e;
}

/* Search box (api-search.js) */
html[data-theme="dark"] .api-search-box,
html[data-theme="dark"] .api-search-panel,
html[data-theme="dark"] .api-search-chip {
  background: var(--dk-surface);
  border-color: var(--dk-line);
}

html[data-theme="dark"] .api-search-box:focus-within {
  border-color: var(--dk-accent);
}

html[data-theme="dark"] .api-search .api-search-box .api-search-input,
html[data-theme="dark"] .api-search-path {
  color: var(--dk-text);
}

/* Beats the dark form-control rule above, which also matches this input */
html[data-theme="dark"] .swagger-ui .api-search .api-search-box input.api-search-input {
  background: transparent;
  border: none;
}

html[data-theme="dark"] .api-search-meta,
html[data-theme="dark"] .api-search-empty,
html[data-theme="dark"] .api-search-sub,
html[data-theme="dark"] .api-search-chip {
  color: var(--dk-muted);
}

html[data-theme="dark"] .api-search-chip:hover {
  border-color: var(--dk-accent);
  color: var(--dk-accent);
}

html[data-theme="dark"] .api-search-kbd {
  background: var(--dk-raised);
  border-color: var(--dk-line);
  color: var(--dk-muted);
}

html[data-theme="dark"] .api-search-icon {
  border-color: var(--dk-muted);
}

html[data-theme="dark"] .api-search-icon::after {
  background: var(--dk-muted);
}

html[data-theme="dark"] .api-search-result.is-active {
  background: var(--dk-raised);
}

html[data-theme="dark"] .swagger-ui .opblock.api-search-flash {
  animation-name: api-search-flash-dark;
}

@keyframes api-search-flash-dark {
  0%, 30% { box-shadow: 0 0 0 4px rgba(143, 180, 255, 0.55); }
  100% { box-shadow: 0 0 0 4px rgba(143, 180, 255, 0); }
}
