/* Streak Snapper — overrides on top of Notika + Bootstrap.
 *
 * Load order matters: bootstrap → icons → notika → this file. Everything here
 * is prefixed `ss-` so it can't collide with theme classes.
 *
 * Every colour lives in this block. The old JS carried its own hardcoded hex
 * values, which meant a palette change had to be made in two places and they
 * drifted; the JS now reads these via getComputedStyle.
 */
:root {
  --ss-bg:        #f3f6f9;
  --ss-card:      #ffffff;
  --ss-border:    #e4e9f0;
  --ss-text:      #33383e;
  --ss-muted:     #7b8794;

  --ss-accent:    #00c292;  /* Notika green */
  --ss-up:        #00c292;
  --ss-down:      #fb9678;
  --ss-ok:        #00c292;
  --ss-warn:      #fec107;
  --ss-err:       #e46a76;
  --ss-fade:      #7b68ee;
  --ss-trend:     #03a9f4;
  --ss-btc:       #f7931a;

  --ss-radius:    6px;
  --ss-shadow:    0 1px 3px rgba(0,0,0,.06);
}

body.ss-body {
  background: var(--ss-bg);
  color: var(--ss-text);
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.ss-main { padding-bottom: 1rem; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */

.ss-topbar {
  background: var(--ss-card);
  border-bottom: 1px solid var(--ss-border);
  padding: .6rem 0;
  margin-bottom: .25rem;
  position: sticky; top: 0; z-index: 1030;
}
.ss-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--ss-radius);
  background: var(--ss-accent); color: #fff; font-size: 17px;
}
.ss-logo-lg { width: 52px; height: 52px; font-size: 26px; }
.ss-brand strong { font-size: 16px; }
.ss-brand small { font-size: 11px; }

.ss-nav-link {
  padding: .35rem .75rem; border-radius: var(--ss-radius);
  color: var(--ss-muted); text-decoration: none; font-size: 13px;
  white-space: nowrap;
}
.ss-nav-link:hover { background: var(--ss-bg); color: var(--ss-text); }
.ss-nav-link.active { background: var(--ss-accent); color: #fff; }

.ss-badge {
  display: inline-block; padding: .2rem .5rem; border-radius: 3px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.ss-badge.ok    { background: rgba(0,194,146,.14);  color: #00987a; }
.ss-badge.err   { background: rgba(228,106,118,.14); color: #d0505d; }
.ss-badge.warn  { background: rgba(254,193,7,.18);   color: #a37c00; }
.ss-badge.off   { background: rgba(123,135,148,.14); color: var(--ss-muted); }
.ss-badge.paper { background: rgba(3,169,244,.14);   color: #0277bd; }
.ss-badge.real  { background: rgba(228,106,118,.16); color: #d0505d; }

.ss-spot { font-size: 12px; color: var(--ss-muted); white-space: nowrap; }
.ss-spot .ss-spot-val { color: var(--ss-btc); font-weight: 600; margin-left: .25rem; }

/* ── Cards / KPIs ────────────────────────────────────────────────────────── */

.ss-card {
  background: var(--ss-card); border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius); padding: 1rem;
}
.ss-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem;
}
.ss-card-head h2 {
  font-size: 14px; font-weight: 600; margin: 0; color: var(--ss-text);
}
.ss-card-head h2 i { color: var(--ss-accent); margin-right: .25rem; }

.ss-kpi {
  background: var(--ss-card); border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius); padding: .85rem 1rem;
  display: flex; flex-direction: column; gap: .15rem;
}
.ss-kpi-label { font-size: 11px; text-transform: uppercase;
                letter-spacing: .04em; color: var(--ss-muted); }
.ss-kpi-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.ss-kpi-sub   { font-size: 11px; color: var(--ss-muted); }

.ss-pos { color: var(--ss-ok); }
.ss-neg { color: var(--ss-err); }

/* ── Charts ──────────────────────────────────────────────────────────────── */

/* Fixed height so Chart.js has a box to fit; without it a responsive canvas
   in a flex column grows on every resize. */
.ss-chart-box { position: relative; height: 240px; }
.ss-chart-box canvas { max-height: 240px; }

.ss-price-chart { min-height: 200px; }
.ss-price-chart svg { width: 100%; height: auto; }

.ss-empty {
  color: var(--ss-muted); font-size: 12px; text-align: center; padding: 1.5rem;
}

/* ── Martingale ──────────────────────────────────────────────────────────── */

.ss-mart {
  border: 1px solid var(--ss-border); border-radius: var(--ss-radius);
  padding: .75rem; border-left: 3px solid var(--ss-muted); height: 100%;
}
.ss-mart.fade  { border-left-color: var(--ss-fade); }
.ss-mart.trend { border-left-color: var(--ss-trend); }
.ss-mart-head  { font-size: 12px; font-weight: 600; margin-bottom: .5rem; }
.ss-mart-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--ss-muted); padding: .15rem 0;
}
.ss-mart-val { color: var(--ss-text); font-weight: 600; }
/* Loud on purpose: ×5 on a 1.5 martingale is 11× the base bet. */
.ss-mart-val.hot { color: var(--ss-err); }
/* A locked cycle is a state, not a problem — accent, not alarm. */
.ss-mart-val.locked { color: var(--ss-trend); }
.ss-mart-val.muted  { color: var(--ss-muted); font-weight: 500; }

/* ── Bot status ──────────────────────────────────────────────────────────── */

.ss-status-row { display: flex; align-items: center; gap: .5rem;
                 font-weight: 600; margin-bottom: .25rem; }
.ss-status-dot { width: 9px; height: 9px; border-radius: 50%;
                 background: var(--ss-muted); flex: none; }
.ss-status-dot.running { background: var(--ss-ok); }
.ss-status-dot.waiting { background: var(--ss-warn); }
.ss-status-dot.error   { background: var(--ss-err); }

.ss-meta { border-top: 1px solid var(--ss-border); padding-top: .5rem; }
.ss-meta-row {
  display: flex; justify-content: space-between; font-size: 12px;
  padding: .15rem 0; color: var(--ss-muted);
}
.ss-meta-row span:last-child { color: var(--ss-text); }

/* ── Prices / order book ─────────────────────────────────────────────────── */

.ss-price {
  border: 1px solid var(--ss-border); border-radius: var(--ss-radius);
  padding: .65rem; text-align: center; border-top: 3px solid var(--ss-muted);
}
.ss-price.up   { border-top-color: var(--ss-up); }
.ss-price.down { border-top-color: var(--ss-down); }
.ss-price-label { font-size: 11px; font-weight: 700; color: var(--ss-muted); }
.ss-price-mid   { font-size: 20px; font-weight: 700; }
.ss-price-bidask { font-size: 11px; color: var(--ss-muted);
                   display: flex; justify-content: space-between; }
.ss-price-bidask .bid { color: var(--ss-up); }
.ss-price-bidask .ask { color: var(--ss-down); }

.ss-sparklines svg { width: 100%; height: 30px; }

.ss-ob-side { border: 1px solid var(--ss-border);
              border-radius: var(--ss-radius); padding: .5rem; }
.ss-ob-title { font-size: 11px; font-weight: 700; margin-bottom: .35rem; }
.ss-ob-row {
  display: flex; justify-content: space-between; font-size: 11px;
  padding: 1px 0; font-variant-numeric: tabular-nums;
}
.ss-ob-row .bid { color: var(--ss-up); }
.ss-ob-row .ask { color: var(--ss-down); }

/* ── Trades table ────────────────────────────────────────────────────────── */

.ss-filters label { font-size: 11px; }

.ss-trades { font-size: 12px; }
.ss-trades thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--ss-muted); font-weight: 600; border-bottom: 2px solid var(--ss-border);
  white-space: nowrap;
}
.ss-trades td { font-variant-numeric: tabular-nums; }
.ss-trades .strat-fade  { color: var(--ss-fade); font-weight: 600; }
.ss-trades .strat-trend { color: var(--ss-trend); font-weight: 600; }
.ss-trades .side-up   { color: var(--ss-up); font-weight: 600; }
.ss-trades .side-down { color: var(--ss-down); font-weight: 600; }

.ss-pill {
  display: inline-block; padding: .1rem .4rem; border-radius: 3px;
  font-size: 10px; font-weight: 600;
}
.ss-pill.won  { background: rgba(0,194,146,.14);  color: #00987a; }
.ss-pill.lost { background: rgba(228,106,118,.14); color: #d0505d; }
.ss-pill.open { background: rgba(254,193,7,.18);   color: #a37c00; }

/* ── Log ─────────────────────────────────────────────────────────────────── */

.ss-log {
  list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
}
.ss-log li {
  padding: .2rem .4rem; border-bottom: 1px solid var(--ss-border);
  display: flex; gap: .5rem;
}
.ss-log li:last-child { border-bottom: none; }
.ss-log .t { color: var(--ss-muted); flex: none; }
.ss-log .lvl-ok   { color: var(--ss-ok); }
.ss-log .lvl-warn { color: #a37c00; }
.ss-log .lvl-err  { color: var(--ss-err); }

/* ── Login ───────────────────────────────────────────────────────────────── */

.ss-login-body { background: var(--ss-bg); }
.ss-login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.ss-login-card {
  background: var(--ss-card); border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius); padding: 2rem; width: 100%; max-width: 360px;
}

/* ── Settings ────────────────────────────────────────────────────────────── */

.ss-field-label { font-size: 12px; font-weight: 600; }
.ss-field-hint  { font-size: 11px; color: var(--ss-muted); }

/* Marks a value that came from a saved override rather than the .env. */
.ss-overridden { border-left: 3px solid var(--ss-warn); padding-left: .5rem; }

.ss-mode-card {
  border: 2px solid var(--ss-border); border-radius: var(--ss-radius);
  padding: .75rem; cursor: pointer; text-align: center; height: 100%;
}
.ss-mode-card:hover  { border-color: var(--ss-accent); }
.ss-mode-card.active { border-color: var(--ss-accent);
                       background: rgba(0,194,146,.06); }
.ss-mode-card h6 { font-size: 13px; margin: .25rem 0; }
.ss-mode-card p  { font-size: 11px; color: var(--ss-muted); margin: 0; }

/* Strategy cards - hide inactive ones instead of just dimming them.
   This keeps the dashboard clean and focused on active strategies only. */
.ss-strategy-block { border-left: 3px solid var(--ss-border); padding-left: .75rem; }
.ss-strategy-off { display: none; }


/* ── Asset selector ──────────────────────────────────────────────────────── */

.ss-symbol-tabs { display: flex; gap: .5rem; flex-wrap: wrap; }
.ss-symbol-tab {
  border: 1px solid var(--ss-border); border-radius: var(--ss-radius);
  background: transparent; color: var(--ss-muted);
  padding: .3rem .9rem; font-size: 12px; font-weight: 600; cursor: pointer;
}
.ss-symbol-tab:hover  { border-color: var(--ss-accent); color: var(--ss-text); }
.ss-symbol-tab.active {
  border-color: var(--ss-accent); color: var(--ss-text);
  background: rgba(0,194,146,.08);
}
/* The market the live panel is currently describing. */
.ss-mart-active { border-left-color: var(--ss-accent); }

@media (max-width: 576px) {
  .ss-kpi-value { font-size: 18px; }
  .ss-chart-box { height: 200px; }
}
