/* ==========================================================================
   Boll Grid Scanner Dashboard - Modern FinTech Design System
   ========================================================================== */

:root {
  --bg-primary: #070b14;
  --bg-secondary: #0d1322;
  --bg-surface: rgba(18, 25, 41, 0.75);
  --bg-surface-hover: rgba(26, 36, 58, 0.85);
  --bg-card: rgba(14, 20, 34, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-active: rgba(56, 189, 248, 0.4);
  
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-purple: #a855f7;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Roboto Mono', monospace;

  --glow-cyan: rgba(56, 189, 248, 0.2);
  --glow-emerald: rgba(16, 185, 129, 0.2);
  --glow-purple: rgba(168, 85, 247, 0.2);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 动态背景光晕与网格 */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.15), transparent 70%);
  top: -100px;
  right: -50px;
}

.bg-glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12), transparent 70%);
  bottom: 0;
  left: -150px;
}

/* ================== Header ================== */
.app-header {
  position: sticky;
  top: 0;
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 50;
}

.header-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(16, 185, 129, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  box-shadow: 0 0 20px var(--glow-cyan);
}

.brand-icon svg {
  width: 24px;
  height: 24px;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.badge-quant {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  background: linear-gradient(90deg, #0284c7, #059669);
  color: #fff;
  border-radius: 6px;
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.live-status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.live-text {
  color: var(--accent-emerald);
  font-family: var(--font-mono);
}

.divider {
  color: var(--border-subtle);
  opacity: 0.6;
}

.next-update {
  color: var(--text-muted);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-surface-hover);
  color: var(--accent-cyan);
  border-color: var(--border-active);
  transform: rotate(45deg);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

/* ================== Main Container ================== */
.main-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.8rem 1.5rem 3rem;
  position: relative;
  z-index: 10;
}

/* ================== KPI Grid ================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.4rem;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.kpi-card.highlight-cyan {
  border-top: 2px solid var(--accent-cyan);
}
.kpi-card.highlight-emerald {
  border-top: 2px solid var(--accent-emerald);
}
.kpi-card.highlight-purple {
  border-top: 2px solid var(--accent-purple);
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.kpi-value {
  font-size: 2.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.kpi-card.highlight-cyan .kpi-value { color: var(--accent-cyan); }
.kpi-card.highlight-emerald .kpi-value { color: var(--accent-emerald); }
.kpi-card.highlight-purple .kpi-value { color: var(--accent-purple); }

.kpi-unit {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.kpi-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ================== Controls Bar ================== */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 0.9rem 1.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  backdrop-filter: blur(12px);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  min-width: 280px;
}

.search-box svg {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  width: 100%;
}

.search-box input::placeholder {
  color: var(--text-dim);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.filter-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.mode-toggle-group {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.35rem 0.8rem;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ================== Token Cards Grid ================== */
.token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1.5rem;
}

.token-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.6rem;
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.token-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5), 0 0 20px var(--glow-cyan);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.symbol-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.symbol-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.symbol-name {
  font-size: 1.45rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.tag-score {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
}

.meta-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.price-box {
  text-align: right;
}

.current-price {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.funding-tag {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  display: inline-block;
  margin-top: 0.2rem;
}

/* ================== Price Visual Range Bar ================== */
.range-widget {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 0.9rem;
}

.range-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.range-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  position: relative;
  margin: 0.6rem 0;
}

.range-box-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.3), rgba(16, 185, 129, 0.4));
  border-radius: 999px;
}

.range-mid-tick {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: rgba(255, 255, 255, 0.4);
  left: 50%;
  transform: translateX(-50%);
}

.range-price-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #38bdf8;
  border: 2px solid #fff;
  box-shadow: 0 0 10px #38bdf8;
  z-index: 2;
}

.range-labels-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ================== Stats Matrix ================== */
.stats-matrix {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.matrix-cell {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
}

.cell-title {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 0.2rem;
}

.cell-val {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.cell-val.text-emerald { color: var(--accent-emerald); }
.cell-val.text-cyan { color: var(--accent-cyan); }
.cell-val.text-purple { color: #c084fc; }

/* ================== Recommended Strategy Box ================== */
.strategy-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(56, 189, 248, 0.06));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 12px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.strategy-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
}

.strategy-label {
  color: var(--text-muted);
}

.strategy-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
}

.text-rose { color: var(--accent-rose); }
.text-emerald { color: var(--accent-emerald); }
.text-cyan { color: var(--accent-cyan); }

/* ================== Card Action Buttons ================== */
.card-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: auto;
}

.btn-card {
  flex: 1;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-card-primary {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-card-primary:hover {
  background: var(--accent-cyan);
  color: #070b14;
  box-shadow: 0 0 15px var(--glow-cyan);
}

.btn-card-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.btn-card-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* ================== Empty State ================== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-surface);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  max-width: 700px;
  margin: 2rem auto;
}

.empty-state.hidden {
  display: none;
}

.empty-radar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.3);
  margin: 0 auto 1.5rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(56, 189, 248, 0.4), transparent 60%);
  animation: spin 3s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.radar-center {
  font-size: 2rem;
  position: relative;
  z-index: 2;
}

.empty-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  color: var(--text-main);
}

.empty-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ================== Modal ================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 20px;
  width: 100%;
  max-width: 580px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 30px var(--glow-cyan);
  overflow: hidden;
  animation: modalEnter 0.25s ease-out;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1.4rem 1.6rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.modal-symbol {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
  margin-top: 0.2rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.6rem;
}

.modal-tip {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1.2rem;
}

.param-spec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.param-spec-item {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.param-spec-item.highlight-box {
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.05);
}

.param-spec-item.highlight-danger {
  border-color: rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.05);
}

.param-label {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.param-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.modal-actions {
  display: flex;
  gap: 0.8rem;
}

.btn-copy {
  flex: 1;
  background: linear-gradient(135deg, #0284c7, #059669);
  border: none;
  color: #fff;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-copy:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 20px var(--glow-emerald);
}

.btn-copy svg {
  width: 18px;
  height: 18px;
}

.btn-binance {
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-binance:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ================== Footer ================== */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  position: relative;
  z-index: 10;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--accent-cyan);
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .header-container { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
  .controls-bar { flex-direction: column; align-items: stretch; }
  .search-box { min-width: 100%; }
  .token-grid { grid-template-columns: 1fr; }
  .param-spec-grid { grid-template-columns: 1fr; }
}
