/**
 * WiseIQ Data Engine — Personalization & Cohort Styles v1.0
 * ─────────────────────────────────────────────────────────────────
 * CSS for all data engine components:
 *  - Cohort personalization bar
 *  - Cohort-specific content variants
 *  - High-intent interstitial overlay
 *  - Article recommendation rail
 *  - Partner postback badge
 *  - PRS badge styles (used in partner dashboard)
 */

/* ── Cohort Bar ──────────────────────────────────────────────────── */
.wiq-cohort-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 10px 16px;
  margin: 12px 0 16px;
  font-size: 13.5px;
  color: #166534;
}
@media (prefers-color-scheme: dark) {
  .wiq-cohort-bar { background: rgba(134,239,172,0.08); border-color: #16a34a; color: #86efac; }
}

.wiq-cohort-bar-icon {
  font-size: 16px;
  color: #16a34a;
  flex-shrink: 0;
}

.wiq-cohort-bar-text { flex: 1; }
.wiq-cohort-bar-text strong { font-weight: 700; }

.wiq-cohort-bar-reset {
  background: none;
  border: 1px solid #86efac;
  color: #166534;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.wiq-cohort-bar-reset:hover { background: rgba(134,239,172,0.2); }

/* ── Cohort-specific card hiding ─────────────────────────────────── */
.wiq-cohort-hidden {
  display: none !important;
}

.wiq-show-all-btn {
  display: block;
  width: 100%;
  margin: 16px 0;
  padding: 12px;
  background: none;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
.wiq-show-all-btn:hover { border-color: #0a7ea4; color: #0a7ea4; }

/* ── Cohort badge on lender cards ────────────────────────────────── */
.wiq-cohort-badge {
  display: none; /* shown by JS when cohort is active */
  align-items: center;
  gap: 5px;
  background: #0a7ea4;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* Cohort-specific badge colors */
[data-cohort="credit-rebuilder"] .wiq-cohort-badge { background: #7c3aed; }
[data-cohort="speed-seeker"] .wiq-cohort-badge { background: #d97706; }
[data-cohort="debt-consolidator"] .wiq-cohort-badge { background: #0891b2; }
[data-cohort="first-timer"] .wiq-cohort-badge { background: #059669; }
[data-cohort="comparison-shopper"] .wiq-cohort-badge { background: #2563eb; }

/* ── High-Intent Interstitial Overlay ────────────────────────────── */
.wiq-interstitial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 16px;
  animation: wiq-fade-in 0.25s ease;
}

@keyframes wiq-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.wiq-interstitial-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: wiq-slide-up 0.3s ease;
}

@media (prefers-color-scheme: dark) {
  .wiq-interstitial-card { background: #1e2022; color: #ecedee; }
}

@keyframes wiq-slide-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.wiq-interstitial-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.wiq-interstitial-close:hover { color: #475569; }

.wiq-interstitial-icon { font-size: 36px; margin-bottom: 12px; }

.wiq-interstitial-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
  line-height: 1.3;
}
@media (prefers-color-scheme: dark) {
  .wiq-interstitial-title { color: #f1f5f9; }
}

.wiq-interstitial-sub {
  font-size: 13.5px;
  color: #64748b;
  margin-bottom: 16px;
  line-height: 1.5;
}

.wiq-interstitial-lenders {
  list-style: none;
  text-align: left;
  margin: 0 0 20px;
  padding: 0;
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px 16px;
}
@media (prefers-color-scheme: dark) {
  .wiq-interstitial-lenders { background: #0f172a; }
}

.wiq-interstitial-lenders li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
}
.wiq-interstitial-lenders li:last-child { border-bottom: none; }
@media (prefers-color-scheme: dark) {
  .wiq-interstitial-lenders li { color: #e2e8f0; border-color: #1e293b; }
}

.wiq-interstitial-check { color: #16a34a; font-size: 14px; }

.wiq-interstitial-cta {
  display: block;
  width: 100%;
  background: #0a7ea4;
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 10px;
}
.wiq-interstitial-cta:hover { background: #0369a1; }

.wiq-interstitial-note {
  font-size: 11.5px;
  color: #94a3b8;
}

/* ── Article Recommendation Rail ─────────────────────────────────── */
.wiq-article-rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.wiq-article-rail [data-article-tags] {
  transition: transform 0.15s, box-shadow 0.15s;
}
.wiq-article-rail [data-article-tags]:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* ── Cohort-specific content variant blocks ──────────────────────── */
[data-cohort-variant] { display: none; }

/* Shown by JS when cohort matches */
/* These are pre-rendered content blocks revealed by the cohort engine */

/* ── PRS Badge (used in partner dashboard table) ─────────────────── */
.pd-prs-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}
.pd-prs-badge.prs-high { background: rgba(52,211,153,0.15); color: #34d399; }
.pd-prs-badge.prs-mid  { background: rgba(251,191,36,0.15); color: #fbbf24; }
.pd-prs-badge.prs-low  { background: rgba(248,113,113,0.15); color: #f87171; }

/* ── Cohort-specific hero variants ───────────────────────────────── */
[data-cohort="rate-shopper"] .wiq-hero-headline::before { content: "📊 "; }
[data-cohort="credit-rebuilder"] .wiq-hero-headline::before { content: "🔄 "; }
[data-cohort="speed-seeker"] .wiq-hero-headline::before { content: "⚡ "; }
[data-cohort="debt-consolidator"] .wiq-hero-headline::before { content: "💳 "; }
[data-cohort="first-timer"] .wiq-hero-headline::before { content: "👋 "; }
[data-cohort="comparison-shopper"] .wiq-hero-headline::before { content: "✅ "; }

/* ── Telemetry endpoint visual feedback (dev only) ───────────────── */
.wiq-telemetry-debug {
  position: fixed;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.8);
  color: #34d399;
  font-size: 10px;
  font-family: monospace;
  padding: 6px 10px;
  border-radius: 6px;
  z-index: 9999;
  pointer-events: none;
  display: none; /* Enable in dev: display: block */
}
