/* Block: templates — styles for the v29 template-based views.
 *
 * Sector heatmap, sentiment gauge, sparkline, news items, score bars,
 * section headers, empty states, and other shared partials used across
 * all rebuilt pages. Token-driven, theme-overridable.
 */

/* ── Section header ─────────────────────────────────────────── */
.fd-section-header {
  margin-bottom: 24px;
}
.fd-section-actions {
  margin-top: 12px;
  display: flex; gap: 10px; flex-wrap: wrap;
}

/* ── Score pill sizes ───────────────────────────────────────── */
.fd-score--sm { font-size: 11px; padding: 2px 8px; }
.fd-score--lg { font-size: 18px; padding: 6px 14px; }

/* ── Score bar ──────────────────────────────────────────────── */
.fd-score-bar {
  height: 6px; border-radius: 3px;
  background: var(--fd-bg-subtle, #1a2335);
  overflow: hidden; position: relative;
}
.fd-score-bar-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  border-radius: 3px;
  transition: width 0.4s var(--fd-tx, ease);
}
.fd-score-bar-fill--bull { background: var(--fd-bull, #34d399); box-shadow: 0 0 8px var(--fd-bull-glow, rgba(52,211,153,0.3)); }
.fd-score-bar-fill--bear { background: var(--fd-bear, #fb7185); box-shadow: 0 0 8px var(--fd-bear-glow, rgba(251,113,133,0.3)); }

/* ── Sector heatmap ──────────────────────────────────────────── */
.fd-heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.fd-heatmap-cell {
  border-radius: var(--fd-radius, 12px);
  padding: 16px 14px;
  text-decoration: none;
  display: flex; flex-direction: column; gap: 4px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(255,255,255,0.06);
}
.fd-heatmap-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px -4px rgba(0,0,0,0.4);
  text-decoration: none;
}
.fd-heatmap-name {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  opacity: 0.9;
}
.fd-heatmap-score {
  font-family: var(--fd-mono, 'JetBrains Mono', monospace);
  font-size: 22px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.fd-heatmap-meta {
  font-size: 10px; opacity: 0.7;
  font-weight: 500;
}

/* ── Sentiment gauge ────────────────────────────────────────── */
.fd-gauge {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px;
}
.fd-gauge-arc {
  position: relative;
  width: 140px; height: 80px;
  border-radius: 140px 140px 0 0;
  background: conic-gradient(
    from 270deg,
    rgba(239,68,68,0.15) 0deg,
    rgba(99,102,241,0.15) 90deg,
    rgba(34,197,94,0.15) 180deg
  );
  overflow: hidden;
}
.fd-gauge-arc::after {
  content: '';
  position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100px; height: 50px;
  border-radius: 100px 100px 0 0;
  background: var(--fd-surface, #131a2a);
  z-index: 1;
}
.fd-gauge-needle {
  position: absolute; bottom: 0; left: 50%;
  width: 3px; height: 65px;
  background: var(--fd-text, #e2e8f0);
  border-radius: 3px 3px 0 0;
  transform-origin: bottom center;
  z-index: 2;
  transition: transform 0.6s ease;
  box-shadow: 0 0 6px rgba(255,255,255,0.3);
}
.fd-gauge-value {
  position: absolute; bottom: -4px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--fd-mono, 'JetBrains Mono', monospace);
  font-size: 20px; font-weight: 800;
  color: var(--fd-text, #e2e8f0);
  z-index: 3;
}
.fd-gauge-label {
  font-size: 12px; font-weight: 600;
  color: var(--fd-text-soft, #94a3b8);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 4px;
}
.fd-gauge-hint {
  font-size: 11px; color: var(--fd-text-dim, #64748b);
  margin-top: 2px;
}

/* ── Sentiment row (gauge + breadth) ─────────────────────────── */
.fd-sentiment-row {
  display: flex; gap: 24px; align-items: center;
  flex-wrap: wrap;
  padding: 24px;
}
.fd-sentiment-gauge-wrap {
  flex-shrink: 0;
}
.fd-breadth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  flex: 1;
  min-width: 200px;
}

/* ── Sparkline ──────────────────────────────────────────────── */
.fd-sparkline {
  display: flex; align-items: flex-end; gap: 2px;
  width: 100%;
}
.fd-sparkline--empty {
  background: var(--fd-bg-subtle, #1a2335);
  border-radius: 4px;
}
.fd-spark-bar {
  flex: 1; border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}
.fd-spark-bar--bull { background: var(--fd-bull, #34d399); }
.fd-spark-bar--bear { background: var(--fd-bear, #fb7185); }
.fd-spark-bar--neutral { background: var(--fd-text-dim, #64748b); }

/* ── News items ─────────────────────────────────────────────── */
.fd-news-list {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 16px;
}
.fd-news-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px;
  background: var(--fd-surface, #131a2a);
  border: 1px solid var(--fd-border, #1e293b);
  border-radius: var(--fd-radius, 12px);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.fd-news-item:hover {
  border-color: var(--fd-border-strong, #334155);
  transform: translateX(2px);
}
.fd-news-sym {
  font-family: var(--fd-mono, 'JetBrains Mono', monospace);
  font-size: 11px; font-weight: 700;
  color: var(--fd-accent, #c9a227);
  background: var(--fd-accent-soft, rgba(99,102,241,0.1));
  padding: 3px 8px; border-radius: 6px;
  white-space: nowrap; flex-shrink: 0;
  text-decoration: none;
}
.fd-news-headline {
  font-size: 14px; font-weight: 500;
  color: var(--fd-text, #e2e8f0);
  line-height: 1.5; flex: 1;
  text-decoration: none;
}
.fd-news-headline:hover { text-decoration: underline; }
.fd-news-meta {
  display: flex; gap: 8px;
  font-size: 11px; color: var(--fd-text-dim, #64748b);
  white-space: nowrap; flex-shrink: 0;
  flex-direction: column; align-items: flex-end;
}
.fd-news-time { opacity: 0.7; }

/* ── Empty state ─────────────────────────────────────────────── */
.fd-empty-state {
  border: 1px dashed var(--fd-border, #1e293b);
  border-radius: var(--fd-radius, 12px);
  padding: 32px 24px;
  text-align: center;
}
.fd-empty-title {
  font-size: 16px; font-weight: 600;
  color: var(--fd-text-soft, #94a3b8);
  margin-bottom: 8px;
}
.fd-empty-msg {
  font-size: 13px; color: var(--fd-text-dim, #64748b);
  margin: 0 0 16px;
  line-height: 1.5;
}
.fd-empty-actions {
  display: flex; gap: 10px; justify-content: center;
}

/* ── Auth wrap ──────────────────────────────────────────────── */
.fd-auth-wrap {
  max-width: 440px;
  margin: 40px auto;
  padding: 0 16px;
}

/* ── News content wrapper ───────────────────────────────────── */
.fd-news-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fd-news-summary {
  font-size: 13px;
  color: var(--fd-text-soft, #94a3b8);
  line-height: 1.5;
  margin: 0;
}
.fd-news-item--full {
  padding: 16px 18px;
}

/* ── Tab panels (v29 template variant) ──────────────────────── */
.fd-tab--on { color: var(--fd-text); border-bottom-color: var(--fd-accent); }
.fd-tab-panel { display: none; }
.fd-tab-panel--on { display: block; animation: fd-tab-fade-in 200ms cubic-bezier(0.4, 0, 0.2, 1); }
.fd-tab { cursor: pointer; background: none; border: none; font: inherit; }
.fd-tab-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
  background: var(--fd-bg-subtle); color: var(--fd-text-dim);
  margin-left: 4px;
}

/* ── Sector heading ─────────────────────────────────────────── */
.fd-sector-heading {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.fd-sector-heading-name { flex-shrink: 0; }
.fd-sector-heading-meta {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .fd-heatmap { grid-template-columns: repeat(2, 1fr); }
  .fd-sentiment-row { flex-direction: column; }
  .fd-breadth-grid { grid-template-columns: repeat(2, 1fr); }
  .fd-news-item { flex-direction: column; gap: 6px; }
  .fd-news-meta { flex-direction: row; align-items: center; }
  .fd-sector-heading { flex-direction: column; align-items: flex-start; gap: 4px; }
}
