/* ═══════════════════════════════════════════════════════════════════
   EmaGuidaTV v1.0 — Cinema Lounge UI (Opzione 1: Bento + Poster 16:9)
   tv.emafausto.it · Integrato con serie.emafausto.it & film.emafausto.it
═══════════════════════════════════════════════════════════════════ */

:root {
  --bg-obsidian: #07090e;
  --bg-card: #0d121d;
  --bg-surface: rgba(15, 21, 34, 0.88);
  --bg-surface-elevated: rgba(23, 31, 49, 0.94);
  --bg-glass: rgba(12, 17, 28, 0.82);

  --border-subtle: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-highlight: rgba(245, 158, 11, 0.5);
  --border-crimson: rgba(225, 29, 72, 0.5);
  --border-emerald: rgba(16, 185, 129, 0.5);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.32);
  --accent-crimson: #e11d48;
  --accent-emerald: #10b981;
  --accent-indigo: #6366f1;
  --accent-cyan: #06b6d4;

  --radius-sm: 10px;
  --radius-md: 15px;
  --radius-lg: 22px;
  --radius-pill: 9999px;

  --font-display: "Outfit", system-ui, -apple-system, sans-serif;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --shadow-lg: 0 22px 55px rgba(0, 0, 0, 0.72);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.48);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  background-color: var(--bg-obsidian);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 10%, rgba(245, 158, 11, 0.11), transparent 42%),
    radial-gradient(circle at 85% 15%, rgba(225, 29, 72, 0.09), transparent 44%),
    radial-gradient(circle at 50% 85%, rgba(99, 102, 241, 0.08), transparent 52%),
    var(--bg-obsidian);
  pointer-events: none;
}

.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* ─── AUTH SCREEN (PASSKEY WEBAUTHN) ─── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  padding: 2.25rem 1.85rem;
  text-align: center;
}

.brand-logo-lg {
  width: 66px;
  height: 66px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent-amber), var(--accent-crimson));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 12px 30px var(--accent-amber-glow);
}

.brand-logo-lg svg {
  width: 36px;
  height: 36px;
}

.auth-brand h1 {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-brand h1 span {
  color: var(--accent-amber);
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
  margin-bottom: 1.75rem;
}

.auth-section {
  margin-bottom: 1.25rem;
}

.auth-hint,
.auth-desc {
  color: var(--text-secondary);
  font-size: 0.84rem;
  margin-top: 0.75rem;
}

.setup-badge {
  display: inline-block;
  padding: 0.28rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--border-highlight);
  color: var(--accent-amber);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.form-group {
  text-align: left;
  margin-top: 0.85rem;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.input-field {
  width: 100%;
  padding: 0.72rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: rgba(7, 9, 14, 0.75);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
}

.input-field:focus {
  border-color: var(--accent-amber);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.35rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.auth-fallback-details summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 0.4rem;
}

.fallback-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.auth-error {
  margin-top: 1rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(225, 29, 72, 0.16);
  border: 1px solid var(--border-crimson);
  color: #fda4af;
  font-size: 0.84rem;
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.58rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  text-decoration: none;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #07090e;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.28);
}

.btn-primary:hover {
  filter: brightness(1.07);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.13);
}

.btn-emerald {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #051b14;
  font-weight: 700;
}

.btn-crimson {
  background: rgba(225, 29, 72, 0.18);
  border-color: var(--border-crimson);
  color: #fda4af;
}

.btn-lg {
  padding: 0.82rem 1.35rem;
  font-size: 0.95rem;
}

.btn-sm {
  padding: 0.4rem 0.72rem;
  font-size: 0.76rem;
  border-radius: var(--radius-sm);
}

.btn-full {
  width: 100%;
}

/* ─── TOPBAR & NAVIGATION ─── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.5rem;
  background: rgba(7, 9, 14, 0.92);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.68rem;
  cursor: pointer;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent-amber), var(--accent-crimson));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-amber-glow);
}

.brand-logo svg {
  width: 21px;
  height: 21px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  display: block;
  line-height: 1.1;
}

.brand-title em {
  font-style: normal;
  color: var(--accent-amber);
}

.brand-domain {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.ecosystem-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.eco-pill {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: all 0.18s;
}

.eco-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.eco-pill.active {
  background: rgba(245, 158, 11, 0.16);
  color: var(--accent-amber);
  border-color: var(--border-highlight);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.search-input {
  width: 210px;
  padding: 0.46rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent-amber);
  width: 250px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 1rem;
  transition: all 0.18s;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.1);
}

.badge-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent-crimson);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── MAIN CONTAINER ─── */
.main-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ─── 1. AGENDA SETTIMANALE (7 GIORNI) ─── */
.week-strip-card {
  padding: 1rem 1.15rem;
}

.week-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.week-strip-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.turn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid var(--border-highlight);
  color: #fde68a;
  font-size: 0.78rem;
  font-weight: 600;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.55rem;
}

.day-pill {
  padding: 0.68rem 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(13, 18, 29, 0.75);
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.4rem;
  min-height: 82px;
  text-align: left;
}

.day-pill:hover {
  border-color: var(--border-strong);
  background: rgba(23, 31, 49, 0.85);
}

.day-pill.active {
  border: 2px solid var(--accent-amber);
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.16), rgba(15, 21, 34, 0.95));
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.16);
}

.day-pill-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.day-name {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.day-pill.active .day-name {
  color: var(--accent-amber);
}

.day-badges {
  display: flex;
  gap: 0.2rem;
  font-size: 0.7rem;
}

.day-choice-box {
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.day-choice-empty {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 500;
}

.day-choice-set {
  color: #fef3c7;
}

.day-choice-out {
  color: #94a3b8;
}

/* ─── 2. BENTO TOP: SCELTA DELLA SERATA + DOCK ESTRAZIONE & ALTERNANZA ─── */
.bento-top-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 1.15rem;
}

.tonight-hero-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, #131b2e 0%, #090d16 100%);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 245px;
  box-shadow: var(--shadow-card);
}

.tonight-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.26;
  filter: saturate(120%);
  transition: background-image 0.3s ease;
}

.tonight-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 9, 14, 0.95) 0%, rgba(7, 9, 14, 0.78) 55%, rgba(7, 9, 14, 0.45) 100%);
}

.tonight-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
}

.hero-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-status-pill.undecided {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid var(--border-highlight);
  color: var(--accent-amber);
}

.hero-status-pill.confirmed {
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid var(--border-emerald);
  color: #6ee7b7;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero-desc {
  color: #cbd5e1;
  font-size: 0.86rem;
  max-width: 640px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

/* ─── DOCK ESTRAZIONE & ALTERNANZA FILM / SERIE ─── */
.decision-dock-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
}

.dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.dock-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.dock-preview-box {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(7, 9, 14, 0.65);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dock-preview-thumb {
  width: 46px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: #1e293b;
  flex-shrink: 0;
}

.dock-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

/* ─── ALERT BAR PER MATCH WATCHLIST & PROGRAMMI SEGUITI ─── */
.priority-alerts-strip {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.priority-alert-banner {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.priority-alert-banner.watchlist-match {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), rgba(15, 21, 34, 0.92));
  border: 1px solid var(--border-highlight);
}

.priority-alert-banner.followed-match {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.16), rgba(15, 21, 34, 0.92));
  border: 1px solid var(--border-emerald);
}

/* ─── BARRA FILTRI CANALI & FASCIA ORARIA ─── */
.filters-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.filter-pills-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-pill {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.16s;
}

.filter-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.filter-pill.active {
  background: var(--accent-amber);
  color: #07090e;
  border-color: var(--accent-amber);
  font-weight: 700;
}

/* ─── LAYOUT PRINCIPALE: GRIGLIA CARD 16:9 + SIDEBAR CODA DI RECUPERO ─── */
.content-split-layout {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 1.25rem;
  align-items: start;
}

.programs-bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: 1rem;
}

/* ─── PROGRAM CARD 16:9 (STILE CINEMA LOUNGE) ─── */
.program-card {
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-card);
}

.program-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.program-card.is-selected {
  border: 2px solid var(--accent-emerald);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.22);
}

.program-card.is-followed {
  border-color: var(--border-highlight);
}

.program-card.is-watchlist {
  border-color: rgba(225, 29, 72, 0.65);
}

.program-media-16-9 {
  position: relative;
  width: 100%;
  height: 168px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  overflow: hidden;
}

.program-media-16-9 img.backdrop-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.program-card:hover .program-media-16-9 img.backdrop-img {
  transform: scale(1.04);
}

.program-media-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(13, 18, 29, 0.98) 0%, rgba(13, 18, 29, 0.35) 55%, rgba(7, 9, 14, 0.65) 100%);
}

.program-top-bar {
  position: absolute;
  top: 0.65rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  z-index: 2;
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.24rem 0.62rem;
  border-radius: 9px;
  background: rgba(7, 9, 14, 0.86);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.75rem;
  font-weight: 700;
  max-width: 72%;
}

.channel-logo-img {
  height: 18px;
  width: auto;
  max-width: 44px;
  object-fit: contain;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.92);
  padding: 1px 3px;
  flex-shrink: 0;
}

.channel-num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-amber);
  flex-shrink: 0;
}

.channel-tivusat-sub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: #94a3b8;
  font-weight: 500;
}

.week-nav-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.week-range-badge {
  font-size: 0.74rem;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
}

.date-picker-input {
  padding: 0.32rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(7, 9, 14, 0.8);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  outline: none;
  cursor: pointer;
}

.date-picker-input:focus {
  border-color: var(--accent-amber);
}

.filter-pill.sport-pill {
  border-color: rgba(16, 185, 129, 0.4);
}

.filter-pill.sport-pill.active {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #041f16;
  border-color: #10b981;
}

.p-badge.sport-kind {
  background: rgba(16, 185, 129, 0.24);
  border: 1px solid rgba(16, 185, 129, 0.55);
  color: #6ee7b7;
}

.p-badge.movie-kind {
  background: rgba(99, 102, 241, 0.26);
  border: 1px solid rgba(99, 102, 241, 0.55);
  color: #c7d2fe;
}

.p-badge.series-kind {
  background: rgba(6, 182, 212, 0.24);
  border: 1px solid rgba(6, 182, 212, 0.55);
  color: #a5f3fc;
}

.p-badge.show-kind {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

.p-badge.fav-channel {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(7, 9, 14, 0.68);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}

.history-row:hover {
  border-color: var(--border-highlight);
  background: rgba(23, 31, 49, 0.85);
}

.time-pill {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 8px;
  background: rgba(7, 9, 14, 0.82);
  color: #f8fafc;
}

.program-badges-row {
  position: absolute;
  bottom: 0.55rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  z-index: 2;
}

.p-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.p-badge.followed {
  background: var(--accent-amber);
  color: #07090e;
}

.p-badge.watchlist {
  background: var(--accent-crimson);
  color: #fff;
}

.p-badge.watched {
  background: rgba(16, 185, 129, 0.25);
  border: 1px solid var(--border-emerald);
  color: #6ee7b7;
}

.p-badge.genre {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-weight: 600;
}

.live-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  z-index: 3;
}

.live-progress-fill {
  height: 100%;
  background: var(--accent-amber);
}

.program-body {
  padding: 0.85rem 1rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
}

.program-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.program-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.25;
}

.star-follow-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.55;
  transition: opacity 0.15s, transform 0.15s;
}

.star-follow-btn:hover,
.star-follow-btn.active {
  opacity: 1;
  transform: scale(1.15);
}

.program-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-amber);
  margin-top: 0.15rem;
}

.program-synopsis {
  font-size: 0.79rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.42;
}

.program-footer {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
}

/* ─── SIDEBAR: CODA DI RECUPERO ("NON POSSO STASERA") & SEGUITI ─── */
.sidebar-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 76px;
}

.sidebar-card {
  padding: 1.1rem;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
}

.deferred-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.deferred-item {
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-md);
  background: rgba(7, 9, 14, 0.65);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.deferred-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.deferred-item-title {
  font-size: 0.83rem;
  font-weight: 700;
}

.deferred-item-meta {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ─── MODALS ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(4, 6, 10, 0.82);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* ─── TOAST ─── */
.toast-container {
  position: fixed;
  bottom: 1.4rem;
  right: 1.4rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(15, 21, 34, 0.96);
  border: 1px solid var(--border-highlight);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1080px) {
  .bento-top-grid {
    grid-template-columns: 1fr;
  }
  .content-split-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-stack {
    position: static;
  }
}

@media (max-width: 768px) {
  .week-grid {
    grid-template-columns: repeat(7, minmax(112px, 1fr));
    overflow-x: auto;
    padding-bottom: 0.35rem;
  }
  .topbar {
    padding: 0.7rem 1rem;
  }
  .ecosystem-pills {
    display: none;
  }
  .search-input {
    width: 140px;
  }
  .search-input:focus {
    width: 175px;
  }
}
