/* =============================================
   Alpha Radar v2 — Dark Premium Dashboard
   ============================================= */

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

:root {
  --bg:         #080b14;
  --bg2:        #0d1120;
  --bg3:        #111827;
  --surface:    rgba(255,255,255,0.04);
  --surface2:   rgba(255,255,255,0.07);
  --border:     rgba(255,255,255,0.08);
  --border2:    rgba(255,255,255,0.13);
  --primary:    #6366f1;
  --primary2:   #818cf8;
  --accent:     #8b5cf6;
  --green:      #10b981;
  --green2:     #34d399;
  --yellow:     #f59e0b;
  --orange:     #f97316;
  --red:        #ef4444;
  --red2:       #f87171;
  --blue:       #3b82f6;
  --cyan:       #06b6d4;
  --text:       #f1f5f9;
  --text2:      #94a3b8;
  --text3:      #64748b;
  --radius:     12px;
  --radius-sm:  8px;
  --radius-lg:  16px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
  --font:       'Inter', sans-serif;
  --mono:       'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 80px;
}

/* Background effects */
.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(99,102,241,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.glow-orb {
  position: fixed; border-radius: 50%;
  filter: blur(120px); pointer-events: none; z-index: 0;
  animation: floatOrb 12s ease-in-out infinite;
}
.glow-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,0.12), transparent 70%);
  top: -200px; left: -200px;
}
.glow-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(139,92,246,0.10), transparent 70%);
  bottom: -150px; right: -100px;
  animation-delay: -6s;
}
@keyframes floatOrb {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%       { transform: translate(20px, 30px) scale(1.05); }
}

/* Header */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,11,20,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.header-inner {
  max-width: 1600px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(139,92,246,0.2));
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.logo-text { display: flex; align-items: center; gap: 8px; }
.logo-text h1 {
  font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px;
}
.version-badge {
  font-size: 10px; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; padding: 2px 7px; border-radius: 20px;
  letter-spacing: 0.5px;
}
.header-controls { display: flex; align-items: center; gap: 12px; }

.phase-pill {
  display: flex; align-items: center; gap: 6px;
  background: rgba(99,102,241,0.12); border: 1px solid rgba(99,102,241,0.25);
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  color: var(--primary2);
}
.phase-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary2);
  animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); cursor: pointer;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
  animation: pulseDot 2s ease-in-out infinite;
}
.status-dot.error { background: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,0.2); }

.auto-refresh-toggle {
  display: flex; align-items: center; gap: 8px;
}
.toggle-label {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.toggle-label input { display: none; }
.toggle-track {
  width: 32px; height: 18px; border-radius: 9px;
  background: var(--border2); position: relative;
  transition: background 0.2s;
}
.toggle-label input:checked ~ .toggle-track { background: var(--primary); }
.toggle-thumb {
  position: absolute; width: 14px; height: 14px;
  background: white; border-radius: 50%; top: 2px; left: 2px;
  transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-label input:checked ~ .toggle-track .toggle-thumb { left: 16px; }
.toggle-text { font-size: 12px; color: var(--text2); font-weight: 500; }

.interval-select {
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text2); font-size: 12px; padding: 3px 6px;
  border-radius: 6px; cursor: pointer; font-family: var(--font);
}
.interval-select:focus { outline: none; border-color: var(--primary); }

.btn-scan {
  display: flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; border: none; padding: 8px 16px; border-radius: 8px;
  font-weight: 600; font-size: 13px; cursor: pointer;
  transition: all 0.2s; font-family: var(--font);
  box-shadow: 0 2px 12px rgba(99,102,241,0.4);
}
.btn-scan:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(99,102,241,0.5); }
.btn-scan:active { transform: translateY(0); }
.btn-scan.loading .spin-icon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Main */
.main {
  max-width: 1600px; margin: 0 auto;
  padding: 24px 24px 0;
  position: relative; z-index: 1;
}

/* Stats Bar */
.stats-bar {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--border2); }
.stat-label {
  font-size: 11px; font-weight: 500; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.stat-value {
  font-size: 22px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-value.score-val { color: var(--primary2); }

/* Filter Bar */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text2); font-size: 12px; font-weight: 500;
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
  transition: all 0.2s; font-family: var(--font); white-space: nowrap;
}
.filter-btn:hover { border-color: var(--border2); color: var(--text); }
.filter-btn.active {
  background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.4);
  color: var(--primary2);
}
.filter-btn.phase2-lock { opacity: 0.5; cursor: not-allowed; }
.filter-btn.phase2-lock:hover { opacity: 0.7; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px; min-width: 240px;
}
.search-box svg { color: var(--text3); flex-shrink: 0; }
.search-box input {
  background: none; border: none; color: var(--text);
  font-size: 13px; font-family: var(--font); width: 100%;
}
.search-box input::placeholder { color: var(--text3); }
.search-box input:focus { outline: none; }

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden; overflow-x: auto;
  margin-bottom: 20px;
}

.token-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.token-table thead {
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}
.token-table th {
  padding: 11px 14px; text-align: left;
  font-size: 11px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap;
}
.token-table th[onclick] { cursor: pointer; user-select: none; }
.token-table th[onclick]:hover { color: var(--text2); }

.token-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.token-table tbody tr:last-child { border-bottom: none; }
.token-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.token-table td { padding: 12px 14px; vertical-align: middle; white-space: nowrap; }

.td-rank { color: var(--text3); font-weight: 600; font-size: 12px; }

.token-info { display: flex; align-items: center; gap: 10px; }
.token-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.token-name { font-weight: 600; color: var(--text); font-size: 13px; line-height: 1.2; }
.token-symbol { color: var(--text3); font-size: 11px; font-family: var(--mono); }
.token-chain {
  font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.chain-base    { background: rgba(59,130,246,0.15); color: #60a5fa; }
.chain-eth     { background: rgba(99,102,241,0.15); color: #818cf8; }
.chain-bsc     { background: rgba(245,158,11,0.15); color: #fbbf24; }
.chain-default { background: rgba(100,116,139,0.15); color: #94a3b8; }

/* Score Badge */
.score-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
}
.tier-badge {
  font-size: 9px; font-weight: 700; padding: 2px 5px; border-radius: 4px;
  letter-spacing: 0.5px;
}
.tier-S  { background: rgba(139,92,246,0.2); color: #a78bfa; border: 1px solid rgba(139,92,246,0.3); }
.tier-A  { background: rgba(16,185,129,0.2); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.tier-B  { background: rgba(245,158,11,0.2); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.tier-C  { background: rgba(249,115,22,0.2); color: #fb923c; border: 1px solid rgba(249,115,22,0.3); }
.tier-D  { background: rgba(239,68,68,0.2);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }

/* Component score */
.comp-bar {
  display: flex; align-items: center; gap: 6px;
}
.comp-num {
  font-size: 12px; font-weight: 600; width: 28px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.mini-bar {
  width: 40px; height: 4px; background: rgba(255,255,255,0.1);
  border-radius: 2px; overflow: hidden; flex-shrink: 0;
}
.mini-bar-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.5s ease;
}
.bar-green { background: var(--green); }
.bar-yellow { background: var(--yellow); }
.bar-orange { background: var(--orange); }
.bar-red { background: var(--red); }

/* Signal badges */
.sig-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
  white-space: nowrap;
}
.sig-gc   { background: rgba(16,185,129,0.15); color: var(--green2); border: 1px solid rgba(16,185,129,0.25); }
.sig-bl   { background: rgba(59,130,246,0.15);  color: #60a5fa;       border: 1px solid rgba(59,130,246,0.25); }
.sig-br   { background: rgba(245,158,11,0.15); color: #fbbf24;       border: 1px solid rgba(245,158,11,0.25); }
.sig-dc   { background: rgba(239,68,68,0.15);  color: var(--red2);   border: 1px solid rgba(239,68,68,0.25); }
.sig-new  { background: rgba(139,92,246,0.15); color: #c4b5fd;       border: 1px solid rgba(139,92,246,0.25); }
.sig-none { background: rgba(100,116,139,0.1); color: var(--text3);  border: 1px solid var(--border); }

.rbd-badge  { cursor: pointer; }
.smre-yes   { color: var(--green); }
.smre-no    { color: var(--text3); }

/* Combo badge */
.combo-breakout {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(16,185,129,0.12); color: var(--green2);
  border: 1px solid rgba(16,185,129,0.25);
  padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700;
}
.combo-fakepump {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(239,68,68,0.12); color: var(--red2);
  border: 1px solid rgba(239,68,68,0.25);
  padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700;
}
.combo-phase1 { color: var(--text3); font-size: 11px; }

/* Price */
.price-val  { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.price-chg  { font-size: 10px; margin-top: 1px; }
.chg-up     { color: var(--green); }
.chg-dn     { color: var(--red2); }

.liq-val { font-size: 12px; color: var(--text2); }
.age-val  { font-size: 12px; color: var(--text3); }

.btn-detail {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text2); font-size: 11px; padding: 5px 10px;
  border-radius: 6px; cursor: pointer; font-family: var(--font);
  transition: all 0.15s;
}
.btn-detail:hover { border-color: var(--primary); color: var(--primary2); }

/* Red flags in row */
.redflag-dot {
  display: inline-block; width: 7px; height: 7px;
  background: var(--red); border-radius: 50%; margin-left: 4px;
  animation: pulseDot 1.5s ease-in-out infinite;
  cursor: help;
}

/* Loading state */
.loading-row td { padding: 60px 0; }
.loading-state {
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  color: var(--text3);
}
.radar-anim {
  position: relative; width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
}
.radar-ring {
  position: absolute; border-radius: 50%;
  border: 1px solid rgba(99,102,241,0.4);
  animation: radarPulse 2s ease-out infinite;
}
.r1 { width: 20px; height: 20px; }
.r2 { width: 40px; height: 40px; animation-delay: 0.5s; }
.r3 { width: 60px; height: 60px; animation-delay: 1s; }
.radar-dot {
  width: 8px; height: 8px; background: var(--primary);
  border-radius: 50%; z-index: 1;
  box-shadow: 0 0 10px rgba(99,102,241,0.8);
}
@keyframes radarPulse {
  0%   { opacity: 0.8; transform: scale(0.8); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* Modal */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); width: min(700px, 95vw);
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  position: relative;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text2); font-size: 13px; width: 28px; height: 28px;
  border-radius: 6px; cursor: pointer; font-family: var(--font);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { color: var(--text); border-color: var(--border2); }
.modal-content { padding: 24px; }

/* Modal Detail */
.modal-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.modal-token-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; flex-shrink: 0;
}
.modal-token-name { font-size: 20px; font-weight: 700; }
.modal-token-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.modal-ca { font-family: var(--mono); font-size: 11px; color: var(--text3); }

.modal-score-big {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
  padding: 16px; background: var(--surface); border-radius: var(--radius);
}
.score-number { font-size: 48px; font-weight: 900; color: var(--primary2); line-height: 1; }
.score-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }

.modal-section { margin-bottom: 16px; }
.modal-section-title {
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;
}
.modal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.modal-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.modal-stat-label { font-size: 10px; color: var(--text3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.modal-stat-value { font-size: 14px; font-weight: 600; }

.score-breakdown {
  display: grid; gap: 8px;
}
.score-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.score-row-label { width: 100px; font-size: 12px; color: var(--text2); }
.score-row-bar {
  flex: 1; height: 6px; background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
.score-row-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.6s ease;
}
.score-row-val { font-size: 13px; font-weight: 700; width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.score-row-pct { font-size: 10px; color: var(--text3); width: 30px; }

.red-flags-list { display: flex; flex-direction: column; gap: 6px; }
.red-flag-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2); border-radius: 6px;
  font-size: 12px; color: var(--red2);
}

.modal-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text2); font-size: 12px; padding: 7px 14px;
  border-radius: 8px; text-decoration: none; font-weight: 500;
  transition: all 0.15s;
}
.link-btn:hover { border-color: var(--primary); color: var(--primary2); }

/* Phase 2 Banner */
.phase2-banner {
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 20px;
}
.phase2-inner { display: flex; align-items: flex-start; gap: 12px; }
.phase2-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.phase2-banner strong { font-size: 13px; font-weight: 700; color: #fbbf24; }
.phase2-banner p { font-size: 12px; color: var(--text3); margin-top: 3px; line-height: 1.5; }

/* CA Bar */
.ca-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: rgba(8,11,20,0.9); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border); padding: 12px 24px;
}
.ca-inner {
  max-width: 1600px; margin: 0 auto;
  display: flex; gap: 10px;
}
.ca-inner input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; color: var(--text);
  font-size: 13px; font-family: var(--mono);
  transition: border-color 0.2s;
}
.ca-inner input::placeholder { color: var(--text3); font-family: var(--font); }
.ca-inner input:focus { outline: none; border-color: var(--primary); }
.btn-ca {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; border: none; padding: 10px 20px; border-radius: 8px;
  font-weight: 600; font-size: 13px; cursor: pointer;
  white-space: nowrap; font-family: var(--font);
  box-shadow: 0 2px 12px rgba(99,102,241,0.3);
  transition: all 0.2s;
}
.btn-ca:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(99,102,241,0.5); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* Tooltip */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text); font-size: 11px; padding: 5px 10px;
  border-radius: 6px; white-space: nowrap; z-index: 999;
  pointer-events: none; box-shadow: var(--shadow);
}

/* Responsive */
@media (max-width: 1200px) {
  .stats-bar { grid-template-columns: repeat(3, 1fr); }
  .th-liq, .td-liq { display: none; }
}
@media (max-width: 900px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .th-comp, .td-comp { display: none; }
  .header-inner { gap: 12px; }
  .toggle-text { display: none; }
}
@media (max-width: 640px) {
  .header { padding: 0 12px; }
  .main { padding: 12px 12px 0; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .filter-group { gap: 6px; }
}
