/* ============================================================
   TradeDesk — Apple Dark Frozen Glass Design System
   ============================================================ */

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

/* ── CSS Custom Properties ── */
:root {
  /* Colors */
  --bg-primary:        #04050f;
  --bg-secondary:      #060814;
  --bg-tertiary:       #080b18;

  --glass-base:        rgba(255,255,255,0.04);
  --glass-elevated:    rgba(255,255,255,0.07);
  --glass-high:        rgba(255,255,255,0.10);
  --glass-border:      rgba(255,255,255,0.07);
  --glass-border-high: rgba(255,255,255,0.12);

  --text-primary:      #ffffff;
  --text-secondary:    rgba(255,255,255,0.45);
  --text-tertiary:     rgba(255,255,255,0.25);
  --text-muted:        rgba(255,255,255,0.15);

  --accent-blue:       #007AFF;
  --accent-blue-glow:  rgba(0,122,255,0.3);
  --accent-blue-soft:  rgba(0,122,255,0.15);
  --accent-green:      #34d399;
  --accent-green-glow: rgba(52,211,153,0.25);
  --accent-green-soft: rgba(52,211,153,0.12);
  --accent-red:        #f87171;
  --accent-red-glow:   rgba(248,113,113,0.25);
  --accent-red-soft:   rgba(248,113,113,0.12);
  --accent-gold:       #FFB800;
  --accent-gold-glow:  rgba(255,184,0,0.25);
  --accent-gold-soft:  rgba(255,184,0,0.12);

  --surface-01: rgba(255,255,255,0.04);
  --surface-02: rgba(255,255,255,0.06);
  --surface-03: rgba(255,255,255,0.08);

  /* Sidebar */
  --sidebar-width: 240px;

  /* Typography */
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radius */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.4);
  --shadow-xl:   0 20px 60px rgba(0,0,0,0.7), 0 8px 20px rgba(0,0,0,0.5);
  --shadow-blue: 0 0 20px rgba(0,122,255,0.4), 0 0 60px rgba(0,122,255,0.15);
  --shadow-green:0 0 20px rgba(52,211,153,0.3), 0 0 60px rgba(52,211,153,0.1);
  --shadow-red:  0 0 20px rgba(248,113,113,0.3), 0 0 60px rgba(248,113,113,0.1);
  --shadow-gold: 0 0 20px rgba(255,184,0,0.3), 0 0 60px rgba(255,184,0,0.1);

  /* Transitions */
  --transition-fast:   all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:   all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index */
  --z-sidebar:  100;
  --z-header:   90;
  --z-modal:    200;
  --z-tooltip:  300;
  --z-toast:    400;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-base);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Deep space background with subtle nebula */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(0,122,255,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(52,211,153,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 60% 30%, rgba(255,184,0,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Glass Components ── */
.glass {
  background: var(--glass-base);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

.glass-elevated {
  background: var(--glass-elevated);
  backdrop-filter: blur(60px) saturate(250%);
  -webkit-backdrop-filter: blur(60px) saturate(250%);
  border: 1px solid var(--glass-border-high);
  border-radius: var(--radius-lg);
}

.glass-sidebar {
  background: rgba(6,8,20,0.8);
  backdrop-filter: blur(80px) saturate(300%);
  -webkit-backdrop-filter: blur(80px) saturate(300%);
  border-right: 1px solid var(--glass-border);
}

.glass-modal {
  background: rgba(10,12,28,0.92);
  backdrop-filter: blur(80px) saturate(300%);
  -webkit-backdrop-filter: blur(80px) saturate(300%);
  border: 1px solid var(--glass-border-high);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
}

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0 var(--space-6);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--space-6);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-blue), rgba(0,122,255,0.7));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-blue);
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.sidebar-logo-text span {
  color: var(--accent-blue);
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent-blue-soft), transparent);
  opacity: 0;
  transition: var(--transition-fast);
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--glass-base);
  border-color: var(--glass-border);
}

.nav-item:hover::before { opacity: 1; }

.nav-item.active {
  color: var(--text-primary);
  background: var(--glass-elevated);
  border-color: rgba(0,122,255,0.2);
}

.nav-item.active::before { opacity: 1; }

.nav-item-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.nav-item-label { position: relative; z-index: 1; }

/* Sidebar Status */
.sidebar-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--glass-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  position: relative;
}

.status-dot.connected {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.connected::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: var(--radius-full);
  background: var(--accent-green);
  opacity: 0.3;
  animation: pulse-ring 2s ease infinite;
}

.status-dot.disconnected {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

.status-dot.paper {
  background: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

.status-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Sidebar P&L Footer */
.sidebar-pnl {
  padding: var(--space-4);
  background: var(--glass-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.sidebar-pnl-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-1);
}

.sidebar-pnl-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.sidebar-pnl-value.positive { color: var(--accent-green); }
.sidebar-pnl-value.negative { color: var(--accent-red); }

.sidebar-pnl-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--space-6);
  gap: var(--space-5);
}

/* ── Header Bar ── */
.header-bar {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-4) var(--space-5);
}

.pair-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--glass-elevated);
  border: 1px solid var(--glass-border-high);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.pair-selector:hover {
  background: var(--glass-high);
  border-color: rgba(0,122,255,0.3);
}

.pair-selector select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.5px;
  cursor: pointer;
  outline: none;
  appearance: none;
  padding-right: var(--space-4);
}

.pair-selector select option {
  background: #0d0f1e;
  color: var(--text-primary);
}

.pair-chevron {
  color: var(--text-secondary);
  font-size: 10px;
  pointer-events: none;
}

/* Price display */
.price-display {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.price-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

.price-value.flash-up {
  color: var(--accent-green);
  text-shadow: var(--shadow-green);
}

.price-value.flash-down {
  color: var(--accent-red);
  text-shadow: var(--shadow-red);
}

.price-delta {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.price-delta.positive {
  background: var(--accent-green-soft);
  color: var(--accent-green);
  border: 1px solid rgba(52,211,153,0.2);
}

.price-delta.negative {
  background: var(--accent-red-soft);
  color: var(--accent-red);
  border: 1px solid rgba(248,113,113,0.2);
}

/* Market status badge */
.market-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.market-status.bullish {
  background: var(--accent-green-soft);
  color: var(--accent-green);
  border: 1px solid rgba(52,211,153,0.2);
}

.market-status.bearish {
  background: var(--accent-red-soft);
  color: var(--accent-red);
  border: 1px solid rgba(248,113,113,0.2);
}

.market-status.neutral {
  background: var(--glass-base);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

/* Mode toggle */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 8px;
  background: var(--glass-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-left: auto;
}

.mode-toggle-btn {
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
  background: transparent;
  color: var(--text-secondary);
}

.mode-toggle-btn.active {
  background: var(--accent-blue);
  color: white;
  box-shadow: 0 2px 8px var(--accent-blue-glow);
}

.mode-toggle-btn.active.paper {
  background: var(--accent-gold);
  box-shadow: 0 2px 8px var(--accent-gold-glow);
}

/* ── Chart Area ── */
.chart-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  position: relative;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.timeframe-selector {
  display: flex;
  gap: 2px;
  background: var(--glass-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 3px;
}

.tf-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.tf-btn:hover { color: var(--text-primary); }

.tf-btn.active {
  background: var(--accent-blue);
  color: white;
  box-shadow: 0 1px 6px var(--accent-blue-glow);
}

#chart-container {
  flex: 1;
  min-height: 300px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ── Dashboard Grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: auto 1fr;
  gap: var(--space-5);
  flex: 1;
  min-height: 0;
}

.chart-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-height: 0;
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 0;
  overflow-y: auto;
}

/* ── Cards ── */
.card {
  padding: var(--space-5);
  transition: var(--transition-base);
}

.card:hover {
  border-color: var(--glass-border-high);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-grid {
  background: rgba(0,122,255,0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(0,122,255,0.25);
}

.badge-dca {
  background: rgba(255,184,0,0.12);
  color: var(--accent-gold);
  border: 1px solid rgba(255,184,0,0.2);
}

.badge-rsi {
  background: rgba(52,211,153,0.12);
  color: var(--accent-green);
  border: 1px solid rgba(52,211,153,0.2);
}

.badge-bollinger_squeeze {
  background: rgba(245,158,11,0.12);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.2);
}

.badge-ema_cross {
  background: rgba(167,139,250,0.12);
  color: #a78bfa;
  border: 1px solid rgba(167,139,250,0.2);
}

/* Active Bot Card */
.bot-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: var(--space-1);
}

.bot-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.bot-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.bot-stat {
  background: var(--surface-01);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  border: 1px solid var(--glass-border);
}

.bot-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.bot-stat-value {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

/* ON/OFF Toggle */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.toggle-input {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-input input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  transition: var(--transition-base);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: var(--radius-full);
  transition: var(--transition-spring);
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.toggle-input input:checked ~ .toggle-track {
  background: var(--accent-green);
  border-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green-glow);
}

.toggle-input input:checked ~ .toggle-thumb {
  left: calc(100% - 19px);
}

.toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Trades List */
.trades-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 200px;
  overflow-y: auto;
}

.trade-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-01);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  transition: var(--transition-fast);
  font-size: 12px;
}

.trade-item:hover {
  background: var(--surface-02);
  border-color: var(--glass-border-high);
}

.trade-side {
  width: 32px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.trade-side.buy {
  background: var(--accent-green-soft);
  color: var(--accent-green);
  border: 1px solid rgba(52,211,153,0.2);
}

.trade-side.sell {
  background: var(--accent-red-soft);
  color: var(--accent-red);
  border: 1px solid rgba(248,113,113,0.2);
}

.trade-price {
  flex: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.trade-pnl {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.trade-pnl.positive { color: var(--accent-green); }
.trade-pnl.negative { color: var(--accent-red); }

.trade-time {
  color: var(--text-tertiary);
  font-size: 10px;
  flex-shrink: 0;
}

/* Whale Signal Card */
.whale-signal {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.whale-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.whale-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-gold), rgba(255,184,0,0.6));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-gold);
  flex-shrink: 0;
}

.whale-wallet {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent-gold);
  margin-bottom: 2px;
}

.whale-time { font-size: 11px; color: var(--text-tertiary); }

.whale-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-2);
}

.whale-stat {
  text-align: center;
  padding: var(--space-2);
  background: var(--glass-base);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}

.whale-stat-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  margin-bottom: 3px;
}

.whale-stat-value {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}

.whale-direction {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
}

.whale-direction.long {
  background: var(--accent-green-soft);
  color: var(--accent-green);
  border: 1px solid rgba(52,211,153,0.2);
}

.whale-direction.short {
  background: var(--accent-red-soft);
  color: var(--accent-red);
  border: 1px solid rgba(248,113,113,0.2);
}

.smart-score {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.smart-score-bar {
  flex: 1;
  height: 4px;
  background: var(--glass-base);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.smart-score-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-green));
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Bottom Stats Bar ── */
.stats-bar {
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  gap: 0;
}

.stat-item {
  flex: 1;
  text-align: center;
  padding: var(--space-3) var(--space-4);
  position: relative;
}

.stat-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: var(--glass-border);
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
}

.stat-value.positive { color: var(--accent-green); }
.stat-value.negative { color: var(--accent-red); }
.stat-value.neutral  { color: var(--text-primary); }

/* ── Bots Page ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px var(--space-5);
  background: var(--accent-blue);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-base);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 12px var(--accent-blue-glow);
  letter-spacing: -0.2px;
}

.btn-primary:hover {
  background: #0A84FF;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-blue-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px var(--space-4);
  background: var(--glass-base);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-base);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--glass-elevated);
  color: var(--text-primary);
  border-color: var(--glass-border-high);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px var(--space-4);
  background: var(--accent-red-soft);
  color: var(--accent-red);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: var(--radius-sm);
  font-family: var(--font-base);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-danger:hover {
  background: rgba(248,113,113,0.2);
  box-shadow: 0 0 12px rgba(248,113,113,0.2);
}

/* Bots Grid */
.bots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
}

.bot-card {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transition: var(--transition-base);
}

.bot-card:hover {
  border-color: rgba(0,122,255,0.2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,122,255,0.1);
  transform: translateY(-2px);
}

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

.bot-card-info { flex: 1; min-width: 0; overflow: hidden; }
.bot-card-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-card-symbol {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.bot-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.bot-card-stat {
  background: var(--surface-01);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
}

.bot-card-stat-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  margin-bottom: 3px;
}

.bot-card-stat-value {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bot-card-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  text-align: center;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: 13px;
  max-width: 280px;
  line-height: 1.6;
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.03) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.03) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
}

.skeleton-text.wide { width: 80%; }
.skeleton-text.medium { width: 50%; }
.skeleton-text.narrow { width: 30%; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: var(--space-3); }
.skeleton-value { height: 28px; width: 45%; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  width: 540px;
  max-width: calc(100vw - 2rem);
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-8);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  opacity: 0;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.8px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--glass-base);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: var(--glass-elevated);
  color: var(--text-primary);
}

/* Strategy tabs in modal */
.strategy-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  background: var(--glass-base);
  border-radius: var(--radius-md);
  padding: 4px;
  border: 1px solid var(--glass-border);
}

.strategy-tab {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  text-align: center;
}

.strategy-tab.active {
  background: var(--glass-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.form-grid.single { grid-template-columns: 1fr; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
}

.form-input {
  background: var(--glass-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 10px var(--space-4);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-fast);
  outline: none;
  width: 100%;
}

.form-input:focus {
  border-color: var(--accent-blue);
  background: var(--glass-elevated);
  box-shadow: 0 0 0 3px var(--accent-blue-soft);
}

.form-input::placeholder { color: var(--text-tertiary); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option { background: #0d0f1e; }

.modal-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ── Portfolio Page ── */
.portfolio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.metric-card {
  padding: var(--space-5);
}

.metric-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.metric-value.positive { color: var(--accent-green); }
.metric-value.negative { color: var(--accent-red); }

.metric-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Trades Table */
.table-container {
  overflow-x: auto;
}

.trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.trades-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}

.trades-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.trades-table tr:hover td {
  background: var(--surface-01);
  color: var(--text-primary);
}

.trades-table tr:last-child td { border-bottom: none; }

/* Table filters */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.filter-input {
  background: var(--glass-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 8px var(--space-3);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 12px;
  outline: none;
  transition: var(--transition-fast);
}

.filter-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px var(--accent-blue-soft);
}

.filter-input::placeholder { color: var(--text-tertiary); }

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--glass-elevated);
  border: 1px solid var(--glass-border-high);
  border-radius: var(--radius-md);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 13px;
  font-weight: 500;
  max-width: 320px;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error   { border-left: 3px solid var(--accent-red); }
.toast.info    { border-left: 3px solid var(--accent-blue); }
.toast.warning { border-left: 3px solid var(--accent-gold); }

/* ── Utility Classes ── */
.text-positive { color: var(--accent-green); }
.text-negative { color: var(--accent-red); }
.text-blue     { color: var(--accent-blue); }
.text-gold     { color: var(--accent-gold); }
.text-muted    { color: var(--text-secondary); }
.text-dim      { color: var(--text-tertiary); }

.font-mono { font-family: var(--font-mono); }
.font-tabular { font-variant-numeric: tabular-nums; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.w-full { width: 100%; }
.mt-auto { margin-top: auto; }

/* Divider */
.divider {
  height: 1px;
  background: var(--glass-border);
  margin: var(--space-4) 0;
}

/* Pulse animation */
@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse { animation: pulse-glow 2s ease infinite; }

/* Signal live indicator */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: var(--accent-red-soft);
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--accent-red);
  text-transform: uppercase;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--accent-red);
  animation: pulse-glow 1s ease infinite;
}

/* ── Responsive ── */
@media (max-width: 1280px) {
  :root { --sidebar-width: 200px; }
  .dashboard-grid { grid-template-columns: 1fr 320px; }
  .portfolio-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1024px) {
  :root { --sidebar-width: 60px; }

  .sidebar-logo-text,
  .nav-item-label,
  .sidebar-status,
  .sidebar-pnl { display: none; }

  .sidebar { padding: var(--space-4) var(--space-3); }
  .sidebar-logo { justify-content: center; }
  .nav-item { justify-content: center; padding: 12px; }

  .dashboard-grid { grid-template-columns: 1fr; }
  .right-column { flex-direction: row; flex-wrap: wrap; }
}

/* Animated gradient for special elements */
@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gradient-text {
  background: linear-gradient(135deg, #007AFF, #34d399, #007AFF);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}

/* Price update flash */
@keyframes flash-green {
  0%   { background-color: rgba(52,211,153,0.2); }
  100% { background-color: transparent; }
}

@keyframes flash-red {
  0%   { background-color: rgba(248,113,113,0.2); }
  100% { background-color: transparent; }
}

.flash-update-green { animation: flash-green 0.6s ease; }
.flash-update-red   { animation: flash-red 0.6s ease; }

/* Section separator line with gradient */
.section-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border-high), transparent);
  margin: var(--space-4) 0;
}

/* Equity chart area */
#equity-chart {
  height: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* Glow spot backgrounds for panels */
.glow-blue  { box-shadow: inset 0 0 80px rgba(0,122,255,0.04); }
.glow-green { box-shadow: inset 0 0 80px rgba(52,211,153,0.04); }
.glow-gold  { box-shadow: inset 0 0 80px rgba(255,184,0,0.04); }

/* ── Glass Card (enhanced) ── */
.glass-card,
.glass.card,
.glass.bot-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}

.glass.card:hover,
.glass.bot-card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
}

/* ── Paper Trading Banner ── */
.paper-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 20px;
  background: rgba(255,184,0,0.07);
  border: 1px solid rgba(255,184,0,0.18);
  border-radius: var(--radius-md);
  color: var(--accent-gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  gap: var(--space-2);
  transition: var(--transition-fast);
}

.paper-banner[hidden] { display: none; }

/* ── Sidebar Paper Badge ── */
.sidebar-paper-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,184,0,0.08);
  border: 1px solid rgba(255,184,0,0.2);
  border-radius: var(--radius-md);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-gold);
  margin-bottom: var(--space-2);
}

.sidebar-version {
  margin-left: auto;
  font-size: 9px;
  font-weight: 500;
  color: rgba(255,184,0,0.5);
  text-transform: lowercase;
  letter-spacing: 0;
}

/* ── Pulse amber dot (PAPER badge) ── */
.pulse-amber-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 6px var(--accent-gold);
  flex-shrink: 0;
  animation: pulse-amber 2s ease-in-out infinite;
  position: relative;
}

@keyframes pulse-amber {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--accent-gold); }
  50%       { opacity: 0.55; box-shadow: 0 0 14px var(--accent-gold), 0 0 28px rgba(255,184,0,0.3); }
}

/* ── Stats bar improved ── */
.stats-bar {
  border-top: 1px solid rgba(255,255,255,0.05);
  position: relative;
}

.stats-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 5%;
  right: 5%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,122,255,0.3), rgba(52,211,153,0.3), transparent);
}

.stat-item:not(:last-child)::after {
  background: linear-gradient(to bottom, transparent, var(--glass-border), transparent);
}
