/* MosaicIQ — Design System */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0e1117;
  --bg-card: #141923;
  --bg-hover: #1a2234;
  --bg-input: #111827;
  --border: #1e2a3a;
  --border-hover: #2d3f56;
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --blue-light: #60a5fa;
  --green: #10b981;
  --green-light: #34d399;
  --red: #ef4444;
  --red-light: #f87171;
  --amber: #f59e0b;
  --purple: #8b5cf6;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #475569;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; }

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

/* ── Typography ── */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }
p { color: var(--text-muted); }

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

/* ── Nav ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 60px;
  background: rgba(14,17,23,0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 14px;
}
.nav-logo-text { font-weight: 700; font-size: 18px; color: var(--text); }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-link {
  padding: 6px 14px; border-radius: 6px;
  color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: all 0.15s;
}
.nav-link:hover, .nav-link.active { background: var(--bg-card); color: var(--text); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius); border: none; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; text-decoration: none;
  transition: all 0.15s; white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg-card); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon { padding: 8px; border-radius: 6px; }

/* ── Cards ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
}
.card-hover { transition: all 0.2s; cursor: pointer; }
.card-hover:hover { border-color: var(--border-hover); background: var(--bg-hover); transform: translateY(-2px); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-blue { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-green { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-red { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-amber { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-purple { background: rgba(139,92,246,0.15); color: #a78bfa; }
.badge-gray { background: rgba(148,163,184,0.1); color: #94a3b8; }

/* ── Conviction badges ── */
.conviction-gold {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  background: rgba(250,189,0,0.18); color: #f5c400; border: 1px solid rgba(250,189,0,0.35);
  vertical-align: middle; margin-left: 5px; white-space: nowrap;
}
.conviction-silver {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  background: rgba(148,163,184,0.18); color: #cbd5e1; border: 1px solid rgba(148,163,184,0.35);
  vertical-align: middle; margin-left: 5px; white-space: nowrap;
}

/* ── Country flags chip ── */
.flag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: all 0.15s;
}
.flag-chip:hover { border-color: var(--blue); color: var(--text); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 12px 16px; text-align: right; color: var(--text-dim); font-weight: 600;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  white-space: nowrap; cursor: pointer; user-select: none;
}
thead th:first-child, thead th:nth-child(2) { text-align: left; }
thead th:hover { color: var(--text); }
thead th.sorted { color: var(--blue); }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: 11px 16px; text-align: right; color: var(--text-muted); }
tbody td:first-child, tbody td:nth-child(2) { text-align: left; }
.td-name { font-weight: 600; color: var(--text); cursor: pointer; }
.td-name:hover { color: var(--blue); }
.td-ticker { font-family: 'JetBrains Mono', monospace; color: var(--blue-light); font-size: 12px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.null-val { color: var(--text-dim); }

/* ── Forms ── */
.input {
  width: 100%; padding: 9px 12px; border-radius: var(--radius);
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 14px;
  transition: border-color 0.15s; outline: none;
}
.input:focus { border-color: var(--blue); }
.input::placeholder { color: var(--text-dim); }
select.input { cursor: pointer; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; }
.form-group { flex: 1; }
.range-row { display: flex; gap: 8px; }
.range-row .input { width: calc(50% - 4px); }

/* ── Sidebar filters ── */
.sidebar {
  width: 240px; min-width: 240px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
  height: fit-content; position: sticky; top: 72px;
}
.filter-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text-dim); text-transform: uppercase; margin-bottom: 8px;
}
.filter-divider { border: none; border-top: 1px solid var(--border); }

/* ── Stat grid ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat-item { padding: 12px 16px; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); }
.stat-label { font-size: 11px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text); font-family: 'JetBrains Mono', monospace; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; padding: 20px 0; }
.page-btn {
  padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-muted); cursor: pointer;
  font-size: 13px; font-family: inherit; transition: all 0.15s;
}
.page-btn:hover { border-color: var(--blue); color: var(--blue); }
.page-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 20px; overflow-y: auto;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 800px;
  margin: auto; padding: 0; overflow: hidden;
  transform: translateY(20px); transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; }
.modal-close:hover { color: var(--text); background: var(--bg-hover); }
.modal-body { padding: 24px; }
.modal-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); padding: 0 24px; }
.modal-tab {
  padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s;
}
.modal-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.modal-tab-content { display: none; padding: 24px; }
.modal-tab-content.active { display: block; }

/* ── ESG grid ── */
.esg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.esg-item { padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg); }
.esg-label { font-size: 11px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; margin-bottom: 6px; }
.esg-score { font-size: 22px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.esg-score.high { color: var(--green); }
.esg-score.mid { color: var(--amber); }
.esg-score.low { color: var(--red); }

/* ── Filings list ── */
.filing-card {
  padding: 14px 0; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px;
}
.filing-card:last-child { border-bottom: none; }
.filing-meta { flex: 1; }
.filing-title { font-weight: 600; color: var(--text); font-size: 14px; text-decoration: none; }
.filing-title:hover { color: var(--blue); }
.filing-sub { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--text-dim); }
.filing-company { font-weight: 600; color: var(--text-muted); }
.filing-date { font-family: 'JetBrains Mono', monospace; }

/* ── Hero ── */
.hero { padding: 80px 24px 60px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(59,130,246,0.15) 0%, transparent 70%);
}
.hero-content { position: relative; max-width: 800px; margin: 0 auto; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
  background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); color: var(--blue);
  margin-bottom: 24px;
}
.hero-headline { margin-bottom: 20px; }
.hero-headline .accent { color: var(--blue); }
.hero-sub { font-size: 18px; max-width: 560px; margin: 0 auto 36px; }
.hero-cta { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Stat bar ── */
.stat-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.stat-bar-item {
  padding: 20px 24px; text-align: center;
  border-right: 1px solid var(--border);
}
.stat-bar-item:last-child { border-right: none; }
.stat-bar-num { font-size: 28px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--text); }
.stat-bar-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Feature cards grid ── */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; max-width: 1100px; margin: 0 auto; }
.feature-icon { font-size: 28px; margin-bottom: 12px; }

/* ── Exchange chips ── */
.exchange-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ── Comparison table ── */
.compare-table { width: 100%; max-width: 800px; margin: 0 auto; }
.compare-table th { text-align: center; padding: 12px 16px; }
.compare-table th:first-child { text-align: left; }
.compare-check { color: var(--green); font-size: 16px; }
.compare-x { color: var(--red); font-size: 16px; }
.compare-partial { color: var(--amber); font-size: 16px; }
.col-ours { background: rgba(59,130,246,0.08); }

/* ── Pricing ── */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; max-width: 900px; margin: 0 auto; }
.pricing-card { position: relative; }
.pricing-card.featured { border-color: var(--blue); }
.pricing-card.featured::before {
  content: 'Most Popular'; position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--blue); color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 12px; border-radius: 20px;
}
.price-amount { font-size: 36px; font-weight: 700; color: var(--text); }
.price-period { font-size: 14px; color: var(--text-muted); }
.price-features { list-style: none; margin: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.price-features li { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--text-muted); }
.price-features li::before { content: '✓'; color: var(--green); font-weight: 700; flex-shrink: 0; }

/* ── Email capture ── */
.email-capture { max-width: 480px; margin: 0 auto; }
.email-form { display: flex; gap: 8px; margin-top: 16px; }
.email-form .input { flex: 1; }

/* ── Layout ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.section { padding: 64px 24px; }
.section-title { text-align: center; margin-bottom: 12px; }
.section-sub { text-align: center; max-width: 520px; margin: 0 auto 40px; font-size: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ── Screener layout ── */
.screener-layout { display: flex; gap: 20px; padding: 20px 24px; max-width: 1400px; margin: 0 auto; }
.screener-main { flex: 1; min-width: 0; }
.result-count { font-size: 13px; color: var(--text-dim); padding: 8px 0; }
.star-btn { background: none; border: none; cursor: pointer; color: var(--text-dim); font-size: 16px; padding: 2px; transition: color 0.15s; }
.star-btn.active { color: var(--amber); }
.star-btn:hover { color: var(--amber); }
.thesis-pill { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.no-thesis-pill { background: var(--text-dim); }

/* ── Deck ── */
.deck-container { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; }
.deck-slide { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; display: none; }
.deck-slide.active { display: flex; }
.deck-content { max-width: 900px; width: 100%; text-align: center; }
.deck-nav { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 16px; }
.deck-progress { font-size: 13px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }
.deck-dots { display: flex; gap: 6px; }
.deck-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); cursor: pointer; transition: all 0.2s; }
.deck-dot.active { background: var(--blue); width: 18px; border-radius: 3px; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; margin-top: 12px; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: var(--green); }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .screener-layout { padding: 12px; }
  .stat-bar { grid-template-columns: repeat(2, 1fr); }
  .stat-bar-item:nth-child(2) { border-right: none; }
  .nav-links { display: none; }
  .hero { padding: 48px 16px 40px; }
  .deck-content { padding: 20px; }
  .esg-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
