/* ===== Bitcoin Retirement Calculator — dark theme (b1m.io inspired) ===== */

:root {
  --bg: #000000;
  --panel: #18181b;          /* zinc-900 */
  --input-bg: #27272a;       /* zinc-800 */
  --input-border: #52525b;   /* zinc-600 */
  --text: #ffffff;
  --text-muted: #a1a1aa;     /* zinc-400 */
  --accent: #f7931a;         /* bitcoin orange */
  --accent-dark: #c2410c;    /* orange-700 */
  --ok: #22c55e;
  --warn: #f59e0b;
  --fail: #ef4444;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Instrument Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* ----- Header ----- */
.header { text-align: center; margin-bottom: 32px; }
.header h1 { font-size: 2rem; margin: 0 0 8px; font-weight: 700; }
.btc-symbol { color: var(--accent); }
.subtitle { color: var(--text-muted); max-width: 640px; margin: 0 auto; }

/* ----- Panels ----- */
.panel {
  background: var(--panel);
  border: 1px solid #27272a;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

/* ----- Mode toggle ----- */
.mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
  max-width: 100%;
}
.mode-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active { background: var(--accent-dark); color: var(--text); }

/* ----- Inputs ----- */
.inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 0.95rem; }
.field .helper { color: var(--text-muted); font-size: 0.8rem; }

input, select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  width: 100%;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent-dark);
}

/* Advanced settings */
.advanced { margin-top: 20px; }
.advanced summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 0;
  user-select: none;
}
.advanced summary:hover { color: var(--text); }
.advanced .inputs-grid { margin-top: 12px; }

/* ----- Button ----- */
.btn-primary {
  display: block;
  margin: 24px auto 0;
  background: var(--accent-dark);
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 14px 48px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-primary:hover { background: var(--accent); color: #000; }

/* ----- Snapshot ----- */
.snapshot { margin-bottom: 32px; }
.snapshot-hero {
  text-align: center;
  padding: 40px 24px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid #27272a;
  background: linear-gradient(180deg, #18181b 0%, #000 100%);
}
.snapshot-hero h2 { font-size: 2.2rem; margin: 0 0 8px; font-weight: 700; }
.snapshot-hero h2 .age { color: var(--accent); }
.snapshot-hero p { color: var(--text-muted); margin: 0; font-size: 1.05rem; }
.snapshot-hero.fail h2 { color: var(--fail); }
.snapshot-hero.fail h2 .age { color: var(--fail); }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid #27272a;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.stat-card .value { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat-card .label { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

/* ----- Table ----- */
.table-note { color: var(--text-muted); font-size: 0.9rem; margin-top: -8px; }

/* Top horizontal scrollbar (mirrors .table-wrap, synced via JS) */
.table-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 8px;
}
.scroll-spacer { height: 1px; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  white-space: nowrap;
}
th, td {
  padding: 8px 8px;
  text-align: right;
  border-bottom: 1px solid #27272a;
}
th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  line-height: 1.3;
  vertical-align: bottom;
  white-space: normal;
  position: sticky;
  top: 0;
  background: var(--panel);
}
td:first-child, th:first-child,
td:nth-child(2), th:nth-child(2) { text-align: left; }

tr.status-ok td:first-child { border-left: 3px solid var(--ok); }
tr.status-warn td:first-child { border-left: 3px solid var(--warn); }
tr.status-fail td:first-child { border-left: 3px solid var(--fail); }
tr.status-fail td { color: var(--fail); }

.status-badge { font-size: 1rem; }

/* ----- Footer ----- */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 48px;
}

/* ----- Utility ----- */
.hidden { display: none; }

/* ----- Mobile ----- */
@media (max-width: 640px) {
  .header h1 { font-size: 1.5rem; }
  .snapshot-hero h2 { font-size: 1.6rem; }
  .panel { padding: 16px; }
  table { font-size: 0.78rem; }
  th, td { padding: 8px 10px; }
  .mode-toggle { width: 100%; }
  .mode-btn { flex: 1; padding: 8px 6px; font-size: 0.85rem; }
}
