/* ============================================
   HARVEST BOTS DASHBOARD THEME UPGRADE
   Safe CSS-only overlay — does NOT modify React app
   Deploy: copy to /var/www/harvestbots/public/
   Inject: <link rel="stylesheet" href="/theme-upgrade.css"> in <head>
   Rollback: remove that one line from index.html
   ============================================ */

/* --- Enhanced Color Palette via Variable Overrides --- */
:root {
  --bg: #04070d !important;
  --surface: #080d16 !important;
  --card: #0c1220 !important;
  --card-border: #162036 !important;
  --green: #22c55e !important;
  --green-dim: #16a34a !important;
  --green-glow: rgba(34,197,94,0.08) !important;
  --green-border: rgba(34,197,94,0.15) !important;
  --text: #f0f4f8 !important;
  --text-sec: #8899aa !important;
  --text-muted: #4a5d73 !important;
  --font: 'Inter', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace !important;

  /* New extended palette */
  --bg-glass: rgba(8,13,22,0.88);
  --border-glow: rgba(34,197,94,0.25);
  --green-bright: #4ade80;
  --green-mid: rgba(34,197,94,0.15);
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,0.07);
  --amber-dim: rgba(245,158,11,0.07);
  --violet: #a78bfa;
  --violet-dim: rgba(167,139,250,0.07);
  --cyan: #06b6d4;
}

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* --- Dot Grid Background --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

/* --- Top Ambient Glow --- */
body::before {
  content: '';
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(34,197,94,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

#root {
  position: relative;
  z-index: 1;
}

/* --- Glassmorphism Header --- */
header {
  background: var(--bg-glass) !important;
  backdrop-filter: blur(16px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.4) !important;
  border-bottom: 1px solid rgba(255,255,255,0.04) !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
}

/* --- Enhanced Card Hover Effects --- */
main > div > div:nth-child(2) > div {
  transition: all 0.2s ease !important;
  border-radius: 14px !important;
  position: relative;
  overflow: hidden;
}

main > div > div:nth-child(2) > div:hover {
  border-color: rgba(255,255,255,0.08) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

/* --- Stat Card Top Glow Bars (added by JS, styled here) --- */
.stat-glow-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0.8;
  pointer-events: none;
}

.stat-glow-bar.green { background: linear-gradient(90deg, #22c55e, transparent 80%); }
.stat-glow-bar.blue { background: linear-gradient(90deg, #3b82f6, transparent 80%); }
.stat-glow-bar.amber { background: linear-gradient(90deg, #f59e0b, transparent 80%); }
.stat-glow-bar.violet { background: linear-gradient(90deg, #a78bfa, transparent 80%); }

/* --- Enhanced Active Pill --- */
[data-enhanced-pill] {
  background: rgba(34,197,94,0.08) !important;
  color: #22c55e !important;
  border: 1px solid rgba(34,197,94,0.15) !important;
  box-shadow: 0 0 12px rgba(34,197,94,0.15);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-size: 11px !important;
}

/* --- Coin Button Enhancements --- */
[data-coin-btn] {
  transition: all 0.2s ease !important;
  border-radius: 12px !important;
  position: relative;
  overflow: hidden;
}

[data-coin-btn]:hover {
  border-color: rgba(34,197,94,0.25) !important;
  transform: translateY(-3px);
  box-shadow: 0 0 20px rgba(34,197,94,0.15);
}

[data-coin-btn]:hover::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(34,197,94,0.05), transparent);
  pointer-events: none;
}

/* --- Sparkline Container --- */
.sparkline-container {
  width: 100%;
  height: 24px;
  margin: 6px 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sparkline-container svg {
  width: 70px;
  height: 24px;
}

/* --- Coin Logo Replacement --- */
.coin-logo-svg {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* --- Percentage Return Badge --- */
.return-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}

.return-badge.positive {
  background: linear-gradient(135deg, rgba(34,197,94,0.12), rgba(34,197,94,0.05));
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.18);
  box-shadow: 0 0 12px rgba(34,197,94,0.15);
}

.return-badge.negative {
  background: linear-gradient(135deg, rgba(239,68,68,0.12), rgba(239,68,68,0.05));
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.15);
}

/* --- Portfolio Section --- */
.portfolio-section-new {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: center;
  animation: fadeIn 0.5s ease;
}

.portfolio-section-new .section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  letter-spacing: -0.1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.portfolio-section-new .section-title svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.portfolio-chart-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.portfolio-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.legend-label span:last-child {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* --- Trades Feed Section --- */
.trades-feed-new {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  animation: fadeIn 0.5s ease;
}

.trades-feed-new .section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  gap: 6px;
}

.trades-feed-new .section-title svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.trade-row-new {
  display: grid;
  grid-template-columns: 70px 100px 70px 100px 1fr;
  gap: 16px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 6px;
  transition: background 0.15s;
  animation: slideIn 0.4s ease-out backwards;
}

.trade-row-new:nth-child(even) {
  background: rgba(255,255,255,0.015);
}

.trade-row-new:hover {
  background: rgba(255,255,255,0.04);
}

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

.trade-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-weight: 500;
}

.trade-pair-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

.trade-side-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.trade-side-tag.buy {
  background: rgba(34,197,94,0.1);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.2);
}

.trade-side-tag.sell {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.2);
}

.trade-amount {
  font-size: 11px;
  color: var(--text);
  font-family: var(--mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.trade-price-val {
  font-size: 11px;
  color: var(--text-sec);
  font-family: var(--mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* --- Enhanced Bot Row (Active Bots table) --- */
[data-bot-row] {
  background: var(--surface) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: 10px !important;
  transition: all 0.15s ease !important;
  margin-bottom: 4px;
}

[data-bot-row]:hover {
  border-color: rgba(255,255,255,0.08) !important;
  background: #111a2e !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

/* --- Live Indicator Dot --- */
.live-dot-enhanced {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34,197,94,0.7), 0 0 20px rgba(34,197,94,0.35);
  animation: pulse 2s ease-in-out infinite;
  display: inline-block;
}

/* --- Animated Number Styling --- */
[data-counter] {
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

/* --- Bull Logo Enhancement --- */
.bull-logo-enhanced {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(145deg, #22c55e 0%, #15803d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(34,197,94,0.3), inset 0 1px 0 rgba(255,255,255,0.15), 0 0 16px rgba(34,197,94,0.25);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.bull-logo-enhanced::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 50%);
  border-radius: 8px;
}

.bull-logo-enhanced svg {
  width: 22px;
  height: 22px;
  position: relative;
  z-index: 1;
}

/* --- Overall Return Stat Special --- */
[data-stat="return"] .stat-value {
  color: #4ade80 !important;
  text-shadow: 0 0 20px rgba(34,197,94,0.3);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .portfolio-section-new {
    grid-template-columns: 1fr;
  }
  .trade-row-new {
    grid-template-columns: 60px 80px 60px 80px 1fr;
    gap: 8px;
  }
}

/* --- Smooth Page Load --- */
#root > div {
  animation: fadeIn 0.3s ease;
}

/* --- Footer Enhancement --- */
.footer-enhanced {
  text-align: center;
  padding: 24px 0 16px;
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
