/* ── Reset & Variables ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f172a;
  --surface:    #1e293b;
  --surface2:   #263348;
  --border:     #334155;
  --accent:     #3b82f6;
  --accent-h:   #2563eb;
  --text:       #f8fafc;
  --muted:      #94a3b8;
  --success:    #22c55e;
  --warning:    #f59e0b;
  --error:      #ef4444;
  --radius:     8px;
  --radius-lg:  12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, border-color 0.15s;
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); color: #fff; }

.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }

.btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
.btn-danger:hover { opacity: 0.85; }

.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.875rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1.0625rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.input, input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  padding: 0.625rem 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus {
  border-color: var(--accent);
}
.input::placeholder, input::placeholder { color: var(--muted); }
.input-lg { font-size: 1.0625rem; padding: 0.875rem 1.125rem; }

/* ── Navigation ──────────────────────────────────────────────────────────── */
.nav {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo span { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-links a { color: var(--muted); font-size: 0.9375rem; }
.nav-links a:hover { color: var(--text); }
.nav-links .btn { color: #fff; }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  padding: 6rem 0 4rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  max-width: 800px;
  margin: 0 auto 1.25rem;
}
.hero-sub {
  color: var(--muted);
  font-size: 1.125rem;
  max-width: 580px;
  margin: 0 auto 2.5rem;
}
.hero-ctas {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Demo Section ────────────────────────────────────────────────────────── */
.demo-section {
  padding: 4rem 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.demo-section h2, .section-sub {
  text-align: center;
}
.demo-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.section-sub { color: var(--muted); margin-bottom: 2rem; }

.demo-search {
  max-width: 520px;
  margin: 0 auto 1.5rem;
}
.demo-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
  margin-top: 0.625rem;
  margin-bottom: 0;
}
.demo-note a { color: var(--accent); }

.keyword-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  min-height: 3rem;
}
.keyword-col-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.keyword-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pill {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  padding: 0.35rem 0.875rem;
  border-radius: 999px;
  font-size: 0.875rem;
  cursor: default;
}
.pill-trends {
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #d8b4fe;
}
.loading-text, .no-results, .error-text, .demo-limit {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 0.5rem;
}
.demo-limit a { color: var(--accent); }
@media (max-width: 600px) {
  .keyword-results-grid { grid-template-columns: 1fr; }
}

.crypto-ticker-wrap {
  max-width: 760px;
  margin: 0 auto;
}
.ticker-label {
  color: var(--muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  text-align: center;
}
.crypto-ticker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}
.ticker-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.625rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.9375rem;
}
.ticker-name { font-weight: 600; color: var(--text); }
.ticker-price { color: var(--text); font-variant-numeric: tabular-nums; }
.ticker-up .ticker-change { color: var(--success); }
.ticker-down .ticker-change { color: var(--error); }
.ticker-loading { color: var(--muted); }

/* ── Features ────────────────────────────────────────────────────────────── */
.features-section { padding: 5rem 0; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.feature-icon { font-size: 2rem; margin-bottom: 1rem; }
.feature-card h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.625rem; }
.feature-card p { color: var(--muted); font-size: 0.9375rem; margin-bottom: 1rem; }
.feature-list { list-style: none; }
.feature-list li {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 0.25rem 0;
  padding-left: 1.25rem;
  position: relative;
}
.feature-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.badge-soon {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--warning);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ── Pricing Teaser ──────────────────────────────────────────────────────── */
.pricing-teaser {
  padding: 5rem 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.pricing-teaser h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 2rem;
}
.teaser-table {
  width: 100%;
  max-width: 640px;
  margin: 0 auto 2rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.teaser-table th, .teaser-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.teaser-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.teaser-table tr:last-child td { border-bottom: none; }

/* ── Pricing Page ────────────────────────────────────────────────────────── */
.pricing-page { padding: 5rem 0; }
.pricing-page h1 {
  text-align: center;
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}
.pricing-page .page-sub {
  text-align: center;
  color: var(--muted);
  margin-bottom: 3rem;
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  position: relative;
}
.pricing-card.featured {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}
.pricing-badge {
  position: absolute;
  top: -0.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}
.pricing-tier {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.pricing-price {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.pricing-price sup { font-size: 1rem; vertical-align: super; }
.pricing-period { color: var(--muted); font-size: 0.875rem; margin-bottom: 1.5rem; }
.pricing-features { list-style: none; margin-bottom: 1.75rem; }
.pricing-features li {
  padding: 0.4rem 0;
  font-size: 0.9375rem;
  color: var(--muted);
  padding-left: 1.5rem;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.pricing-features li:last-child { border-bottom: none; }
.pricing-features li::before { content: "✓"; position: absolute; left: 0; color: var(--success); }
.pricing-card.current-plan { border-color: var(--success); }
.plan-current-label {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--success);
  font-weight: 500;
  margin-top: 0.5rem;
}

/* ── Auth / Sign-up ──────────────────────────────────────────────────────── */
.auth-page {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
}
.auth-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.auth-card p { color: var(--muted); font-size: 0.9375rem; margin-bottom: 2rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--muted);
}
.form-error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: none;
}
.form-error.visible { display: block; }
.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* Key reveal */
.key-reveal {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1.25rem 0;
}
.key-reveal pre {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: #93c5fd;
  word-break: break-all;
  white-space: pre-wrap;
  margin-bottom: 0.75rem;
}
.key-warning {
  color: var(--warning);
  font-size: 0.8125rem;
  margin-top: 0.5rem;
}

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.dashboard-page { padding: 2.5rem 0 4rem; }
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.dash-user-info h2 { font-size: 1.125rem; font-weight: 600; }
.dash-user-info .user-email { color: var(--muted); font-size: 0.9375rem; }
.dash-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tier-free { background: rgba(148, 163, 184, 0.15); color: var(--muted); }
.tier-starter { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.tier-pro { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; }
.tier-business { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

.dash-section { margin-bottom: 3rem; }
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.dash-section-header h3 { font-size: 1.125rem; font-weight: 600; }

.keys-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.keys-table th {
  text-align: left;
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.keys-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.keys-table tr:last-child td { border-bottom: none; }
.key-prefix { font-family: var(--mono); font-size: 0.875rem; color: #93c5fd; }
.key-inactive { opacity: 0.5; }
.status-badge {
  display: inline-flex;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}
.status-active { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.status-inactive { background: rgba(148, 163, 184, 0.15); color: var(--muted); }
.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem;
  font-size: 0.9375rem;
}

/* Usage bars */
.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.usage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.usage-label {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}
.usage-count {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.usage-count .limit { color: var(--muted); font-size: 1rem; font-weight: 400; }
.progress-bar-wrap {
  background: var(--surface2);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.progress-bar.near-limit { background: var(--warning); }
.progress-bar.at-limit { background: var(--error); }

/* Upgrade banner */
.upgrade-banner {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.upgrade-banner p { color: var(--muted); font-size: 0.9375rem; margin-top: 0.25rem; }
.upgrade-banner h4 { font-size: 1rem; font-weight: 600; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 460px;
}
.modal h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; }
.modal p { color: var(--muted); font-size: 0.9375rem; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--muted); font-size: 0.875rem; }
.footer-links a:hover { color: var(--text); }
.footer-copy { color: var(--muted); font-size: 0.875rem; }

/* ── Alert ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.alert-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: #86efac; }
.alert-info { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3); color: #93c5fd; }
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .features-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr 1fr; }
  .usage-grid { grid-template-columns: 1fr; }
  .dash-header { flex-direction: column; align-items: flex-start; }
  .keys-table th:nth-child(3), .keys-table td:nth-child(3),
  .keys-table th:nth-child(4), .keys-table td:nth-child(4) { display: none; }
  .hero { padding: 3.5rem 0 2.5rem; }
  .upgrade-banner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .nav-links a:not(.btn) { display: none; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
}
