/* ApexTradeLog theme — dark trading terminal aesthetic */
:root {
  --bg: #0B1120;
  --bg-card: #111827;
  --bg-surface: #1a2235;
  --fg: #F8FAFC;
  --fg-muted: #94A3B8;
  --accent: #F59E0B;
  --accent-dim: rgba(245, 158, 11, 0.12);
  --green: #10B981;
  --red: #EF4444;
  --border: rgba(255,255,255,0.08);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.15;
}

/* NAV */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
  background: rgba(11,17,32,0.85);
  backdrop-filter: blur(12px);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.wordmark {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.tagline {
  font-size: 0.8rem;
  color: var(--fg-muted);
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.nav-spacer { flex: 1; }
.nav-link {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
  padding: 6px 12px;
  border-radius: 6px;
}
.nav-link:hover { color: var(--fg); background: var(--bg-surface); }
.nav-link.active { color: var(--accent); }

/* HERO */
.hero {
  padding: 140px 40px 100px;
  max-width: 1200px;
  margin: 0 auto;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 60px;
  align-items: start;
}
.hero-text h1 {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  color: var(--fg);
  margin-bottom: 24px;
  letter-spacing: -0.03em;
}
.lede {
  font-size: 1.1rem;
  color: var(--fg-muted);
  margin-bottom: 12px;
  max-width: 520px;
}
.lede.secondary { color: var(--fg-muted); font-size: 1rem; opacity: 0.7; }

.hero-stats { display: flex; flex-direction: column; gap: 12px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.stat-label { font-size: 0.8rem; color: var(--fg-muted); min-width: 90px; }
.stat-value { font-size: 1.3rem; font-weight: 700; font-family: 'Space Grotesk', monospace; }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.accent { color: var(--accent); }

.hero-cta {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'DM Sans', system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #0B1120;
}
.btn-primary:hover { background: #FBBF24; transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-surface);
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #243047; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-red { background: var(--red); color: white; }
.btn-red:hover { background: #F87171; }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: #34D399; }

/* SECTIONS */
.section { padding: 80px 40px; max-width: 1200px; margin: 0 auto; }
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.section-title {
  font-size: 2rem;
  color: var(--fg);
  margin-bottom: 16px;
}
.section-sub {
  color: var(--fg-muted);
  font-size: 1.05rem;
  max-width: 540px;
}

/* FEATURE GRID */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 48px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
}
.feature-icon {
  width: 40px; height: 40px;
  background: var(--accent-dim);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 16px;
}
.feature-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}
.feature-desc {
  font-size: 0.875rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* FOOTER */
footer {
  padding: 40px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
}
footer a { color: var(--fg-muted); text-decoration: none; }
footer a:hover { color: var(--fg); }

/* DASHBOARD */
.dashboard-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 100px 40px 60px;
}
.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 40px;
}
.dashboard-title {
  font-size: 1.8rem;
  color: var(--fg);
}
.dashboard-subtitle {
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* METRICS ROW */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
.metric-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.metric-label { font-size: 0.75rem; color: var(--fg-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 1.6rem; font-weight: 700; font-family: 'Space Grotesk', monospace; }
.metric-value.g { color: var(--green); }
.metric-value.r { color: var(--red); }
.metric-value.accent { color: var(--accent); }

/* TRADE TABLE */
.trade-table-wrap { overflow-x: auto; }
table.trade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.trade-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
table.trade-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}
table.trade-table tr:last-child td { border-bottom: none; }
table.trade-table tbody tr:hover { background: var(--bg-surface); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-buy { background: rgba(16,185,129,0.12); color: var(--green); }
.badge-sell { background: rgba(239,68,68,0.12); color: var(--red); }
.badge-executed { background: var(--accent-dim); color: var(--accent); }

.no-trades {
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}
.no-trades-emoji { font-size: 2.5rem; margin-bottom: 12px; }

/* FORMS */
.form-group { margin-bottom: 20px; }
label.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
input.form-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--fg);
  font-size: 0.9rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  outline: none;
  transition: border-color 0.15s;
}
input.form-input::placeholder { color: #475569; }
input.form-input:focus { border-color: var(--accent); }
.form-hint { font-size: 0.78rem; color: var(--fg-muted); margin-top: 6px; }
.form-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 6px;
  padding: 12px;
  font-size: 0.85rem;
  color: #FCA5A5;
  margin-bottom: 16px;
}
.form-success {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 6px;
  padding: 12px;
  font-size: 0.85rem;
  color: #6EE7B7;
  margin-bottom: 16px;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 0.9rem; color: var(--fg); }
.toggle-sub { font-size: 0.78rem; color: var(--fg-muted); }

/* TOGGLE SWITCH */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: 0.2s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--fg-muted);
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider:before { background: white; transform: translateX(20px); }

/* STATUS BADGES */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}
.status-badge.connected { background: rgba(16,185,129,0.12); color: var(--green); }
.status-badge.disconnected { background: rgba(239,68,68,0.12); color: var(--red); }
.status-badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.status-badge.connected .dot { background: var(--green); }
.status-badge.disconnected .dot { background: var(--red); }

/* LOADING SPINNER */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* LOGS */
.log-box {
  background: #0a0f1a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.78rem;
  color: #94A3B8;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.7;
}
.log-line { padding: 2px 0; }
.log-line.error { color: var(--red); }
.log-line.success { color: var(--green); }
.log-ts { color: #475569; margin-right: 8px; }

/* NOTIFICATION BANNER */
.banner {
  background: var(--accent-dim);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 0.88rem;
  color: var(--fg);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.banner a { color: var(--accent); font-weight: 600; }

/* Responsive */
@media (max-width: 768px) {
  .hero-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .metrics-row { grid-template-columns: 1fr 1fr; }
}