/* ═══════════════════════════════════════════════
   dashboard.css — Portfolio Screener Styles
   ═══════════════════════════════════════════════ */

:root {
  --bg:      #080b12;
  --surface: #0d1018;
  --card:    #111520;
  --border:  #1b2133;
  --border2: #232d42;
  --green:   #00e676;
  --red:     #ff4560;
  --blue:    #4f8ef7;
  --yellow:  #f59e0b;
  --purple:  #a855f7;
  --text:    #d8dce8;
  --muted:   #526080;
  --muted2:  #2c3550;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Heebo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
}

/* ── HEADER ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 300;
}
.logo { display: flex; align-items: center; gap: 11px; }
.logo-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700; font-size: 14px; color: #000;
}
.logo h1 { font-size: 15px; font-weight: 800; }
.logo p  { font-size: 10px; color: var(--muted); margin-top: 1px; }

.hdr-r { display: flex; align-items: center; gap: 10px; }
.live-badge {
  display: flex; align-items: center; gap: 5px;
  background: rgba(0,230,118,.07);
  border: 1px solid rgba(0,230,118,.2);
  color: var(--green);
  padding: 4px 12px; border-radius: 20px;
  font-size: 11px; font-family: 'IBM Plex Mono', monospace;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: blink 1.8s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.15} }
.last-upd { font-size: 11px; color: var(--muted); font-family: 'IBM Plex Mono', monospace; }

/* ── MAIN ── */
main { padding: 20px 24px; }

/* ── COLUMN CHOOSER ── */
.chooser {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: none;
}
.chooser.open { display: block; }
.chooser-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 12px;
}
.grp-row { margin-bottom: 12px; }
.grp-lbl {
  font-size: 10px; color: var(--muted2);
  text-transform: uppercase; letter-spacing: .7px;
  font-weight: 700; margin-bottom: 6px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 12px; border-radius: 7px;
  border: 1px solid var(--border2);
  background: var(--surface);
  cursor: pointer; font-size: 12px; color: var(--muted);
  transition: all .14s; user-select: none;
  display: flex; align-items: center; gap: 5px;
}
.chip:hover { border-color: var(--blue); color: var(--text); }
.chip.on { border-color: var(--blue); background: rgba(79,142,247,.1); color: var(--blue); }

/* ── TOOLBAR ── */
.toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 16px;
  margin-bottom: 16px;
}
.toolbar-lbl { font-size: 12px; color: var(--muted); white-space: nowrap; }
.toolbar-sep {
  width: 1px; height: 22px;
  background: var(--border2);
  margin: 0 4px;
}

input, select {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 6px 11px; border-radius: 7px;
  font-size: 13px; font-family: 'Heebo', sans-serif;
  transition: border-color .14s;
}
input:focus, select:focus { outline: none; border-color: var(--blue); }
input::placeholder { color: var(--muted2); }
#inp-sym  { font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; width: 145px; }
#inp-name { width: 145px; }

.btn {
  padding: 6px 16px; border-radius: 7px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  font-family: 'Heebo', sans-serif; transition: all .14s;
  white-space: nowrap;
}
.btn-add  { background: var(--green); color: #000; }
.btn-add:hover  { filter: brightness(1.1); transform: translateY(-1px); }
.btn-sec  { background: var(--surface); border: 1px solid var(--border2); color: var(--muted); }
.btn-sec:hover  { border-color: var(--blue); color: var(--blue); }
.btn-danger { background: var(--surface); border: 1px solid var(--border2); color: var(--red); }
.btn-danger:hover { border-color: var(--red); background: rgba(255,69,96,.08); }

.spin { display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TABLE ── */
.tbl-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.tbl-bar {
  padding: 11px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.tbl-bar h2 { font-size: 14px; font-weight: 700; }
.tbl-count { font-size: 12px; color: var(--muted); font-family: 'IBM Plex Mono', monospace; }

.tbl-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  padding: 8px 13px; text-align: right;
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
  background: rgba(255,255,255,.015);
  border-bottom: 1px solid var(--border);
  white-space: nowrap; cursor: pointer; user-select: none;
  transition: color .12s;
  position: relative;
}
thead th:hover { color: var(--text); }
thead th.sorted { color: var(--blue); }

/* ── CUSTOM TOOLTIP ON TH ── */
thead th[title]:hover::after {
  content: attr(title);
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #1c2236;
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 7px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  width: max-content;
  max-width: 260px;
  line-height: 1.5;
  z-index: 200;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  pointer-events: none;
  animation: fadeInTip .15s ease;
}
thead th[title]:hover::before {
  content: '';
  position: absolute;
  top: 100%;
  right: 14px;
  border: 5px solid transparent;
  border-bottom-color: var(--border2);
  z-index: 201;
}
@keyframes fadeInTip {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.022); }

td {
  padding: 9px 13px; white-space: nowrap;
  font-family: 'IBM Plex Mono', monospace;
  vertical-align: middle;
}

/* ── SYMBOL CELL ── */
.sym-cell { display: flex; flex-direction: column; gap: 1px; }
.sym-t    { font-weight: 700; font-size: 13px; }
.sym-he   { font-size: 12px; color: var(--text); font-family: 'Heebo', sans-serif; font-weight: 600; }
.sym-exch { font-size: 10px; color: var(--muted2); font-family: 'IBM Plex Mono', monospace; }

/* ── COLORS ── */
.pos { color: var(--green); }
.neg { color: var(--red); }
.neu { color: var(--muted); }

/* ── PILLS ── */
.pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; font-family: 'Heebo', sans-serif;
}
.p-g { background: rgba(0,230,118,.08); color: var(--green);  border: 1px solid rgba(0,230,118,.2); }
.p-r { background: rgba(255,69,96,.08);  color: var(--red);    border: 1px solid rgba(255,69,96,.2); }
.p-b { background: rgba(79,142,247,.08); color: var(--blue);   border: 1px solid rgba(79,142,247,.2); }
.p-m { background: rgba(255,255,255,.05); color: var(--muted); border: 1px solid var(--border2); }
.p-y { background: rgba(245,158,11,.08); color: var(--yellow); border: 1px solid rgba(245,158,11,.2); }

/* ── TREND BAR ── */
.trend-wrap { display: flex; align-items: center; gap: 6px; }
.trend-bg   { width: 56px; height: 4px; background: var(--border2); border-radius: 2px; overflow: hidden; }
.trend-fill { height: 100%; border-radius: 2px; transition: width .4s; }
.trend-lbl  { font-size: 11px; font-family: 'Heebo', sans-serif; min-width: 42px; }

/* ── MINI BAR (Bollinger) ── */
.mini-bar-bg   { width: 44px; height: 4px; background: var(--border2); border-radius: 2px; overflow: hidden; display: inline-block; }
.mini-bar-fill { height: 100%; border-radius: 2px; display: block; }

/* ── RSI SIGNAL DOT ── */
.sig-dot  { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 4px; }
.sd-buy   { background: var(--green); box-shadow: 0 0 4px var(--green); }
.sd-sell  { background: var(--red);   box-shadow: 0 0 4px var(--red); }
.sd-neu   { background: var(--muted); }

/* ── NOTE CELL ── */
.note-cell {
  max-width: 200px; overflow: hidden; text-overflow: ellipsis;
  font-family: 'Heebo', sans-serif; font-size: 12px; color: var(--muted);
  cursor: pointer; transition: color .14s;
}
.note-cell:hover { color: var(--text); }
.note-add { color: var(--muted2); font-style: italic; }

/* ── ACTION BUTTONS IN TABLE ── */
.btn-sm {
  background: none; border: 1px solid var(--border2); cursor: pointer;
  color: var(--muted); font-size: 11px; padding: 2px 8px; border-radius: 20px;
  font-family: 'Heebo', sans-serif; font-weight: 600; transition: all .14s;
}
.btn-sm:hover { border-color: var(--blue); color: var(--blue); }
.btn-del { border: none; font-size: 14px; padding: 2px 5px; background: none; cursor: pointer; color: var(--muted); transition: color .14s; }
.btn-del:hover { color: var(--red); }

.tv-a {
  color: var(--muted); text-decoration: none; font-size: 12px;
  padding: 2px 7px; border: 1px solid var(--border2); border-radius: 5px;
  transition: all .14s; font-family: 'Heebo', sans-serif;
}
.tv-a:hover { border-color: var(--blue); color: var(--blue); }
.btn-chart {
  background: none; cursor: pointer; font-size: 12px;
  padding: 2px 7px; border: 1px solid var(--border2); border-radius: 5px;
  color: var(--muted); font-family: 'Heebo', sans-serif; transition: all .14s;
}
.btn-chart:hover { border-color: var(--blue); color: var(--blue); }

/* ── WARNING / DEBUG BARS ── */
.warn-bar {
  padding: 8px 16px; margin-bottom: 10px;
  background: rgba(245,158,11,.07);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: 8px;
  font-size: 12px; color: var(--yellow);
  font-family: 'Heebo', sans-serif;
  display: none;
}
.warn-bar.show { display: block; }

.debug-panel {
  background: rgba(255,69,96,.05);
  border: 1px solid rgba(255,69,96,.2);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 14px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--red);
  display: none; white-space: pre-wrap; word-break: break-all;
}
.debug-panel.show { display: block; }

/* ── MODAL ── */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.82); z-index: 500;
  align-items: center; justify-content: center;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 14px; width: min(980px,95vw); height: min(640px,90vh);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-hdr {
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-hdr span { font-weight: 700; font-size: 14px; }
.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 22px; cursor: pointer; line-height: 1; transition: color .14s;
}
.modal-close:hover { color: var(--red); }
.modal-body { flex: 1; overflow: hidden; }
.modal-body iframe { width: 100%; height: 100%; border: none; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(70px);
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--text); padding: 8px 20px; border-radius: 10px;
  font-size: 13px; z-index: 999;
  transition: transform .3s; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── FOOTER ── */
footer {
  text-align: center; padding: 20px;
  color: var(--muted2); font-size: 11px;
  border-top: 1px solid var(--border); margin-top: 24px;
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  main { padding: 14px 12px; }
  header { padding: 12px 14px; }
  .toolbar { gap: 6px; }
  #inp-sym, #inp-name { width: 120px; }
}

/* ══════════════════════════════════════════════
   FILTER SECTION
   ══════════════════════════════════════════════ */
.filter-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 5px 12px;
  transition: border-color .14s;
}
.search-wrap:focus-within { border-color: var(--blue); }
.search-icon { font-size: 14px; color: var(--muted); }
.search-wrap input {
  background: none;
  border: none;
  padding: 2px 0;
  font-size: 13px;
  flex: 1;
  color: var(--text);
  font-family: 'Heebo', sans-serif;
}
.search-wrap input:focus { outline: none; }
.search-wrap input::placeholder { color: var(--muted2); }
.btn-clear-search {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color .14s;
}
.btn-clear-search:hover { color: var(--red); }

.filter-chips-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-lbl {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 600;
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.filter-chip {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  font-family: 'Heebo', sans-serif;
  font-weight: 600;
  transition: all .14s;
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--blue); color: var(--text); }
.filter-chip.active {
  border-color: var(--blue);
  background: rgba(79,142,247,.15);
  color: var(--blue);
}
.btn-clear-filter {
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: 'Heebo', sans-serif;
  font-weight: 600;
  white-space: nowrap;
  transition: all .14s;
}
.btn-clear-filter:hover { border-color: var(--red); color: var(--red); }

/* ══════════════════════════════════════════════
   ALERTS BUTTON & BADGE
   ══════════════════════════════════════════════ */
.btn-alert {
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.3);
  color: var(--yellow);
  position: relative;
}
.btn-alert:hover {
  background: rgba(245,158,11,.15);
  border-color: var(--yellow);
  color: var(--yellow);
}
.alert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--yellow);
  color: #000;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-right: 4px;
}

/* ══════════════════════════════════════════════
   ALERTS MODAL
   ══════════════════════════════════════════════ */
.modal-alerts {
  width: min(620px, 95vw) !important;
  height: auto !important;
  max-height: 90vh;
}

.alerts-desc {
  font-size: 12px;
  color: var(--muted);
  font-family: 'Heebo', sans-serif;
  background: rgba(255,255,255,.03);
  border-radius: 8px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  line-height: 1.5;
}

/* שורת התראה קיימת */
.alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1px solid var(--border2);
  background: var(--surface);
  transition: border-color .14s, opacity .14s;
}
.alert-row.alert-disabled { opacity: .5; }
.alert-row-left  { display: flex; align-items: center; gap: 12px; }
.alert-row-right { display: flex; align-items: center; gap: 8px; }
.alert-desc { display: flex; flex-direction: column; gap: 2px; }
.alert-desc strong { font-size: 13px; font-weight: 700; }
.alert-desc span   { font-size: 11px; color: var(--muted); font-family: 'IBM Plex Mono', monospace; }

.alert-color-dot {
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-family: 'Heebo', sans-serif;
  font-weight: 600;
}

/* Toggle switch */
.alert-toggle { position: relative; display: inline-block; width: 34px; height: 19px; cursor: pointer; }
.alert-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border2);
  border-radius: 19px;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 13px; height: 13px;
  left: 3px; bottom: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
.alert-toggle input:checked + .toggle-slider { background: rgba(0,230,118,.25); }
.alert-toggle input:checked + .toggle-slider::before {
  transform: translateX(15px);
  background: var(--green);
}

/* טופס הוספת התראה */
.alert-add-form {
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.alert-form-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.alert-form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
} 
.alert-form-row select,
.alert-form-row input {
  font-size: 12px;
  padding: 6px 10px;
}
#al-value { width: 110px; }

/* ══════════════════════════════════════════════
   ALERT HIGHLIGHT ROWS
   ══════════════════════════════════════════════ */
tbody tr[style*="background"] td { /* כבר מוגדר inline */ }