/* ==========================================================================
   CasaFlix - Netflix-Authentic UI/UX with Subtitle Style Customizer
   ========================================================================== */

:root {
  --netflix-red: #e50914;
  --netflix-red-dark: #b20710;
  --netflix-red-hover: #f40612;
  --bg-dark: #141414;
  --bg-card: #181818;
  --bg-card-hover: #282828;
  --bg-modal: #181818;
  --text-main: #ffffff;
  --text-muted: #aaaaaa;
  --border: rgba(255, 255, 255, 0.15);
  --tv-focus-border: #e50914;
  --tv-focus-glow: 0 0 30px rgba(229, 9, 20, 0.9), 0 0 12px #ffffff;
  --font-netflix: 'Bebas Neue', 'Outfit', sans-serif;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  height: 100%;
  overflow-x: hidden;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  background: #141414;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  will-change: transform;
}

/* Submenú Desplegable de Categorías en Películas */
.nav-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  background: rgba(20, 20, 20, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-width: 210px;
  padding: 0.6rem 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-dropdown-menu.hidden {
  display: none !important;
}

.dropdown-cat-item {
  background: transparent;
  border: none;
  color: #e5e5e5;
  padding: 0.65rem 1.25rem;
  text-align: left;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  outline: none;
}

.dropdown-cat-item:hover,
.dropdown-cat-item:focus {
  background: rgba(229, 9, 20, 0.85);
  color: #ffffff;
  padding-left: 1.5rem;
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0.4rem 0;
}

/* Navbar with Glassmorphism & Netflix Brand Logo */
.netflix-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 4%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.netflix-navbar.scrolled {
  background: rgba(20, 20, 20, 0.96);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 2.8rem;
}

/* Netflix Style Logo: "C" Emblem + Red "CASAFLIX" Typography */
.netflix-brand-logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  outline: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.netflix-brand-logo:hover,
.netflix-brand-logo:focus {
  transform: scale(1.05);
}

.logo-c-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 4px 18px rgba(229, 9, 20, 0.7);
  border: 1.5px solid rgba(229, 9, 20, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.netflix-brand-logo:hover .logo-c-img {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(229, 9, 20, 0.9);
}

.logo-text-netflix {
  font-family: var(--font-netflix);
  font-size: 2.25rem;
  line-height: 1;
  letter-spacing: 3px;
  background: linear-gradient(180deg, #ff2a33 0%, #e50914 55%, #b20710 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 12px rgba(229, 9, 20, 0.85));
  display: inline-block;
}

/* Netflix Style Navigation Links */
.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-item {
  background: transparent;
  border: none;
  color: #e5e5e5;
  font-family: var(--font-netflix);
  font-size: 1.25rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
  padding: 0.3rem 0.6rem;
  position: relative;
  opacity: 0.75;
}

.nav-item:hover {
  color: #ffffff;
  opacity: 1;
}

.nav-item.active {
  color: #ffffff;
  opacity: 1;
  font-weight: 700;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 10%;
  right: 10%;
  height: 3px;
  background: var(--netflix-red);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(229, 9, 20, 0.9);
}

.nav-item:focus,
.nav-item.tv-focused {
  color: #ffffff;
  opacity: 1;
  background: rgba(229, 9, 20, 0.25);
  outline: 2px solid var(--netflix-red);
  border-radius: 4px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.remote-access-badge {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
}

.remote-access-badge:hover,
.remote-access-badge:focus {
  background: #38bdf8;
  color: #000;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
  transform: translateY(-2px);
}

.refresh-badge {
  background: rgba(229, 9, 20, 0.15) !important;
  border-color: rgba(229, 9, 20, 0.4) !important;
  color: #ffffff !important;
  font-weight: 500 !important;
}

.refresh-badge:hover,
.refresh-badge:focus {
  background: var(--netflix-red) !important;
  color: #ffffff !important;
  box-shadow: 0 0 20px rgba(229, 9, 20, 0.7) !important;
}

.server-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  padding: 0.4rem 0.95rem;
  border-radius: 20px;
  font-size: 0.85rem;
  color: #e5e5e5;
  font-weight: 400;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #46d369;
  box-shadow: 0 0 10px #46d369;
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(70, 211, 105, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(70, 211, 105, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(70, 211, 105, 0); }
}

.user-avatar {
  font-size: 1.3rem;
  background: linear-gradient(135deg, #e50914 0%, #b20710 100%);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.4);
}

/* Hero Billboard */
.hero-billboard {
  position: relative;
  height: 75vh;
  min-height: 520px;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0 4%;
  margin-bottom: -4rem;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: cover;
  background-position: center top;
  z-index: 1;
  background-image: radial-gradient(circle at 70% 30%, #311013 0%, #141414 80%);
  transition: background-image 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
  background: 
    linear-gradient(90deg, #0a0a0c 0%, rgba(10, 10, 12, 0.88) 35%, rgba(10, 10, 12, 0.35) 60%, transparent 100%),
    linear-gradient(180deg, rgba(10, 10, 12, 0.2) 0%, transparent 45%, #0a0a0c 100%);
}

.hero-content {
  position: relative;
  z-index: 3;
  max-width: 650px;
  margin-top: 4rem;
}

.hero-badges {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.badge-n {
  background: linear-gradient(135deg, #e50914 0%, #b20710 100%);
  color: #fff;
  font-family: var(--font-netflix);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.15rem 0.65rem;
  border-radius: 4px;
  letter-spacing: 1.5px;
  box-shadow: 0 2px 8px rgba(229, 9, 20, 0.5);
}

.badge-type {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 2.5px;
  color: #e5e5e5;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1rem;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.95);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.1rem;
  font-size: 0.95rem;
}

.match-score {
  color: #f5c518;
  font-weight: 600;
}

.meta-tag {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #e5e5e5;
  font-weight: 400;
}

.meta-tag.sub-tag {
  border-color: var(--netflix-red);
  color: #ffffff;
  background: rgba(229, 9, 20, 0.2);
  font-weight: 500;
}

.hero-description {
  font-size: 1.05rem;
  color: #e5e5e5;
  margin-bottom: 1.85rem;
  line-height: 1.6;
  font-weight: 400;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions {
  display: flex;
  gap: 1rem;
}

.btn-netflix {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.9rem;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: var(--font-heading);
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.btn-primary {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
}

.play-pulse-btn:hover,
.play-pulse-btn:focus,
.play-pulse-btn.tv-focused {
  background-color: rgba(255, 255, 255, 0.95);
  transform: scale(1.05);
  outline: 3px solid var(--tv-focus-border);
  box-shadow: 0 10px 30px rgba(229, 9, 20, 0.6);
}

.btn-secondary {
  background-color: rgba(109, 109, 110, 0.6);
  color: #ffffff;
  backdrop-filter: blur(8px);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary.tv-focused {
  background-color: rgba(109, 109, 110, 0.4);
  transform: scale(1.05);
  outline: 3px solid var(--tv-focus-border);
  box-shadow: var(--tv-focus-glow);
}

/* Main Catalog */
.main-catalog {
  position: relative;
  z-index: 10;
  padding: 0 4% 5rem 4%;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.netflix-row {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.row-header {
  font-family: var(--font-netflix);
  font-size: 1.65rem;
  letter-spacing: 1px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.row-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
  font-family: var(--font-family);
}

/* Outer Carousel with Navigation Arrows & Drag-Scroll Support */
.carousel-container-outer {
  position: relative;
  width: 100%;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  background: rgba(20, 20, 20, 0.85);
  border: 1px solid var(--border);
  color: #ffffff;
  width: 44px;
  height: 70px;
  border-radius: 6px;
  font-size: 2rem;
  font-weight: 300;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: all 0.25s ease;
  opacity: 0.6;
}

.carousel-container-outer:hover .carousel-arrow {
  opacity: 1;
}

.carousel-arrow:hover {
  background: var(--netflix-red);
  border-color: var(--netflix-red);
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.7);
  transform: translateY(-50%) scale(1.1);
}

.arrow-left { left: -15px; }
.arrow-right { right: -15px; }

.carousel-wrapper {
  position: relative;
  width: 100%;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 1.25rem 0;
  scrollbar-width: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.carousel-wrapper.active-dragging {
  cursor: grabbing !important;
  scroll-behavior: auto !important;
}

.carousel-wrapper::-webkit-scrollbar {
  display: none;
}

.carousel-track {
  display: flex;
  gap: 1.35rem;
}

/* Movie & Series Poster Cards */
.netflix-card {
  min-width: 200px;
  width: 200px;
  height: 295px;
  background: var(--bg-card);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease, border-color 0.4s ease;
  outline: none;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  user-select: none;
  -webkit-user-select: none;
}

.netflix-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  transition: transform 0.4s ease;
  pointer-events: none;
  -webkit-user-drag: none;
}

.netflix-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(20, 20, 20, 0.95) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.1rem;
  pointer-events: none;
}

.card-title-text {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bottom-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-weight: 400;
}

.netflix-card:hover,
.netflix-card:focus,
.netflix-card.tv-focused {
  transform: scale(1.06) translateY(-4px);
  z-index: 50;
  border-color: var(--tv-focus-border);
  box-shadow: var(--tv-focus-glow);
}

.netflix-card:hover .netflix-card-img {
  transform: scale(1.03);
}

.netflix-empty {
  padding: 2rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  color: var(--text-muted);
}

.netflix-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  gap: 1.5rem;
  background: rgba(20, 20, 20, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  max-width: 600px;
  margin: 2rem auto;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7);
  transition: all 0.3s ease;
}

.loader-badge {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.loader-logo {
  font-family: var(--font-netflix);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--netflix-red);
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(229, 9, 20, 0.6);
}

.netflix-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(229, 9, 20, 0.18);
  border-top-color: var(--netflix-red);
  border-radius: 50%;
  animation: spin 0.8s infinite linear;
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.4);
}

.loader-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 0.85rem;
}

.loader-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  letter-spacing: 0.3px;
  font-family: var(--font-heading);
}

.loader-progress-track {
  width: 100%;
  max-width: 440px;
  height: 7px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.loader-progress-fill {
  height: 100%;
  width: 12%;
  background: linear-gradient(90deg, #e50914 0%, #ff4d58 50%, #e50914 100%);
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(229, 9, 20, 0.8);
  transition: width 0.4s ease;
}

.loader-subtext {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton Lazy-Loading Cards (Netflix Shimmer Effect) */
.skeleton-card {
  position: relative;
  background: #1a1a20;
  overflow: hidden;
  border-radius: 8px;
  pointer-events: none;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 150%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
  animation: skeletonShimmer 1.6s infinite linear;
}

@keyframes skeletonShimmer {
  0% { transform: translateX(0); }
  100% { transform: translateX(200%); }
}

.skeleton-img {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.04);
}

.skeleton-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.9) 100%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skeleton-line {
  height: 12px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.skeleton-line.title {
  width: 80%;
  height: 16px;
}

.skeleton-line.short {
  width: 45%;
}

/* Detail Summary Modal Styling */
.detail-modal-container {
  max-width: 900px !important;
  max-height: 90vh !important;
  border-radius: 16px;
  background: var(--bg-modal);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95);
}

.detail-hero-header {
  position: relative;
  height: 390px;
  width: 100%;
  background-size: cover;
  background-position: center top;
  display: flex;
  align-items: flex-end;
  padding: 2.2rem;
}

.detail-hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(24, 24, 24, 0.2) 0%, #181818 100%);
}

.detail-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 20;
}

.detail-hero-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

.detail-title {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.95);
}

.detail-badges-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.imdb-rating-badge {
  background: linear-gradient(135deg, #f5c518 0%, #e2b100 100%);
  color: #000000;
  font-weight: 700;
  padding: 0.3rem 0.85rem;
  border-radius: 6px;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(245, 197, 24, 0.4);
}

.size-badge {
  border-color: #46d369 !important;
  color: #46d369 !important;
  background: rgba(70, 211, 105, 0.1) !important;
  font-weight: 500;
}

.detail-play-btn {
  margin-top: 0;
  width: fit-content;
  font-size: 1.15rem;
  font-weight: 600;
  padding: 0.85rem 2.2rem;
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.5);
}

/* Playback Resume Progress Container */
.detail-progress-box {
  margin-top: 0.85rem;
  margin-bottom: 0.3rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.75rem 1.1rem;
  border-radius: 8px;
  max-width: 520px;
  backdrop-filter: blur(8px);
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
}

.detail-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  overflow: hidden;
}

.detail-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #e50914 0%, #46d369 100%);
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(70, 211, 105, 0.7);
  transition: width 0.3s ease;
}

.detail-body {
  padding: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.85rem;
  overflow-y: auto;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.detail-section-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.detail-cast-text {
  font-size: 1.05rem;
  color: #38bdf8;
  font-weight: 500;
  line-height: 1.5;
}

.detail-plot-text {
  font-size: 1.05rem;
  color: #e5e5e5;
  line-height: 1.6;
  font-weight: 400;
}

/* Subtitle Style Customization Modal (#sub-style-modal) */
.sub-style-preview-box {
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  position: relative;
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9);
}

.preview-label {
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.preview-screen {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-image: radial-gradient(circle at center, #222 0%, #050505 100%);
  border-radius: 6px;
}

.style-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.style-option-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.style-option-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #e5e5e5;
}

.sub-style-select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: #ffffff;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
  font-family: var(--font-family);
  cursor: pointer;
}

.sub-style-select option {
  background: #181818;
  color: #ffffff;
}

.sub-style-select:focus {
  border-color: var(--netflix-red);
}

/* Subtitle & Audio Menu Controls */
.subtitle-menu-wrapper {
  position: relative;
}

.subtitle-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 0.5rem 1.1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 400;
  font-family: var(--font-family);
  cursor: pointer;
  outline: none;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
}

.subtitle-toggle-btn:hover,
.subtitle-toggle-btn:focus,
.subtitle-toggle-btn.tv-focused {
  background: rgba(229, 9, 20, 0.85);
  border-color: var(--netflix-red);
  box-shadow: 0 0 16px rgba(229, 9, 20, 0.5);
}

.settings-icon-btn {
  font-size: 1.25rem !important;
  width: 44px;
  height: 44px;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
}

.subtitle-dropdown {
  position: absolute;
  top: 120%;
  right: 0;
  background: rgba(24, 24, 28, 0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 290px;
  max-width: 90vw;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9);
  padding: 0.75rem 0;
  z-index: 350;
  backdrop-filter: blur(20px);
}

.sub-dropdown-header {
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sub-tracks-list {
  display: flex;
  flex-direction: column;
}

.sub-track-option {
  background: transparent;
  border: none;
  color: #e5e5e5;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: background 0.2s ease;
  width: 100%;
}

.sub-track-option:hover,
.sub-track-option:focus,
.sub-track-option.tv-focused {
  background: rgba(229, 9, 20, 0.25);
  color: #ffffff;
}

.sub-track-option.active {
  font-weight: 500;
  color: var(--netflix-red);
}

.sub-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}

.sub-track-option.search-opt {
  color: #38bdf8;
  font-weight: 400;
}

.sub-search-box {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.sub-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 1rem;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 400;
  outline: none;
}

.sub-input:focus {
  border-color: var(--netflix-red);
  background: rgba(255, 255, 255, 0.15);
}

/* Hide native video subtitle cues ONLY in normal mode */
body:not(.in-pip-mode) video::-webkit-media-text-track-container,
body:not(.in-pip-mode) video::-webkit-media-text-track-display,
body:not(.in-pip-mode) video::cue,
body:not(.in-pip-mode) ::cue {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Native WebVTT Subtitle Cue Styling when inside Picture-in-Picture window */
body.in-pip-mode video::cue,
body.in-pip-mode ::cue {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  background-color: rgba(0, 0, 0, 0.82) !important;
  color: #ffffff !important;
  font-size: 1.7rem !important;
  font-weight: 500 !important;
  border-radius: 6px !important;
  padding: 4px 14px !important;
}

/* Single Stylized Custom Subtitle Front Overlay (Non-Bold & 100% Responsive) */
.custom-subtitle-overlay {
  position: absolute;
  bottom: clamp(85px, 12vh, 130px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 350;
  text-align: center;
  pointer-events: none;
  width: 92%;
  max-width: 980px;
  transition: bottom 0.4s ease;
}

/* Ocultar barra de controles en modo cine: los subtítulos bajan suavemente para una visión inmersiva */
#player-modal.controls-hidden .custom-subtitle-overlay {
  bottom: clamp(20px, 5vh, 50px);
}

.custom-sub-text {
  background-color: rgba(10, 10, 14, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: clamp(1rem, 3.2vw, 1.85rem);
  font-weight: 500;
  letter-spacing: 0.3px;
  padding: 0.35em 0.85em;
  border-radius: 8px;
  display: inline-block;
  text-shadow: 
    0 2px 8px rgba(0, 0, 0, 1),
    -1px -1px 0 #000, 
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
  line-height: 1.35;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.85);
  transition: all 0.25s ease;
  word-break: break-word;
  max-width: 100%;
}

/* Dynamic Subtitle Style Variants (Netflix Customizable & Responsive Fluid Scale) */
.sub-bg-transparent {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.sub-bg-semi {
  background-color: rgba(10, 10, 14, 0.82) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.sub-bg-solid {
  background-color: #000000 !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.sub-shadow-outline {
  text-shadow: 
    -1.5px -1.5px 0 #000, 
     1.5px -1.5px 0 #000,
    -1.5px  1.5px 0 #000,
     1.5px  1.5px 0 #000,
     0 3px 10px rgba(0, 0, 0, 0.9) !important;
}

.sub-shadow-drop {
  text-shadow: 2px 3px 10px rgba(0, 0, 0, 0.95), 0 0 15px rgba(0, 0, 0, 0.9) !important;
}

.sub-shadow-raised {
  text-shadow: 1px 1px 2px #000, 0 0 1em #000, 0 0 0.2em #000 !important;
}

.sub-shadow-none {
  text-shadow: none !important;
}

/* Responsive Subtitle Sizes using Fluid Clamps */
.sub-size-small { font-size: clamp(0.85rem, 2.2vw, 1.25rem) !important; }
.sub-size-medium { font-size: clamp(1.05rem, 3.2vw, 1.85rem) !important; }
.sub-size-large { font-size: clamp(1.25rem, 4.2vw, 2.45rem) !important; }
.sub-size-xlarge { font-size: clamp(1.45rem, 5.5vw, 3.15rem) !important; }

/* Stylized Fullscreen Player Header & Footer Controls with Auto-Hide */
.netflix-player {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: cursor 0.3s ease;
}

/* Auto-Hide Active State */
#player-modal.controls-hidden {
  cursor: none !important;
}

#player-modal.controls-hidden .player-controls-top,
#player-modal.controls-hidden .player-controls-bottom,
#player-modal.controls-hidden .remote-banner,
#player-modal.controls-hidden .subtitle-dropdown {
  opacity: 0 !important;
  pointer-events: none !important;
}

#player-modal.controls-hidden .player-controls-top {
  transform: translateY(-20px);
}

#player-modal.controls-hidden .player-controls-bottom {
  transform: translateY(20px);
}

.player-controls-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1.35rem 2.5rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.88) 0%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  transition: opacity 0.4s ease, transform 0.4s ease;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.player-back-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 400;
  font-family: var(--font-family);
  cursor: pointer;
  outline: none;
  backdrop-filter: blur(12px);
  transition: all 0.25s ease;
  white-space: nowrap;
}

.player-back-btn:hover,
.player-back-btn:focus,
.player-back-btn.tv-focused {
  background: var(--netflix-red);
  border-color: var(--netflix-red);
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.5);
}

.player-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}

.player-video-container {
  flex: 1;
  min-height: 0;        /* crucial: evita que el flex child crezca más allá del contenedor */
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.video-buffering-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2.5rem;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.video-buffering-loader span {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font-heading);
  letter-spacing: 0.3px;
}

#video-element {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  outline: none;
}

/* Bottom Glassmorphism Player Control Bar */
.player-controls-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.2rem 2.5rem 2rem 2.5rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.5) 75%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  z-index: 20;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Scrubber Timeline Bar */
.player-timeline-container {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  width: 100%;
}

.time-label {
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  min-width: 48px;
}

.timeline-bar-wrapper {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: height 0.2s ease;
}

.timeline-bar-wrapper:hover {
  height: 8px;
}

.timeline-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e50914 0%, #ff3b47 100%);
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(229, 9, 20, 0.7);
  transition: width 0.1s linear;
}

/* Lower Player Action Buttons */
.player-bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.player-actions-left,
.player-actions-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.player-btn-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.95);
  padding: 0.45rem 1rem;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 400;
  font-family: var(--font-family);
  cursor: pointer;
  outline: none;
  transition: all 0.25s ease;
  backdrop-filter: blur(10px);
  white-space: nowrap;
}

.player-btn-action:hover,
.player-btn-action:focus,
.player-btn-action.tv-focused {
  background: rgba(229, 9, 20, 0.85);
  border-color: var(--netflix-red);
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.5);
  transform: translateY(-1px);
}

.pip-btn {
  background: rgba(56, 189, 248, 0.12) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
  color: #38bdf8 !important;
  font-weight: 400 !important;
}

.pip-btn:hover,
.pip-btn:focus,
.pip-btn.tv-focused {
  background: #38bdf8 !important;
  color: #000000 !important;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.6) !important;
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.volume-slider {
  width: 80px;
  accent-color: var(--netflix-red);
  cursor: pointer;
}

/* Modals */
.netflix-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

#opensubs-modal,
#remote-modal,
#sub-style-modal,
#detail-modal {
  z-index: 450 !important;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
}

.modal-container {
  position: relative;
  z-index: 460;
  background: var(--bg-modal);
  width: 90%;
  max-width: 850px;
  max-height: 85vh;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95);
  border: 1px solid var(--border);
}

.modal-hero {
  padding: 1.75rem 2rem;
  background: linear-gradient(135deg, #2d0a0d 0%, #121215 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-hero h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.modal-close-btn:hover,
.modal-close-btn:focus,
.modal-close-btn.tv-focused {
  background: var(--netflix-red);
  outline: 2px solid #fff;
  transform: scale(1.1);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
}

.seasons-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.season-heading {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--netflix-red);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.episodes-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.episode-card {
  background: rgba(255, 255, 255, 0.04);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  outline: none;
  transition: background 0.2s ease, transform 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.episode-card:hover,
.episode-card:focus,
.episode-card.tv-focused {
  background: rgba(229, 9, 20, 0.25);
  transform: translateX(8px);
  outline: 2px solid var(--netflix-red);
}

.hidden {
  display: none !important;
}

/* Responsive Media Queries for Mobile & Tablet Optimization */
@media (max-width: 1024px) {
  .netflix-navbar {
    padding: 0.85rem 3%;
  }
  .nav-left {
    gap: 1.8rem;
  }
  .hero-billboard {
    padding-left: 4%;
    padding-right: 4%;
  }
}

@media (max-width: 820px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  .netflix-navbar {
    padding: 0.75rem 1rem;
  }

  .nav-left {
    gap: 1rem;
  }

  .logo-c-icon {
    font-size: 2.2rem;
  }

  .logo-text-netflix {
    font-size: 1.5rem;
    letter-spacing: 1.5px;
  }

  .nav-links {
    gap: 0.75rem;
  }

  .nav-item {
    font-size: 1.05rem;
    padding: 0.2rem 0.4rem;
  }

  .server-badge {
    display: none !important;
  }

  .nav-right {
    gap: 0.5rem;
  }

  .remote-access-badge {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }

  .hero-billboard {
    min-height: auto;
    padding: 6.5rem 1.25rem 2.5rem 1.25rem;
  }

  .hero-title {
    font-size: clamp(2rem, 7.5vw, 3.5rem);
  }

  .hero-description {
    font-size: 0.92rem;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .detail-hero-header {
    height: 250px;
    padding: 1.25rem;
  }

  .detail-title {
    font-size: 1.85rem;
  }

  .detail-body {
    padding: 1.25rem;
    gap: 1.25rem;
  }

  .carousel-arrow {
    display: none !important;
  }
}

@media (max-width: 580px) {
  .logo-text-netflix {
    display: none !important;
  }

  .netflix-navbar {
    padding: 0.6rem 0.75rem;
  }

  .nav-left {
    gap: 0.6rem;
  }

  .nav-links {
    gap: 0.4rem;
  }

  .nav-item {
    font-size: 0.95rem;
    padding: 0.15rem 0.3rem;
  }

  .remote-access-badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }

  .user-avatar {
    display: none !important;
  }

  .style-options-grid {
    grid-template-columns: 1fr;
  }

  .player-controls-top {
    flex-direction: row;
    justify-content: space-between;
    padding: 0.75rem 0.85rem;
  }

  .player-title {
    display: none !important;
  }

  .subtitle-toggle-btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
  }

  .player-btn-action {
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
  }

  .volume-slider {
    width: 45px;
  }

  .remote-banner {
    display: none !important;
  }

  .custom-subtitle-overlay {
    width: 96%;
    bottom: clamp(75px, 11vh, 100px);
  }

  #player-modal.controls-hidden .custom-subtitle-overlay {
    bottom: clamp(15px, 4vh, 35px);
  }

  .custom-sub-text {
    padding: 0.25em 0.6em;
    line-height: 1.25;
  }

  .modal-container {
    width: 96% !important;
    max-height: 94vh !important;
    margin: 10px auto !important;
  }

  .detail-actions-row, .detail-badges-row {
    gap: 0.5rem;
  }

  .detail-play-btn {
    font-size: 1rem;
    padding: 0.7rem 1.4rem;
    width: 100%;
  }
}
