/* ============================================================
   screener.css  —  SwingScan dashboard styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg0: #0c0e12; --bg1: #111318; --bg2: #171b22;
  --bg3: #1e232d; --bg4: #252c38;
  --line: #2a3040;
  --t0: #eef0f4; --t1: #9ba3b4; --t2: #5e6778;
  --ac: #00e5ff; --gr: #00d68f; --rd: #ff4c6a;
  --gd: #ffc947; --pu: #b57aff; --or: #ff7f3f;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'DM Sans', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg0);
  color: var(--t0);
  font-family: var(--sans);
  font-size: 13px;
  overflow: hidden;
}

/* ── APP SHELL ─────────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-rows: 48px 34px 1fr;
  grid-template-columns: 480px 1fr;
  height: calc(100vh - 70px);
  overflow: hidden;
  max-width: 1900px;
  margin: 0 auto;
}

/* ── TOPBAR ────────────────────────────────────────────────── */
#topbar {
  grid-column: 1 / -1;
  background: var(--bg1);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
}

.logo {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ac);
  letter-spacing: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}
.logo em { color: var(--t2); font-style: normal; font-weight: 400; }

.tdiv { width: 1px; height: 20px; background: var(--line); flex-shrink: 0; }

.tb-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t2);
  white-space: nowrap;
  flex-shrink: 0;
}

.tb-input {
  flex: 1;
  min-width: 0;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--t0);
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 4px;
  outline: none;
  transition: border-color .15s;
}

#extra-syms {
  text-transform:uppercase;
}

.tb-input:focus { border-color: var(--ac); }

.tb-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--t1);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color .15s, color .15s;
}
.tb-btn:hover { border-color: var(--ac); color: var(--ac); }
.tb-btn.pri {
  background: var(--ac);
  border-color: var(--ac);
  color: #000;
  font-weight: 700;
}
.tb-btn.pri:hover { background: #33ecff; }

#sdot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--t2);
  flex-shrink: 0;
  transition: background .3s;
}
#sdot.spin { background: var(--gd); animation: blink .8s infinite; }
#sdot.ok   { background: var(--gr); }
#sdot.err  { background: var(--rd); }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

#stxt {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t2);
  min-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── TABBAR ────────────────────────────────────────────────── */
#tabbar {
  grid-column: 1 / -1;
  background: var(--bg1);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: stretch;
  padding: 0 16px;
  gap: 2px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--t2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  user-select: none;
}
.tab:hover { color: var(--t1); }
.tab.active { color: var(--t0); border-bottom-color: var(--ac); }

.tbadge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 10px;
  background: var(--bg3);
  color: var(--t2);
  transition: background .15s, color .15s;
}
.tab.active .tbadge { background: rgba(0,229,255,.15); color: var(--ac); }

/* ── LEFT PANEL ────────────────────────────────────────────── */
#left {
  background: var(--bg1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ph {
  padding: 9px 13px 7px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ptitle {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--t2);
}
.pmeta {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t2);
}

/* Swing filter pills */
.frow {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.fb {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--t2);
  font-family: var(--mono);
  font-size: 9px;
  padding: 3px 9px;
  border-radius: 16px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.fb:hover { border-color: var(--t1); color: var(--t1); }
.fb.on { background: var(--ac); border-color: var(--ac); color: #000; font-weight: 700; }

/* SI filter inputs */
.sif {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
}
.sif-g { display: flex; align-items: center; gap: 5px; }
.sif-g label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t2);
  letter-spacing: .5px;
  text-transform: uppercase;
}
.sif-in {
  width: 50px;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--t0);
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 3px;
  outline: none;
  text-align: center;
  transition: border-color .15s;
}
.sif-in:focus { border-color: var(--or); }

/* SI column headers */
.sich {
  display: grid;
  grid-template-columns: 44px 50px 48px 44px 50px 1fr;
  gap: 5px;
  padding: 4px 12px 3px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8px;
  color: var(--t2);
  letter-spacing: .5px;
  text-transform: uppercase;
  background: var(--bg0);
  flex-shrink: 0;
}
.sich span { text-align: right; }
.sich span:first-child { text-align: left; }

/* Group headers inside list */
.grp-hdr {
  padding: 6px 13px 4px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--t2);
  background: var(--bg0);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}

/* Ticker list scroll area */
#list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0 50px;
}
#list::-webkit-scrollbar { width: 3px; }
#list::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

/* ── SWING TICKER ROW ──────────────────────────────────────── */
.tr-s {
  display: grid;
  grid-template-columns: 35px 320px 42px 25px 1fr;
  align-items: center;
  gap: 5px;
  padding: 8px 5px;
  cursor: pointer;
  border-left: 2px solid transparent;
  border-bottom: 1px solid rgba(255,255,255,.025);
  transition: background .12s;
  position:relative;
}
.tr-s:hover { background: var(--bg2); }
.tr-s.on    { background: var(--bg3); border-left-color: var(--ac); }

.tsym { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--t0); }
.tpb  { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tsig { font-size: 9px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width:300px;}

.sw { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.sn { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.sb { width: 38px; height: 3px; background: var(--bg4); border-radius: 2px; overflow: hidden; }
.sbf { height: 100%; border-radius: 2px; transition: width .4s; }

.gr { font-family: var(--mono); font-size: 9px; font-weight: 700; padding: 2px 4px; border-radius: 3px; text-align: center; }
.gAp { background: rgba(0,214,143,.18); color: #00d68f; }
.gA  { background: rgba(122,223,170,.15); color: #7adfaa; }
.gBp { background: rgba(255,201,71,.15); color: #ffc947; }
.gB  { background: rgba(245,166,35,.15); color: #f5a623; }
.gC  { background: rgba(255,76,106,.15); color: #ff4c6a; }

/* ── SI TICKER ROW ─────────────────────────────────────────── */
.tr-i {
  display: grid;
  grid-template-columns: 44px 50px 48px 44px 50px 1fr;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  cursor: pointer;
  border-left: 2px solid transparent;
  border-bottom: 1px solid rgba(255,255,255,.025);
  transition: background .12s;
}
.tr-i:hover { background: var(--bg2); }
.tr-i.on    { background: var(--bg3); border-left-color: var(--or); }

.cv { font-family: var(--mono); font-size: 10px; color: var(--t0); text-align: right; }
.cv.hi  { color: var(--rd); }
.cv.med { color: var(--gd); }
.cv.lo  { color: var(--t1); }
.cv.nd  { color: var(--t2); font-style: italic; }

.sqb { font-family: var(--mono); font-size: 8px; font-weight: 700; padding: 2px 5px; border-radius: 3px; white-space: nowrap; }
.sqe { background: rgba(255,76,106,.2);  color: #ff4c6a; border: 1px solid rgba(255,76,106,.4); }
.sqh { background: rgba(255,201,71,.2);  color: #ffc947; border: 1px solid rgba(255,201,71,.4); }
.sqm { background: rgba(255,127,63,.2);  color: #ff7f3f; border: 1px solid rgba(255,127,63,.4); }
.sql { background: rgba(90,100,120,.2);  color: var(--t2); }


.remove-btn,
.add-btn,
.added-badge {
  position: relative;
  font-size: 16px;
  font-weight: bold;
  text-align:center;
  cursor: pointer;
  border: none;
  border-radius: 5px;
  opacity: 0.7;
}

.remove-btn {
  color: #ff4c6a;
}
.remove-btn:hover {
  background: #3a2a2a;
  opacity: 1;
}

.add-btn {
  background: #00d68f;
  color: #0c0e12;
}

.add-btn:hover {
  background: #00b87a;
}

.added-badge {
  background: #2a3a2a;
  color: #00d68f;
}

/* ── RIGHT / DETAIL PANEL ──────────────────────────────────── */
#right {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg0);
}

/* Placeholder */
.dph {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--t2);
}
.dph .ic { font-size: 30px; opacity: .2; }
.dph p   { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; }

/* Detail header — hidden by default, shown via JS */
#dh {
  display: none;
  padding: 11px 18px 9px;
  background: var(--bg1);
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
  gap: 14px;
  flex-shrink: 0;
}
.dsym  { font-family: var(--mono); font-size: 20px; font-weight: 600; line-height: 1; }
.dprice { font-family: var(--mono); font-size: 16px; color: var(--ac); line-height: 1; }
.dchg  { font-family: var(--mono); font-size: 11px; line-height: 1; }
.dsb   { display: flex; flex-direction: column; gap: 4px; }
.dr2   { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.dsp   { flex: 1; }

.ptag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 16px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid;
}

.dgr { font-family: var(--mono); font-size: 24px; font-weight: 700; line-height: 1; }
.dgs { font-family: var(--mono); font-size: 11px; color: var(--t1); margin-top: 2px; }

/* Detail body — hidden by default, shown via JS */
#db {
  display: none;
  flex: 1;
  overflow: hidden;
}

#dg {
  display: grid;
  grid-template-columns: 1fr 350px;
  height: 100%;
  overflow: hidden;
}

/* Chart column */
#cc {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
}
#dc { min-height: 0; }

/* Chart EMA controls */
#ctl {
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  background: var(--bg1);
  display: flex;
  gap: 9px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.ctl-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t2);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.et { display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10px; cursor: pointer; }
.et input { display: none; }
.ed { width: 8px; height: 8px; border-radius: 50%; border: 1px solid currentColor; transition: background .15s; }
.et input:checked ~ .ed { background: currentColor; }

/* Trade Analysis Section */
.analysis-block {
    margin-bottom: 14px;
}
.analysis-subtitle {
    font-family: var(--mono);
    font-size: 10px;
    color: #9ba3b4;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 5px;
    font-weight: 500;
}
.analysis-text {
    font-size: 12px;
    color: #d1d5db;
    line-height: 1.5;
}
.analysis-text ul {
    margin: 6px 0 0 16px;
    padding: 0;
}
.analysis-text li {
    margin-bottom: 4px;
}

/* ── SIDEBARS ──────────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg1);
}

.sss {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.ssl {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--t2);
  margin-bottom: 7px;
}

.gauge-val {
  color: var(--t0);
  font-size: 11px;
  font-family: var(--mono);
}

/* Playbook score bars */
.pbr {
  display: grid;
  grid-template-columns: 95px 1fr 25px;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}
.pbn { font-size: 10px; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbb { height: 3px; background: var(--bg4); border-radius: 2px; overflow: hidden; }
.pbf { height: 100%; border-radius: 2px; background: var(--ac); transition: width .5s; }
.pbf.b { background: var(--gr); }
.pbv { font-family: var(--mono); font-size: 10px; color: var(--t1); text-align: right; }

/* Signal list (why this setup) */
.sl {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
  padding: 8px 13px;
}
.sl::-webkit-scrollbar { width: 3px; }
.sl::-webkit-scrollbar-thumb { background: var(--bg4); }

.sig-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11px;
  color: var(--t1);
  line-height: 1.4;
}
.sig-item::before {
  content: '›';
  color: var(--ac);
  font-size: 12px;
  flex-shrink: 0;
  line-height: 1.3;
}

/* Preferred Execution - matches Why This Setup styling */
.preferred-exec {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 4px;
}

.pref-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 11px;
    color: var(--t1);
    line-height: 1.45;
}

.pref-item::before {
    content: '›';
    color: var(--ac);
    font-size: 12px;
    flex-shrink: 0;
    line-height: 1.3;
}

.pref-label {
    font-weight: 500;
    color: #c5c9d1;
    white-space: nowrap;
    flex-shrink: 0;
}

.pref-value {
    color: var(--t1);
}

/* Optional: make the "Best trade here" line stand out slightly */
.preferred-exec > div:first-child {
    font-size: 11px;
    color: var(--t1);
    margin-bottom: 2px;
}

/* Small Confluence badge (used inside the card) */
.confluence-badge {
    background: #003d1f;
    color: #00e676;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 500;
}

/* Optional: small badge if you ever want it in the list rows again */
.cf-badge {
    background: #00c853;
    color: #fff;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

/* Optional: keep these if you still use them elsewhere */
.opt-str {
    font-size: 10px;
    color: #00b8ff;
    margin-top: 2px;
    line-height: 1.2;
}
/* Tech grid */
.tg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.tc { background: var(--bg2); padding: 6px 8px; }
.tk { font-family: var(--mono); font-size: 9px; color: var(--t2); letter-spacing: .5px; text-transform: uppercase; }
.tv { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--t0); margin-top: 1px; }
.tv.p { color: var(--gr); }
.tv.n { color: var(--rd); }
.tv.w { color: var(--gd); }
.tv.i { color: var(--ac); }

/* EMA pip badges */
.eps { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 5px; }
.ep {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 9px;
}
.ep.ab { background: rgba(0,214,143,.12);  color: var(--gr); }
.ep.bl { background: rgba(255,76,106,.12); color: var(--rd); }
.ep.nr { background: rgba(0,229,255,.12);  color: var(--ac); }

/* Gauge (SMI / RSI) */
.smg {
  position: relative;
  height: 6px;
  background: linear-gradient(to right, var(--gr), var(--bg4) 40%, var(--bg4) 60%, var(--rd));
  border-radius: 3px;
}
.smg-rsi {
  background: linear-gradient(to right, var(--gr), var(--bg4) 28%, var(--bg4) 72%, var(--rd));
}
.smn {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 14px;
  background: var(--t0);
  border-radius: 1px;
  transform: translateX(-50%);
  transition: left .5s;
  box-shadow: 0 0 4px rgba(255,255,255,.3);
}
.sml {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 8px;
  color: var(--t2);
}

/* ── SI DETAIL SIDEBAR ─────────────────────────────────────── */
.si-sg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.si-s  { background: var(--bg2); padding: 7px 9px; }
.si-sk { font-family: var(--mono); font-size: 9px; color: var(--t2); text-transform: uppercase; letter-spacing: .5px; }
.si-sv { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--t0); margin-top: 2px; }
.si-sv.hi  { color: var(--rd); }
.si-sv.med { color: var(--gd); }
.si-sv.ok  { color: var(--gr); }

/* Source + filter pills */
.srcb { font-family: var(--mono); font-size: 9px; padding: 1px 6px; border-radius: 10px; }
.s-both  { background: rgba(0,214,143,.15); color: var(--gr); }
.s-fin   { background: rgba(0,229,255,.15); color: var(--ac); }
.s-schw  { background: rgba(181,122,255,.15); color: var(--pu); }
.s-none  { background: var(--bg3); color: var(--t2); }

.fps { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px; }
.fp  { font-family: var(--mono); font-size: 9px; padding: 2px 6px; border-radius: 10px; }
.fp.pass    { background: rgba(0,214,143,.12);  color: var(--gr); }
.fp.fail    { background: rgba(255,76,106,.1);  color: var(--rd); }
.fp.no_data { background: var(--bg3); color: var(--t2); }

.tf-btn {
    background: #1e232d;
    border: 1px solid #2a3040;
    color: #9ba3b4;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}
.tf-btn:hover { background: #252c38; }
.tf-btn.active {
    background: #00e5ff;
    color: #0c0e12;
    border-color: #00e5ff;
    font-weight: 600;
}

/* ── MISC ──────────────────────────────────────────────────── */
.mt-a { margin-top: auto; }

.es {
  padding: 40px 16px;
  text-align: center;
  color: var(--t2);
  font-size: 11px;
  line-height: 1.7;
}

/* Fade-in animation for new rows */
@keyframes fi { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.fi { animation: fi .2s ease; }

/* Skeleton loader shimmer */
.sk {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: sh 1.2s infinite;
  border-radius: 3px;
}
@keyframes sh { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
 
/* =============================================================================
   DISCLAIMER FOOTER
   ============================================================================= */
 
#disclaimer {
    text-align: center;
    padding: 10px 20px;
    font-size: 14px;
    line-height:20px;
    color: var(--t2);
    border-top: 1px solid var(--line);
    background: var(--bg1);
    position:absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    z-index: 100;
}

/* Global scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--bg4) transparent; }