/* ================================
   Pulse Runner – Global Design System
   v2.0 – November 2025
=================================== */

/* ---------- Theme tokens ---------- */
:root{
  --bg:#0f1115;
  --card:#171a21;
  --subcard:#1b1f2a;
  --text:#e7e9ee;
  --muted:#9aa3b2;
  --rule:#262b36;
  --accent:#7aa2ff;
  --good:#7affb3;
  --bad:#ff7a7a;

  --r-xxl:96px;
  --r-xl:64px;
  --r-lg:40px;
  --r-md:24px;
  --r-sm:16px;
  --r-xs:12px;

  --rad-lg:16px;
  --rad-md:14px;
  --rad-sm:10px;

  --glow:0 10px 30px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04);
}

/* ---------- Reset / Base ---------- */
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  background:var(--bg);
  color:var(--text);
  font-family:"Roboto",system-ui,-apple-system,Segoe UI,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  line-height:1.6;
  font-size:16px;
  padding-bottom: 70px;
}
h1,h2,h3,h4{
  color:var(--text);
  font-weight:700;
  font-family:"Roboto Mono",ui-monospace,SFMono-Regular,monospace;
}
p,li{font-family:"Roboto",sans-serif}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}

/* ---------- Layout helpers ---------- */
.wrap{max-width:1100px;margin:0 auto;padding:0 var(--r-sm)}

/* ---------- Card ---------- */
.card{
  background:var(--card);
  border:1px solid var(--rule);
  border-radius:var(--rad-md);
  box-shadow:var(--glow);
}

/* ================================
   Header
=================================== */
.site-header{
  width:100%;
  background:var(--bg);
  border-bottom:1px solid var(--rule);
  position:sticky; top:0; z-index:50;
  backdrop-filter:saturate(120%) blur(6px);
  -webkit-backdrop-filter:saturate(120%) blur(6px);
}
.site-header .bar{
  display:flex;align-items:center;gap:10px;padding:22px 28px
}
.logo{
  display:flex;align-items:center;gap:10px;
  font-size:20px;font-weight:700;
  font-family:"Roboto Mono",monospace
}
.logo-badge{
  width:32px;height:32px;border-radius:8px;background:var(--subcard);
  display:flex;align-items:center;justify-content:center;
  font-weight:800;border:1px solid var(--rule);color:var(--accent);
  font-family:"Roboto Mono",monospace
}

/* Nav */
.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 26px;
}
.nav-link {
  font-family: "Roboto Mono", monospace;
  font-size: 13px;
  color: var(--muted);
  padding: 6px 2px;
  text-decoration: none;
  transition: color .2s ease;
}
.nav-link:hover { color: var(--accent); }
.nav-link.active { color: var(--accent); }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.hamburger span {
  width: 24px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
}
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .nav-links {
    position: absolute;
    top: 60px;
    right: 0;
    background: #1a1a1a;
    flex-direction: column;
    width: 200px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s;
  }
  .nav-links.show { max-height: 300px; }
  .nav-links a { padding: 16px 20px; border-bottom: 1px solid #333; }
}

/* ================================
   MarketPulse Header
=================================== */
.mp-header {
  margin: 28px auto 32px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.mp-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}
.mp-header .stamp {
  font-size: 13px;
  color: var(--muted);
}
.mp-header::before {
  content: "";
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 520px;
  height: 220px;
  background: radial-gradient(ellipse at center, rgba(122,162,255,0.22) 0%, rgba(122,162,255,0.06) 45%, rgba(0,0,0,0) 80%);
  filter: blur(28px);
  opacity: 0.75;
  pointer-events: none;
  z-index: -1;
}

.mpulse-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ================================
   Watchlist Toolbar
=================================== */
.watchlist-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #111;
  border-top: 1px solid #333;
  padding: 10px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  z-index: 100;
  flex-wrap: wrap;
}
.toolbar-btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #222;
  color: #999;
  font-weight: 500;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.toolbar-btn:hover { background: #333; color: #fff; border-color: #555; }
.toolbar-count { color: #666; font-size: 12px; }
.toolbar-count span { color: #888; }

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #00ff88;
  color: #000;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ============================================
   LIVE PRICE UPDATES
   ============================================ */

/* Price + PnL container */
.price-cluster {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Price display */
.sig-price {
  font-family: 'Roboto Mono', monospace;
  font-weight: 600;
  transition: color 0.3s, transform 0.2s;
}

/* Flash animations */
.sig-price.flash-up {
  color: #00ff88 !important;
  transform: scale(1.05);
}

.sig-price.flash-down {
  color: #ff4444 !important;
  transform: scale(1.05);
}

/* Live PnL badge in header */
.live-pnl {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75em;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  transition: all 0.3s;
}

.live-pnl.positive {
  color: #00ff88;
  background: rgba(0, 255, 136, 0.15);
}

.live-pnl.negative {
  color: #ff4444;
  background: rgba(255, 68, 68, 0.15);
}

/* Cluster section PnL coloring */
.cluster-pnl-metric.positive strong { 
  color: #00ff88; 
}

.cluster-pnl-metric.negative strong { 
  color: #ff4444; 
}

/* ============================================
   WEBSOCKET STATUS INDICATOR
   ============================================ */

.ws-status {
  position: fixed;
  bottom: 60px;
  right: 20px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 600;
  z-index: 1000;
  transition: all 0.3s;
  cursor: default;
}

.ws-status.connected {
  background: rgba(0, 255, 136, 0.2);
  color: #00ff88;
  border: 1px solid #00ff88;
}

.ws-status.disconnected {
  background: rgba(255, 68, 68, 0.2);
  color: #ff4444;
  border: 1px solid #ff4444;
}

.ws-status.connecting {
  background: rgba(255, 200, 0, 0.2);
  color: #ffc800;
  border: 1px solid #ffc800;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ================================
   Signal Accordion
=================================== */
.signal-accordion {
  position: relative;
  background: 
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.04) 1px, transparent 0),
    linear-gradient(90deg, rgba(0,255,136,0.08) 0%, transparent 50%, rgba(100,200,255,0.08) 100%),
    #1a1a1a;
  background-size: 8px 8px, 100% 100%, 100% 100%;
  border: 2px solid #333;
  border-radius: 12px;
  margin-bottom: 0;
  transition: all 0.3s ease;
}
.signal-accordion:hover {
  border-color: #555;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.signal-checkbox {
  position: absolute;
  top: 16px;
  right: 60px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: #00ff88;
  z-index: 10;
}

/* Urgency Borders */
.signal-accordion.urgency-parabolic {
  border: 3px solid #ff4444 !important;
  background: linear-gradient(135deg, rgba(255,68,68,0.1) 0%, #1a1a1a 100%);
  animation: urgentPulse 1.5s ease-in-out infinite;
}
.signal-accordion.urgency-breakout {
  border: 3px solid #ff8800 !important;
  background: linear-gradient(135deg, rgba(255,136,0,0.08) 0%, #1a1a1a 100%);
  animation: breakoutPulse 2s ease-in-out infinite;
}
.signal-accordion.urgency-rally {
  border: 3px solid #ffdd00 !important;
  background: linear-gradient(135deg, rgba(255,221,0,0.06) 0%, #1a1a1a 100%);
}
.signal-accordion.signal-bullish {
  border-color: rgba(0,255,136,0.4);
}
.signal-accordion.signal-bearish {
  border-color: rgba(255,68,68,0.4);
}
.signal-accordion.actionable-signal {
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
}
.signal-accordion.alpha-perfect {
  border: 3px solid #FFD700 !important;
  box-shadow: 0 0 30px rgba(255,215,0,0.5) !important;
  animation: perfectAlpha 2s ease-in-out infinite !important;
}

@keyframes perfectAlpha {
  0%, 100% { box-shadow: 0 0 30px rgba(255,215,0,0.5); border-color: #FFD700; }
  50% { box-shadow: 0 0 50px rgba(255,215,0,0.8); border-color: #FFEC8B; }
}
@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255,68,68,0.4); }
  50% { box-shadow: 0 0 40px rgba(255,68,68,0.7); }
}
@keyframes breakoutPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(255,136,0,0.3); }
  50% { box-shadow: 0 0 30px rgba(255,136,0,0.5); }
}

/* Summary Row */
.signal-summary {
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}
.signal-summary::-webkit-details-marker { display: none; }

.sum-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sig-emoji { font-size: 36px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.sig-logo-wrapper {
  width: 44px; height: 44px;
  background: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.sig-logo { width: 36px; height: 36px; border-radius: 50%; }
.sig-identity { display: flex; flex-direction: column; gap: 2px; }
.sig-rank { font-size: 12px; color: #888; font-weight: 600; }
.sig-symbol { font-size: 22px; font-weight: 700; color: #fff; }
.sig-price { font-size: 15px; color: #00ff88; font-weight: 600; }

.sum-middle { display: flex; flex-direction: column; gap: 10px; }
.badge-row-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge-row-bottom { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* Alpha Badge */
.alpha-badge {
  font-size: 18px; font-weight: 700;
  padding: 4px 10px; border-radius: 6px;
  background: rgba(255,215,0,0.15);
  font-family: 'Roboto Mono', monospace;
}
.alpha-badge.alpha-100 { color: #FFD700; background: linear-gradient(135deg, rgba(255,215,0,0.3), rgba(255,180,0,0.2)); }
.alpha-badge.alpha-90 { color: #FFD700; }
.alpha-badge.alpha-80 { color: #FFEC8B; }
.alpha-badge.alpha-70 { color: #FFF; background: rgba(255,255,255,0.1); }
.alpha-badge.alpha-low { color: #999; background: rgba(128,128,128,0.1); }

/* Signal Type Badge */
.signal-type-badge {
  font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 6px;
  text-transform: uppercase;
  font-family: 'Roboto Mono', monospace;
}
.signal-type-badge.type-parabolic { background: linear-gradient(135deg, #ff4444, #cc0000); color: #fff; }
.signal-type-badge.type-breakout { background: linear-gradient(135deg, #ff8800, #cc6600); color: #fff; }
.signal-type-badge.type-rally { background: linear-gradient(135deg, #ffdd00, #ccaa00); color: #000; }
.signal-type-badge.type-strong { background: rgba(0,255,136,0.2); color: #00ff88; border: 1px solid rgba(0,255,136,0.3); }
.signal-type-badge.type-building { background: rgba(100,180,255,0.15); color: #64b4ff; }
.signal-type-badge.type-dip { background: rgba(0,200,255,0.15); color: #00c8ff; }
.signal-type-badge.type-watch { background: rgba(128,128,128,0.15); color: #aaa; }
.signal-type-badge.type-bearish { background: rgba(255,68,68,0.15); color: #ff6666; }

/* Urgency Indicator */
.urgency-indicator {
  font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 4px;
  text-transform: uppercase;
}
.urgency-indicator.urgency-hot { background: #ff4444; color: #fff; animation: urgencyBlink 0.8s ease-in-out infinite; }
.urgency-indicator.urgency-breaking { background: #ff8800; color: #fff; }
.urgency-indicator.urgency-momentum { background: #ffdd00; color: #000; }
@keyframes urgencyBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* DEX Badge */
.dex-badge { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 4px; }
.dex-badge.dex-confirmed { background: rgba(0,255,136,0.2); color: #00ff88; }
.dex-badge.dex-available { background: rgba(255,221,0,0.15); color: #ffdd00; }
.dex-badge.dex-weak { background: rgba(255,136,0,0.15); color: #ff8800; }

/* Action Badge */
.action-badge { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 4px; }
.action-badge.action-now { background: #00ff88; color: #000; }
.action-badge.action-new { background: #ffaa00; color: #000; }
.action-badge.action-update { background: #666; color: #fff; }

/* Quick Metrics */
.quick-metric { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #aaa; }
.quick-metric .label { color: #666; font-weight: 500; }
.quick-metric .value { font-weight: 600; color: #fff; }
.quick-metric .value.positive { color: #00ff88; }
.quick-metric .value.negative { color: #ff4444; }

.pattern-badge { font-size: 11px; color: #888; padding: 2px 8px; background: rgba(255,255,255,0.05); border-radius: 4px; }

.sum-right { display: flex; align-items: center; }
.expand-icon {
  width: 32px; height: 32px;
  background: #333; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #888;
  transition: all 0.2s ease;
}
.signal-accordion[open] .expand-icon { transform: rotate(45deg); background: #444; color: #fff; }

/* ================================
   SIGNAL CONTENT (Expanded)
=================================== */
.signal-content {
  padding: 20px 24px;
  border-top: 1px solid #333;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #444, transparent);
  margin: 16px 0;
}

/* Conviction Box */
.conviction-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-family: 'Roboto Mono', monospace;
}
.conviction-box.conviction-high {
  background: linear-gradient(135deg, rgba(0,255,136,0.15), rgba(0,200,100,0.08));
  border: 1px solid rgba(0,255,136,0.4);
}
.conviction-box.conviction-med {
  background: linear-gradient(135deg, rgba(255,200,0,0.12), rgba(200,150,0,0.06));
  border: 1px solid rgba(255,200,0,0.35);
}
.conviction-box.conviction-low {
  background: rgba(128,128,128,0.1);
  border: 1px solid rgba(128,128,128,0.3);
}
.conviction-bars { font-size: 18px; letter-spacing: 2px; }
.conviction-level { font-weight: 700; font-size: 13px; text-transform: uppercase; }
.conviction-high .conviction-level { color: #00ff88; }
.conviction-med .conviction-level { color: #ffcc00; }
.conviction-low .conviction-level { color: #888; }
.conviction-reason { color: #aaa; font-size: 12px; }

/* Thesis Box */
.thesis-box {
  font-size: 14px;
  line-height: 1.7;
  color: #ddd;
  padding: 0 4px;
  margin-bottom: 16px;
}

/* Signal Section */
.signal-section { margin-bottom: 16px; }
.section-header {
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 8px;
}
.section-metrics .metric {
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  color: #888;
}
.section-metrics .metric strong { color: #fff; font-weight: 600; }
.section-metrics .metric strong.positive { color: #00ff88; }
.section-metrics .metric strong.negative { color: #ff4444; }
.section-metrics .metric.positive strong { color: #00ff88; }
.section-metrics .metric.negative strong { color: #ff4444; }

.section-read {
  font-size: 13px;
  line-height: 1.6;
  color: #bbb;
  margin-top: 6px;
  padding-left: 2px;
}

/* Fear & Greed Badge */
.fng-badge {
  font-size: 0.7em;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.fng-extreme-fear {
  background: rgba(255, 68, 68, 0.25);
  color: #ff4444;
  border: 1px solid #ff4444;
}

.fng-fear {
  background: rgba(255, 136, 68, 0.25);
  color: #ff8844;
  border: 1px solid #ff8844;
}

.fng-neutral {
  background: rgba(200, 200, 200, 0.25);
  color: #cccccc;
  border: 1px solid #888888;
}

.fng-greed {
  background: rgba(136, 255, 68, 0.25);
  color: #88ff44;
  border: 1px solid #88ff44;
}

.fng-extreme-greed {
  background: rgba(0, 255, 136, 0.25);
  color: #00ff88;
  border: 1px solid #00ff88;
}

/* Action Box */
.action-section .action-box {
  background: rgba(0,0,0,0.3);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 14px 18px;
}
.action-primary {
  font-family: 'Roboto Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}
.action-levels { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.action-levels .level {
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  color: #aaa;
}
.action-levels .level.stop { color: #ff6666; }
.action-levels .level.tp { color: #66ff99; }

/* Badges in sections */
.hot-badge {
  background: rgba(255,100,0,0.2);
  color: #ff8844;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.whale-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.whale-badge.whale-buy { background: rgba(0,255,136,0.15); color: #00ff88; }
.whale-badge.whale-sell { background: rgba(255,68,68,0.15); color: #ff6666; }
.leader-badge {
  background: rgba(255,215,0,0.15);
  color: #ffd700;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.breakout-flag {
  background: rgba(255,136,0,0.15);
  color: #ff8800;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* Risks */
.risks-section .risks-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.risks-list li {
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  color: #cc8888;
  padding: 4px 0 4px 18px;
  position: relative;
}
.risks-list li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: #ff6666;
}

/* Footer */
.signal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
}
.chart-link {
  color: #00ff88;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}
.chart-link:hover { text-decoration: underline; }
.signal-time {
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
  color: #666;
}

/* ================================
   Footer
=================================== */
footer {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  margin-top: 48px;
}

/* ================================
   Responsive
=================================== */
@media (max-width: 768px) {
  .signal-summary {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 16px;
    padding-bottom: 50px;
  }
  .sum-middle { gap: 8px; }
  .badge-row-top { gap: 8px; }
  .badge-row-bottom { gap: 10px; }
  .sig-emoji { font-size: 28px; }
  .sig-logo-wrapper { width: 38px; height: 38px; }
  .sig-logo { width: 30px; height: 30px; }
  .sig-symbol { font-size: 18px; }
  .alpha-badge { font-size: 16px; padding: 3px 8px; }
  .signal-type-badge { font-size: 11px; padding: 4px 8px; }
  .sum-right { position: absolute; bottom: 14px; right: 16px; }
  .signal-checkbox { top: 12px; right: 50px; width: 20px; height: 20px; }
  .watchlist-toolbar { padding: 8px 12px; gap: 6px; }
  .toolbar-btn { padding: 6px 10px; font-size: 11px; }
  body { padding-bottom: 60px; }
  .toast { bottom: 70px; }
  
  .conviction-box { flex-wrap: wrap; }
  .section-metrics { gap: 8px 14px; }
  .action-levels { flex-direction: column; gap: 6px; }
}

@media (max-width: 480px) {
  .quick-metric { font-size: 11px; }
  .badge-row-bottom { gap: 8px; }
  .toolbar-btn { padding: 6px 8px; font-size: 10px; }
}
