/* ============================================
   ATENA CRYPTO — LIQUIDATIONS
   ============================================ */

/* ── PAGE LAYOUT ── */
.liq-page {
  padding: 1.8rem 2.5rem 3rem;
  display: flex; flex-direction: column; gap: 1.4rem;
  min-height: calc(100vh - 88px);
}
.page-header { margin-bottom: 0.2rem; }
.page-title  { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.page-sub    { color: var(--text-tertiary); font-size: 0.82rem; margin-top: 0.2rem; }

/* ── SUB-NAV ── */
.subnav-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 2.5rem;
}
.subnav-inner { display: flex; gap: 0.25rem; align-items: center; height: 42px; }
.subnav-link {
  font-family: var(--font-mono); font-size: 0.71rem; font-weight: 500;
  color: var(--text-tertiary); text-decoration: none;
  padding: 0.28rem 0.85rem; border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.subnav-link:hover  { background: var(--bg-hover); color: var(--text); }
.subnav-link.active { background: var(--green-dim); color: var(--green); border: 1px solid rgba(46,184,92,0.25); }

/* ── PANEL ── */
.liq-panel {
  background: var(--bg-glass); backdrop-filter: blur(16px) saturate(1.1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  transition: border-color 0.15s; position: relative; overflow: hidden;
}
.liq-panel::before {
  content: ''; position: absolute; top: 0; left: 20%; right: 20%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-shine), transparent);
}
.liq-panel:hover { border-color: var(--glass-border-hover); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; flex-wrap: wrap; gap: 0.6rem;
}
.panel-title  { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.panel-meta   { font-family: var(--font-mono); font-size: 0.62rem; color: var(--text-tertiary); }

/* ── PILL BUTTONS ── */
.pill-group {
  display: flex; gap: 0.2rem;
  background: var(--bg-elevated);
  border-radius: var(--radius); padding: 3px;
  border: 1px solid var(--glass-border);
}
.pill {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600;
  padding: 0.25rem 0.75rem; border-radius: calc(var(--radius) - 3px);
  border: none; background: none; color: var(--text-tertiary);
  cursor: pointer; transition: background 0.15s, color 0.15s;
  letter-spacing: 0.04em;
}
.pill:hover      { color: var(--text); }
.pill.active     { background: var(--bg-hover); color: var(--text); }
.pill.active-red { background: rgba(230,90,79,0.15); color: var(--negative); }
.pill.active-grn { background: var(--green-dim); color: var(--positive); }
.pill.active-blu { background: var(--bg-hover); color: var(--text); }

/* ── ROW LAYOUTS ── */
.row-3col { display: grid; grid-template-columns: 2fr 1.4fr 1.4fr; gap: 1.2rem; align-items: start; }
.row-2col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.2rem; align-items: start; }

/* ══════════════════════════════════════════════
   TREEMAP
══════════════════════════════════════════════ */
.treemap { display: flex; flex-direction: column; height: 360px; gap: 3px; border-radius: var(--radius); overflow: hidden; }
.tm-row  { display: flex; gap: 3px; overflow: hidden; }
.tm-col  { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.tm-cell { border-radius: 4px; padding: 6px 8px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; cursor: pointer; transition: filter 0.15s; user-select: none; }
.tm-cell:hover { filter: brightness(1.15); }
.tm-lbl { font-weight: 700; color: #fff; line-height: 1.1; }
.tm-val { color: rgba(255,255,255,0.82); line-height: 1.1; margin-top: 2px; }
.tm-xl .tm-lbl { font-size: 1.1rem; }
.tm-xl .tm-val { font-size: 0.88rem; }
.tm-lg .tm-lbl { font-size: 0.92rem; }
.tm-lg .tm-val { font-size: 0.74rem; }
.tm-md .tm-lbl { font-size: 0.76rem; }
.tm-md .tm-val { font-size: 0.64rem; }
.tm-sm .tm-lbl { font-size: 0.63rem; }
.tm-sm .tm-val { font-size: 0.57rem; }
.tm-xs .tm-lbl { font-size: 0.57rem; }
.tm-xs .tm-val { display: none; }
.tm-red   { background: rgba(230,90,79,0.72); }
.tm-grn   { background: rgba(46,184,92,0.62); }
.tm-red-d { background: rgba(180,55,48,0.75); }
.tm-grn-d { background: rgba(28,120,60,0.65); }

/* ══════════════════════════════════════════════
   METRIC BOXES
══════════════════════════════════════════════ */
.metric-toggle { display: flex; gap: 0.4rem; margin-bottom: 0.9rem; }
.m-toggle {
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700;
  padding: 0.22rem 0.7rem; border-radius: var(--radius-sm); border: 1px solid var(--glass-border);
  cursor: pointer; transition: opacity 0.15s; letter-spacing: 0.03em;
  background: transparent; color: var(--text-tertiary);
}
.m-toggle:hover { color: var(--text); }
.m-toggle.long  { color: var(--negative); }
.m-toggle.short { color: var(--positive); }
.m-toggle.trade { color: var(--text-secondary); }
.m-toggle.active.long  { background: var(--negative); color: #fff; border-color: var(--negative); }
.m-toggle.active.short { background: var(--positive); color: #000; border-color: var(--positive); }
.m-toggle.active.trade { background: var(--bg-hover); color: var(--text); border-color: var(--glass-border-hover); }

.metric-2x2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-bottom: 0.9rem; }
.m-box {
  background: var(--bg-elevated); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 0.85rem 1rem;
}
.m-box-label { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.35rem; }
.m-box-total { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); font-family: var(--font-mono); line-height: 1.1; margin-bottom: 0.35rem; }
.m-box-split { font-family: var(--font-mono); font-size: 0.68rem; line-height: 1.5; }
.m-long  { color: var(--negative); }
.m-short { color: var(--positive); }
.m-summary { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.65; background: var(--bg-elevated); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 0.8rem; }
.m-summary strong { color: var(--text); }

/* ══════════════════════════════════════════════
   REAL-TIME FEED
══════════════════════════════════════════════ */
.feed-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.feed-title { font-size: 0.88rem; font-weight: 700; color: var(--text); flex: 1; }
.feed-icon { font-size: 0.9rem; }
.feed-sel {
  font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-secondary);
  background: var(--bg-elevated); border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm); padding: 0.22rem 0.55rem; cursor: pointer;
  outline: none; appearance: none; -webkit-appearance: none;
}

/* Live dot — RED pulse for liquidations */
.feed-live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
  animation: livePulse 2s ease-in-out infinite; flex-shrink: 0;
}
@keyframes livePulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }

.feed-scroll { max-height: 480px; overflow-y: auto; margin: 0 -1.5rem; padding: 0 1.5rem; }
.feed-scroll::-webkit-scrollbar { width: 4px; }
.feed-scroll::-webkit-scrollbar-track { background: transparent; }
.feed-scroll::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 2px; }

.feed-row {
  display: grid;
  grid-template-columns: 90px 48px 70px 70px 60px 60px;
  align-items: center; gap: 0.3rem;
  padding: 0.38rem 0.4rem;
  border-left: 3px solid transparent;
  font-family: var(--font-mono); font-size: 0.72rem;
  transition: background 0.12s;
  border-bottom: 1px solid var(--glass-border);
}
.feed-row:last-child { border-bottom: none; }
.feed-row:hover { background: rgba(46,184,92,0.04) !important; }
.feed-row.fr-long  { background: rgba(230,90,79,0.05); border-left-color: var(--negative); }
.feed-row.fr-short { background: rgba(46,184,92,0.04); border-left-color: var(--positive); }
.fr-sym   { font-weight: 700; color: var(--text); font-size: 0.71rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-side  { font-size: 0.63rem; font-weight: 700; padding: 1px 5px; border-radius: var(--radius-sm); text-align: center; }
.fr-side.long  { background: rgba(230,90,79,0.15); color: var(--negative); }
.fr-side.short { background: var(--green-dim); color: var(--positive); }
.fr-val   { color: var(--text); font-weight: 600; text-align: right; }
.fr-price { color: var(--text-secondary); text-align: right; font-size: 0.68rem; }
.fr-exch  { color: var(--text-tertiary); font-size: 0.64rem; overflow: hidden; text-overflow: ellipsis; }
.fr-time  { color: var(--text-tertiary); font-size: 0.63rem; text-align: right; }

/* ══════════════════════════════════════════════
   EXCHANGE TABLE
══════════════════════════════════════════════ */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.liq-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.liq-table th { font-family: var(--font-mono); font-size: 0.62rem; color: var(--text-tertiary); text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--glass-border); text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }
.liq-table td { padding: 0.65rem 0.8rem; font-size: 0.81rem; border-bottom: 1px solid var(--glass-border); white-space: nowrap; }
.liq-table tr:last-child td { border-bottom: none; }
.liq-table tr:hover td { background: rgba(46,184,92,0.04); }
.liq-table tr.all-row td { background: var(--bg-elevated); font-weight: 600; }

/* Split bar */
.exch-split { display: flex; height: 5px; border-radius: 3px; overflow: hidden; background: var(--bg-hover); min-width: 80px; width: 100%; }
.es-long  { height: 100%; background: rgba(230,90,79,0.6); }
.es-short { height: 100%; background: rgba(46,184,92,0.55); }

.rate-long  { color: var(--positive); font-family: var(--font-mono); font-size: 0.75rem; }
.rate-short { color: var(--negative); font-family: var(--font-mono); font-size: 0.75rem; }

/* ══════════════════════════════════════════════
   TOP 10 EVENTS TABLE
══════════════════════════════════════════════ */
.events-notice { font-size: 0.76rem; color: var(--text-secondary); line-height: 1.55; background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.18); border-radius: var(--radius); padding: 0.7rem 1rem; margin-bottom: 1rem; display: flex; align-items: flex-start; gap: 0.5rem; flex-wrap: wrap; }
.events-notice a { color: var(--text-secondary); font-size: 0.73rem; white-space: nowrap; }
.event-table { min-width: 600px; }
.rank-medal { font-size: 1.05rem; }
.rank-num   { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); }
.rank-1 .rank-num { color: #ffd700; }
.rank-2 .rank-num { color: #c0c0c0; }
.rank-3 .rank-num { color: #cd7f32; }
.event-desc { font-size: 0.8rem; color: var(--text-secondary); max-width: 420px; }
.event-date { font-family: var(--font-mono); font-size: 0.73rem; color: var(--text-secondary); }

/* ══════════════════════════════════════════════
   BAR CHARTS
══════════════════════════════════════════════ */
.chart-outer { position: relative; }
.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.8rem; flex-wrap: wrap; gap: 0.5rem; }
.chart-title { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.chart-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.chart-legend { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; font-family: var(--font-mono); font-size: 0.63rem; color: var(--text-tertiary); margin-bottom: 0.5rem; }
.leg-dot  { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.leg-line { width: 20px; height: 2px; flex-shrink: 0; }

.chart-wrap { display: flex; gap: 0.4rem; }
.chart-yaxis { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 22px; width: 52px; flex-shrink: 0; align-items: flex-end; }
.chart-yaxis-r { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 22px; width: 52px; flex-shrink: 0; align-items: flex-start; }
.chart-yaxis span, .chart-yaxis-r span { font-family: var(--font-mono); font-size: 0.58rem; color: var(--text-tertiary); line-height: 1; }
.chart-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chart-area { flex: 1; position: relative; display: flex; align-items: flex-end; gap: 2px; overflow: hidden; height: 200px; }
.chart-area-zero { flex: 1; position: relative; display: flex; align-items: center; gap: 2px; overflow: hidden; height: 200px; }
.chart-xaxis { height: 22px; display: flex; align-items: center; padding: 2px 0 0; overflow: hidden; }
.chart-xaxis span { font-family: var(--font-mono); font-size: 0.57rem; color: var(--text-tertiary); white-space: nowrap; flex: 1; text-align: center; overflow: hidden; }

.cb-col { flex: 1; display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.cb-inner { display: flex; flex-direction: column-reverse; justify-content: flex-start; overflow: hidden; }
.cb-short { background: rgba(46,184,92,0.62); flex-shrink: 0; min-height: 0; }
.cb-long  { background: rgba(230,90,79,0.68); flex-shrink: 0; min-height: 0; }
.cb-col:hover .cb-short { background: rgba(46,184,92,0.85); }
.cb-col:hover .cb-long  { background: rgba(230,90,79,0.9); }

.cb-zero-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cb-zero-top { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; border-bottom: 1px solid var(--glass-border); }
.cb-zero-bot { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; }
.cb-z-long  { background: rgba(46,184,92,0.65); flex-shrink: 0; min-height: 0; }
.cb-z-short { background: rgba(230,90,79,0.68); flex-shrink: 0; min-height: 0; }
.cb-zero-col:hover .cb-z-long  { background: rgba(46,184,92,0.88); }
.cb-zero-col:hover .cb-z-short { background: rgba(230,90,79,0.88); }

.price-svg { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; }
.price-svg polyline { fill: none; stroke: #fbbf24; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }

/* ══════════════════════════════════════════════
   COIN CARDS
══════════════════════════════════════════════ */
.cards-scroll { display: flex; gap: 0.8rem; overflow-x: auto; padding-bottom: 0.5rem; scrollbar-width: thin; scrollbar-color: var(--text-muted) transparent; }
.cards-scroll::-webkit-scrollbar { height: 4px; }
.cards-scroll::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 2px; }
.coin-card { flex-shrink: 0; width: 148px; background: var(--bg-elevated); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; transition: border-color 0.15s; }
.coin-card:hover { border-color: var(--glass-border-hover); }
.cc-head { display: flex; align-items: center; gap: 0.4rem; }
.cc-icon { font-size: 1.1rem; }
.cc-sym  { font-weight: 800; font-size: 0.82rem; color: var(--text); }
.cc-vals { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem; }
.cc-val  { font-family: var(--font-mono); font-size: 0.66rem; line-height: 1.3; }
.cc-val-label { font-size: 0.55rem; color: var(--text-tertiary); margin-bottom: 1px; }
.cc-val-num   { font-weight: 600; }
.cc-long  { color: var(--negative); }
.cc-short { color: var(--positive); }
.cc-spark { display: flex; align-items: flex-end; gap: 2px; height: 22px; }
.spark-bar { flex: 1; border-radius: 2px 2px 0 0; }

/* ══════════════════════════════════════════════
   FULL COIN TABLE
══════════════════════════════════════════════ */
.table-controls { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.tbl-search { font-family: var(--font-mono); font-size: 0.7rem; background: var(--bg-elevated); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 0.28rem 0.7rem; color: var(--text); outline: none; width: 160px; transition: border-color 0.15s; }
.tbl-search:focus { border-color: rgba(46,184,92,0.4); }
.tbl-search::placeholder { color: var(--text-tertiary); }
.tbl-sel { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-secondary); background: var(--bg-elevated); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 0.28rem 0.65rem; cursor: pointer; outline: none; appearance: none; -webkit-appearance: none; }
.full-table { min-width: 900px; }
.full-table th.th-long  { color: rgba(230,90,79,0.75); }
.full-table th.th-short { color: rgba(46,184,92,0.7); }
.coin-row-sym { display: flex; align-items: center; gap: 0.4rem; }
.coin-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.coin-tick { font-weight: 700; font-size: 0.82rem; }

/* ── DISCLAIMER ── */
.liq-disclaimer { font-size: 0.73rem; color: var(--text-tertiary); background: var(--bg-elevated); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 0.7rem 1rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ext-link { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-secondary); text-decoration: none; }
.ext-link:hover { color: var(--text); text-decoration: underline; }

/* UTILITY */
.t-mono   { font-family: var(--font-mono); }
.t-right  { text-align: center; }
.t-center { text-align: center; }
.t-dim    { color: var(--text-secondary); }
.t-muted  { color: var(--text-tertiary); }
.pos { color: var(--positive); }
.neg { color: var(--negative); }
.exch-name { font-weight: 600; }
.exch-em   { margin-right: 0.35rem; }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .row-3col { grid-template-columns: 1.4fr 1fr; }
  .col-feed { display: none; }
}
@media (max-width: 860px) {
  .row-3col { grid-template-columns: 1fr; }
  .col-feed { display: block; }
  .row-2col { grid-template-columns: 1fr; }
  .liq-page { padding: 1rem 1.2rem 2rem; }
  .subnav-bar { padding: 0 1.2rem; overflow-x: auto; }
  .subnav-inner { min-width: max-content; }
  .treemap { height: 260px; }
}
@media (max-width: 560px) {
  .metric-2x2 { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .m-box-total { font-size: 1.1rem; }
  .liq-page { padding: 0.75rem 0.9rem 2rem; }
  /* wrap tables in scrollable containers */
  .liq-table-wrap { overflow-x: auto; }
  .event-table-wrap { overflow-x: auto; }
  .full-table-wrap { overflow-x: auto; }
}
@media (max-width: 400px) {
  .metric-2x2 { grid-template-columns: 1fr; }
  .treemap { height: 200px; }
}
