/* ─── Bellwether custom styles ─────────────────────────────────────────── */

:root {
  --bg-base:    #0a0b0e;
  --bg-card:    #111318;
  --bg-row:     #16191f;
  --border:     #1e2330;
  --text-dim:   #4a5568;
  --text-muted: #718096;
  --green:      #22c55e;
  --red:        #ef4444;
  --yellow:     #eab308;
  --blue:       #3b82f6;
  --purple:     #a855f7;
}

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

body {
  background: var(--bg-base);
  color: #e2e8f0;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  min-height: 100vh;
}

/* ─── Header ──────────────────────────────────────────────────────────── */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.logo { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.1em; color: var(--green); }
.header-meta { font-size: 0.75rem; color: var(--text-muted); }
.header-page-label { font-size: 0.8rem; }

/* ─── Layout ──────────────────────────────────────────────────────────── */
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

/* ─── Refresh bar ─────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.stats-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 5px 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.refresh-btn {
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.refresh-btn:hover   { opacity: 0.85; }
.refresh-btn:disabled{ opacity: 0.5; cursor: not-allowed; }

/* ─── Pick card ───────────────────────────────────────────────────────── */
.pick-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 20px;
  overflow: hidden;
}
.pick-card.call { border-top: 3px solid var(--green); }
.pick-card.put  { border-top: 3px solid var(--red); }

.card-header {
  padding: 18px 20px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.rank-badge {
  background: var(--bg-row);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 3px 8px;
  margin-right: 8px;
}
.ticker { font-size: 1.4rem; font-weight: 800; letter-spacing: 0.04em; }
.direction-badge {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 4px 10px;
  margin-left: 8px;
  vertical-align: middle;
}
.direction-badge.call { background: rgba(34,197,94,.15); color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.direction-badge.put  { background: rgba(239,68,68,.15);  color: var(--red);   border: 1px solid rgba(239,68,68,.3); }

.score-block { text-align: right; }
.score-number { font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.score-number.high  { color: var(--green); }
.score-number.mid   { color: var(--yellow); }
.score-number.low   { color: var(--red); }
.score-label { font-size: 0.65rem; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; }

.top-pick-bar {
  background: var(--bg-row);
  margin: 0 20px 14px;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #cbd5e0;
  border-left: 3px solid var(--blue);
}
.expiry-tags { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 20px 14px; }
.expiry-tag {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ─── Decisive factors ────────────────────────────────────────────────── */
.factors-section { padding: 0 20px 14px; }
.factors-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.factor-row {
  display: grid;
  grid-template-columns: 120px 44px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
}
.factor-name  { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.factor-score { font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.factor-bar-wrap { height: 6px; background: var(--bg-base); border-radius: 3px; overflow: hidden; }
.factor-bar      { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.factor-detail {
  grid-column: 2 / -1;
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: -4px;
  margin-bottom: 4px;
}

/* ─── Strikes table ───────────────────────────────────────────────────── */
.strikes-section { padding: 0 20px 18px; }
.strikes-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.strikes-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.strikes-table th {
  text-align: left;
  padding: 6px 10px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.strikes-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--bg-base);
  vertical-align: middle;
}
.strikes-table tr:last-child td { border-bottom: none; }
.strikes-table tr:hover td { background: var(--bg-row); }
.strike-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.multiplier-badge {
  background: rgba(168,85,247,.12);
  color: var(--purple);
  border: 1px solid rgba(168,85,247,.25);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 0.70rem;
  font-weight: 700;
  white-space: nowrap;
}
.crush-badge {
  background: rgba(234,179,8,.12);
  color: var(--yellow);
  border: 1px solid rgba(234,179,8,.3);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}
.uoa-highlight { color: var(--green); font-weight: 700; }

/* ─── Empty / loading / error states ─────────────────────────────────── */
.state-box {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── VIX chip ────────────────────────────────────────────────────────── */
.vix-chip {
  display: inline-block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ─── Custom ticker input ─────────────────────────────────────────────── */
#custom-ticker:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 2px rgba(168,85,247,.15);
}
#custom-ticker::placeholder { color: #4a5568; }

/* ─── Responsive ──────────────────────────────────────────────────────── */

/* Tablet ≤ 768px */
@media (max-width: 768px) {
  .header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .header-nav { gap: 8px; }
  .header-nav a { font-size: 0.70rem; padding: 3px 8px; }
  .page { padding: 16px 12px; }
  .pick-card .strikes-section { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Mobile ≤ 480px */
@media (max-width: 480px) {
  /* Header: logo row + nav row */
  .header { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 14px; }
  .header-nav { width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
  .header-nav a { font-size: 0.68rem; padding: 3px 8px; }
  .header-page-label { font-size: 0.72rem; }
  .header-meta { display: none; }

  /* Cards */
  .card-header { flex-direction: column; gap: 6px; }
  .score-block { text-align: left; display: flex; align-items: center; gap: 10px; }
  .score-label { margin-top: 0; }
  .ticker { font-size: 1.2rem; }

  /* Factor rows: compress label column */
  .factor-row { grid-template-columns: 90px 38px 1fr; font-size: 0.70rem; }
  .factor-name { font-size: 0.70rem; }
  .factor-detail { font-size: 0.64rem; }

  /* Top pick bar */
  .top-pick-bar { font-size: 0.80rem; padding: 10px 12px; margin: 0 12px 12px; }

  /* Strikes table: scrollable container, show only 5 key columns */
  .strikes-section { padding: 0 12px 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .strikes-table { min-width: 360px; font-size: 0.72rem; }
  .strikes-table th,
  .strikes-table td { padding: 7px 8px; }

  /* Hide: Gamma, Vega, IV, Vol/OI, OI — keep Strike, Expiry, Premium, Delta, Potential */
  .strikes-table th:nth-child(5),
  .strikes-table td:nth-child(5),
  .strikes-table th:nth-child(6),
  .strikes-table td:nth-child(6),
  .strikes-table th:nth-child(7),
  .strikes-table td:nth-child(7),
  .strikes-table th:nth-child(8),
  .strikes-table td:nth-child(8),
  .strikes-table th:nth-child(9),
  .strikes-table td:nth-child(9) { display: none; }

  /* Factors section */
  .factors-section { padding: 0 12px 12px; }
  .expiry-tags { padding: 0 12px 12px; }

  /* Stats pills wrap */
  .toolbar { gap: 8px; }
  .stats-pill { font-size: 0.72rem; padding: 4px 10px; }
  .refresh-btn { font-size: 0.76rem; padding: 7px 14px; }

  /* State box */
  .state-box { padding: 40px 16px; }
}
