/* ═══════════════════════════════════════════════════
   CSV → Context — Design System v2
   AI Context Optimizer + SQL Generator
   ═══════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────── */
:root {
  --bg:          #0a0d12;
  --bg-2:        #0e1118;
  --surface:     #12161e;
  --surface-2:   #181d28;
  --surface-3:   #1f2534;
  --border:      #272e3f;
  --border-2:    #353e55;
  --accent:      #a78bfa;        /* purple — AI / token vibe */
  --accent-hover:#8b5cf6;
  --accent-dim:  #4c1d95;
  --accent-glow: rgba(167, 139, 250, 0.15);
  --green:       #4ade80;
  --green-glow:  rgba(74, 222, 128, 0.12);
  --yellow:      #fbbf24;
  --yellow-glow: rgba(251, 191, 36, 0.12);
  --red:         #f87171;
  --red-glow:    rgba(248, 113, 113, 0.12);
  --blue:        #38bdf8;
  --text-1:      #f0f4f8;
  --text-2:      #94a3b8;
  --text-3:      #525c6f;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-xs:   6px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --transition: color 0.1s, background-color 0.1s, border-color 0.1s, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
}

/* ── Light Mode ──────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root {
    --bg:          #fafbfc;
    --bg-2:        #ffffff;
    --surface:     #ffffff;
    --surface-2:   #f3f4f6;
    --surface-3:   #e5e7eb;
    --border:      #d1d5db;
    --border-2:    #9ca3af;
    --accent:      #6366f1;
    --accent-hover:#4f46e5;
    --accent-dim:  #e0e7ff;
    --accent-glow: rgba(99, 102, 241, 0.1);
    --green:       #059669;
    --green-glow:  rgba(5, 150, 105, 0.08);
    --yellow:      #d97706;
    --yellow-glow: rgba(217, 119, 6, 0.08);
    --red:         #dc2626;
    --red-glow:    rgba(220, 38, 38, 0.08);
    --blue:        #0284c7;
    --text-1:      #111827;
    --text-2:      #4b5563;
    --text-3:      #9ca3af;
    --shadow:      0 4px 20px rgba(0,0,0,0.06);
  }

  /* Light mode specific overrides */
  body::before {
    background-image: radial-gradient(rgba(99, 102, 241, 0.06) 1px, transparent 1px);
  }

  .header {
    background: rgba(250, 251, 252, 0.92);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }

  .hero-title {
    background: linear-gradient(135deg, #111827 0%, #4f46e5 60%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .seo-content h2, .seo-content h3 {
    color: #111827;
  }

  .seo-content p, .seo-content li {
    color: #374151;
  }

  .seo-content code {
    background: #f3f4f6;
    color: #6366f1;
    border-color: #e5e7eb;
  }

  .tool-card {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }

  .tool-card:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
  }

  .tool-card-icon {
    background: #f3f4f6;
  }

  .footer {
    background: #f9fafb;
    border-color: #e5e7eb;
  }

  .footer a {
    color: #4b5563;
  }

  .footer a:hover {
    color: #6366f1;
  }
}

/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(var(--accent-glow) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

/* ── Accessibility ──────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Header ─────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 1rem;
}

.logo {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0;
  color: var(--text-1);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-yay {
  font-family: 'Fredoka', 'Comic Neue', cursive;
  font-weight: 600;
  color: var(--accent);
}

.logo-exclaim {
  font-family: 'Fredoka', 'Comic Neue', cursive;
  font-weight: 600;
  color: var(--text-1);
  margin-left: -0.05em;
}

.logo-converter {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  color: var(--text-2);
  margin-left: 0.05em;
}

.logo-icon {
  display: none;
}

.logo-arrow { color: var(--accent); }

.header-nav {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: var(--transition);
}

.nav-link:hover { color: var(--text-1); background: var(--surface-2); }

.nav-link--active {
  color: var(--text-1);
  background: var(--surface-3);
  font-weight: 600;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Hero ────────────────────────────────────────── */
.hero {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0.75rem;
  text-align: center;
}

.hero-title {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-1) 0%, var(--accent) 60%, var(--green) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-2);
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.55;
}

.hero-sub strong {
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
}

/* Hero stats row */
.hero-stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.hero-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

.hero-stat-label {
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ── Feature Badges ─────────────────────────────── */
.features-bar {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0.75rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.feature-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.7rem;
  color: var(--text-2);
  transition: var(--transition);
  white-space: nowrap;
}

.feature-badge:hover { border-color: var(--accent); color: var(--accent); }

.badge-toon { border-color: var(--accent); color: var(--accent); background: rgba(167,139,250,0.06); }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-1);
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-2); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }

.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 0 20px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }

.btn.copied { background: var(--green); color: #000; border-color: var(--green); }

.btn-convert-top { font-size: 0.78rem; padding: 0.35rem 0.8rem; }

/* ── Inputs ─────────────────────────────────────── */
.select, select, input[type="text"] {
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  outline: none;
  transition: var(--transition);
}

select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ── Layout ─────────────────────────────────────── */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0.75rem auto 0;
  padding: 0 1.5rem 3rem;
}

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

/* ── Panel ──────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 500px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.panel-header-actions { display: flex; align-items: center; gap: 0.4rem; }

.panel-title {
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.panel-title .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  animation: pulseDot 2.5s ease-in-out infinite;
}

.row-count {
  display: inline-flex;
  padding: 0.12rem 0.45rem;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 100px;
  font-size: 0.65rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.panel-body {
  flex: 1;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
}

/* ── Drop Zone ──────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, var(--accent-glow), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: rgba(167,139,250,0.02); }
.drop-zone:hover::before, .drop-zone.drag-over::before { opacity: 1; }

.drop-zone-icon { font-size: 1.8rem; display: block; margin-bottom: 0.4rem; position: relative; z-index: 1; }
.drop-zone-text { position: relative; z-index: 1; }
.drop-zone-text p { color: var(--text-2); font-size: 0.85rem; margin-bottom: 0.15rem; }
.drop-zone-text .highlight { color: var(--accent); font-weight: 600; }
.drop-zone-text small { color: var(--text-3); font-size: 0.72rem; }

#file-input { position: absolute; opacity: 0; width: 0; height: 0; }

.or-divider { display: flex; align-items: center; gap: 0.55rem; color: var(--text-3); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; flex-shrink: 0; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── CSV Textarea ────────────────────────────────── */
.csv-textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  line-height: 1.5;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-1);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.csv-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.csv-textarea::placeholder { color: var(--text-3); font-size: 0.73rem; }

/* ── Settings ────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; flex-shrink: 0; }

.setting-group { display: flex; flex-direction: column; gap: 0.25rem; }
.setting-group label:first-child { font-size: 0.68rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.setting-group select, .setting-group input[type="text"] { width: 100%; }
.setting-group--checkbox { justify-content: flex-end; }

.checkbox-group { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-2); cursor: pointer; user-select: none; padding: 0.25rem 0; }
.checkbox-group input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

/* ── Error ────────────────────────────────────────── */
.error-msg {
  background: var(--red-glow);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--red);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  animation: slideDown 0.25s ease;
  flex-shrink: 0;
}

/* ── Preview Table ───────────────────────────────── */
.preview-section { flex-shrink: 0; }
.preview-heading { font-size: 0.7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.35rem; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.preview-heading span { color: var(--text-3); font-weight: 400; text-transform: none; letter-spacing: 0; }

.preview-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 160px; overflow-y: auto; }
.preview-table { width: 100%; border-collapse: collapse; font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; }
.preview-table th { background: var(--surface-2); padding: 0.35rem 0.5rem; text-align: left; font-weight: 600; color: var(--blue); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.preview-table td { padding: 0.28rem 0.5rem; border-bottom: 1px solid var(--border); color: var(--text-2); white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.preview-table tr:last-child td { border-bottom: none; }
.preview-table tr:hover { background: rgba(255,255,255,0.015); }

/* ── Type Table (SQL page) ───────────────────────── */
.type-table-container { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; max-height: 200px; overflow-y: auto; flex-shrink: 0; }
.type-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.type-table th { background: var(--surface-2); padding: 0.4rem 0.65rem; text-align: left; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.66rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; }
.type-table td { padding: 0.35rem 0.65rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.type-table tr:last-child td { border-bottom: none; }
.type-table tr:hover { background: rgba(255,255,255,0.015); }
.col-name { font-family: 'JetBrains Mono', monospace; font-size: 0.73rem; color: var(--blue); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-val { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: var(--text-3); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-select { padding: 0.25rem 0.4rem; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface); color: var(--yellow); font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; outline: none; cursor: pointer; max-width: 150px; }
.type-select:focus { border-color: var(--accent); }

/* ── Convert Row ─────────────────────────────────── */
.convert-row { display: flex; align-items: center; gap: 0.65rem; flex-shrink: 0; margin-top: auto; padding-top: 0.2rem; }
.convert-btn { font-size: 0.88rem; padding: 0.55rem 1.5rem; position: relative; overflow: hidden; }
.convert-btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%); transform: translateX(-100%); transition: transform 0.4s; }
.convert-btn:hover:not(:disabled)::after { transform: translateX(100%); }
.convert-hint { font-size: 0.7rem; color: var(--text-3); font-family: 'JetBrains Mono', monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0.12rem 0.35rem; }

/* ── Output Panel ────────────────────────────────── */
.output-actions { display: flex; gap: 0.4rem; }

/* ── Token Calculator ────────────────────────────── */
.section-heading { font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.55rem; font-weight: 700; }

.token-comparison-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.65rem; flex-wrap: wrap; gap: 0.5rem; }
.token-comparison-header .section-heading { margin-bottom: 0; }

.token-summary { font-size: 0.74rem; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); padding: 0.25rem 0.6rem; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 0.4rem; }
.token-summary-val { color: var(--accent); font-family: 'JetBrains Mono', monospace; font-size: 0.88rem; }

.token-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.token-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  cursor: pointer;
  transition: var(--transition);
}

.token-card:hover { border-color: var(--border-2); transform: translateY(-1px); }

.token-card--active { border-color: var(--accent) !important; background: rgba(167,139,250,0.06); box-shadow: 0 0 12px var(--accent-glow); }

.token-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; }

.token-format-name { font-size: 0.72rem; font-weight: 600; color: var(--text-2); }

.token-badge {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 0.1rem 0.4rem;
  border-radius: 100px;
}

.token-winner  .token-badge { background: var(--green-glow); color: var(--green); border: 1px solid rgba(74,222,128,0.2); }
.token-better  .token-badge { background: var(--yellow-glow); color: var(--yellow); border: 1px solid rgba(251,191,36,0.2); }
.token-baseline .token-badge { background: var(--red-glow); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }

.token-card-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
}

.token-unit { font-size: 0.65rem; font-weight: 400; color: var(--text-3); }

.token-card-cost { font-size: 0.65rem; color: var(--text-3); margin-top: 0.2rem; font-family: 'JetBrains Mono', monospace; }

/* ── Format Tabs ─────────────────────────────────── */
.format-tabs {
  display: flex;
  gap: 0.2rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.format-tab {
  padding: 0.38rem 0.7rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}

.format-tab:hover { border-color: var(--border-2); color: var(--text-1); }

.format-tab--active {
  border-color: var(--accent);
  background: rgba(167,139,250,0.08);
  color: var(--accent);
  font-weight: 600;
}

/* ── Output Textarea ─────────────────────────────── */
.output-textarea,
.sql-output {
  flex: 1;
  width: 100%;
  min-height: 300px;
  resize: vertical;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  line-height: 1.5;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-1);
  outline: none;
  white-space: pre;
  overflow: auto;
  tab-size: 2;
}

.output-textarea:focus,
.sql-output:focus { border-color: var(--border-2); }

/* ── Empty / Loading State ───────────────────────── */
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem 1.25rem; color: var(--text-3); min-height: 280px; }
.empty-state-icon { font-size: 2.75rem; margin-bottom: 0.85rem; opacity: 0.3; font-family: 'JetBrains Mono', monospace; }
.empty-state p { font-size: 0.85rem; max-width: 240px; line-height: 1.5; }
.empty-state-hint { margin-top: 0.35rem !important; font-size: 0.72rem !important; font-family: 'JetBrains Mono', monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0.15rem 0.45rem; display: inline-block; }

.loading-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.85rem; min-height: 280px; color: var(--text-2); font-size: 0.88rem; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }

/* ── Stats (SQL page) ────────────────────────────── */
.stats { display: flex; gap: 0.75rem; flex-wrap: wrap; flex-shrink: 0; }
.stat-item { display: flex; align-items: center; gap: 0.25rem; font-size: 0.73rem; color: var(--text-3); }
.stat-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.stat-value { font-family: 'JetBrains Mono', monospace; color: var(--text-2); font-weight: 600; font-size: 0.76rem; }

/* ── SEO Content ─────────────────────────────────── */
.seo-content { position: relative; z-index: 1; max-width: 820px; margin: 3rem auto; padding: 0 1.5rem; color: var(--text-2); line-height: 1.8; }
.seo-content h2 { color: var(--text-1); font-size: 1.15rem; margin: 2rem 0 0.55rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.seo-content h2:first-child { margin-top: 0; }
.seo-content h3 { color: var(--text-1); font-size: 0.92rem; margin: 1.25rem 0 0.35rem; }
.seo-content p { margin-bottom: 0.8rem; font-size: 0.9rem; }
.seo-content a { color: var(--accent); text-decoration: none; }
.seo-content a:hover { text-decoration: underline; }
.seo-content code { background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 0.82em; color: var(--blue); border: 1px solid var(--border); }

/* ── Footer ─────────────────────────────────────── */
.footer { position: relative; z-index: 1; text-align: center; padding: 1.75rem 1.5rem; border-top: 1px solid var(--border); color: var(--text-3); font-size: 0.78rem; display: flex; flex-direction: column; gap: 0.6rem; align-items: center; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: var(--text-3); text-decoration: none; font-size: 0.78rem; transition: var(--transition); }
.footer-links a:hover { color: var(--accent); }
.footer-affiliate a { color: var(--accent); text-decoration: none; }
.footer-affiliate a:hover { text-decoration: underline; }

/* ── Animations ──────────────────────────────────── */
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.9); } }
.animate-in { animation: fadeIn 0.3s ease both; }

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

.hidden { display: none !important; }

/* ── Responsive: Tablet ──────────────────────────── */
@media (max-width: 960px) {
  .panels { grid-template-columns: 1fr; }
  .app-container { padding: 0.6rem 0.9rem 2rem; }
  .hero { padding: 1.25rem 1rem 0.5rem; }
  .features-bar { padding: 0.4rem 1rem 0; }
  .token-grid { grid-template-columns: repeat(2, 1fr); }
  .convert-row .convert-btn { display: none; }
  .convert-hint { display: none; }
  .btn-convert-top { display: inline-flex !important; }
  .panel { min-height: auto; }
  .hero-stats { gap: 1.25rem; }
}

@media (max-width: 600px) {
  .header-inner { padding: 0; }
  .header { padding: 0 0.65rem; }
  .hero-title { font-size: 1.3rem; }
  .hero-sub { font-size: 0.88rem; }
  .hero-stats { gap: 0.8rem; }
  .hero-stat-value { font-size: 1.1rem; }
  .settings-grid { grid-template-columns: 1fr; }
  .token-grid { grid-template-columns: 1fr; }
  .output-actions { flex-wrap: wrap; }
  .output-actions .btn { flex: 1; justify-content: center; }
  .format-tabs { gap: 0.15rem; }
  .format-tab { padding: 0.3rem 0.5rem; font-size: 0.68rem; }
  .btn-convert-top { width: 100%; justify-content: center; }
  .panel-header-actions { width: 100%; }
  .nav-link { padding: 0.35rem 0.55rem; font-size: 0.75rem; }
}

@media (min-width: 961px) {
  .btn-convert-top { display: none; }
}

/* ── Tools Suite Section ─────────────────────────── */
.tools-suite-section {
  padding: 4rem 1.5rem;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text-2);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tool-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}

.tool-card-icon {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.tool-card h3 {
  color: var(--text-1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  margin: 0;
}

.tool-card p {
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
}

@media (max-width: 768px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }
}
