/* ═══════════════════════════════════════════
   TV Pulse v3.0 – Spreekbuis
   Licht thema · alle metrics zichtbaar · interactief
   ═══════════════════════════════════════════ */

.tvpulse-widget {
  --red:        #c8102e;
  --red-light:  #fde8eb;
  --red-mid:    #f5c0c8;
  --red-pale:   #fff5f6;
  --bg:         #ffffff;
  --bg-sub:     #fafafa;
  --bg-hover:   #fef8f8;
  --border:     #eeeeee;
  --border-sub: #f5f5f5;
  --text:       #1a1a1a;
  --text-mid:   #555555;
  --muted:      #aaaaaa;
  --google:     #4285f4;
  --nmo:        #888888;
  --social:     #1DA1F2;
  --news:       #e8a020;
  --rising:     #c8102e;
  --falling:    #5577bb;

  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 2px 20px rgba(0,0,0,0.07);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  color: var(--text);
  margin-bottom: 24px;
}

/* ── Loading ─────────────────────────── */
.tvp-loading, .tvp-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* ── Header ─────────────────────────── */
.tvp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 2px solid var(--red);
}

.tvp-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tvp-logo {
  width: 32px;
  height: 32px;
  background: var(--red);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.tvp-title {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  font-family: Georgia, serif;
  line-height: 1.1;
  margin: 0;
}

.tvp-title em { font-style: normal; color: var(--red); }

.tvp-subtitle {
  display: block;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 2px;
}

.tvp-live {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tvp-dot {
  width: 7px;
  height: 7px;
  background: #2ecc71;
  border-radius: 50%;
  animation: tvp-pulse 2s infinite;
}

@keyframes tvp-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(46,204,113,.4); }
  50%      { box-shadow: 0 0 0 4px rgba(46,204,113,0); }
}

.tvp-meta-bar {
  background: var(--bg-sub);
  border-bottom: 1px solid var(--border);
  padding: 5px 16px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}

/* ── Sorteer balk ───────────────────── */
.tvp-sortbar {
  background: var(--bg-sub);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.tvp-sort-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
  flex-shrink: 0;
}

.tvp-sort-btn {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-mid);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 9px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.5;
}

.tvp-sort-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.tvp-sort-active {
  background: var(--red);
  border-color: var(--red);
  color: #fff !important;
}

/* ── Lijst ──────────────────────────── */
.tvp-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tvp-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px 10px 12px;
  border-bottom: 1px solid var(--border-sub);
  transition: background 0.15s;
  position: relative;
  animation: tvp-in 0.3s ease both;
}

.tvp-item:last-child { border-bottom: none; }
.tvp-item:hover { background: var(--bg-hover); }
.tvp-top3 { background: var(--red-pale); }
.tvp-top3:hover { background: #fef0f2; }
.tvp-open { background: #fef5f6 !important; }

@keyframes tvp-in {
  from { opacity: 0; transform: translateX(-5px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Rode zijlijn top 3 */
.tvp-item::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  opacity: 0;
}
.tvp-item[data-rank="1"]::before { background: var(--red); opacity: 1; }
.tvp-item[data-rank="2"]::before { background: var(--red); opacity: .55; }
.tvp-item[data-rank="3"]::before { background: var(--red); opacity: .3; }

/* ── Linker kolom ───────────────────── */
.tvp-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  width: 34px;
}

.tvp-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  background: #f0f0f0;
  flex-shrink: 0;
}

.tvp-rank-1 { background: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(200,16,46,.28); }
.tvp-rank-2 { background: var(--red-mid); color: var(--red); }
.tvp-rank-3 { background: var(--red-light); color: var(--red); }

.tvp-bar {
  width: 8px;
  flex: 1;
  min-height: 30px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.tvp-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--red) 0%, #e8405a 100%);
  border-radius: 3px;
  transition: height 0.5s ease;
}

.tvp-score-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tvp-item[data-rank="1"] .tvp-score-num { color: var(--red); }
.tvp-item[data-rank="2"] .tvp-score-num { color: #d94060; }
.tvp-item[data-rank="3"] .tvp-score-num { color: #e06070; }

/* ── Body ───────────────────────────── */
.tvp-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Rij 1: titel + badge + expand */
.tvp-row-title {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.tvp-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  transition: color 0.15s;
}

.tvp-name:hover { color: var(--red); }

.tvp-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.5;
}

.tvp-rising  { background: #fff0f2; color: var(--rising);  border: 1px solid #ffc0c8; }
.tvp-falling { background: #f0f4ff; color: var(--falling); border: 1px solid #c0d0f0; }

.tvp-expand-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-sub);
  color: var(--text-mid);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}

.tvp-expand-btn:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.tvp-open .tvp-expand-btn {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* Rij 2: meta */
.tvp-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tvp-meta-item {
  font-size: 10.5px;
  color: var(--text-mid);
}

.tvp-channel { font-weight: 600; }

.tvp-genre-pill {
  background: #f0f0f0;
  color: var(--text-mid);
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 9.5px;
}

/* ── Metrics — altijd zichtbaar ─────── */
.tvp-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 10px;
  padding: 6px 0 2px;
}

.tvp-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tvp-metric-active .tvp-metric-label {
  font-weight: 700;
}

.tvp-metric-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.tvp-metric-label {
  font-size: 9.5px;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tvp-metric-weight {
  font-size: 9px;
  font-weight: 700;
}

.tvp-metric-bar-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tvp-metric-bar {
  flex: 1;
  height: 5px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
}

.tvp-metric-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.tvp-metric-val {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mid);
  min-width: 20px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Detail (uitgeklapt) ─────────────── */
.tvp-detail {
  border-top: 1px solid var(--border-sub);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tvp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tvp-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--red);
  background: var(--red-light);
  padding: 2px 7px;
  border-radius: 8px;
}

.tvp-headlines {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tvp-headline {
  font-size: 10.5px;
  color: var(--text-mid);
  font-style: italic;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tvp-formula {
  font-size: 10px;
  color: var(--muted);
  background: var(--bg-sub);
  border-radius: 6px;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tvp-formula-label {
  font-weight: 600;
  color: var(--text-mid);
}

.tvp-formula-calc {
  font-family: monospace;
  font-size: 10px;
}

.tvp-formula-calc strong { color: var(--red); }

/* ── Footer ─────────────────────────── */
.tvp-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-sub);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 9.5px;
  color: var(--muted);
}

.tvp-next { font-weight: 600; }

/* ── Responsive ─────────────────────── */
@media (max-width: 400px) {
  .tvp-metrics { grid-template-columns: 1fr; }
  .tvp-sortbar { gap: 3px; }
  .tvp-sort-btn { font-size: 9px; padding: 2px 7px; }
}
