/* ═══════════════════════════════════════════════════════════════
   PaperMind — Premium Dark Theme
   Aesthetic: Refined dark SaaS, Fraunces display + DM Sans body
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────────── */
:root {
  --bg-base:      #0a0b0f;
  --bg-surface:   #111318;
  --bg-raised:    #181b24;
  --bg-overlay:   rgba(24, 27, 36, 0.85);
  --border:       rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);

  --accent:       #6366f1;        /* Indigo */
  --accent-glow:  rgba(99,102,241,0.25);
  --accent-2:     #14b8a6;        /* Teal */
  --accent-warm:  #f59e0b;        /* Amber */
  --accent-pink:  #ec4899;

  --text-1:  #f1f5f9;
  --text-2:  #94a3b8;
  --text-3:  #475569;

  --sidebar-w: 240px;
  --topbar-h:  58px;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.6);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-1);
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

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

/* ══════════════════════════════════════ SIDEBAR ═══════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-icon {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}
.logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.02em;
}
.logo-text em {
  font-style: italic;
  color: var(--accent);
}

/* Nav Items */
.sidebar-nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 400;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all var(--transition);
}
.nav-item:hover {
  background: var(--bg-raised);
  color: var(--text-1);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(99,102,241,0.08));
  color: var(--accent);
  font-weight: 500;
  border: 1px solid rgba(99,102,241,0.2);
}
.nav-icon {
  font-size: 14px;
  opacity: 0.7;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Papers list */
.sidebar-papers {
  padding: 16px 12px 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  flex: 1;
  overflow-y: auto;
}
.sidebar-section-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.paper-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  margin-bottom: 4px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.paper-chip:hover { border-color: var(--border-hover); }
.paper-chip.selected { border-color: var(--accent); }
.paper-chip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  flex-shrink: 0;
}
.paper-chip-name {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empty-hint {
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
}

.sidebar-footer {
  padding: 12px 16px;
  font-size: 11px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ══════════════════════════════════════ MAIN AREA ════════════ */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ───────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 50;
}
.hamburger {
  display: none;
  background: none; border: none;
  color: var(--text-2); font-size: 20px;
  cursor: pointer; padding: 4px;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  color: var(--text-1);
  flex: 1;
}
.topbar-actions { display: flex; gap: 10px; }

/* ── Panels ───────────────────────────────────────────────────── */
.panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px;
  animation: fadeIn 0.25s ease;
}
.panel.active { display: flex; flex-direction: column; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-inner {
  max-width: 860px;
  width: 100%;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.panel-subtitle {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 28px;
  line-height: 1.6;
}
.section-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin: 24px 0 12px;
  letter-spacing: 0.02em;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary:hover {
  background: #5254cc;
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--border-hover); color: var(--text-1); }

.btn-export {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-export:hover { border-color: var(--accent); color: var(--accent); }

/* ── Controls Row ─────────────────────────────────────────────── */
.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

/* ── Selects & Inputs ─────────────────────────────────────────── */
.paper-select, .text-input {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 13.5px;
  padding: 9px 14px;
  min-width: 200px;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
}
.paper-select:focus, .text-input:focus { border-color: var(--accent); }

/* ── Upload Zone ──────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-surface);
  position: relative;
  margin-bottom: 24px;
}
.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--accent);
  background: rgba(99,102,241,0.04);
  box-shadow: inset 0 0 40px rgba(99,102,241,0.06);
}
.drop-icon {
  font-size: 40px;
  color: var(--text-3);
  margin-bottom: 12px;
  transition: color var(--transition);
}
.drop-zone:hover .drop-icon { color: var(--accent); }
.drop-primary {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 4px;
}
.drop-secondary {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 20px;
}

/* ── Upload Status ────────────────────────────────────────────── */
.upload-status { margin-top: 16px; }
.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
.upload-item.success { border-left: 3px solid var(--accent-2); }
.upload-item.error { border-left: 3px solid #ef4444; }
.upload-item-icon { font-size: 18px; }
.upload-item-info { flex: 1; }
.upload-item-name { font-size: 13px; font-weight: 500; color: var(--text-1); }
.upload-item-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── PDF Preview ──────────────────────────────────────────────── */
.pdf-preview-container {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
  display: flex;
  justify-content: center;
  padding: 16px;
  margin-bottom: 12px;
}
#pdf-canvas {
  max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.pdf-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}
#pdf-page-info { font-size: 13px; color: var(--text-2); }

/* ══════════════════════════════════════ CHAT ════════════════ */
.chat-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  text-align: center;
  padding: 32px;
}
.chat-welcome-icon {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 16px;
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}
.chat-welcome h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 8px;
}
.chat-welcome p {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 24px;
}
.example-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 540px;
}
.example-q {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-2);
  font-size: 12.5px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.example-q:hover { border-color: var(--accent); color: var(--accent); }

/* Chat Bubbles */
.chat-bubble {
  display: flex;
  gap: 12px;
  max-width: 800px;
  animation: fadeIn 0.25s ease;
}
.chat-bubble.user { flex-direction: row-reverse; align-self: flex-end; }
.chat-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.chat-bubble.user .chat-avatar { background: var(--accent); color: #fff; }
.chat-bubble.ai   .chat-avatar { background: var(--bg-raised); border: 1px solid var(--border); color: var(--accent); }

.chat-message-body {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-1);
  max-width: 560px;
}
.chat-bubble.user .chat-message-body {
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(99,102,241,0.1));
  border-color: rgba(99,102,241,0.3);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}
.typing-dot {
  width: 7px; height: 7px;
  background: var(--text-3);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* Chat Input */
.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  background: var(--bg-surface);
  flex-shrink: 0;
}
.paper-selector-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.input-label { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.chat-input-row { display: flex; gap: 10px; }
.chat-textarea {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 12px 16px;
  outline: none;
  resize: none;
  transition: border-color var(--transition);
  line-height: 1.5;
}
.chat-textarea:focus { border-color: var(--accent); }
.btn-send {
  width: 46px; height: 46px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-send:hover {
  background: #5254cc;
  box-shadow: 0 0 20px var(--accent-glow);
}

/* ══════════════════════════════════ OUTPUT CARDS ════════════ */
.output-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 8px;
}
.output-card-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.output-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}
.output-body {
  padding: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-1);
  white-space: pre-wrap;
  max-height: 480px;
  overflow-y: auto;
}
.output-body ul { padding-left: 20px; }
.output-body li { margin-bottom: 8px; }

/* ── Mode Toggle ──────────────────────────────────────────────── */
.mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.mode-btn {
  background: none;
  border: none;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all var(--transition);
  border-right: 1px solid var(--border);
}
.mode-btn:last-child { border-right: none; }
.mode-btn.active { background: var(--accent); color: #fff; }
.mode-btn:hover:not(.active) { background: var(--bg-raised); color: var(--text-1); }

/* ── Level Cards ──────────────────────────────────────────────── */
.level-cards {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.level-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  min-width: 110px;
}
.level-card input { display: none; }
.level-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(99,102,241,0.08);
}
.level-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}
.level-desc {
  font-size: 11px;
  color: var(--text-3);
}

/* ── Keywords Cloud ───────────────────────────────────────────── */
.keywords-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.keyword-tag {
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  cursor: default;
  transition: transform var(--transition);
  animation: popIn 0.3s ease backwards;
}
.keyword-tag:hover { transform: scale(1.05); }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Sections Grid ────────────────────────────────────────────── */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.section-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  animation: fadeIn 0.3s ease;
  transition: border-color var(--transition), transform var(--transition);
}
.section-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.section-card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.section-card-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
  max-height: 120px;
  overflow-y: auto;
}

/* ── Compare Grid ─────────────────────────────────────────────── */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 8px;
}
.compare-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: fadeIn 0.35s ease;
}
.compare-card-header {
  padding: 14px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.compare-card-num {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.compare-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compare-field {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.compare-field:last-child { border-bottom: none; }
.compare-field-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 5px;
}
.compare-field-value {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-2);
}
.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}
.tech-tag {
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(20,184,166,0.12);
  border: 1px solid rgba(20,184,166,0.25);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 500;
}

/* ── Checkbox Group ───────────────────────────────────────────── */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.paper-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  transition: all var(--transition);
}
.paper-checkbox-label:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
}
.paper-checkbox-label input { display: none; }

/* ── Chart ────────────────────────────────────────────────────── */
.chart-container {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 760px;
}
.chart-note {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 12px;
  font-style: italic;
}

/* ── Word2Vec Results ─────────────────────────────────────────── */
.w2v-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 500px;
}
.w2v-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: slideIn 0.3s ease backwards;
}
.w2v-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  width: 20px;
}
.w2v-term {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
}
.w2v-bar-bg {
  width: 100px;
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.w2v-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.w2v-score {
  font-size: 12px;
  color: var(--text-3);
  width: 36px;
  text-align: right;
}

/* ══════════════════════════════════ LOADING & TOAST ════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,11,15,0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.loading-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-lg);
}
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-size: 14px; color: var(--text-2); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-size: 14px;
  color: var(--text-1);
  box-shadow: var(--shadow-lg);
  z-index: 9998;
  animation: toastIn 0.3s ease;
  max-width: 90vw;
  text-align: center;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ══════════════════════════════════════ UTILITIES ════════════ */
.hidden { display: none !important; }

/* ══════════════════════════════════════ RESPONSIVE ══════════ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-area { margin-left: 0; }
  .hamburger { display: block; }
  .panel { padding: 20px 16px; }
  .panel-title { font-size: 20px; }
  .chat-messages { padding: 16px; }
  .control-row { flex-direction: column; align-items: flex-start; }
  .compare-grid { grid-template-columns: 1fr; }
  .sections-grid { grid-template-columns: 1fr; }
}
.footer {
  width: 100%;
  text-align: center;
  padding: 18px;
  color: #94a3b8;
  font-size: 14px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.2);
}