/* Master Screener - Light / Dark theme (additive)
   Dashboard already drives its whole look off 23 CSS variables on :root, so
   light mode is just a second set of values for [data-theme="light"]. This
   file is loaded after the dashboard's own inline <style>, so these values win. */

:root[data-theme="light"] {
  --bg:        #eef1f6;
  --surface:   #ffffff;
  --surface1:  #f6f8fb;
  --surface2:  #eef1f6;
  --border:    #dde3ee;
  --border2:   #c7d0e0;
  --green:     #00a86b;
  --green2:    #00c27a;
  --red:       #e0304a;
  --amber:     #c47a00;
  --blue:      #1f6fd6;
  --purple:    #7a4fe0;
  --muted:     #aab4c8;
  --text:      #16202e;
  --textdim:   #5b6980;
  --label:     #5b6980;
  --glow-g: 0 0 14px rgba(0,168,107,0.20);
  --glow-r: 0 0 14px rgba(224,48,74,0.20);
  --glow-a: 0 0 14px rgba(196,122,0,0.20);
  --glow-b: 0 0 14px rgba(31,111,214,0.20);
}

/* two labels in the dashboard hardcode white text for the dark background */
:root[data-theme="light"] .nav-logo-title,
:root[data-theme="light"] #navToggleBtn { color: var(--text) !important; }

html { transition: background-color 0.25s ease; }
body, .topbar, .card, .sidebar, .nav-item { transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease; }

/* ── toggle switch (sun / moon pill, styled after the reference clip) ── */
#msThemeToggle {
  position: fixed; z-index: 200;
  top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px;
  width: 52px; height: 28px; padding: 0; border: 0; border-radius: 999px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  background: linear-gradient(180deg, #1a2434, #0c121d);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 4px 10px rgba(0,0,0,0.35);
  transition: background 0.35s ease;
}
:root[data-theme="light"] #msThemeToggle {
  background: linear-gradient(180deg, #bcd4ff, #eef4ff);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08), 0 4px 10px rgba(30,80,180,0.18);
}
#msThemeToggle .knob {
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3a4560, #0c121d);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  transition: left 0.35s cubic-bezier(.3,1.4,.5,1), background 0.35s ease;
}
:root[data-theme="light"] #msThemeToggle .knob {
  left: 27px;
  background: radial-gradient(circle at 35% 30%, #fff7dd, #ffd76a);
  box-shadow: 0 2px 8px rgba(255,183,0,0.5);
}
#msThemeToggle .knob::after { content: '🌙'; line-height: 1; }
:root[data-theme="light"] #msThemeToggle .knob::after { content: '☀️'; }

/* keep clear of the mobile-app bottom bar / hero area */
body.m-app #msThemeToggle { top: calc(8px + env(safe-area-inset-top, 0px)); right: 8px; transform: scale(0.9); }

/* ── same toggle, reused on the standalone login/register pages ── */
.auth-theme-row { display: flex; justify-content: flex-end; margin-bottom: -4px; }

/* a few panels build their background from hardcoded dark rgba/hex instead of
   the --surface variable; give them a light-mode version too */
:root[data-theme="light"] .hero-chart-inner { background: rgba(255,255,255,0.85); }
:root[data-theme="light"] .hero-gauge-card,
:root[data-theme="light"] .hero-movers-card { background: linear-gradient(160deg, #ffffff, #f6f8fb); }
:root[data-theme="light"] .hero-gauge-inner { background: #eef1f6; }
:root[data-theme="light"] .ptx-field select,
:root[data-theme="light"] .ptx-input,
:root[data-theme="light"] .ptx-swap-btn { background: #ffffff; }
:root[data-theme="light"] .ana-report-frame { background: #ffffff; }
:root[data-theme="light"] .topbar-title { color: var(--text); }
