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

:root {
  --bg:         #0a0f1e;
  --bg-card:    #111827;
  --bg-card2:   #1a2235;
  --border:     #1f2d44;
  --border2:    #2a3a52;
  --primary:    #3b82f6;
  --primary-d:  #2563eb;
  --green:      #10b981;
  --red:        #ef4444;
  --yellow:     #f59e0b;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim:   #64748b;
  --font:       'Inter', system-ui, sans-serif;
  --mono:       'JetBrains Mono', 'Fira Code', monospace;
  --radius:     8px;
  --radius-lg:  12px;
  --shadow:     0 4px 24px rgba(0,0,0,.45);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  background: #060c18;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-icon { font-size: 1.3rem; }
.brand-name { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.brand-tag {
  font-size: .7rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

.nav-links { display: flex; gap: 1.5rem; }
.nav-link {
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  padding: .3rem .6rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--bg-card2);
  text-decoration: none;
}

/* ── Layout ─────────────────────────────────────────────────── */
.main-content { flex: 1; max-width: 1100px; margin: 0 auto; width: 100%; padding: 2.5rem 1.5rem; }

.footer {
  text-align: center;
  padding: 1.2rem;
  color: var(--text-dim);
  font-size: .8rem;
  border-top: 1px solid var(--border);
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.hero-title {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .6rem;
}
.hero-sub { color: var(--text-muted); font-size: 1rem; max-width: 560px; margin: 0 auto; }

/* ── Analyze Card ───────────────────────────────────────────── */
.analyze-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

.url-input-group {
  display: flex;
  gap: .75rem;
}

.url-input {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: .9rem;
  padding: .75rem 1rem;
  outline: none;
  transition: border-color .2s;
}
.url-input::placeholder { color: var(--text-dim); }
.url-input:focus { border-color: var(--primary); }

.btn-analyze {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  padding: .75rem 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn-analyze:hover { background: var(--primary-d); }
.btn-analyze:active { transform: scale(.97); }
.btn-analyze:disabled { opacity: .5; cursor: not-allowed; }

.input-hints { margin-top: .6rem; color: var(--text-dim); font-size: .8rem; }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ── Error Box ──────────────────────────────────────────────── */
.error-box {
  margin-top: 1rem;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.4);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  color: #fca5a5;
  font-size: .9rem;
}

/* ── Loading Panel ──────────────────────────────────────────── */
.loading-panel { margin-top: 1.5rem; }
.loading-steps { display: flex; flex-direction: column; gap: .75rem; }
.step {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--text-dim);
  font-size: .9rem;
  transition: color .3s;
}
.step.active-step { color: var(--text); }
.step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border2);
  flex-shrink: 0;
  transition: background .3s;
}
.step-dot.active { background: var(--primary); box-shadow: 0 0 6px var(--primary); }
.step-dot.done { background: var(--green); }
.loading-note { margin-top: 1rem; color: var(--text-dim); font-size: .8rem; }

/* ── Features ───────────────────────────────────────────────── */
.features-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.feature-icon { font-size: 1.5rem; margin-bottom: .5rem; }
.feature-card h3 { font-size: .95rem; margin-bottom: .3rem; color: var(--text); }
.feature-card p { font-size: .85rem; color: var(--text-muted); }

/* ── Recent ─────────────────────────────────────────────────── */
.recent-section { margin-top: 2.5rem; }
.section-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-muted); }
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 1rem; }
.recent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  transition: border-color .2s, transform .15s;
  display: flex;
  flex-direction: column;
}
.recent-card:hover { border-color: var(--primary); transform: translateY(-2px); text-decoration: none; }
.recent-thumb-wrap { aspect-ratio: 16/9; overflow: hidden; background: var(--bg-card2); }
.recent-thumb { width: 100%; height: 100%; object-fit: cover; }
.recent-thumb-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 1.5rem; }
.recent-info { padding: .75rem; }
.recent-title { font-size: .85rem; font-weight: 500; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recent-meta { font-size: .75rem; color: var(--text-dim); margin-top: .25rem; }

/* ── Report Header ──────────────────────────────────────────── */
.report-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.report-header-inner { display: flex; gap: 1.5rem; align-items: flex-start; }
.report-thumb { width: 200px; min-width: 200px; border-radius: var(--radius); object-fit: cover; }
.report-header-info { flex: 1; }
.report-title { font-size: 1.4rem; font-weight: 700; line-height: 1.3; margin-bottom: .75rem; }
.report-meta-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.meta-pill {
  background: var(--bg-card2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: .25rem .75rem;
  font-size: .8rem;
  color: var(--text-muted);
}
.outlook-pill { font-weight: 600; }
.outlook-pill.outlook-bullish { background: rgba(16,185,129,.12); border-color: var(--green); color: var(--green); }
.outlook-pill.outlook-bearish { background: rgba(239,68,68,.12); border-color: var(--red); color: var(--red); }
.outlook-pill.outlook-neutral, .outlook-pill.outlook-mixed { background: rgba(245,158,11,.12); border-color: var(--yellow); color: var(--yellow); }

.report-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-secondary {
  background: var(--bg-card2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 500;
  padding: .4rem .9rem;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  text-decoration: none;
  display: inline-block;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--text); text-decoration: none; }

/* ── Report Body ────────────────────────────────────────────── */
.report-body { display: flex; flex-direction: column; gap: 1.5rem; }

.report-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.section-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}

/* TL;DR */
.tldr-section { border-left: 3px solid var(--primary); }
.tldr-text { font-size: 1rem; line-height: 1.7; color: var(--text); }
.tag-row { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  border-radius: 4px;
  padding: .2rem .6rem;
  font-size: .78rem;
  font-weight: 500;
}
.tag-index { background: rgba(59,130,246,.15); color: #93c5fd; border: 1px solid rgba(59,130,246,.3); }
.tag-sector { background: rgba(16,185,129,.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,.25); }

/* Key Concepts */
.concepts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: .75rem; }
.concept-card {
  background: var(--bg-card2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.concept-name { font-weight: 600; font-size: .9rem; color: #93c5fd; }
.concept-desc { font-size: .83rem; color: var(--text-muted); }

/* Tickers Table */
.table-wrap { overflow-x: auto; }
.tickers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.tickers-table th {
  background: var(--bg-card2);
  color: var(--text-dim);
  font-weight: 600;
  text-align: left;
  padding: .65rem .85rem;
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
}
.tickers-table td {
  padding: .7rem .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ticker-row:hover { background: var(--bg-card2); }
.ticker-symbol { font-family: var(--mono); font-weight: 700; font-size: .9rem; color: var(--text); }
.validated-dot { color: var(--green); font-size: .75rem; margin-left: .3rem; }
.exchange-badge {
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.25);
  color: #93c5fd;
  border-radius: 4px;
  padding: .1rem .45rem;
  font-size: .75rem;
  font-family: var(--mono);
}
.sentiment-badge {
  border-radius: 4px;
  padding: .2rem .5rem;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}
.sentiment-bullish { background: rgba(16,185,129,.15); color: var(--green); }
.sentiment-bearish { background: rgba(239,68,68,.15); color: var(--red); }
.sentiment-neutral { background: rgba(245,158,11,.12); color: var(--yellow); }
.company-col, .sector-col { color: var(--text-muted); max-width: 180px; }
.context-col { color: var(--text-muted); font-size: .82rem; max-width: 220px; }
.target-col { font-family: var(--mono); font-size: .85rem; }
.ts-link { color: var(--primary); font-family: var(--mono); font-size: .82rem; }

/* Summary */
.summary-list { display: flex; flex-direction: column; gap: 1rem; }
.summary-item {
  border-left: 2px solid var(--border2);
  padding-left: 1rem;
}
.summary-item-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .35rem; }
.ts-badge {
  background: rgba(59,130,246,.15);
  color: var(--primary);
  border-radius: 4px;
  padding: .15rem .5rem;
  font-family: var(--mono);
  font-size: .8rem;
  white-space: nowrap;
  text-decoration: none;
}
.ts-badge:hover { background: rgba(59,130,246,.25); text-decoration: none; }
.summary-item-title { font-weight: 600; font-size: .9rem; }
.summary-item-content { color: var(--text-muted); font-size: .88rem; line-height: 1.6; }

/* Quotes */
.quotes-list { display: flex; flex-direction: column; gap: .85rem; }
.notable-quote {
  border-left: 3px solid var(--yellow);
  padding: .6rem 1rem;
  color: var(--text-muted);
  font-style: italic;
  font-size: .9rem;
  background: rgba(245,158,11,.04);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Disclaimer */
.disclaimer {
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.analyzed-note { margin-top: .4rem; color: var(--text-dim); }

/* ── History ─────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 700; }
.page-sub { color: var(--text-muted); font-size: .9rem; margin-top: .3rem; }

.history-table-wrap { overflow-x: auto; }
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.history-table th {
  background: var(--bg-card);
  color: var(--text-dim);
  font-weight: 600;
  text-align: left;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.history-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.history-row:hover td { background: var(--bg-card2); }
.history-video-cell { display: flex; align-items: center; gap: .75rem; }
.history-thumb { width: 80px; height: 45px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.history-thumb-ph { width: 80px; height: 45px; background: var(--bg-card2); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--text-dim); flex-shrink: 0; }
.history-title { color: var(--text); font-weight: 500; font-size: .88rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 360px; }
.history-title:hover { color: var(--primary); text-decoration: none; }
.history-channel, .history-duration, .history-date { color: var(--text-muted); white-space: nowrap; }
.history-actions { display: flex; gap: .4rem; white-space: nowrap; }

.btn-sm {
  background: var(--bg-card2);
  border: 1px solid var(--border2);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 500;
  padding: .25rem .6rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: border-color .15s, color .15s;
}
.btn-sm:hover { border-color: var(--primary); color: var(--text); text-decoration: none; }
.btn-sm.btn-danger:hover { border-color: var(--red); color: var(--red); }

/* Empty state */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  padding: .6rem 1.5rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  margin-top: 1rem;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-d); text-decoration: none; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .main-content { padding: 1.5rem 1rem; }
  .url-input-group { flex-direction: column; }
  .btn-analyze { width: 100%; justify-content: center; }
  .report-header-inner { flex-direction: column; }
  .report-thumb { width: 100%; min-width: unset; }
  .hero-title { font-size: 1.4rem; }
  .navbar { padding: 0 1rem; }
  .brand-tag { display: none; }
}
