/* ================================================================
   assets/theme-scifi.css — optional dark theme, toggled by a small
   script (assets/theme-toggle.js) that sets data-theme="dark" on
   <html> and remembers the choice in localStorage.

   Every rule here is scoped under html[data-theme="dark"], so with
   no attribute set (or data-theme="light") the page renders exactly
   as it always did — its own plain, original light theme — nothing
   in this file applies at all. Loaded as a <link> at the END of
   every page's <head>, after that page's own inline <style> block,
   so plain source order lets these rules win on equal specificity
   without needing !important anywhere except a couple of spots
   where a page sets an inline color.

   Kept deliberately plain: solid opaque backgrounds, no blur, no
   animation, no glow — just a dark background with clearly legible
   light text.
   ================================================================ */

:root[data-theme="dark"]{
  /* ---- core palette (same variable names the pages already use) ----
     --navy/--navy-2 are almost always used as TEXT color across the
     site (headings, labels), only rarely as a background — and every
     place that DOES use them as a background gets its own explicit
     override further down, so these two stay bright/legible-on-dark. */
  --navy:#eef2fb;
  --navy-2:#b7c4e0;
  --blue:#4c8dff;
  --blue-light:rgba(76,141,255,.18);
  --ink:#e9edf5;
  --muted:#93a0b8;
  --bg:#12151f;
  --card:#1b1f2c;
  --good:#3ddc84;
  --good-bg:rgba(61,220,132,.16);
  --warn:#ffb648;
  --warn-bg:rgba(255,182,72,.16);
  --danger:#ff6b7f;
  --danger-bg:rgba(255,107,127,.18);
  --code-bg:#0c0f17;
  --code-ink:#8fe3a8;
  --ring:#4c8dff;
  --radius:10px;
  --shadow:0 2px 10px rgba(0,0,0,.35);
  --shadow-hover:0 4px 16px rgba(0,0,0,.45);

  --sf-panel:#1b1f2c;
  --sf-panel-2:#222739;
  --sf-panel-mid:#232939;
  --sf-border:#333a4f;
}

html[data-theme="dark"]{ background:var(--bg); }
html[data-theme="dark"] body{
  background:var(--bg) !important;
  color:var(--ink) !important;
  font-family:"Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3{ color:var(--navy) !important; }

html[data-theme="dark"] ::selection{ background:var(--blue); color:#fff; }
html[data-theme="dark"] a{ color:var(--blue); }

html[data-theme="dark"] ::-webkit-scrollbar{ width:11px; height:11px; }
html[data-theme="dark"] ::-webkit-scrollbar-track{ background:var(--bg); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb{ background:#3a4257; border-radius:8px; border:2px solid var(--bg); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover{ background:#4a5470; }

/* ================================================================
   Structural surfaces — nav bars, side panels, cards, modals.
   ================================================================ */
html[data-theme="dark"] .nav, html[data-theme="dark"] .topbar, html[data-theme="dark"] .nav-bar{
  background:var(--sf-panel-2) !important;
  border-bottom:1px solid var(--sf-border);
}

html[data-theme="dark"] .card, html[data-theme="dark"] .card-section, html[data-theme="dark"] .panel,
html[data-theme="dark"] .shell .content, html[data-theme="dark"] .subcard,
html[data-theme="dark"] .sidebar, html[data-theme="dark"] .sidenav, html[data-theme="dark"] .stepnav,
html[data-theme="dark"] .console-shell .sidebar, html[data-theme="dark"] .intro-banner,
html[data-theme="dark"] .status-banner, html[data-theme="dark"] .help-glossary,
html[data-theme="dark"] .edit-bar, html[data-theme="dark"] .save-bar,
html[data-theme="dark"] .result-list, html[data-theme="dark"] .hist-row, html[data-theme="dark"] .sidebar-list,
html[data-theme="dark"] .last-resp-btn ~ .modal-card, html[data-theme="dark"] .history-panel{
  background:var(--sf-panel) !important;
  border-color:var(--sf-border) !important;
}
/* The workspace (middle section) gets a shade lighter than the
   sidebar/history panels framing it on both sides, so the three
   sections read as distinct the same way they do in the light theme
   (sidebar/history a soft gray, workspace brighter white). */
html[data-theme="dark"] .workspace, html[data-theme="dark"] .request-bar, html[data-theme="dark"] .tabs,
html[data-theme="dark"] .tab-panel, html[data-theme="dark"] .req-panel-area, html[data-theme="dark"] .response-area,
html[data-theme="dark"] .response-tabs, html[data-theme="dark"] .action-row,
html[data-theme="dark"] .response-content, html[data-theme="dark"] .req-panel, html[data-theme="dark"] .docs-panel,
html[data-theme="dark"] .env-bar, html[data-theme="dark"] .cred-bar, html[data-theme="dark"] .date-group,
html[data-theme="dark"] .response-meta{
  background:var(--sf-panel-mid) !important;
  border-color:var(--sf-border) !important;
}
html[data-theme="dark"] .card, html[data-theme="dark"] .card-section,
html[data-theme="dark"] .panel, html[data-theme="dark"] .subcard{
  box-shadow:var(--shadow);
  border-radius:var(--radius);
}

html[data-theme="dark"] .modal-overlay{ background:rgba(4,6,12,.72) !important; }
html[data-theme="dark"] .modal-card{
  background:var(--sf-panel-2) !important;
  border:1px solid var(--sf-border) !important;
}

html[data-theme="dark"] hr{ border-color:var(--sf-border) !important; }

/* ================================================================
   Buttons — a plain bordered look by default, solid fill on primary.
   The attribute-selector catch-all goes first (equal specificity to
   a plain class selector) so it only ever wins for a button whose
   class name wasn't already covered below.
   ================================================================ */
html[data-theme="dark"] [class*="btn"]{
  background:var(--sf-panel-2) !important;
  border:1px solid var(--sf-border) !important;
  color:var(--ink) !important;
}
html[data-theme="dark"] .link-btn, html[data-theme="dark"] .link-btn:hover{
  background:none !important; border:none !important; color:var(--blue) !important;
}
html[data-theme="dark"] .close-btn, html[data-theme="dark"] .copy-btn, html[data-theme="dark"] .modal-close{
  background:var(--sf-panel-2) !important; border:none !important; color:var(--ink) !important;
}

html[data-theme="dark"] .btn, html[data-theme="dark"] .nav-btn, html[data-theme="dark"] .back,
html[data-theme="dark"] .pillbtn, html[data-theme="dark"] .add-row-btn, html[data-theme="dark"] .send-btn,
html[data-theme="dark"] .tab-btn, html[data-theme="dark"] .main-tab-btn, html[data-theme="dark"] .sidebar-tab,
html[data-theme="dark"] button.btn-ghost, html[data-theme="dark"] .btn-ghost{
  background:var(--sf-panel-2) !important;
  border:1px solid var(--sf-border) !important;
  color:var(--ink) !important;
}
html[data-theme="dark"] .btn:hover, html[data-theme="dark"] .nav-btn:hover, html[data-theme="dark"] .back:hover,
html[data-theme="dark"] .pillbtn:hover, html[data-theme="dark"] .add-row-btn:hover,
html[data-theme="dark"] .tab-btn:hover, html[data-theme="dark"] .sidebar-tab:hover,
html[data-theme="dark"] button.btn-ghost:hover{
  background:#282e40 !important;
}
html[data-theme="dark"] .btn-primary, html[data-theme="dark"] .send-btn, html[data-theme="dark"] .nav-btn.primary,
html[data-theme="dark"] .main-tab-btn.active, html[data-theme="dark"] .tab-btn.active,
html[data-theme="dark"] .sidebar-tab.active, html[data-theme="dark"] .env-btn.active,
html[data-theme="dark"] #script1Btn, html[data-theme="dark"] #script2Btn, html[data-theme="dark"] #script3Btn,
html[data-theme="dark"] #script4Btn, html[data-theme="dark"] #script5Btn,
html[data-theme="dark"] .col-req-actions button, html[data-theme="dark"] button[onclick*="Search"]{
  background:var(--blue) !important;
  border:1px solid var(--blue) !important;
  color:#fff !important;
}
html[data-theme="dark"] .btn-primary:hover, html[data-theme="dark"] .send-btn:hover,
html[data-theme="dark"] .nav-btn.primary:hover{
  background:#3a7cf0 !important;
}
html[data-theme="dark"] .btn-danger-ghost{
  background:var(--sf-panel-2) !important; border:1px solid var(--danger) !important; color:var(--danger) !important;
}
html[data-theme="dark"] .last-resp-btn, html[data-theme="dark"] #gte-msg-btn,
html[data-theme="dark"] #gte-design-pen-btn, html[data-theme="dark"] .sidebar-collapse-btn,
html[data-theme="dark"] .ep-manage-btn, html[data-theme="dark"] #gte-theme-toggle-btn{
  background:var(--blue) !important;
  border:1px solid var(--blue) !important;
  color:#fff !important;
}

/* ================================================================
   Forms — dark, opaque fields with a clear border and focus color.
   option elements get their own explicit background+color too: left
   alone, some browsers render a dropdown's option list with the
   browser's default WHITE popup background while still inheriting
   the light text color set on <select> — white text on a white
   popup, invisible. Setting it directly on <option> avoids that.
   ================================================================ */
html[data-theme="dark"] input[type="text"], html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"], html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="number"], html[data-theme="dark"] input[type="file"],
html[data-theme="dark"] input[type="search"], html[data-theme="dark"] input[type="url"],
html[data-theme="dark"] select, html[data-theme="dark"] textarea,
html[data-theme="dark"] .url-input, html[data-theme="dark"] .method-select,
html[data-theme="dark"] .endpoint-preset-select{
  background:#10131c !important;
  border:1px solid var(--sf-border) !important;
  color:var(--ink) !important;
}
html[data-theme="dark"] option{
  background:#10131c !important;
  color:var(--ink) !important;
}
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder{ color:#6a7691 !important; }
html[data-theme="dark"] input:focus, html[data-theme="dark"] select:focus, html[data-theme="dark"] textarea:focus{
  outline:none !important;
  border-color:var(--blue) !important;
  box-shadow:0 0 0 2px rgba(76,141,255,.25) !important;
}
html[data-theme="dark"] label{ color:var(--muted) !important; }

html[data-theme="dark"] table{ border-color:var(--sf-border) !important; }
html[data-theme="dark"] th{ color:var(--navy) !important; border-bottom:1px solid var(--sf-border) !important; }
html[data-theme="dark"] td{ border-bottom:1px solid var(--sf-border) !important; }
html[data-theme="dark"] tr:hover td{ background:rgba(255,255,255,.03); }

/* Every list/row hover across the site used a light gray-blue tint
   (e.g. #eef1f8, #f7f8fc) meant for a white background — paired with
   this theme's light text color, that's the exact white-on-white
   problem reported: a light hover patch with light text sitting on
   top of it. All of them get the same subtle dark-lightening tint
   used for buttons above instead. */
html[data-theme="dark"] .hist-row:hover, html[data-theme="dark"] .col-row:hover,
html[data-theme="dark"] .col-req-row:hover, html[data-theme="dark"] .shared-req-row:hover,
html[data-theme="dark"] .toc a:hover, html[data-theme="dark"] .screen-tile-foot button:hover,
html[data-theme="dark"] .result-row:hover, html[data-theme="dark"] .room-card:hover,
html[data-theme="dark"] .clear-btn:hover{
  background:#282e40 !important;
  color:var(--ink) !important;
}
html[data-theme="dark"] .col-actions button:hover, html[data-theme="dark"] .col-req-actions button:hover{
  background:#333a52 !important;
}

/* ================================================================
   Avatar / brand accents.
   ================================================================ */
html[data-theme="dark"] .avatar, html[data-theme="dark"] .brand-badge, html[data-theme="dark"] #meBadge,
html[data-theme="dark"] #meLabel, html[data-theme="dark"] #avatarBtn{
  background:var(--blue) !important;
  color:#fff !important;
}
html[data-theme="dark"] .avatar-menu{
  background:var(--sf-panel-2) !important;
  border:1px solid var(--sf-border) !important;
}
html[data-theme="dark"] .avatar-menu button:hover{ background:#282e40 !important; }

/* A handful of small badges/buttons that use --navy/--navy-2 as a
   BACKGROUND (paired with white text) rather than as text color —
   now that those two variables are bright (for the far more common
   text-color usage elsewhere), these need their own explicit dark
   treatment so white-on-white doesn't happen here specifically. */
html[data-theme="dark"] .history-badge, html[data-theme="dark"] .apply-style-btn,
html[data-theme="dark"] .row-type-badge.type-heading1{
  background:var(--sf-panel-2) !important; color:var(--blue) !important; border:1px solid var(--sf-border);
}
html[data-theme="dark"] .ask-panel{
  background:var(--sf-panel-2) !important;
  border:1px solid var(--sf-border) !important;
}

html[data-theme="dark"] .resize-handle{ background:var(--sf-panel) !important; border-color:var(--sf-border) !important; }
html[data-theme="dark"] .resize-handle::after{ background:var(--sf-border) !important; }
html[data-theme="dark"] .resize-handle:hover::after, html[data-theme="dark"] .resize-handle.dragging::after{
  background:var(--blue) !important;
}

html[data-theme="dark"] #gte-design-mode-border{ border-color:var(--blue) !important; }

/* Every other :hover rule already in each page's own <style> block
   that lightens a dark-nav element toward white (a subtle overlay
   tint, meant for that page's own dark navy nav bar) stays harmless
   here too, EXCEPT the couple that go fully solid white — those need
   a dark equivalent so white text on top of them doesn't disappear. */
html[data-theme="dark"] .nav-btn.primary:hover, html[data-theme="dark"] .api-docs-link:hover,
html[data-theme="dark"] .sidenav a:hover, html[data-theme="dark"] .ask-input-wrap .clear-btn:hover{
  background:#282e40 !important; color:var(--ink) !important; opacity:1 !important;
}

/* ================================================================
   Round 3 — everything else still showing a light/white background:
   the in-flight "Sending…" loading state and its skeleton placeholder
   bars (never seen until an actual request was sent), small pill/
   badge classes with a light pastel fill, a couple of focus/drag/
   hover states, and one nav link whose base (non-hover) fill was
   still white. Same story throughout: paired with this theme's light
   text color, any of these left as-is is white-on-white.
   ================================================================ */
html[data-theme="dark"] .api-docs-link{
  background:var(--blue) !important; color:#fff !important;
}
html[data-theme="dark"] .api-docs-link:hover{
  background:#3a7cf0 !important; opacity:1 !important;
}

/* "Sending…" state + skeleton loader (api-console.html) */
html[data-theme="dark"] .sending-meta{ background:var(--sf-panel) !important; border-color:var(--sf-border) !important; }
html[data-theme="dark"] .loading-bar-track{ background:var(--sf-border) !important; }
html[data-theme="dark"] .skeleton-line{
  background:linear-gradient(90deg, #232838 25%, #2d3348 37%, #232838 63%) !important;
  background-size:400px 100% !important;
}

/* Small light-pastel pill/badge/status classes → same dark-chip
   treatment as everywhere else, reusing the existing good/warn/danger
   accent variables so each still reads as ok/warning/error. */
html[data-theme="dark"] .status-banner.ok{
  background:var(--good-bg) !important; color:var(--good) !important; border:1px solid var(--good);
}
html[data-theme="dark"] .status-banner.error, html[data-theme="dark"] .status-banner.danger{
  background:var(--danger-bg) !important; color:var(--danger) !important; border:1px solid var(--danger);
}
html[data-theme="dark"] .status-banner.warn, html[data-theme="dark"] .status-banner.local{
  background:var(--warn-bg) !important; color:var(--warn) !important; border:1px solid var(--warn);
}
html[data-theme="dark"] .status-chip.warn{ background:var(--warn-bg) !important; color:var(--warn) !important; }
html[data-theme="dark"] .count-pill.sent, html[data-theme="dark"] .status-pill.s9,
html[data-theme="dark"] .builtin-tag, html[data-theme="dark"] .row-type-badge.type-text{
  background:var(--sf-panel-2) !important; color:var(--muted) !important;
}
html[data-theme="dark"] .resp-url{ background:#10131c !important; }
html[data-theme="dark"] .hotel-block-head{ background:var(--sf-panel-2) !important; }
html[data-theme="dark"] .passenger-row, html[data-theme="dark"] .room-row-card,
html[data-theme="dark"] .step-block{ background:var(--sf-panel) !important; border-color:var(--sf-border) !important; }
html[data-theme="dark"] .dropzone.drag{ background:var(--blue-light) !important; }
html[data-theme="dark"] .danger{ background:var(--sf-panel-2) !important; color:var(--danger) !important; }
html[data-theme="dark"] .danger:hover{ background:#3a2530 !important; color:var(--danger) !important; }
html[data-theme="dark"] .row-text:focus{ background:#10131c !important; }
html[data-theme="dark"] .copy-btn:hover{ background:#333a52 !important; color:var(--ink) !important; }

/* ================================================================
   Theme toggle button (mounted by assets/theme-toggle.js).
   ================================================================ */
#gte-theme-toggle-btn{
  width:34px; height:34px; border-radius:50%; border:none; cursor:pointer;
  background:rgba(255,255,255,.16); color:#fff; font-size:15px; display:inline-flex; align-items:center;
  justify-content:center; vertical-align:middle; margin-right:8px; flex:0 0 auto;
}
#gte-theme-toggle-btn:hover{ background:rgba(255,255,255,.28); }
