/* prediction.css — MTDPE Prediction Page Styles */
/* Uses --color-* tokens from main.css. Classes prefixed .pred-* */

/* ── Page shell override (scoped to prediction page only) ─── */
/* .page-content is shared across many pages (main.css); do not edit that
   rule. Here we zero out only the top padding for this page's <main>,
   identified by the extra .pred-page-content class, so content sits
   closer to the top nav. Left/right/bottom padding stay untouched. */

.page-content.pred-page-content {
  padding-top: 0;
}

/* ── Layout ──────────────────────────────────────────────── */

.pred-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 2rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.pred-main { min-width: 0; }

.pred-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
}

@media (max-width: 768px) {
  .pred-layout { grid-template-columns: 1fr; }
  .pred-sidebar { position: static; }
}

/* ── Hub page ────────────────────────────────────────────── */

.pred-hub {
  max-width: 700px;
  margin: 4rem auto;
  padding: 2rem 1rem;
  text-align: center;
}

.pred-hub__title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-text-primary, #f0f0f0);
  margin-bottom: 0.5rem;
}

.pred-hub__sub {
  color: var(--color-text-muted, #888);
  margin-bottom: 2rem;
  font-size: 1rem;
}

.pred-search-form {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
  margin: 0 auto 3rem;
}

.pred-search-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--color-surface-2, #1a1a2e);
  border: 1px solid var(--color-border, #333);
  border-radius: 8px;
  color: var(--color-text-primary, #f0f0f0);
  font-size: 1.1rem;
  text-transform: uppercase;
  outline: none;
}

.pred-search-form input:focus {
  border-color: var(--color-brand, #6366f1);
}

.pred-search-form button {
  padding: 0.75rem 1.5rem;
  background: var(--color-brand, #6366f1);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}

.pred-search-form button:hover {
  background: var(--color-brand-hover, #4f46e5);
}

/* ── Recent ticker pills ──────────────────────────────────── */

.pred-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.pred-pill {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: monospace;
  color: var(--color-text-primary, #f0f0f0);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: border-color 0.15s, background 0.15s;
}
.pred-pill:hover {
  border-color: var(--color-brand, #6366f1);
  background: rgba(99,102,241,0.12);
  color: var(--color-brand, #6366f1);
}

/* ── Recent prediction cards ─────────────────────────────── */

.pred-recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  text-align: left;
}

.pred-recent-card {
  background: var(--color-surface-2, #1a1a2e);
  border: 1px solid var(--color-border, #333);
  border-radius: 10px;
  padding: 1rem;
  text-decoration: none;
  transition: border-color 0.2s;
  display: block;
}

.pred-recent-card:hover { border-color: var(--color-brand, #6366f1); }

.pred-recent-card__ticker {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-primary, #f0f0f0);
}

.pred-recent-card__dir {
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* ── Loading state ───────────────────────────────────────── */

.pred-loading {
  max-width: 520px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--color-surface-2, #111122);
  border: 1px solid var(--color-border, #2a2a3a);
  border-radius: 14px;
}

.pred-loading__header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.pred-loading__title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-text-primary, #f0f0f0);
}

.pred-loading__ticker {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-brand, #6366f1);
  letter-spacing: 0.05em;
}

.pred-loading__horizon {
  font-size: 0.85rem;
  color: var(--color-text-muted, #888);
  margin-top: 0.25rem;
}

.pred-progress-track {
  height: 4px;
  background: var(--color-surface-3, #222233);
  border-radius: 2px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.pred-progress-bar {
  height: 100%;
  background: var(--color-brand, #6366f1);
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
}

.pred-layer-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.pred-layer-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-surface-3, #222);
  transition: background 0.2s;
}

.pred-layer-item:last-child { border-bottom: none; }
.pred-layer--done { animation: pred-pop 0.3s ease; }

@keyframes pred-pop {
  0%   { opacity: 0.4; transform: translateX(-4px); }
  100% { opacity: 1;   transform: translateX(0); }
}

.pred-layer-icon {
  width: 20px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-muted, #666);
  flex-shrink: 0;
}

.pred-layer-icon--done    { color: #10b981; }
.pred-layer-icon--loading { color: var(--color-brand, #6366f1); animation: pred-spin 1s linear infinite; }
.pred-layer-icon--wait    { color: #444; }
.pred-layer-icon--skip    { color: #555; }

@keyframes pred-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.pred-layer-name {
  flex: 1;
  font-size: 0.9rem;
  color: var(--color-text-secondary, #ccc);
}

.pred-layer-score {
  font-size: 0.8rem;
  font-family: monospace;
  min-width: 50px;
  text-align: right;
}

.pred-loading__elapsed {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted, #666);
  margin-top: 0.5rem;
}

/* ── Result page ─────────────────────────────────────────── */

.pred-page-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.pred-logo,
.pred-logo-chip {
  align-self: center;
  flex-shrink: 0;
}

.pred-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--color-surface-2, #111122);
  border: 1px solid var(--color-border, #333);
}

.pred-logo-chip {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-2, #111122);
  border: 1.5px solid var(--color-brand, #D5477F);
  color: var(--color-brand, #D5477F);
  font-weight: 800;
  font-size: 1rem;
}

.pred-ticker-label {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-text-primary, #f0f0f0);
}

.pred-company-label {
  font-size: 1rem;
  color: var(--color-text-muted, #888);
}

.pred-price-label {
  font-size: 1.1rem;
  color: var(--color-text-secondary, #ccc);
}

/* ── Company detail: subtitle + metrics strip ───────────────── */

.pred-company-detail {
  margin-top: -0.6rem;
  margin-bottom: 1.5rem;
}

.pred-company-subtitle {
  font-size: 0.9rem;
  color: var(--color-text-muted, #888);
  line-height: 1.5;
}

.pred-company-metrics {
  margin-top: 0.15rem;
  font-family: 'SF Mono', 'Roboto Mono', Consolas, monospace;
  font-size: 0.78rem;
  color: var(--color-text-muted, #666);
  letter-spacing: 0.01em;
  line-height: 1.6;
}

.pred-company-dot {
  color: var(--color-brand, #D5477F);
  margin: 0 0.15rem;
  opacity: 0.7;
}

/* ── Verdict hero ────────────────────────────────────────── */

.pred-verdict {
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border, #333);
  background: var(--color-surface-2, #111122);
}

.pred-dir--bull { border-color: #10b981; }
.pred-dir--bear { border-color: #ef4444; }
.pred-dir--neutral { border-color: var(--color-border, #333); }

.pred-verdict__direction {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.pred-dir--bull .pred-verdict__direction { color: #10b981; }
.pred-dir--bear .pred-verdict__direction { color: #ef4444; }
.pred-dir--neutral .pred-verdict__direction { color: #666; }

.pred-cards-disabled {
  padding: 1rem 0;
  display: flex;
  justify-content: center;
}

.pred-verdict__confidence {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.pred-verdict__headline {
  font-size: 1rem;
  color: var(--color-text-secondary, #ccc);
  line-height: 1.5;
}

/* ── Badges ──────────────────────────────────────────────── */

.pred-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-left: 0.5rem;
}

.pred-badge--warn   { background: #3f0a0a; color: #f87171; }
.pred-badge--weak   { background: #3b1a00; color: #fb923c; }
.pred-badge--low    { background: #1c1a00; color: #fbbf24; border: 1px solid #78350f; }
.pred-badge--cache  { background: #1e3a5f; color: #60a5fa; }

/* ── Horizon tabs ────────────────────────────────────────── */

.pred-horizon-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.pred-htab {
  padding: 0.4rem 1rem;
  border: 1px solid var(--color-border, #333);
  background: var(--color-surface-2, #111);
  color: var(--color-text-muted, #888);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.pred-htab:hover { border-color: var(--color-brand, #6366f1); color: var(--color-text-primary, #f0f0f0); }

.pred-htab--active {
  background: var(--color-brand, #6366f1);
  border-color: var(--color-brand, #6366f1);
  color: #fff;
  font-weight: 600;
}

/* ── Chart wrap ──────────────────────────────────────────── */

.pred-chart-wrap {
  background: var(--color-surface-2, #0d0d1a);
  border: 1px solid var(--color-border, #222);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  padding: 0.5rem 0;
}

/* ── Trader Cards ────────────────────────────────────────── */

.pred-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) { .pred-cards { grid-template-columns: 1fr; } }

.pred-card {
  background: var(--color-surface-2, #111122);
  border: 1px solid var(--color-border, #333);
  border-radius: 10px;
  padding: 1rem;
}

.pred-card--bull { border-top: 3px solid #10b981; }
.pred-card--bear { border-top: 3px solid #ef4444; }

.pred-card__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted, #888);
  margin-bottom: 0.25rem;
}

.pred-card__dir {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--color-text-primary, #f0f0f0);
}

.pred-card__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.pred-card__table td {
  padding: 0.2rem 0;
  color: var(--color-text-secondary, #ccc);
}

.pred-card__table td:first-child { color: var(--color-text-muted, #888); }

.pred-val      { text-align: right; font-family: monospace; font-weight: 600; }
.pred-stop     { color: #ef4444 !important; }
.pred-target   { color: #10b981 !important; }

.pred-card__risk,
.pred-card__note {
  font-size: 0.75rem;
  color: var(--color-text-muted, #888);
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* ── Score colors ────────────────────────────────────────── */

.pred-score--bull    { color: #10b981; }
.pred-score--bear    { color: #ef4444; }
.pred-score--neutral { color: #888; }
.pred-score--na      { color: #444; font-size: 0.75em; letter-spacing: 0.05em; }

/* ── Sections ────────────────────────────────────────────── */

.pred-section {
  margin-bottom: 2rem;
}

.pred-section__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-primary, #f0f0f0);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border, #333);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
}

/* ── AI Narrative ────────────────────────────────────────── */

.pred-narrative { }

.pred-narrative__main {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text-secondary, #ccc);
  margin-bottom: 1rem;
}

.pred-layer-accordion { margin-bottom: 1rem; }

.pred-accordion-toggle {
  background: none;
  border: 1px solid var(--color-border, #333);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  color: var(--color-text-muted, #888);
  cursor: pointer;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.pred-accordion-toggle:hover { color: var(--color-text-primary, #f0f0f0); }

.pred-accordion-body { display: none; }
.pred-accordion--open .pred-accordion-body { display: block; }
.pred-accordion--open .pred-accordion-toggle::after { content: ' ▾'; }

.pred-layer-row {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-surface-3, #1a1a2e);
  font-size: 0.85rem;
  line-height: 1.5;
}

.pred-layer-badge {
  display: inline-block;
  min-width: 28px;
  padding: 0.1rem 0.35rem;
  background: var(--color-surface-3, #1a1a2e);
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-brand, #6366f1);
  text-align: center;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}

.pred-layer-txt {
  color: var(--color-text-secondary, #ccc);
}

.pred-risk-box {
  background: rgba(239, 68, 68, 0.07);
  border-left: 3px solid #ef4444;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--color-text-secondary, #ccc);
  line-height: 1.5;
}

.pred-risk-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: #ef4444;
  margin-bottom: 0.25rem;
}

/* ── History section ─────────────────────────────────────── */

.pred-history-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pred-history-tab {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--color-border, #333);
  background: none;
  border-radius: 5px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--color-text-muted, #888);
}

.pred-history-tab--active {
  background: var(--color-brand, #6366f1);
  border-color: var(--color-brand, #6366f1);
  color: #fff;
}

.pred-history-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-surface-3, #1a1a2e);
  font-size: 0.85rem;
  cursor: pointer;
}

.pred-history-row:hover { background: var(--color-surface-2, #111); }

.pred-history-date { color: var(--color-text-muted, #888); min-width: 80px; }
.pred-history-dir  { font-weight: 700; min-width: 70px; }
.pred-history-conf { color: var(--color-text-muted, #888); min-width: 60px; }
.pred-history-detail { display: none; padding: 0.5rem 0; }
.pred-history-detail--open { display: block; }

/* ── Sidebar (sticky TOC) ────────────────────────────────── */

.pred-sidebar-section { margin-bottom: 1.5rem; }

.pred-sidebar-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted, #888);
  margin-bottom: 0.5rem;
}

.pred-toc-link {
  display: block;
  padding: 0.25rem 0;
  font-size: 0.8rem;
  color: var(--color-text-muted, #888);
  text-decoration: none;
  transition: color 0.2s;
}

.pred-toc-link:hover { color: var(--color-text-primary, #f0f0f0); }

.pred-sidebar-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted, #666);
  line-height: 1.6;
}

/* ── Search Ticker (right rail) ─────────────────────────── */

.pred-ts { position: relative; width: 100%; }

.pred-ts__input-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  background: var(--color-bg, #0a0a0a);
  border: 1px solid var(--color-border, #2a2a2a);
  border-radius: 8px;
  transition: border-color 0.15s;
}

.pred-ts__input-wrap:focus-within {
  border-color: var(--color-brand, #D5477F);
  box-shadow: 0 0 0 2px rgba(213, 71, 127, 0.18);
}

.pred-ts__icon {
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.6;
  flex: 0 0 auto;
}

.pred-ts__input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text-primary, #f0f0f0);
  font-size: 0.8rem;
  font-family: inherit;
}

.pred-ts__input::placeholder { color: var(--color-text-muted, #666); }

.pred-ts__clear {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--color-text-muted, #888);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pred-ts__clear:hover { color: var(--color-text-primary, #f0f0f0); }

.pred-ts__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--color-bg, #0a0a0a);
  border: 1px solid var(--color-border, #2a2a2a);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  max-height: 280px;
  overflow-y: auto;
  padding: 0.35rem;
}

.pred-ts__row {
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.pred-ts__row + .pred-ts__row { margin-top: 2px; }

.pred-ts__row:hover,
.pred-ts__row--active {
  background: rgba(213, 71, 127, 0.12);
}

.pred-ts__row-top {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.pred-ts__symbol {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  color: var(--color-brand, #D5477F);
  font-size: 0.82rem;
  flex: 0 0 auto;
}

.pred-ts__name {
  font-weight: 600;
  color: var(--color-text-primary, #f0f0f0);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.pred-ts__meta {
  font-size: 0.68rem;
  color: var(--color-text-muted, #777);
  margin-top: 0.15rem;
}

.pred-ts__empty {
  padding: 0.6rem 0.5rem;
  font-size: 0.78rem;
  color: var(--color-text-muted, #888);
}

/* ── Meta bar ────────────────────────────────────────────── */

.pred-meta-bar {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--color-text-muted, #666);
  padding: 1rem 0;
  border-top: 1px solid var(--color-border, #222);
  margin-top: 2rem;
  flex-wrap: wrap;
}

.pred-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted, #666);
  margin-top: 0.25rem;
}

/* ── Buttons ─────────────────────────────────────────────── */

.pred-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.pred-btn--ghost {
  background: none;
  border: 1px solid var(--color-border, #333);
  color: var(--color-text-muted, #888);
}

.pred-btn--ghost:hover { color: var(--color-text-primary, #f0f0f0); border-color: var(--color-text-muted, #888); }

/* ── Error state ─────────────────────────────────────────── */

.pred-error-msg {
  padding: 1rem;
  background: rgba(239,68,68,0.07);
  border: 1px solid #ef4444;
  border-radius: 8px;
  color: #fca5a5;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* Feed status badge alignment in prediction header (styles in feed-status.css) */
.feed-status-badge { margin-left: auto; align-self: center; }
