/* Self-Learning Trader — Dark Dashboard */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #22263a;
  --border: #2a2e3f;
  --text: #e1e4ed;
  --text-muted: #8b8fa3;
  --amber: #f5a623;
  --amber-dim: rgba(245, 166, 35, 0.15);
  --green: #34d399;
  --red: #f87171;
  --blue: #60a5fa;
  --purple: #a78bfa;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

header {
  padding: 1.5rem 2rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

/* === Tabs === */
#tabs {
  display: flex;
  gap: 0;
  padding: 0 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.tab {
  padding: 0.6rem 1.2rem;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-family: inherit;
}

.tab:hover { color: var(--text); }
.tab.active {
  color: var(--amber);
  border-bottom-color: var(--amber);
  background: var(--amber-dim);
}

/* === Main === */
main {
  padding: 1.5rem 2rem;
  max-width: 1200px;
}

/* === Cards === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.ticker {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--amber);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.catalyst-tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--amber-dim);
  color: var(--amber);
  white-space: nowrap;
}

.outcome-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.outcome-alpha { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.outcome-trap { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.outcome-missed { background: rgba(96, 165, 250, 0.15); color: var(--blue); }

.justification {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.entry-rationale {
  font-size: 0.78rem;
  color: var(--blue);
  margin-top: 0.3rem;
}

/* === Date Header === */
.session-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 1rem 0 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.session-date:first-of-type { padding-top: 0; }

/* === History list === */
.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.date-chip {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.date-chip:hover { background: var(--surface-hover); }
.date-chip.active { background: var(--amber-dim); border-color: var(--amber); color: var(--amber); }

/* === Evolution timeline === */
.evo-entry {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.evo-version {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-weight: 700;
  color: var(--amber);
  min-width: 4rem;
  font-size: 0.9rem;
}

.evo-delta {
  font-size: 0.8rem;
  color: var(--text);
  flex: 1;
}

.evo-mod {
  background: var(--amber-dim);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  margin: 0.15rem 0;
  display: inline-block;
}

.evo-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  min-width: 10rem;
  text-align: right;
}

/* === Stats === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.stat-win { color: var(--green); }
.stat-loss { color: var(--red); }
.stat-missed { color: var(--blue); }
.stat-total { color: var(--text); }

/* === Config block === */
.config-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-top: 1rem;
  white-space: pre-wrap;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.6;
}

/* === Empty state === */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* === Loading === */
#loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* === Footer === */
footer {
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 768px) {
  header, main, #tabs, footer { padding-left: 1rem; padding-right: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
