/* HL shared theme — used by hl-scan.html + hl-deep-analyze.html */

:root {
  --bg: #0a0a0a;
  --surface: #111;
  --surface2: #161616;
  --border: #222;
  --text: #e0e0e0;
  --muted: #666;
  --dim: #444;
  --accent: #e8ff00;
  --up: #2ecc71;
  --down: #f04040;
  --warn: #f39c12;
  --blue: #7aa2f7;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.wrap,
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  width: 100%;
  flex: 1;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
}

.spacer { flex: 1; }

/* ── Typography ─────────────────────────────────────────────────────────────── */
.logo,
h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1.2;
}
.logo span,
h1 span { color: #fff; }

.subtitle {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

#clock {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn,
#scanBtn,
.analyze-btn {
  background: var(--accent);
  color: #000;
  border: none;
  font-weight: 800;
  font-size: 13px;
  padding: 9px 22px;
  cursor: pointer;
  letter-spacing: 0.05em;
  border-radius: 2px;
  transition: opacity 0.15s;
}
.btn:hover,
#scanBtn:hover,
.analyze-btn:hover { opacity: 0.88; }
.btn:disabled,
#scanBtn:disabled,
.analyze-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.input-row label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}
.ticker-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  padding: 9px 14px;
  width: 180px;
  outline: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ticker-input:focus { border-color: #444; }

/* ── Meta / status ──────────────────────────────────────────────────────────── */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}
#metaLine { color: var(--text); }
#ts, .footer-ts { font-variant-numeric: tabular-nums; }

.error-msg,
#errEl {
  display: none;
  background: #2a1215;
  color: var(--down);
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 4px;
  font-size: 13px;
}
.error-msg.visible,
#errEl.visible { display: block; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px 18px;
}
.card.full { margin-bottom: 12px; }
.card-title {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.metric-row:last-child { border-bottom: none; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
}

/* ── Color utilities ────────────────────────────────────────────────────────── */
.up { color: var(--up); }
.down { color: var(--down); }
.warn { color: var(--warn); font-weight: 700; }

/* ── DEX badge ──────────────────────────────────────────────────────────────── */
.dex-badge,
.dex-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  background: #1a1a1a;
  color: var(--muted);
  border: 1px solid #2a2a2a;
  vertical-align: middle;
  letter-spacing: 0.03em;
}

/* ── Table (scan) ───────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  background: #0d0d0d;
  position: sticky;
  top: 0;
}
thead th:hover { color: var(--text); }
thead th.sorted { color: var(--accent); }
thead th.sorted.asc::after { content: " ↑"; }
thead th.sorted:not(.asc)::after { content: " ↓"; }

tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

td {
  padding: 9px 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.col-symbol { font-weight: 600; color: var(--text); }

.conf-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dir-arrow {
  font-size: 14px;
  font-weight: 700;
  width: 16px;
  display: inline-block;
  text-align: center;
}
.dir-arrow.LONG { color: var(--up); }
.dir-arrow.SHORT { color: var(--down); }
.dir-arrow.NEUTRAL { color: var(--dim); }

.confidence { display: flex; gap: 3px; }
.pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2a2a2a;
}
.pip.on { background: var(--accent); }

.score-cell {
  font-weight: 700;
  text-align: right;
  color: var(--text);
}

/* ── Deep analyze layout ────────────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.asset-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.asset-symbol {
  font-size: 34px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1;
}
.asset-price {
  font-size: 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text);
  margin-top: 6px;
}
.asset-change { font-size: 15px; margin-left: 10px; }

.rec-block { text-align: right; }
.rec-badge {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 7px 20px;
  border: 2px solid currentColor;
  display: inline-block;
}
.rec-badge.LONG { color: var(--up); }
.rec-badge.SHORT { color: var(--down); }
.rec-badge.NEUTRAL { color: var(--muted); }
.rec-strength {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Funding sparkline */
.funding-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 56px;
  margin-top: 12px;
  position: relative;
}
.f-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}
.f-bar {
  width: 100%;
  min-height: 2px;
  position: absolute;
}
.f-bar.pos { background: rgba(240, 64, 64, 0.7); bottom: 50%; }
.f-bar.neg { background: rgba(46, 204, 113, 0.7); top: 50%; }
.f-midline {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 1px;
  background: var(--border);
  pointer-events: none;
}

/* Order book */
.book-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.book-side.asks {
  border-right: 1px solid var(--border);
  padding-right: 12px;
}
.book-side.bids { padding-left: 12px; }
.book-header {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.book-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 3px 0;
  position: relative;
}
.book-row-fill {
  position: absolute;
  top: 0; bottom: 0;
  opacity: 0.08;
  pointer-events: none;
}
.book-row-fill.ask { background: var(--down); right: 0; }
.book-row-fill.bid { background: var(--up); left: 0; }
.book-price { font-weight: 600; }
.book-size { color: var(--muted); }

.book-imbalance {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.imbalance-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--border);
  display: flex;
  overflow: hidden;
}
.imbalance-bid { background: var(--up); height: 100%; }
.imbalance-ask { background: var(--down); height: 100%; }
.imbalance-label { font-size: 11px; white-space: nowrap; }

/* Walls / liq clusters */
.liq-list { display: flex; flex-direction: column; gap: 6px; }
.liq-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface2);
  font-size: 12px;
}
.liq-row.above { border-left: 2px solid var(--down); }
.liq-row.below { border-left: 2px solid var(--up); }
.liq-price {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  min-width: 90px;
}
.liq-size {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  min-width: 55px;
}
.liq-dist { color: var(--muted); font-size: 11px; margin-left: auto; }
.liq-bar-wrap { flex: 1; height: 6px; background: var(--border); }
.liq-bar { height: 100%; }
.liq-bar.above { background: rgba(240, 64, 64, 0.6); }
.liq-bar.below { background: rgba(46, 204, 113, 0.6); }
.liq-empty { color: var(--muted); font-size: 12px; font-style: italic; }

/* Signals */
.signals-list { list-style: none; }
.signals-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.signals-list li:last-child { border-bottom: none; }
.sig-bullet { color: var(--accent); flex-shrink: 0; font-size: 10px; }

.summary-box {
  background: var(--bg);
  border-left: 2px solid var(--accent);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.7;
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--dim);
}
.footer-left { color: var(--muted); }
.footer-left strong { color: var(--accent); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .wrap, .container { padding: 16px 10px 32px; }
  thead th, td { padding: 8px; }
  .asset-symbol { font-size: 28px; }
}

/* ── App nav ────────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: color 0.12s, border-color 0.12s;
}
.nav a:hover {
  color: var(--text);
  border-color: #444;
}
.nav a.active {
  color: #000;
  background: var(--accent);
  border-color: var(--accent);
}
