/* ===== AI Trading System — Shared Design Tokens ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Backgrounds */
  --bg-primary: #050e15;
  --bg-secondary: #0a1520;
  --bg-tertiary: #131b23;
  --bg-card: #0d1822;
  /* Text */
  --text-primary: rgb(255,255,255);
  --text-secondary: rgba(255,255,255,0.64);
  --text-tertiary: rgba(255,255,255,0.30);
  --text-muted: rgba(255,255,255,0.12);
  /* Gold accent */
  --accent-gold: rgb(255,169,48);
  --accent-gold-grad: linear-gradient(95deg,#ffa930 0%,#ffab23 51%,#d5aa12 100%);
  --accent-gold-glow: rgba(255,169,48,0.06);
  --accent-gold-border: rgba(255,169,48,0.25);
  --accent-gold-bg: rgba(255,169,48,0.12);
  --accent-blue: #ffa930;
  --accent-blue-hover: #e69520;
  /* Semantic */
  --profit-green: #22c55e;
  --loss-red: #ef4444;
  --green-bg: rgba(34,197,94,0.10);
  --red-bg: rgba(239,68,68,0.10);
  /* Borders */
  --border-color: rgba(255,255,255,0.07);
  --border-primary: rgba(255,255,255,0.07);
  --border-color2: rgba(255,255,255,0.12);
  /* Typography */
  --font-primary: 'Montserrat','Inter',-apple-system,BlinkMacSystemFont,sans-serif;
  --font-mono: 'JetBrains Mono',monospace;
  --ls-label: 1.2px;
  /* Layout */
  --header-height: 52px;
  --left-sidebar-width: 68px;
  --radius: 10px;
  --radius-lg: 16px;
}

html { font-size: 13px; }

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* ===== UTILITIES ===== */
.mono { font-family: var(--font-mono); letter-spacing: -0.01em; }
.gold-text { background: var(--accent-gold-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.flash-up { animation: flash-green 0.6s ease; }
.flash-dn { animation: flash-red 0.6s ease; }
@keyframes flash-green { 0%{background:rgba(34,197,94,0.25)} 100%{background:transparent} }
@keyframes flash-red { 0%{background:rgba(239,68,68,0.25)} 100%{background:transparent} }

/* ===== ICON RAIL / SIDEBAR ===== */
.icon-rail {
  position: fixed; top: 0; left: 0;
  width: var(--left-sidebar-width); height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; z-index: 400; gap: 2px;
}
.rail-logo {
  width: 42px; height: 42px; border-radius: var(--radius);
  background: var(--accent-gold-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; color: #000;
  margin-bottom: 18px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(255,169,48,0.3);
  font-family: var(--font-primary);
  text-decoration: none;
}
.rail-item {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary); cursor: pointer;
  transition: all 0.18s; position: relative;
  background: none; border: none; font-size: 18px;
  text-decoration: none;
}
.rail-item:hover { background: rgba(255,255,255,0.05); color: var(--text-secondary); }
.rail-item.active { background: var(--accent-gold-bg); color: var(--accent-gold); }
.rail-tooltip {
  position: absolute; left: calc(100% + 10px); top: 50%;
  transform: translateY(-50%);
  background: var(--bg-tertiary); border: 1px solid var(--border-color2);
  border-radius: 8px; padding: 5px 11px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  color: var(--text-primary); opacity: 0; pointer-events: none;
  transition: opacity 0.15s; z-index: 500;
}
.rail-item:hover .rail-tooltip { opacity: 1; }
.rail-spacer { flex: 1; }

/* ===== PAGE CONTAINER ===== */
.page-container {
  margin-left: var(--left-sidebar-width);
  min-height: 100vh;
  padding: 0;
}

/* ===== PAGE HEADER ===== */
.page-header {
  background: rgba(5,14,21,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: var(--header-height);
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 300;
}
.page-header .logo-text {
  background: var(--accent-gold-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  white-space: nowrap;
}
.page-header .header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-header .user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-gold-bg);
  border: 1px solid var(--accent-gold-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--accent-gold);
  cursor: pointer;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.card:hover {
  border-color: var(--accent-gold-border);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.card-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  margin-bottom: 12px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s;
  border: none;
}
.btn-gold {
  background: var(--accent-gold-grad);
  color: #000;
}
.btn-gold:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color2);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent-gold-border); color: var(--text-primary); }
.btn-green { background: var(--profit-green); color: #fff; }
.btn-red { background: var(--loss-red); color: #fff; }

/* ===== SIGNAL PILLS ===== */
.signal-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.signal-pill.bullish { background: var(--green-bg); color: var(--profit-green); border: 1px solid rgba(34,197,94,0.25); }
.signal-pill.bearish { background: var(--red-bg); color: var(--loss-red); border: 1px solid rgba(239,68,68,0.25); }
.signal-pill.neutral { background: rgba(255,255,255,0.05); color: var(--text-secondary); border: 1px solid var(--border-color); }

/* ===== TABLES ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
}
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: -0.01em;
}
.data-table tr:hover { background: rgba(255,255,255,0.02); }
.data-table .sortable { cursor: pointer; }
.data-table .sortable:hover { color: var(--accent-gold); }

/* ===== INPUTS ===== */
.input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font-primary);
  outline: none;
  width: 100%;
}
.input:focus { border-color: var(--accent-gold-border); }
.input::placeholder { color: var(--text-tertiary); }

/* ===== TABS ===== */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab-btn {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: var(--font-primary);
  white-space: nowrap;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-gold); border-bottom-color: var(--accent-gold); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
  max-width: 320px;
  animation: slideIn 0.3s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 8px;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast.info { background: var(--bg-card); border-left: 3px solid var(--accent-gold); color: var(--text-primary); }
.toast.success { background: var(--bg-card); border-left: 3px solid var(--profit-green); color: var(--profit-green); }
.toast.error { background: var(--bg-card); border-left: 3px solid var(--loss-red); color: var(--loss-red); }

/* ===== LOADING ===== */
.loading-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===== STAT STRIP ===== */
.stat-strip {
  display: flex;
  gap: 24px;
  padding: 16px 0;
}
.stat-strip .stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-strip .stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
}
.stat-strip .stat-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.stat-strip .stat-value.positive { color: var(--profit-green); }
.stat-strip .stat-value.negative { color: var(--loss-red); }
.stat-strip .stat-value.gold { background: var(--accent-gold-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* ===== HERO SECTION ===== */
.hero {
  padding: 48px 32px;
  text-align: center;
}
.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: var(--accent-gold-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

/* ===== CONFIDENCE BAR ===== */
.confidence-bar {
  width: 60px; height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}
.confidence-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}
.confidence-fill.bullish { background: var(--profit-green); }
.confidence-fill.bearish { background: var(--loss-red); }
.confidence-fill.neutral { background: var(--text-secondary); }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
}
.pagination .page-btn {
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all 0.15s;
}
.pagination .page-btn:hover { border-color: var(--accent-gold-border); color: var(--text-primary); }
.pagination .page-btn.active { background: var(--accent-gold-bg); color: var(--accent-gold); border-color: var(--accent-gold-border); }
.pagination .page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination .page-info { color: var(--text-tertiary); font-size: 12px; }
