/* ----------------------------------------------------------
   Hunar Pro Watchlist — light-theme styling
   ----------------------------------------------------------
   This file is loaded by /pages/hunar.html alongside style.min.css
   and hunar-guardian.css. It uses the same CSS variables exposed by
   the page's :root block (--primary-dark, --text-light, --bg-white,
   --accent-gold, --hunar-cyan, --hunar-green, --hunar-red, --hunar-amber)
   so it slots into the existing light design system instead of fighting it.
   ---------------------------------------------------------- */

/* Re-usable colour tokens local to the watchlist (semi-transparent variants) */
:root {
  --wl-green-dim:  rgba(16, 185, 129, 0.12);
  --wl-red-dim:    rgba(239, 68, 68,  0.12);
  --wl-amber-dim:  rgba(245, 158, 11, 0.13);
  --wl-cyan-dim:   rgba(0, 229, 255, 0.13);
  --wl-indigo-dim: rgba(99, 102, 241, 0.13);
  --wl-row-hover:  #f6f8fb;
}

/* ── Header (title + status pill + actions) ─────────────────────────────── */
.wl-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.wl-header__title { display: flex; align-items: center; gap: 12px; }
.wl-header h2     { margin: 0; font-size: 22px; font-weight: 700; color: var(--primary-dark); font-family: 'Sora', sans-serif; letter-spacing: -0.01em; }
.wl-header__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Live-stream pill in the header ─────────────────────────────────────── */
.wl-stream-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 12px;
  background: var(--bg-light); color: var(--text-light);
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wl-stream-pill__dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-light);
}
.wl-stream-pill--ok { background: var(--wl-green-dim); color: var(--success-green); }
.wl-stream-pill--ok .wl-stream-pill__dot {
  background: var(--success-green);
  animation: wlPulseDot 2s ease-out infinite;
}
@keyframes wlPulseDot {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ── Macro strip (NIFTY / BANKNIFTY / VIX / BTC / USDINR pinned at top) ── */
.wl-macro {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 0;
  margin-bottom: 16px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
}
@media (max-width: 820px) {
  .wl-macro { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
.wl-macro__cell {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px;
  border-right: 1px solid var(--border-light);
  min-width: 0;
  transition: background-color 0.6s ease;
}
.wl-macro__cell:last-child { border-right: 0; }
.wl-macro__label {
  font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-light); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wl-macro__price {
  font-size: 16px; font-weight: 700;
  color: var(--primary-dark);
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}
.wl-macro__chg {
  font-size: 11px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-light);
}
.wl-macro__cell--up   { animation: wlMacroFlashUp   0.7s ease-out; }
.wl-macro__cell--down { animation: wlMacroFlashDown 0.7s ease-out; }
@keyframes wlMacroFlashUp {
  0%   { background-color: var(--wl-green-dim); }
  100% { background-color: transparent; }
}
@keyframes wlMacroFlashDown {
  0%   { background-color: var(--wl-red-dim); }
  100% { background-color: transparent; }
}

/* ── Watchlist tabs ──────────────────────────────────────────────────────── */
.wl-tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 12px;
}
.wl-tab {
  background: transparent; border: 0; padding: 8px 14px;
  color: var(--text-light); font-size: 13px; font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent;
  font-family: inherit; transition: color 0.12s ease, border-color 0.12s ease;
}
.wl-tab:hover { color: var(--primary-dark); }
.wl-tab--active {
  color: var(--primary-dark); border-bottom-color: var(--accent-gold);
  font-weight: 600;
}
.wl-tab__count {
  display: inline-block; margin-left: 6px;
  padding: 1px 7px; border-radius: 9px;
  background: var(--bg-light); color: var(--text-light);
  font-size: 10px; font-weight: 600;
}
.wl-tab--active .wl-tab__count { background: var(--accent-gold); color: #fff; }

/* ── Filter chips ────────────────────────────────────────────────────────── */
.wl-chips {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  margin-bottom: 12px;
}
.wl-chip-fil {
  background: var(--bg-white); border: 1px solid var(--border-light);
  color: var(--text-light); border-radius: 16px;
  padding: 5px 13px; font-size: 12px; font-weight: 500;
  font-family: inherit; cursor: pointer; line-height: 1.4;
  transition: all 0.15s ease;
}
.wl-chip-fil:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
.wl-chip-fil--active {
  background: var(--primary-dark); color: #fff; border-color: var(--primary-dark);
}
.wl-chip-fil--clear {
  background: rgba(245, 158, 11, 0.1); color: var(--accent-gold);
  border-color: var(--accent-gold);
  margin-left: auto;
}

/* ── Table shell ─────────────────────────────────────────────────────────── */
.wl-table-wrap {
  overflow-x: auto;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 10px;
}
.wl-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.wl-th {
  text-align: left; padding: 10px 12px;
  font-weight: 600; font-size: 10px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-light);
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.wl-th--num     { text-align: right; }
.wl-th--actions { text-align: right; }
.wl-th--drag    { width: 24px; padding-left: 10px; padding-right: 0; }
.wl-th--sym     { min-width: 200px; }

.wl-th--sort { cursor: pointer; user-select: none; transition: color 0.12s ease; }
.wl-th--sort:hover         { color: var(--primary-dark); }
.wl-th--sort-active        { color: var(--accent-gold); }
.wl-th__arrow {
  display: inline-block; margin-left: 4px;
  font-size: 9px; opacity: 0.4;
}
.wl-th--sort:hover .wl-th__arrow,
.wl-th--sort-active .wl-th__arrow { opacity: 1; }

/* Rows */
.wl-row { border-bottom: 1px solid var(--bg-light); transition: background-color 0.12s ease; }
.wl-row:hover { background: var(--wl-row-hover); }
.wl-row:last-child { border-bottom: 0; }
.wl-td {
  padding: 10px 12px; vertical-align: middle;
  color: var(--text-dark);
  font-family: 'JetBrains Mono', monospace;
}
.wl-td--num     { text-align: right; font-variant-numeric: tabular-nums; }
.wl-td--actions { text-align: right; white-space: nowrap; padding-right: 12px; }
.wl-td--drag {
  font-size: 16px; line-height: 1; color: #cbd5e1;
  cursor: grab; user-select: none; text-align: center;
  font-family: inherit;
}
.wl-td--drag:active { cursor: grabbing; }
.wl-row:hover .wl-td--drag { color: var(--text-light); }
.wl-td--sym strong { font-weight: 700; color: var(--primary-dark); font-family: inherit; }
.wl-td__symline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wl-td__chips   { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.wl-td__ex {
  font-size: 10px; color: var(--text-light); margin-top: 3px;
  font-family: inherit; letter-spacing: 0.02em;
}

.wl-empty {
  padding: 32px; text-align: center; color: var(--text-light);
  font-family: inherit;
}

/* ── Asset-class chip ───────────────────────────────────────────────────── */
.wl-chip {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  font-family: inherit;
  background: var(--bg-light); color: var(--text-light);
}
.wl-chip--eq      { background: var(--wl-indigo-dim); color: #4f46e5; }
.wl-chip--fut     { background: var(--wl-amber-dim);  color: #b45309; }
.wl-chip--opt     { background: var(--wl-cyan-dim);   color: #0891b2; }
.wl-chip--crypto  { background: var(--wl-green-dim);  color: var(--success-green); }

/* ── LTP cell + tick flash ──────────────────────────────────────────────── */
.wl-ltp {
  font-weight: 700; color: var(--primary-dark);
  transition: background-color 0.4s ease;
}
.wl-flash--up   { animation: wlFlashUp   0.6s ease-out; }
.wl-flash--down { animation: wlFlashDown 0.6s ease-out; }
@keyframes wlFlashUp {
  0%   { background-color: var(--wl-green-dim); color: var(--success-green); }
  100% { background-color: transparent; }
}
@keyframes wlFlashDown {
  0%   { background-color: var(--wl-red-dim); color: var(--hunar-red); }
  100% { background-color: transparent; }
}
.wl-chg--up   { color: var(--success-green); font-weight: 600; }
.wl-chg--down { color: var(--hunar-red);     font-weight: 600; }

/* ── Day-range bar ──────────────────────────────────────────────────────── */
.wl-range {
  position: relative; width: 110px; height: 8px;
  background: var(--bg-light); border-radius: 4px; overflow: hidden;
}
.wl-range__bar {
  position: absolute; inset: 0;
  background: linear-gradient(to right,
    var(--wl-red-dim), rgba(245,158,11,0.22), var(--wl-green-dim));
}
.wl-range__marker {
  position: absolute; top: -2px; width: 3px; height: 12px;
  background: var(--primary-dark); border-radius: 1px;
  transform: translateX(-1.5px);
  transition: left 0.4s ease;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.85);
}

/* Day position % cell — color-graded */
.wl-daypos--hi  { color: var(--success-green); font-weight: 700; }
.wl-daypos--lo  { color: var(--hunar-red);     font-weight: 700; }
.wl-daypos--mid { color: var(--text-light); }

/* ── Sparkline canvas ───────────────────────────────────────────────────── */
.wl-spark { display: block; image-rendering: -webkit-optimize-contrast; }

/* ── Bell button ────────────────────────────────────────────────────────── */
.wl-bell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: transparent; border: 0; border-radius: 6px;
  color: #cbd5e1; cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.wl-bell:hover           { background: var(--bg-light); color: var(--text-light); }
.wl-bell--armed          { color: var(--accent-gold); }
.wl-bell--armed:hover    { background: rgba(212,168,75,0.13); }

/* ── Quick-action buttons (Buy / Sell / ↗ / ✕) ──────────────────────────── */
.wl-td--actions {
  display: flex; gap: 5px; justify-content: flex-end; align-items: center;
}
.wl-act {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; min-width: 30px; padding: 0 10px;
  border: 1px solid transparent;
  background: var(--bg-light);
  color: var(--text-light);
  border-radius: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  font-family: inherit;
  cursor: pointer; line-height: 1;
  transition: background-color 0.12s ease, color 0.12s ease, transform 0.06s ease;
}
.wl-act:hover  { color: var(--primary-dark); }
.wl-act:active { transform: translateY(1px); }
.wl-act--buy {
  background: var(--wl-green-dim); color: var(--success-green);
  border-color: rgba(16, 185, 129, 0.25);
}
.wl-act--buy:hover  { background: rgba(16, 185, 129, 0.22); color: var(--success-green); }
.wl-act--sell {
  background: var(--wl-red-dim); color: var(--hunar-red);
  border-color: rgba(239, 68, 68, 0.25);
}
.wl-act--sell:hover { background: rgba(239, 68, 68, 0.22); color: var(--hunar-red); }
.wl-act--open       { color: #0891b2; background: var(--wl-cyan-dim); border-color: rgba(0,229,255,0.22); }
.wl-act--open:hover { background: rgba(0,229,255,0.22); color: #0891b2; }
.wl-act--del        { color: #cbd5e1; background: transparent; }
.wl-act--del:hover  { color: var(--hunar-red); background: var(--wl-red-dim); }
.wl-act svg { display: block; }

/* ── Position-aware row border + chips ──────────────────────────────────── */
.wl-row--long  { box-shadow: inset 3px 0 0 var(--success-green); }
.wl-row--short { box-shadow: inset 3px 0 0 var(--hunar-red); }

.wl-pos-chip,
.wl-evt-chip,
.wl-sec-chip,
.wl-gap-chip {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}
.wl-pos-chip            { background: var(--bg-light); color: var(--text-light); }
.wl-pos-chip--long      { background: var(--wl-green-dim); color: var(--success-green); }
.wl-pos-chip--short     { background: var(--wl-red-dim);   color: var(--hunar-red); }
.wl-evt-chip            { background: var(--bg-light); color: var(--text-light); }
.wl-evt-chip--earnings  { background: var(--wl-indigo-dim); color: #4f46e5; }
.wl-evt-chip--expiry    { background: var(--wl-amber-dim);  color: #b45309; }
.wl-evt-chip--imminent  { background: var(--wl-red-dim); color: var(--hunar-red); animation: wlEvtPulse 1.6s ease-in-out infinite; }
@keyframes wlEvtPulse { 0%,100%{opacity:1} 50%{opacity:.55} }
.wl-sec-chip {
  background: rgba(0,0,0,0.04); color: var(--text-light); font-weight: 500;
  border: 1px solid var(--border-light);
}
.wl-gap-chip               { background: var(--bg-light); color: var(--text-light); }
.wl-gap-chip--up           { background: var(--wl-green-dim); color: var(--success-green); }
.wl-gap-chip--down         { background: var(--wl-red-dim);   color: var(--hunar-red); }

/* ── Bundle 3 columns (Greeks / IV / OI / Funding) ──────────────────────── */
[data-cell="greeks"] { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
[data-cell="iv"]     { font-variant-numeric: tabular-nums; color: #0891b2; font-weight: 600; }
[data-cell="oi"]     { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wl-funding-sim      { display: inline-block; margin-left: 2px; color: var(--text-light); font-size: 9px; cursor: help; }

/* ── Footer totals ──────────────────────────────────────────────────────── */
.wl-foot {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px; margin-top: 10px;
  padding: 8px 14px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 10px;
}
.wl-foot__totals {
  display: flex; gap: 18px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-light);
  font-variant-numeric: tabular-nums;
}
.wl-foot__count   { color: var(--text-light); }
.wl-foot__updown  { font-weight: 700; }
.wl-foot__avg     { color: var(--text-light); }
.wl-foot__avg .wl-chg--up,
.wl-foot__avg .wl-chg--down { font-weight: 700; margin-left: 4px; }

/* ── Modal (Add Symbol / Set Alert / Columns) ───────────────────────────── */
.wl-modal {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  z-index: 100000 !important;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
  animation: wlModalIn 140ms ease-out;
}
@keyframes wlModalIn { from { opacity: 0; } to { opacity: 1; } }
.wl-modal__inner {
  background: var(--bg-white); padding: 24px 26px;
  border: 1px solid var(--border-light); border-radius: 12px;
  box-shadow: 0 16px 60px rgba(15, 23, 42, 0.25);
  min-width: 320px; max-width: min(440px, 90vw);
  max-height: calc(100vh - 48px); overflow-y: auto;
  animation: wlModalCardIn 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes wlModalCardIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
.wl-modal__inner h3 { margin: 0 0 16px 0; font-size: 16px; font-weight: 700; color: var(--primary-dark); font-family: 'Sora', sans-serif; }
.wl-col-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.wl-col-row  { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--text-dark); }
.wl-modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.wl-form { min-width: 320px; }
.wl-form__row {
  display: flex; flex-direction: column; gap: 5px;
  margin-bottom: 14px; font-size: 12px;
  color: var(--text-light); font-weight: 600;
}
.wl-form__row > input,
.wl-form__row > select {
  background: var(--bg-white); color: var(--text-dark);
  border: 1px solid var(--border-light); border-radius: 7px;
  padding: 9px 12px; font-size: 13px; font-family: inherit;
  outline: none; transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.wl-form__row > input:focus,
.wl-form__row > select:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.15);
}
.wl-form__hint {
  margin: -6px 0 14px 0; font-size: 11px;
  color: var(--text-light); line-height: 1.5; font-weight: 400;
}
.wl-form__hint code {
  background: var(--bg-light); padding: 1px 5px;
  border-radius: 3px; font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
}
.wl-form__ltp {
  display: inline-block; margin-left: 8px;
  padding: 2px 9px; border-radius: 4px;
  background: var(--bg-light); color: var(--primary-dark);
  font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', monospace;
}
