/* TFlix 2.0 - TV-First Design & Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --color-bg: #09090b;
  --color-bg-card: #141419;
  --color-primary: #e50914;
  --color-primary-glow: rgba(229, 9, 20, 0.45);
  --color-focus: #ffffff;
  --color-focus-border: #e50914;
  --color-text: #f4f4f5;
  --color-text-muted: #a1a1aa;
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: 18px;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  position: relative;
  overflow: hidden;
}

/* Scrollable Main View */
.main-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  padding-bottom: 80px;
}

/* Hide scrollbars for TV */
::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* Icon utility — inherits currentColor from its containing element */
.icon {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* Left Sidebar Navigation */
.sidebar {
  flex-shrink: 0;
  width: 116px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: #0c0c10;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 22px 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
  padding: 0 10px;
}

.brand-logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--color-primary);
  text-transform: uppercase;
}

.brand-badge {
  font-size: 10px;
  font-weight: 700;
  background: rgba(229, 9, 20, 0.2);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.nav-links {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 0 14px;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 84px;
  height: 84px;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.nav-btn.active {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.08);
}

/* Global Focus Effect for 10-Foot UI */
.tflix-focused {
  outline: none !important;
  transform: scale(1.06) !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 0 3px #ffffff, 0 10px 30px var(--color-primary-glow) !important;
  z-index: 50 !important;
  color: #ffffff !important;
}

.nav-btn.tflix-focused {
  background: var(--color-primary) !important;
  color: #ffffff !important;
  transform: scale(1.08) !important;
  box-shadow: 0 0 0 2px #ffffff, 0 4px 20px var(--color-primary-glow) !important;
}

/* Hero Spotlight Banner */
.hero-banner {
  position: relative;
  width: 100%;
  height: 65vh;
  min-height: 480px;
  background-size: cover;
  background-position: center top;
  display: flex;
  align-items: flex-end;
  padding: 0 48px 48px;
  margin-top: 0;
}

.hero-backdrop-gradient {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 75% 30%, rgba(9, 9, 11, 0.1) 0%, rgba(9, 9, 11, 0.85) 65%, #09090b 100%),
              linear-gradient(180deg, rgba(9, 9, 11, 0.2) 0%, rgba(9, 9, 11, 0.4) 50%, #09090b 100%);
}

.hero-content {
  position: relative;
  max-width: 680px;
  z-index: 10;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(229, 9, 20, 0.9);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 44px;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 12px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 15px;
  color: #e4e4e7;
  margin-bottom: 14px;
}

.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fbbf24;
  font-weight: 700;
}

.hero-overview {
  font-size: 15px;
  line-height: 1.5;
  color: #a1a1aa;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions {
  display: flex;
  gap: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  backdrop-filter: blur(10px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Media Rows & Carousels */
.media-section {
  padding: 0 48px;
  margin-top: 24px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #f4f4f5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.media-carousel {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 6px;
  scroll-behavior: smooth;
}

.media-card {
  flex: 0 0 170px;
  height: 255px;
  background-color: var(--color-bg-card);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  outline: none;
}

.media-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-card-info {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(9, 9, 11, 0.95) 0%, rgba(9, 9, 11, 0.4) 40%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.media-card.tflix-focused .media-card-info {
  opacity: 1;
}

.media-card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card-sub {
  font-size: 11px;
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
}

/* Continue Watching: persistent progress bar + badge (not focus-gated) */
.cw-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  background: rgba(9, 9, 11, 0.8);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
}

.cw-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  z-index: 2;
}

.cw-progress-fill {
  height: 100%;
  background: var(--color-primary);
}

.cw-context-menu {
  padding: 32px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cw-context-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #fff;
}

.cw-context-menu .btn {
  width: 100%;
  justify-content: flex-start;
}

/* TV-safe server picker (replaces native <select>) */
.server-menu {
  padding: 28px;
  max-width: 440px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.server-menu-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.server-menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.server-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #1a1a24;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 12px 16px;
  color: #f4f4f5;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.server-menu-item.active {
  border-color: var(--color-primary);
}

/* TV-safe episode-range picker (replaces the crowded flat row of range tabs) */
.range-menu {
  padding: 28px;
  max-width: 620px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.range-menu-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.range-menu-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  overflow-y: auto;
  /* Wide enough to fit the focused item's scale(1.06) + box-shadow (see the
     global .tflix-focused rule) without this list's own scrolling clipping
     it at the edges/corners. */
  padding: 10px;
}

.range-menu-item {
  background: #1a1a24;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 12px 14px;
  color: #f4f4f5;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.range-menu-item.active {
  border-color: var(--color-primary);
  background: rgba(229, 9, 20, 0.15);
}

/* Modals (Details, Search, Settings, Player) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  animation: fadeIn 0.2s ease;
}

/* The server menu is opened from inside the native (.native-player-screen,
   z-index 600) and embed (.player-screen, z-index 500) players — the
   default modal z-index of 200 rendered it invisibly behind them. */
.server-menu-overlay {
  z-index: 800;
}

/* Same issue as .server-menu-overlay above — the range menu also opens from
   inside .in-player-episode-drawer (z-index 700), so it needs to clear that
   too or it renders (and is clickable) behind the drawer. */
.range-menu-overlay {
  z-index: 800;
}

.modal-container {
  background: #111116;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  width: 90vw;
  max-width: 1150px;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 60px rgba(0,0,0,0.9);
}

/* Details Modal */
.details-hero {
  position: relative;
  height: 380px;
  background-size: cover;
  background-position: center top;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.details-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #111116 0%, rgba(17, 17, 22, 0.8) 50%, rgba(17, 17, 22, 0.3) 100%);
}

.details-content {
  position: relative;
  margin-top: -160px;
  padding: 0 40px 40px;
  z-index: 10;
}

.details-header {
  display: flex;
  gap: 32px;
  margin-bottom: 28px;
}

.details-poster {
  width: 190px;
  height: 280px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  border: 2px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.details-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.details-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.details-title {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 8px;
}

.details-genres {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.genre-tag {
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  padding: 3px 10px;
  border-radius: 12px;
  color: #d4d4d8;
}

/* Season / Episode Picker */

/* Collapses a long, chunked season's episode ranges (which as a flat row of
   buttons can run to dozens wide) behind one button that opens the TV-safe
   rangeMenu.js picker instead — see .range-menu* below and hidden by default
   via the [hidden] attribute when a season isn't chunked. */
.range-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #d4d4d8;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin: 12px 0;
}

/* An author-stylesheet display rule always beats the UA [hidden] rule
   regardless of selector specificity, so .range-picker-btn's own
   `display: inline-flex` was silently keeping the button visible (as an
   empty pill) even while the `hidden` attribute was set. */
.range-picker-btn[hidden] {
  display: none;
}

.range-picker-btn.tflix-focused {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #ffffff;
}

.season-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin: 20px 0 14px;
  padding-bottom: 6px;
}

.season-btn {
  background: rgba(255,255,255,0.06);
  color: #a1a1aa;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.season-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.season-ep-count {
  opacity: 0.7;
  font-weight: 500;
}

.episodes-grid {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 10px 4px 20px;
}

.episode-card {
  flex: 0 0 240px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.episode-thumb {
  height: 135px;
  background: #1a1a20;
  position: relative;
}

.episode-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.episode-number {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.8);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Episode-availability badge for the currently-selected provider (see
   DetailsModal.js's and EpisodeDrawer.js's loadAvailability) —
   informational, not blocking. */
.episode-unavailable .episode-thumb,
.episode-unavailable .drawer-ep-thumb-wrap {
  opacity: 0.55;
}

.episode-unavailable-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(120,20,20,0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-info {
  padding: 12px;
}

.episode-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-desc {
  font-size: 11px;
  color: #71717a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Fullscreen Video Player */
.player-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 500;
  display: flex;
  flex-direction: column;
}

.player-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

.player-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 24px 40px;
  background: linear-gradient(180deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 60%, transparent 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 1;
  transform: translateY(0);
}

.player-hud.hidden {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}

.player-info h2 {
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.player-info p {
  font-size: 14px;
  color: #a1a1aa;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.player-controls {
  display: flex;
  gap: 12px;
}

.player-controls .btn,
.player-controls select {
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}

.player-controls .btn.tflix-focused,
.player-controls select.tflix-focused {
  border-color: #ffffff;
  transform: scale(1.06);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.8), 0 8px 24px rgba(0,0,0,0.8);
}

/* Search Screen & TV Virtual Keyboard */
.search-container {
  padding: 40px;
}

.search-input-box {
  background: #181820;
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tv-keyboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 30px;
  max-width: 720px;
}

.keyboard-row {
  display: flex;
  gap: 8px;
}

.key-btn {
  flex: 1;
  height: 48px;
  background: #1c1c24;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: #f4f4f5;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.key-btn.wide-key {
  flex: 2;
  font-size: 14px;
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 10px 4px;
}

/* Settings Screen */
.settings-section {
  background: #16161e;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid rgba(255,255,255,0.06);
}

.settings-label {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.settings-desc {
  font-size: 13px;
  color: #a1a1aa;
  margin-bottom: 16px;
  line-height: 1.4;
}

.provider-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.provider-btn {
  background: #1f1f2a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 14px;
  color: #f4f4f5;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.provider-btn.active {
  border-color: var(--color-primary);
  background: rgba(229, 9, 20, 0.1);
}

.provider-btn .name {
  font-size: 15px;
  font-weight: 700;
}

.provider-btn .desc {
  font-size: 11px;
  color: #71717a;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   10-Foot TV Native Video Player Styles
   ========================================================================== */

.native-player-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 600;
  overflow: hidden;
  user-select: none;
}

.native-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* TV On-Screen Display HUD Overlay */
.native-player-hud {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 1;
  transform: translateY(0);
}

.native-player-hud.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.hud-top-bar {
  padding: 32px 48px;
  background: linear-gradient(180deg, rgba(0,0,0,0.94) 0%, rgba(0,0,0,0.6) 65%, transparent 100%);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: all;
}

.hud-title-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-main-title {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.hud-sub-title {
  font-size: 15px;
  color: #a1a1aa;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-badge-tag {
  background: rgba(229, 9, 20, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.hud-top-actions {
  display: flex;
  gap: 12px;
}

.hud-bottom-bar {
  padding: 32px 48px;
  background: linear-gradient(0deg, rgba(0,0,0,0.96) 0%, rgba(0,0,0,0.7) 65%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  pointer-events: all;
}

/* Timeline Scrubber Bar */
.timeline-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.time-label {
  font-size: 15px;
  font-family: monospace;
  font-weight: 700;
  color: #e4e4e7;
  min-width: 65px;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.timeline-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  position: relative;
  cursor: pointer;
  transition: height 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.timeline-track.tflix-focused {
  height: 12px;
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.9), 0 0 20px rgba(229, 9, 20, 0.5) !important;
  /* Override the generic .tflix-focused scale/z-index — growing the track
     from its center and raising it above siblings makes it visually cover
     the adjacent current-time label. */
  transform: none !important;
  z-index: 1 !important;
}

.timeline-buffered {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  transition: width 0.2s linear;
}

.timeline-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--color-primary);
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(229, 9, 20, 0.7);
}

.timeline-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.8);
  transition: transform 0.15s ease;
}

.timeline-track.tflix-focused .timeline-thumb {
  transform: translate(-50%, -50%) scale(1.4);
  background: #ffffff;
  box-shadow: 0 0 12px #ffffff;
}

/* Pending scrub (left/right moved the target position, not yet committed
   with OK) renders amber instead of the playback-red, so it reads clearly
   as "not real yet" until confirmed. */
.timeline-track.scrubbing-pending .timeline-progress {
  background: #fbbf24;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.7);
}

.timeline-track.scrubbing-pending .timeline-thumb {
  background: #fbbf24;
  box-shadow: 0 0 12px #fbbf24;
}

.time-label.scrub-pending {
  color: #fbbf24;
}

/* Bottom Button Row */
.hud-buttons-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-button-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Center Animated Feedback Badge */
.player-center-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  background: rgba(18, 18, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  padding: 24px 36px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  pointer-events: none;
  opacity: 0;
  z-index: 20;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.player-center-badge.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.badge-icon {
  font-size: 38px;
  color: var(--color-primary);
}

.badge-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Player Toast Notification */
.player-toast {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(24, 24, 32, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  color: #f4f4f5;
  padding: 10px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 30px rgba(0,0,0,0.8);
  pointer-events: none;
  opacity: 0;
  z-index: 30;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.player-toast.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.player-fallback-tag {
  display: inline-block;
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 10px;
  vertical-align: middle;
}

/* Subtitles & Audio Modal Dialog */
.player-modal-dialog {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.2s ease;
}

.player-modal-dialog.hidden {
  display: none;
}

.dialog-card {
  background: #181824;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 28px 32px;
  width: 480px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 14px;
}

.dialog-header h3 {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
}

.dialog-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dialog-label {
  font-size: 13px;
  font-weight: 700;
  color: #a1a1aa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dialog-options-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.dialog-opt-btn {
  background: #232330;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #f4f4f5;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dialog-opt-btn.active {
  background: rgba(229, 9, 20, 0.2);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* Next Episode Auto-Countdown Card */
.next-ep-card {
  position: absolute;
  bottom: 40px;
  right: 48px;
  background: #181824;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 20px 24px;
  width: 380px;
  box-shadow: 0 16px 50px rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 40;
  animation: fadeIn 0.3s ease;
}

.next-ep-card.hidden {
  display: none;
}

.next-ep-tag {
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.next-ep-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.next-ep-timer-text {
  font-size: 13px;
  color: #a1a1aa;
}

.next-ep-actions {
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   In-Player Episode Drawer & Carousel
   ========================================================================== */

.in-player-episode-drawer {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.drawer-content {
  position: relative;
  background: linear-gradient(180deg, #181824 0%, #0e0e16 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: 28px 48px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.9);
  max-height: 75vh;
  z-index: 1;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-title {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
}

.drawer-season-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.season-tab-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #a1a1aa;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.season-tab-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.season-tab-btn.tflix-focused {
  border-color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 0 0 2px #ffffff;
}

.drawer-episodes-carousel {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 6px 20px;
  scroll-behavior: smooth;
}

.drawer-episodes-carousel::-webkit-scrollbar {
  height: 6px;
}

.drawer-episodes-carousel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.drawer-ep-card {
  flex: 0 0 260px;
  background: #14141c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.drawer-ep-card.current-playing {
  border-color: var(--color-primary);
  box-shadow: 0 0 16px rgba(229, 9, 20, 0.4);
}

.drawer-ep-card.tflix-focused {
  border-color: #ffffff;
  transform: translateY(-8px) scale(1.04);
  box-shadow: 0 0 0 3px var(--color-primary), 0 12px 30px rgba(0,0,0,0.8);
}

.drawer-ep-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #09090d;
}

.drawer-ep-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drawer-ep-num-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.drawer-now-playing-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

.drawer-ep-info {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-ep-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-ep-overview {
  font-size: 12px;
  color: #a1a1aa;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


