/* ===== Google Font Import ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
  --teal: #2f6a73;
  --teal-light: #3d8a96;
  --teal-dark: #1e4a52;
  --teal-glow: rgba(47, 106, 115, 0.25);
  --orange: #e07a4b;
  --orange-light: #f0956a;
  --bg: #0c1a24;
  --bg2: #101f2c;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-teal: rgba(47, 106, 115, 0.35);
  --text: #dde8ef;
  --text-muted: #7a96a8;
  --text-dim: #445f70;
  --success: #4caf7d;
  --error: #e05a5a;
  --warning: #f0b340;
  --info: #4a9fd4;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
}

[data-theme="light"] {
  --bg: #f0f5f8;
  --bg2: #e6edf3;
  --surface: rgba(0, 0, 0, 0.03);
  --surface-2: rgba(0, 0, 0, 0.06);
  --surface-hover: rgba(0, 0, 0, 0.06);
  --border: rgba(0, 0, 0, 0.09);
  --border-teal: rgba(47, 106, 115, 0.25);
  --text: #182530;
  --text-muted: #4a6678;
  --text-dim: #8aacbc;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Lucide Icons ===== */
[data-lucide] {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}

/* ===== Background Decorations ===== */
.bg-decoration {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.bg-circle {
  position: absolute; border-radius: 50%;
  filter: blur(100px); opacity: 0.1;
}
.bg-circle-1 { width: 700px; height: 700px; background: var(--teal); top: -250px; right: -150px; }
.bg-circle-2 { width: 500px; height: 500px; background: var(--orange); bottom: -150px; left: -150px; }
.bg-circle-3 { width: 350px; height: 350px; background: var(--teal-light); top: 45%; left: 38%; opacity: 0.06; }

/* ===== Layout ===== */
.app-container {
  position: relative; z-index: 1;
  max-width: 1340px; margin: 0 auto; padding: 0 24px;
}

/* ===== Header ===== */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
  position: relative;
}
.header::after {
  content: '';
  position: absolute; bottom: -1px; left: 0;
  width: 120px; height: 1px;
  background: linear-gradient(90deg, var(--teal), transparent);
}
.logo { display: flex; align-items: center; gap: 14px; }
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px var(--teal-glow);
  color: white;
}
.logo-icon [data-lucide] { width: 20px; height: 20px; }
.logo-text h1 {
  font-size: 17px; font-weight: 700; color: var(--text);
  letter-spacing: -0.3px;
}
.logo-text span { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.theme-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.theme-btn:hover { border-color: var(--teal); color: var(--teal-light); background: var(--surface-2); }
.topbar-user {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 12px; font-weight: 500;
}
.topbar-user [data-lucide] { width: 14px; height: 14px; flex-shrink: 0; }
.help-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-teal); background: transparent;
  color: var(--teal-light); font-size: 12px; font-weight: 500;
  font-family: 'Inter', inherit; text-decoration: none;
  cursor: pointer; transition: var(--transition);
}
.help-btn:hover { background: var(--surface-2); color: var(--text); }
.help-btn [data-lucide] { width: 13px; height: 13px; }

/* ===== Main Grid ===== */
.main-grid {
  display: grid; grid-template-columns: 420px 1fr; gap: 24px; align-items: start;
}
@media (max-width: 960px) { .main-grid { grid-template-columns: 1fr; } }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: var(--transition);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.02);
}
.card-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--orange);
  display: flex; align-items: center; gap: 7px;
}
.card-title [data-lucide] { width: 13px; height: 13px; }
.card-body { padding: 20px; }

/* ===== Upload Zone ===== */
.upload-zone {
  border: 2px dashed var(--border-teal);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(47, 106, 115, 0.03);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--teal-light);
  background: rgba(47, 106, 115, 0.08);
  transform: translateY(-1px);
}
.upload-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(47,106,115,0.15), rgba(47,106,115,0.05));
  border: 1px solid var(--border-teal);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; color: var(--teal-light);
}
.upload-icon [data-lucide] { width: 22px; height: 22px; }
.upload-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.upload-sub { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.upload-sub span { color: var(--teal-light); font-weight: 500; }
.upload-input { display: none; }

.file-info {
  margin-top: 12px; padding: 10px 14px;
  background: rgba(47, 106, 115, 0.08);
  border: 1px solid var(--border-teal);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.file-info-left { display: flex; align-items: center; gap: 8px; color: var(--teal-light); }
.file-info-left [data-lucide] { width: 14px; height: 14px; }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.file-size { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.file-remove {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; padding: 4px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.file-remove:hover { color: var(--error); background: rgba(224,90,90,0.1); }
.file-remove [data-lucide] { width: 14px; height: 14px; }

/* ===== Mapping Toggle ===== */
.mapping-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 0 0; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.mapping-toggle-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
}
.mapping-toggle-label [data-lucide] { width: 14px; height: 14px; color: var(--teal-light); }

/* Toggle switch */
.toggle-btn {
  background: none; border: none; cursor: pointer; padding: 0; flex-shrink: 0;
}
.toggle-track {
  display: block; width: 36px; height: 20px; border-radius: 10px;
  background: var(--border); border: 1px solid var(--border);
  position: relative; transition: background 0.2s, border-color 0.2s;
}
.toggle-thumb {
  display: block; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-dim); position: absolute; top: 2px; left: 2px;
  transition: transform 0.2s, background 0.2s;
}
.toggle-btn[aria-pressed="true"] .toggle-track {
  background: var(--teal); border-color: var(--teal);
}
.toggle-btn[aria-pressed="true"] .toggle-thumb {
  background: white; transform: translateX(16px);
}

/* Mapping upload section */
#mapping-section { margin-top: 12px; animation: fadeIn 0.2s ease; }
.mapping-zone { padding: 18px 16px; }
.mapping-zone .upload-icon { width: 40px; height: 40px; margin-bottom: 10px; }
.mapping-zone .upload-title { font-size: 13px; }

/* ===== Query Area ===== */
.query-area { }
.query-label {
  font-size: 11px; color: var(--text-muted); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: 0.6px; font-weight: 500;
}
.query-input {
  width: 100%; min-height: 96px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 14px;
  font-family: 'Inter', inherit; resize: vertical; outline: none;
  transition: var(--transition); line-height: 1.6;
}
.query-input::placeholder { color: var(--text-dim); }
.query-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
  background: var(--surface);
}
.query-footer { display: flex; align-items: center; justify-content: flex-end; margin-top: 6px; }
.char-counter { font-size: 11px; color: var(--text-dim); transition: color 0.2s; }
.char-counter.warn { color: var(--warning); }
.char-counter.limit { color: var(--error); }

/* ===== Model Selector ===== */
.model-selector { margin-bottom: 14px; }
.model-selector-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  display: flex; align-items: center; gap: 5px; margin-bottom: 8px;
}
.model-selector-label [data-lucide] { width: 12px; height: 12px; }
.model-btn-group { display: flex; gap: 6px; }
.model-btn {
  flex: 1; padding: 8px 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 12px; font-weight: 500; font-family: 'Inter', inherit;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.model-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-teal); }
.model-btn.active {
  background: var(--teal-glow); border-color: var(--teal-light);
  color: var(--teal-light); font-weight: 600;
}
.model-icon { font-size: 13px; }

.analyze-btn {
  width: 100%; padding: 12px; margin-top: 14px;
  background: linear-gradient(135deg, var(--teal-light), var(--teal-dark));
  border: none; border-radius: var(--radius-sm); color: white;
  font-size: 14px; font-weight: 600; font-family: 'Inter', inherit;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  letter-spacing: 0.2px; position: relative; overflow: hidden;
}
.analyze-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.analyze-btn:hover:not(:disabled)::before { opacity: 1; }
.analyze-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--teal-glow);
}
.analyze-btn:active:not(:disabled) { transform: translateY(0); }
.analyze-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.analyze-btn [data-lucide] { width: 15px; height: 15px; }
.analyze-btn.loading { pointer-events: none; }
.analyze-btn.loading::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: white;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* ===== History ===== */
.history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.history-title {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.history-title [data-lucide] { width: 12px; height: 12px; }
.history-clear {
  font-size: 11px; color: var(--text-dim);
  background: none; border: none; cursor: pointer;
  font-family: inherit; transition: var(--transition);
}
.history-clear:hover { color: var(--error); }
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-item {
  padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition); font-size: 13px;
}
.history-item:hover { border-color: var(--border-teal); background: var(--surface-hover); }
.history-item-q { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; font-weight: 500; }
.history-item-meta { font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; }
.history-item-meta [data-lucide] { width: 10px; height: 10px; }
.history-empty { font-size: 13px; color: var(--text-dim); text-align: center; padding: 16px 0; }

/* ===== Result Panel ===== */
.result-panel { min-height: 500px; }

/* ===== Placeholder ===== */
.result-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 500px; gap: 36px; padding: 48px 40px;
}
.placeholder-hero { text-align: center; }
.placeholder-icon-ring {
  width: 88px; height: 88px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(47,106,115,0.15), rgba(224,122,75,0.08));
  border: 1px solid var(--border-teal);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 22px;
  animation: float 4s ease-in-out infinite;
  color: var(--teal-light);
  box-shadow: 0 0 40px var(--teal-glow);
}
.placeholder-icon-ring [data-lucide] { width: 36px; height: 36px; stroke-width: 1.5; }
.placeholder-title {
  font-size: 22px; font-weight: 700; color: var(--text);
  margin-bottom: 10px; letter-spacing: -0.4px;
}
.placeholder-sub {
  font-size: 14px; color: var(--text-muted);
  max-width: 440px; line-height: 1.7; margin: 0 auto;
}

/* Steps */
.placeholder-steps { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; width: 100%; }
.placeholder-step {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  flex: 1; min-width: 150px; max-width: 200px;
  transition: var(--transition);
}
.placeholder-step:hover { border-color: var(--border-teal); }
.step-num {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: white; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px var(--teal-glow);
}
.step-text { font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.step-text strong { color: var(--text); display: block; font-weight: 600; }

/* Example chips */
.placeholder-examples { text-align: center; width: 100%; }
.examples-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-dim); margin-bottom: 12px; font-weight: 500;
}
.examples-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.example-chip {
  padding: 7px 16px;
  background: rgba(47,106,115,0.08);
  border: 1px solid var(--border-teal); border-radius: 20px;
  font-size: 12px; color: var(--teal-light); cursor: pointer;
  transition: var(--transition); font-family: 'Inter', inherit;
  font-weight: 500;
}
.example-chip:hover {
  background: rgba(47,106,115,0.18);
  color: var(--text); border-color: var(--teal-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--teal-glow);
}

/* ===== Loading Overlay ===== */
.loading-overlay {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 500px; gap: 18px; color: var(--text-muted);
}
.loading-spinner {
  width: 44px; height: 44px; border: 3px solid var(--border);
  border-top-color: var(--teal); border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loading-text { font-size: 15px; font-weight: 600; color: var(--text); }
.loading-sub { font-size: 13px; color: var(--text-muted); max-width: 360px; text-align: center; line-height: 1.6; }

/* ===== Error Card ===== */
.error-card {
  margin: 20px;
  padding: 24px;
  background: rgba(224,90,90,0.06);
  border: 1px solid rgba(224,90,90,0.2);
  border-radius: var(--radius);
  display: flex; gap: 16px; align-items: flex-start;
}
.error-icon { color: var(--error); flex-shrink: 0; margin-top: 2px; }
.error-icon [data-lucide] { width: 20px; height: 20px; }
.error-card h3 { font-size: 15px; font-weight: 600; color: var(--error); margin-bottom: 6px; }
.error-card p { font-size: 13px; line-height: 1.6; color: var(--text-muted); }

/* ===== Result iframe ===== */
.result-iframe {
  width: 100%; border: none; border-radius: var(--radius);
  background: transparent; min-height: 600px;
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999; pointer-events: none;
}
.toast {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  pointer-events: auto; max-width: 340px; min-width: 220px;
  display: flex; align-items: center; gap: 10px;
  animation: slideIn 0.25s ease; box-shadow: var(--shadow);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.toast [data-lucide] { width: 15px; height: 15px; flex-shrink: 0; }
.toast.success { background: rgba(12,28,38,0.95); color: var(--success); border: 1px solid rgba(76,175,125,0.25); }
.toast.error   { background: rgba(12,28,38,0.95); color: var(--error);   border: 1px solid rgba(224,90,90,0.25); }
.toast.warning { background: rgba(12,28,38,0.95); color: var(--warning); border: 1px solid rgba(240,179,64,0.25); }
.toast.info    { background: rgba(12,28,38,0.95); color: var(--info);    border: 1px solid rgba(74,159,212,0.25); }
.toast-msg { color: var(--text); }
.toast.hide { animation: slideOut 0.25s ease forwards; }
@keyframes slideIn  { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOut { from { opacity: 1; transform: translateX(0); }    to { opacity: 0; transform: translateX(50px); } }

/* ===== Preview Panel ===== */
#preview-section { margin-top: 18px; display: none; }
.preview-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.preview-title {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.preview-title [data-lucide] { width: 12px; height: 12px; }
.section-divider { margin: 16px 0; border: none; border-top: 1px solid var(--border); }

/* Column stats */
.col-stats-scroll {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.col-stat-card {
  min-width: 160px; flex-shrink: 0; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border-teal);
  border-radius: var(--radius-sm); font-size: 12px;
  transition: var(--transition);
}
.col-stat-card:hover { border-color: var(--teal-light); }
.cs-name {
  font-weight: 600; color: var(--text); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px;
}
.cs-dtype {
  color: var(--teal-light); font-size: 10px; margin-bottom: 8px;
  padding: 2px 7px; background: rgba(47,106,115,0.15); border-radius: 10px;
  display: inline-block; font-weight: 500; letter-spacing: 0.3px;
}
.cs-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; color: var(--text-muted); font-size: 11px; }
.cs-row span:last-child { color: var(--text); text-align: right; font-weight: 500; }
.cs-samples span:last-child { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Preview table */
.preview-search-wrap { margin-bottom: 10px; }
.preview-search {
  width: 100%; padding: 8px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 13px; outline: none;
  font-family: 'Inter', inherit; transition: var(--transition);
}
.preview-search::placeholder { color: var(--text-dim); }
.preview-search:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-glow); }

.preview-table-wrap {
  overflow-x: auto; border-radius: var(--radius-sm);
  border: 1px solid var(--border); max-height: 260px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.preview-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.preview-table th {
  padding: 8px 12px; text-align: left; background: rgba(47,106,115,0.15);
  color: var(--orange); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600;
  position: sticky; top: 0; white-space: nowrap;
}
.preview-table td {
  padding: 7px 12px; border-bottom: 1px solid var(--border);
  color: var(--text); white-space: nowrap;
}
.preview-table tr:last-child td { border-bottom: none; }
.preview-table tr:hover td { background: var(--surface-hover); }
.preview-info { font-size: 11px; color: var(--text-dim); margin-top: 8px; }

/* ===== Animations ===== */
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card { animation: fadeIn 0.3s ease both; }

/* ===== Inline Help Tooltips ===== */
.help-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 10px; font-weight: 700;
  cursor: default; flex-shrink: 0;
  transition: var(--transition); margin-left: 4px; vertical-align: middle;
  font-style: normal; line-height: 1; font-family: 'Inter', sans-serif;
  user-select: none;
}
.help-icon:hover { border-color: var(--teal); color: var(--teal); }

/* Global tooltip — positioned via JS to escape overflow:hidden parents */
#help-tooltip {
  display: none; position: fixed; z-index: 9999; pointer-events: none;
  background: var(--bg2); border: 1px solid var(--border-teal);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 12px; color: var(--text); line-height: 1.6;
  max-width: 260px; box-shadow: var(--shadow); text-align: left;
}
#help-tooltip::after {
  content: ''; position: absolute; top: 100%; left: var(--arrow-left, 50%);
  transform: translateX(-50%); border: 5px solid transparent;
  border-top-color: var(--border-teal);
}

/* ===== Empty State Query Suggestions ===== */
.query-suggestions {
  margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px;
}
.query-suggestion-label {
  width: 100%; font-size: 11px; color: var(--text-dim);
  margin-bottom: 2px; display: flex; align-items: center; gap: 4px;
}
.suggestion-chip {
  padding: 6px 12px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; font-size: 12px; color: var(--text-muted);
  cursor: pointer; transition: var(--transition); white-space: nowrap;
  font-family: 'Inter', inherit;
}
.suggestion-chip:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-glow); }

/* ===== Auto Insights ===== */
.auto-insights-section {
  margin-top: 14px; background: var(--surface-2);
  border: 1px solid var(--border-teal); border-radius: var(--radius);
  padding: 14px 16px;
}
.insights-loading {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted);
}
.insights-header {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--teal-light); margin-bottom: 10px;
}
.insights-header svg { width: 13px; height: 13px; }
.insights-list { display: flex; flex-direction: column; gap: 7px; }
.insight-item {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px; color: var(--text); line-height: 1.5;
}
.insight-item svg { width: 13px; height: 13px; color: var(--orange); flex-shrink: 0; margin-top: 2px; }

/* ===== Follow-up Suggestions ===== */
.followup-section {
  margin-top: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.followup-header {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 10px;
}
.followup-header svg { width: 13px; height: 13px; }
.followup-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.followup-chip {
  padding: 7px 14px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; font-size: 12px; color: var(--text-muted);
  cursor: pointer; transition: var(--transition); font-family: 'Inter', inherit;
  text-align: left;
}
.followup-chip:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-glow); }

/* ===== Data Story Button ===== */
.story-launch-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 18px; background: linear-gradient(135deg, var(--teal-light), var(--teal-dark));
  border: none; border-radius: var(--radius-sm); color: white;
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: 'Inter', inherit; transition: opacity 0.2s;
}
.story-launch-btn:hover { opacity: 0.88; }
.story-launch-btn svg { width: 15px; height: 15px; }

/* ===== Data Story Modal ===== */
.story-modal {
  position: relative; background: var(--bg2);
  border: 1px solid var(--border-teal); border-radius: var(--radius);
  padding: 40px; max-width: 600px; width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.story-close {
  position: absolute; top: 14px; right: 18px;
  background: none; border: none; font-size: 24px; color: var(--text-muted);
  cursor: pointer; line-height: 1; transition: color 0.2s;
}
.story-close:hover { color: var(--text); }
.story-progress { display: flex; gap: 6px; margin-bottom: 20px; }
.story-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); transition: background 0.2s;
}
.story-dot.active { background: var(--teal-light); }
.story-slide-num {
  font-size: 11px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 12px;
}
.story-headline {
  font-size: 22px; font-weight: 700; color: var(--text);
  line-height: 1.3; margin-bottom: 16px;
}
.story-narrative {
  font-size: 15px; color: var(--text-muted); line-height: 1.7; margin-bottom: 28px;
}
.story-nav { display: flex; gap: 10px; }
.story-nav-btn {
  padding: 9px 20px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13px;
  cursor: pointer; font-family: 'Inter', inherit; transition: var(--transition);
}
.story-nav-btn:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.story-nav-btn:disabled { opacity: 0.35; cursor: default; }
