/* ═══════════════════════════════════════════════════════════
   Research Agent — styles.css
   Dark professional theme, no emojis, all English
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg-base:       #080811;
  --bg-surface:    #0f0f1c;
  --bg-raised:     #161628;
  --bg-card:       #1a1a2e;
  --bg-glass:      rgba(255,255,255,0.04);
  --border:        rgba(255,255,255,0.08);
  --border-focus:  rgba(99,102,241,0.6);

  --text-primary:  #f0f0ff;
  --text-secondary:#a8a8cc;
  --text-muted:    #5a5a80;
  --text-link:     #818cf8;

  --accent-1:      #6366f1;
  --accent-2:      #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);

  --blue:    #3b82f6;
  --purple:  #8b5cf6;
  --green:   #22c55e;
  --orange:  #f97316;
  --red:     #ef4444;

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

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 40px rgba(99,102,241,0.25);

  --font-base:  'Inter', -apple-system, system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
  font-family: var(--font-base);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(139,92,246,0.08), transparent);
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Utilities ───────────────────────────────────────────── */
.hidden { display: none !important; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(8,8,17,0.85);
  backdrop-filter: blur(16px);
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: white;
  letter-spacing: -0.5px;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-actions { display: flex; gap: 8px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-base);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(99,102,241,0.4);
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 8px 28px rgba(99,102,241,0.5); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-base);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { background: var(--bg-glass); color: var(--text-primary); border-color: rgba(255,255,255,0.14); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  color: #f87171;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-base);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ── Hero Section ─────────────────────────────────────────── */
#hero-section { padding: 80px 0 60px; }

.hero-content { text-align: center; max-width: 760px; margin: 0 auto 64px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 100px;
  background: rgba(99,102,241,0.08);
  color: #a5b4fc;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 28px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-1);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.hero-title {
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto 40px;
}

/* ── Search Box ───────────────────────────────────────────── */
.search-box {
  display: flex;
  gap: 10px;
  max-width: 680px;
  margin: 0 auto 24px;
}

.search-input {
  flex: 1;
  padding: 14px 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-base);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ── Example Chips ────────────────────────────────────────── */
.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.examples-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-base);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover {
  background: var(--bg-glass);
  border-color: rgba(99,102,241,0.4);
  color: var(--text-primary);
}

/* ── Feature Cards ────────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.feature-card {
  padding: 24px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s, background 0.2s;
}
.feature-card:hover {
  border-color: rgba(99,102,241,0.3);
  background: rgba(99,102,241,0.05);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.icon-blue   { background: rgba(59,130,246,0.12); color: #60a5fa; }
.icon-purple { background: rgba(139,92,246,0.12); color: #a78bfa; }
.icon-green  { background: rgba(34,197,94,0.12);  color: #4ade80; }
.icon-orange { background: rgba(249,115,22,0.12); color: #fb923c; }

.feature-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Section Shared ───────────────────────────────────────── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent-1);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

/* ── Progress Section ─────────────────────────────────────── */
#progress-section { padding: 60px 0; }

.progress-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
}

/* Steps */
.steps-row {
  display: flex;
  align-items: center;
  margin-bottom: 36px;
  gap: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 60px;
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.3s;
}

.step.active .step-circle {
  border-color: var(--accent-1);
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}

.step.done .step-circle {
  border-color: var(--accent-1);
  background: var(--accent-gradient);
  color: white;
}

.step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: color 0.3s;
}

.step.active .step-label,
.step.done .step-label { color: var(--text-secondary); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-bottom: 20px;
  transition: background 0.4s;
}
.step-line.done { background: var(--accent-1); }

/* Terminal */
.terminal {
  background: #050510;
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}

.terminal-dots { display: flex; gap: 6px; }
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #ffbd2e; }
.dot-green  { background: #28c840; }

.terminal-title {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex: 1;
  text-align: center;
}

.terminal-body {
  padding: 20px;
  min-height: 260px;
  max-height: 360px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.8;
  color: #4ade80;
}

.log-line { display: block; }
.log-line.dim { color: rgba(74,222,128,0.5); }

.cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #4ade80;
  border-radius: 1px;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── Results Section ──────────────────────────────────────── */
#results-section { padding: 60px 0 80px; }

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.results-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.results-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.meta-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.meta-chip svg { color: var(--accent-1); }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  width: fit-content;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-base);
  cursor: pointer;
  transition: all 0.2s;
}
.tab:hover { color: var(--text-secondary); }
.tab.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-sm);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Report Content ───────────────────────────────────────── */
.report-container {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 820px;
}

.report-container h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

.report-container h2 {
  font-size: 20px;
  font-weight: 700;
  color: #c4b5fd;
  margin: 32px 0 12px;
}

.report-container h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 8px;
}

.report-container p {
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.8;
}

.report-container strong {
  color: var(--text-primary);
  font-weight: 600;
}

.report-container ul, .report-container ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.report-container li {
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.7;
}

.report-container a {
  color: var(--accent-1);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.report-container blockquote {
  border-left: 3px solid var(--accent-1);
  padding: 12px 20px;
  background: rgba(99,102,241,0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0;
  color: var(--text-secondary);
}

.report-container code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-raised);
  padding: 2px 6px;
  border-radius: 4px;
  color: #a5b4fc;
}

.report-container pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
}

.report-container pre code {
  background: transparent;
  padding: 0;
}

.report-container hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

/* ── Sources Tab ──────────────────────────────────────────── */
.sources-container { display: flex; flex-direction: column; gap: 32px; }

.sources-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent-1);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.query-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.query-chip {
  padding: 6px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.articles-list { display: flex; flex-direction: column; gap: 10px; }

.article-card {
  padding: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s;
}
.article-card:hover { border-color: rgba(99,102,241,0.3); }

.article-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.5;
}

.article-url {
  font-size: 12px;
  color: var(--text-link);
  word-break: break-all;
  margin-bottom: 8px;
}

.article-snippet {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-score {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  background: rgba(99,102,241,0.1);
  border-radius: 100px;
  font-size: 11px;
  color: #a5b4fc;
  font-weight: 500;
}

/* ── Mind Map ─────────────────────────────────────────────── */
.mindmap-container {
  position: relative;
  background: #06060f;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.mindmap-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

#mindmap-canvas {
  display: block;
  width: 100%;
  cursor: grab;
}
#mindmap-canvas:active { cursor: grabbing; }

.mindmap-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--bg-glass); color: var(--text-primary); }

.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

/* Form */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.form-input {
  padding: 10px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--border-focus); }

.form-hint { font-size: 12px; color: var(--text-muted); }
.form-hint a { color: var(--text-link); }

.form-range {
  width: 100%;
  accent-color: var(--accent-1);
  cursor: pointer;
}

.range-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-1);
  min-width: 20px;
  text-align: right;
}

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  white-space: nowrap;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  #hero-section { padding: 48px 0 40px; }
  .hero-title { letter-spacing: -1px; }
  .search-box { flex-direction: column; }
  .search-input, .btn-primary { width: 100%; justify-content: center; }
  .progress-header { flex-direction: column; }
  .results-header { flex-direction: column; }
  .report-container { padding: 20px; }
  .steps-row .step-label { display: none; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; }
}
