/* Kalshi Trading Bot - Dark Terminal Aesthetic */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Core palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --bg-elevated: #1e1e2a;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.1);
  --border-bright: rgba(255, 255, 255, 0.15);

  /* Text */
  --text-primary: #f0f0f5;
  --text-secondary: #8b8b9a;
  --text-muted: #5a5a6e;

  /* Accent colors */
  --accent-cyan: #00d4ff;
  --accent-green: #00ff88;
  --accent-red: #ff4757;
  --accent-orange: #ffa502;
  --accent-purple: #a855f7;
  --accent-blue: #3b82f6;
  --accent-yellow: #fbbf24;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow-cyan: 0 0 20px rgba(0, 212, 255, 0.15);
  --shadow-glow-green: 0 0 20px rgba(0, 255, 136, 0.15);

  /* Typography */
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Plus Jakarta Sans', sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(0, 255, 136, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* ============ HEADER ============ */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-md) var(--space-xl);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--bg-primary);
}

.logo-text {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

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

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-link.active {
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.1);
}

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

.status-badge {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.status-badge.running {
  color: var(--accent-green);
  border-color: rgba(0, 255, 136, 0.3);
  background: rgba(0, 255, 136, 0.1);
}

.status-badge.paused {
  color: var(--accent-orange);
  border-color: rgba(255, 165, 2, 0.3);
  background: rgba(255, 165, 2, 0.1);
}

.status-badge.paper {
  color: var(--accent-purple);
  border-color: rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.1);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

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

/* ============ MAIN CONTENT ============ */
.main {
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--space-xl);
  flex: 1;
  width: 100%;
}

/* ============ GRID LAYOUTS ============ */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid-markets {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
}

@media (max-width: 1200px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .mt-lg.grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .grid-markets { grid-template-columns: 1fr; }
  .main { padding: var(--space-md); }
  .live-activity-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============ STAT CARDS ============ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent-cyan);
}

.stat-card.success::before { background: var(--accent-green); }
.stat-card.warning::before { background: var(--accent-orange); }
.stat-card.danger::before { background: var(--accent-red); }

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-value.success { color: var(--accent-green); }
.stat-value.warning { color: var(--accent-orange); }
.stat-value.danger { color: var(--accent-red); }

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
}

.card-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.card-body {
  padding: var(--space-lg);
}

/* ============ MARKET CARDS ============ */
.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.2s ease;
}

.market-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.market-card.has-edge {
  border-color: rgba(0, 255, 136, 0.3);
}

.market-card-header {
  padding: var(--space-md);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
}

.market-type-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.market-type-badge.weather {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}
.market-type-badge.crypto {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}
.market-type-badge.sports {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.market-title {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 2px;
}

.market-ticker {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.market-ticker-small {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  word-break: break-all;
  opacity: 0.7;
}

.market-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.market-card-body {
  padding: var(--space-md);
}

.market-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.market-stat {
  text-align: center;
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.market-stat-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.market-stat-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.market-card-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.market-decision {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.decision-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  flex-shrink: 0;
}

.decision-badge.buy-yes {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.decision-badge.buy-no {
  background: rgba(255, 71, 87, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(255, 71, 87, 0.3);
}

.decision-badge.no-trade {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.decision-reason {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ MARKET TIMING ============ */
.market-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.market-time {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.market-time .time-icon {
  font-size: 0.75rem;
  opacity: 0.8;
}

.market-time .time-value {
  white-space: nowrap;
}

/* Urgency levels */
.market-time.today {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.market-time.soon {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.4);
  color: var(--accent-yellow);
}

.market-time.urgent {
  background: rgba(255, 71, 87, 0.2);
  border-color: rgba(255, 71, 87, 0.5);
  color: var(--accent-red);
  animation: urgentPulse 1.5s ease-in-out infinite;
}

@keyframes urgentPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4);
  }
  50% {
    box-shadow: 0 0 8px 2px rgba(255, 71, 87, 0.3);
  }
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 2px;
  padding: var(--space-xs);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

.tab {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.tab:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.tab.active {
  color: var(--accent-cyan);
  background: var(--bg-card);
}

.tab-count {
  font-size: 0.7rem;
  margin-left: var(--space-xs);
  padding: 2px 6px;
  background: var(--bg-elevated);
  border-radius: 10px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ============ ACTIVITY FEED ============ */
.activity-feed {
  max-height: 600px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}

.activity-item:hover {
  background: var(--bg-card-hover);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item.has-opportunity {
  background: rgba(0, 255, 136, 0.03);
  border-left: 2px solid var(--accent-green);
}

.activity-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 70px;
}

.activity-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.activity-center {
  flex: 1;
  min-width: 0;
}

.activity-ticker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-edge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-edge.positive {
  color: var(--accent-green);
  font-weight: 600;
}

.activity-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 80px;
}

/* ============ TABLES ============ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.data-table th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-medium);
}

.data-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.data-table tbody tr:hover td {
  color: var(--text-primary);
}

/* ============ FOOTER ============ */
.footer {
  background: rgba(18, 18, 26, 0.5);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-md) 0;
  margin-top: auto;
}

.footer-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: #66e0ff;
}

.footer-divider {
  margin: 0 0.5rem;
  opacity: 0.3;
}

.footer-admin {
  opacity: 0.5;
  font-size: 0.8rem;
}

.footer-admin:hover {
  opacity: 1;
}

/* ============ BUTTONS ============ */
.btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-bright);
}

.btn-primary {
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  border-color: var(--accent-cyan);
  color: var(--bg-primary);
}

.btn-primary:hover {
  box-shadow: var(--shadow-glow-cyan);
}

.btn-success {
  background: rgba(0, 255, 136, 0.15);
  border-color: rgba(0, 255, 136, 0.4);
  color: var(--accent-green);
}

.btn-danger {
  background: rgba(255, 71, 87, 0.15);
  border-color: rgba(255, 71, 87, 0.4);
  color: var(--accent-red);
}

/* ============ FORMS ============ */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

/* ============ SECTION HEADERS ============ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

/* ============ LOGIN PAGE ============ */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-title {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.login-error {
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.3);
  color: var(--accent-red);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: var(--space-lg);
}

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

/* ============ LOADING ============ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-medium);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ============ UTILITIES ============ */
.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-success { color: var(--accent-green); }
.text-danger { color: var(--accent-red); }
.text-warning { color: var(--accent-orange); }
.text-cyan { color: var(--accent-cyan); }
.text-sm { font-size: 0.75rem; }
.text-xs { font-size: 0.65rem; }
.font-bold { font-weight: 700; }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-bright);
}

/* ============ LIVE ACTIVITY CARD ============ */
.live-activity-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.live-activity-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
}

.live-activity-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.live-activity-title h3 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.heartbeat-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: heartbeat 1.5s ease-in-out infinite;
}

.heartbeat-indicator.green {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.heartbeat-indicator.amber {
  background: var(--accent-orange);
  box-shadow: 0 0 8px var(--accent-orange);
  animation: pulse 2s infinite;
}

.heartbeat-indicator.red {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
  animation: none;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

.live-activity-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.live-stat {
  text-align: center;
}

.live-stat-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.live-stat-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.live-activity-filters {
  display: flex;
  gap: 4px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.event-filter {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.event-filter:hover {
  border-color: var(--border-bright);
  color: var(--text-primary);
}

.event-filter.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: var(--bg-primary);
}

.live-events-container {
  max-height: 400px;
  overflow-y: auto;
}

.live-event {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}

.live-event:hover {
  background: var(--bg-card-hover);
}

.live-event:last-child {
  border-bottom: none;
}

.live-event-time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  min-width: 55px;
  flex-shrink: 0;
}

.live-event-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.live-event-icon.info {
  background: rgba(0, 212, 255, 0.15);
  color: var(--accent-cyan);
}

.live-event-icon.success {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent-green);
}

.live-event-icon.warning {
  background: rgba(255, 165, 2, 0.15);
  color: var(--accent-orange);
}

.live-event-icon.error {
  background: rgba(255, 71, 87, 0.15);
  color: var(--accent-red);
}

.live-event-content {
  flex: 1;
  min-width: 0;
}

.live-event-type {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.live-event-message {
  font-size: 0.8rem;
  color: var(--text-primary);
  word-break: break-word;
}

.live-event-ticker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-cyan);
  margin-top: 2px;
}

.live-event.new {
  animation: eventFlashIn 0.6s ease-out;
}

@keyframes eventFlashIn {
  0% {
    background: rgba(0, 255, 136, 0.4);
    box-shadow: inset 0 0 20px rgba(0, 255, 136, 0.3);
    transform: translateX(-5px);
  }
  30% {
    background: rgba(0, 255, 136, 0.25);
    box-shadow: inset 0 0 15px rgba(0, 255, 136, 0.2);
  }
  100% {
    background: transparent;
    box-shadow: none;
    transform: translateX(0);
  }
}

.connection-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.connection-status.connected { color: var(--accent-green); }
.connection-status.disconnected { color: var(--accent-red); }
.connection-status.connecting { color: var(--accent-orange); }

/* ============ ORDERS/POSITIONS/SETTLED TABLES ============ */
#orders-table table,
#positions-table table,
#settled-table table {
  font-family: var(--font-mono);
  width: 100%;
  border-collapse: collapse;
}

#orders-table tr,
#positions-table tr,
#settled-table tr {
  transition: background 0.15s ease;
}

#orders-table tbody tr:hover,
#positions-table tbody tr:hover,
#settled-table tbody tr:hover {
  background: var(--bg-card-hover);
}

#orders-table th,
#positions-table th,
#settled-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-medium);
  white-space: nowrap;
}

#orders-table td,
#positions-table td,
#settled-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  white-space: nowrap;
}

#orders-table tbody tr:last-child td,
#positions-table tbody tr:last-child td,
#settled-table tbody tr:last-child td {
  border-bottom: none;
}

/* Result badges for settled bets */
.result-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.result-badge.win {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.result-badge.loss {
  background: rgba(255, 71, 87, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(255, 71, 87, 0.3);
}

.positive { color: var(--accent-green) !important; }
.negative { color: var(--accent-red) !important; }

/* ============ CLICKABLE ROWS ============ */
.clickable-row {
  cursor: pointer;
  transition: all 0.15s ease;
}

.clickable-row:hover {
  background: var(--bg-elevated) !important;
  transform: scale(1.01);
}

.clickable-row:active {
  transform: scale(0.99);
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.2s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
}

.modal-header h3 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

.modal-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.modal-detail-item {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.modal-detail-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.modal-detail-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-detail-value.mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ============ AI ANALYSIS BOX ============ */
.ai-analysis-box {
  margin-top: var(--space-lg);
  padding: var(--space-lg);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-md);
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ai-loading .loading-spinner {
  width: 18px;
  height: 18px;
}

.ai-result {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

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

.ai-icon {
  font-size: 1.2rem;
}

.ai-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-purple);
}

.ai-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.ai-meta {
  display: flex;
  gap: var(--space-lg);
  padding-top: var(--space-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.ai-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.ai-error {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--accent-orange);
  font-size: 0.85rem;
}

.ai-unavailable {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* ============ BORDER VAR ============ */
:root {
  --border-primary: var(--border-medium);
}

/* ============ ANTI-SELECT ============ */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
