/* === Ahab Dashboard — Dark Financial Intelligence === */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --bg: #0b0d11;
  --bg-subtle: #0e1016;
  --surface: #141720;
  --surface-raised: #1a1e2a;
  --surface-hover: #1f2435;
  --surface-border: rgba(255, 255, 255, 0.06);
  --surface-border-hover: rgba(255, 255, 255, 0.12);

  --text: #e8eaf0;
  --text-secondary: #a0a4b8;
  --text-muted: #6b7089;

  --accent: #e8a84c;
  --accent-hover: #f0b960;
  --accent-dim: rgba(232, 168, 76, 0.12);

  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --orange: #fbbf24;
  --blue: #60a5fa;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
}

::selection {
  background: var(--accent-dim);
  color: var(--accent);
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse at 15% 5%, rgba(232, 168, 76, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 95%, rgba(96, 165, 250, 0.02) 0%, transparent 50%);
}

/* === Header === */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(11, 13, 17, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-border);
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-shrink: 0;
}

.header-left h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
}

.header-left .whale {
  font-size: 22px;
}

.header-date {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.header-generated {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.refresh-btn:hover {
  border-color: var(--surface-border-hover);
  color: var(--accent);
  background: var(--surface-raised);
}

.refresh-btn.spinning svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Navigation Tabs === */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--surface-border);
}

.nav-tab {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 7px 16px;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
  user-select: none;
}

.nav-tab:hover {
  color: var(--text-secondary);
  background: var(--surface-raised);
}

.nav-tab.active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 600;
}

/* === Market Pulse Bar (persistent) === */
.pulse-bar {
  position: sticky;
  top: 54px; /* below header */
  z-index: 90;
  background: rgba(14, 16, 22, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-border);
  padding: 0;
}

.pulse-metrics {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
}

.pulse-metric {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-right: 1px solid var(--surface-border);
  white-space: nowrap;
  flex-shrink: 0;
}

.pulse-metric:last-child {
  border-right: none;
}

.pulse-metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pulse-metric-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.pulse-metric-change {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
}

.pulse-metric-5d {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
}

.pulse-vix {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px 8px;
  border-top: 1px solid var(--surface-border);
  font-size: 12px;
}

.pulse-vix-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pulse-vix.vix-calm .pulse-vix-indicator { background: var(--green); box-shadow: 0 0 6px rgba(52, 211, 153, 0.5); }
.pulse-vix.vix-elevated .pulse-vix-indicator { background: var(--orange); box-shadow: 0 0 6px rgba(251, 191, 36, 0.5); }
.pulse-vix.vix-fear .pulse-vix-indicator { background: var(--red); box-shadow: 0 0 6px rgba(248, 113, 113, 0.5); }

.pulse-vix-label {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pulse-vix.vix-calm .pulse-vix-label { color: var(--green); }
.pulse-vix.vix-elevated .pulse-vix-label { color: var(--orange); }
.pulse-vix.vix-fear .pulse-vix-label { color: var(--red); }

.pulse-vix-strip {
  flex: 1;
  max-width: 200px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-raised);
  overflow: hidden;
}

.pulse-vix-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.pulse-vix.vix-calm .pulse-vix-fill { background: var(--green); }
.pulse-vix.vix-elevated .pulse-vix-fill { background: var(--orange); }
.pulse-vix.vix-fear .pulse-vix-fill { background: var(--red); }

.pulse-vix-detail {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.pulse-vix-link {
  margin-left: auto;
  font-size: 11px;
}

.pulse-vix-link a {
  color: var(--blue);
  text-decoration: none;
}

.pulse-vix-link a:hover {
  text-decoration: underline;
}

/* === Pages === */
.page {
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
}

/* === Cards === */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--surface-border-hover);
}

.card-full {
  width: 100%;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--surface-border);
}

.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

.badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-raised);
  padding: 4px 10px;
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.card-body {
  flex: 1;
  padding: 0;
  overflow-y: auto;
}

.card-footer {
  padding: 12px 24px 16px;
  border-top: 1px solid var(--surface-border);
}

/* === Tables === */
.table-scroll {
  overflow-x: auto;
  position: relative;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--surface);
  border-bottom: 1px solid var(--surface-border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  min-height: 44px;
}

th:hover {
  color: var(--text-secondary);
}

th.sorted-asc::after { content: ' ↑'; color: var(--accent); }
th.sorted-desc::after { content: ' ↓'; color: var(--accent); }

td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

tbody tr:nth-child(even) { background: var(--surface-raised); }
tbody tr:nth-child(odd) { background: var(--surface); }
tbody tr:hover { background: var(--surface-hover); }

/* === Ticker styling === */
.ticker {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--accent);
}

/* === Issuer/Full Name cell === */
.issuer-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-secondary);
}

/* === Pill badges === */
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pill-buy { color: var(--green); background: var(--green-dim); }
.pill-sell { color: var(--red); background: var(--red-dim); }
.pill-house, .pill-senate { color: var(--text-muted); background: rgba(255, 255, 255, 0.05); font-size: 10px; }
.pill-party-r { color: #f87171; background: rgba(248, 113, 113, 0.12); font-weight: 600; }
.pill-party-d { color: #60a5fa; background: rgba(96, 165, 250, 0.12); font-weight: 600; }
.pill-party-i { color: #a78bfa; background: rgba(167, 139, 250, 0.12); font-weight: 600; }
.pill-call { color: var(--green); background: var(--green-dim); }
.pill-put { color: var(--red); background: var(--red-dim); }

/* === Value styling (insider buys) === */
.value-cell {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  text-align: right;
}

.value-sm { color: var(--green); }
.value-md { color: #5ee8a0; font-weight: 500; }
.value-lg { color: #7af0b5; font-weight: 600; }
.value-xl { color: #a0f7cc; font-weight: 700; font-size: 14px; }

tr.highlight-row { border-left: 2px solid var(--accent); }

/* === Price columns === */
.price-cell {
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* === Ticker pills (congress footer) === */
.ticker-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ticker-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}

.ticker-pill .count {
  font-size: 10px;
  color: var(--text-muted);
}

/* === Options empty state === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-state .whale-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
}

/* === Vol/OI color scaling === */
.voloi-low { color: var(--text); }
.voloi-med { color: var(--orange); font-weight: 500; }
.voloi-high { color: var(--red); font-weight: 600; }

.change-positive { color: var(--green); }
.change-negative { color: var(--red); }

.text-muted { color: var(--text-muted); }

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* === Loading state === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 14px;
}

/* === Responsive === */
@media (max-width: 900px) {
  header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
  }

  .nav-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .nav-tab {
    font-size: 12px;
    padding: 6px 12px;
  }

  .header-generated { display: none; }

  .pulse-bar { top: 94px; }

  .pulse-metrics { flex-wrap: nowrap; overflow-x: auto; }

  .pulse-metric { padding: 8px 14px; }
  .pulse-metric-price { font-size: 13px; }

  .page { padding: 16px 12px; }

  th, td {
    padding: 8px 12px;
    font-size: 12px;
  }

  th { min-height: 44px; line-height: 24px; }

  .issuer-cell { max-width: 120px; }
}

@media (max-width: 480px) {
  .header-date { display: none; }
  .pulse-bar { top: 82px; }
}
