/* ==========================================================================
   STREAMALL PREMIUM DESIGN SYSTEM
   Vanilla CSS con Glassmorphism, Gradientes Neón y Soporte Mobile-First Completo
   ========================================================================== */

:root {
  /* Paleta de Colores — Igual que la App Android */
  --bg-primary: #070709;
  --bg-secondary: #0e0e13;
  --bg-tertiary: #181820;
  
  --accent-red: #E50914;
  --accent-red-dark: #b20710;
  --accent-cyan: #E50914;          /* reemplaza cyan en badges/activo */
  --accent-purple: #E50914;         /* reemplaza purple en gradientes */
  --accent-gradient: linear-gradient(135deg, #b20710 0%, #E50914 100%);
  --accent-danger: #ff3b30;
  
  --text-primary: #ffffff;
  --text-secondary: #8e8e93;
  --text-muted: #48484a;
  
  /* Fuentes de Sistema y Google Fonts */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  /* Layout y Bordes */
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --border-glass: 1px solid rgba(255, 255, 255, 0.08);
  --shadow-premium: 0 12px 30px rgba(0, 0, 0, 0.5);
  
  /* Ajustes seguros de iPhone (notch/home indicator) */
  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* Reset y Normalización de Gestos */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* Quita el destello azul en móviles */
  outline: none;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
  -webkit-user-select: none;
}

/* Contenedores de Pantallas */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
  overflow: hidden;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  z-index: 20;
}

/* Scrollables */
.content-scrollable {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(75px + var(--safe-bottom));
  padding-top: calc(55px + var(--safe-top));
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Botones Premium */
.btn {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.95);
  opacity: 0.9;
}

.btn-primary {
  background: var(--accent-gradient);
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: var(--border-glass);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  border: var(--border-glass);
}

.btn-danger {
  background-color: var(--accent-danger);
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(255, 59, 48, 0.3);
}

.btn-flex {
  flex: 1;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.icon-btn:active {
  background-color: rgba(255, 255, 255, 0.1);
}

.icon-circle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  border: var(--border-glass);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s;
}

.icon-circle-btn:active {
  transform: scale(0.92);
  background-color: rgba(255, 255, 255, 0.2);
}

/* ================= PANTALLA 1: SELECTOR DE PERFILES ================= */
#profile-screen {
  background: radial-gradient(circle at center, #1a0000 0%, var(--bg-primary) 70%);
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.logo-container {
  position: absolute;
  top: calc(20px + var(--safe-top));
  text-align: center;
  width: 100%;
}

.install-shortcut-btn {
  position: absolute;
  top: 10px;
  right: 16px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.install-shortcut-btn svg {
  stroke: currentColor;
}

.brand-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
}

.profile-content {
  text-align: center;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 30px;
}

.profile-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 32px;
  letter-spacing: -0.5px;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px 24px;
  width: 100%;
  margin-bottom: 20px;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s;
}

.profile-card:active {
  transform: scale(0.95);
}

.avatar-wrapper {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-premium);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
  border: 2.5px solid rgba(255, 255, 255, 0.05);
}

/* Estado de Edición (Wobble opcional como iOS) */
@keyframes profile-wobble {
  0% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg); }
  100% { transform: rotate(-1deg); }
}

.profile-card.editing {
  animation: profile-wobble 0.3s infinite ease-in-out;
}

.profile-card.editing .avatar-img {
  border-color: var(--accent-red);
  filter: brightness(0.7);
}

/* Botón Añadir Perfil (Dashed Square) */
.add-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.dashed-add-square {
  width: 110px;
  height: 110px;
  border-radius: 8px;
  border: 2px dashed rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.02);
}

.dashed-add-square:hover, .dashed-add-square:active {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-red);
  transform: scale(1.02);
}

.dashed-add-square svg {
  color: rgba(255, 255, 255, 0.4);
}

.profile-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s, font-weight 0.2s;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card.editing .profile-name {
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Lápiz flotante en edición */
.edit-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--accent-purple);
  border: 2px solid var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  opacity: 0;
  transform: scale(0.4);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.profile-card.editing .edit-badge {
  opacity: 1;
  transform: scale(1);
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.profile-actions .btn {
  width: 100%;
}

/* ================= PANTALLA 2: DASHBOARD PRINCIPAL ================= */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(55px + var(--safe-top));
  background: rgba(7, 7, 9, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--safe-top) 16px 0 16px;
  z-index: 100;
}

.header-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.active-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-cyan);
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}

.active-avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Barra de Búsqueda Desplegable */
.search-bar-container {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  padding: 8px 16px;
  background: rgba(7, 7, 9, 0.95);
  border-bottom: var(--border-glass);
  transform: translateY(-20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-bar-container.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-secondary);
}

#search-input {
  width: 100%;
  background-color: var(--bg-secondary);
  border: var(--border-glass);
  border-radius: var(--border-radius-sm);
  padding: 10px 12px 10px 38px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
}

#search-input:focus {
  border-color: var(--accent-cyan);
}

#clear-search-btn {
  position: absolute;
  right: 6px;
  color: var(--text-secondary);
}

/* Hero Banner (Sección Principal) */
.hero-banner {
  position: relative;
  height: 60vh;
  min-height: 380px;
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px 16px;
  margin-top: -10px;
}

.hero-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, 
              rgba(7, 7, 9, 0.2) 0%, 
              rgba(7, 7, 9, 0.6) 60%, 
              var(--bg-primary) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 500px;
}

.hero-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  background: var(--accent-gradient);
  border-radius: 4px;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  margin-bottom: 10px;
  line-height: 1.1;
  letter-spacing: -1px;
}

.hero-description {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-buttons {
  display: flex;
  gap: 10px;
}

.hero-buttons .btn {
  flex: 1;
}

.install-prompt {
  margin: 16px;
  padding: 14px 14px 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
}

.install-prompt-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
}

.install-prompt-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-primary);
  font-size: 14px;
}

.install-prompt-copy strong {
  font-size: 15px;
  color: var(--text-white);
}

.install-prompt-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.install-prompt .btn {
  padding: 10px 14px;
  font-size: 14px;
}

.install-prompt .btn-outline {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text-white);
}

/* Secciones de Categorías y Carruseles */
.category-section {
  padding: 16px 0;
  display: flex;
  flex-direction: column;
}

.category-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  margin: 0 16px 12px 16px;
  letter-spacing: -0.3px;
}

.carousel-container {
  width: 100%;
  position: relative;
}

/* Deslizamiento Táctil Scroll Snap */
.carousel-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0 16px 8px 16px;
  scrollbar-width: none; /* Firefox */
  -webkit-overflow-scrolling: touch;
}

.carousel-track::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.movie-card {
  flex: 0 0 115px;
  aspect-ratio: 2/3;
  border-radius: var(--border-radius-md);
  scroll-snap-align: start;
  position: relative;
  overflow: hidden;
  border: var(--border-glass);
  box-shadow: var(--shadow-premium);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  /* Asegurar que el card sea el objetivo del toque */
  pointer-events: auto;
  z-index: 5;
}

.movie-card:active {
  transform: scale(0.94);
}

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

/* Grid de Resultados de Búsqueda y Mi Lista */
.search-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 16px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-secondary);
  gap: 16px;
}

.empty-state p {
  font-size: 14px;
}

/* Barra de Navegación Inferior (Transparente/Glass) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: calc(58px + var(--safe-bottom));
  background: rgba(14, 14, 19, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: var(--border-glass);
  display: flex;
  justify-content: space-around;
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  font-family: var(--font-primary);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-item svg {
  transition: transform 0.2s;
}

.nav-item:active svg {
  transform: scale(0.85);
}

.nav-item.active {
  color: var(--accent-red);
}

/* ================= PANTALLA 3: BOTTOM SHEET DE DETALLES ================= */
.bottom-sheet {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100dvh;
  background-color: var(--bg-secondary);
  border-radius: 0;
  z-index: 20000;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-shadow: -15px 0 40px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  border-left: var(--border-glass);
  touch-action: none; /* Prevenir scroll del body mientras el sheet está abierto */
  pointer-events: none;
}

.bottom-sheet.open {
  transform: translateX(0);
  pointer-events: auto;
}

body.video-active .bottom-sheet,
body.plyr-is-fullscreen .bottom-sheet {
  transform: none !important;
}

/* Fix para el fullscreen de Plyr (fallback CSS) */
body.plyr-is-fullscreen .bottom-sheet {
  border-radius: 0 !important;
  z-index: 99999 !important;
}

.bottom-sheet-bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
  z-index: 190;
}

.bottom-sheet-bg-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

/* Tirador superior de cierre */
.drag-handle-wrapper {
  width: 100%;
  padding: 12px 0 8px 0;
  display: flex;
  justify-content: center;
  cursor: pointer;
  background: var(--bg-secondary);
  z-index: 10;
}

.drag-handle {
  width: 40px;
  height: 5px;
  background-color: var(--text-muted);
  border-radius: 3px;
  transition: background-color 0.2s;
}

.drag-handle-wrapper:active .drag-handle {
  background-color: var(--text-secondary);
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: var(--safe-bottom);
  -webkit-overflow-scrolling: touch;
}

/* Personalización Video.js */
.vjs-big-play-centered .vjs-big-play-button {
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 80px !important;
  height: 80px !important;
  line-height: 80px !important;
  border-radius: 50% !important;
  background-color: rgba(229, 9, 20, 0.8) !important;
  border: none !important;
}

.vjs-skip-forward-15, .vjs-skip-backward-15 {
  cursor: pointer;
  padding: 0 10px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vjs-skip-forward-15 svg, .vjs-skip-backward-15 svg {
  fill: none;
  stroke: white;
}
  position: relative; /* Para sticky content */
}

/* Contenedor principal de la ficha (Bottom Sheet) */
#bottom-sheet {
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Importante para que el scroll sea interno */
}

/* Cabecera del Media en Sheet - FIJA ESTILO YOUTUBE */
.sheet-media-header {
  position: sticky;
  top: 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000;
  z-index: 1000; /* Siempre por encima del scroll */
  flex-shrink: 0;
}

#sheet-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
}

.sheet-media-gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, transparent 40%, var(--bg-secondary) 100%);
  pointer-events: none;
  z-index: 2;
}

.sheet-media-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 4px solid white;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px rgba(229, 9, 20, 0.6);
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Área de contenido que SI hace scroll */
.sheet-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 80px;
}

.video-container-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  background: #000;
}

/* Iframe para videos que requieren JS (Voex, Streamwish, etc) */
.video-iframe-fallback {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

/* Iframe para videos que requieren JS (Voex, Streamwish, etc) */
.video-iframe-fallback {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  background: #000;
}

.video-container-wrapper.hidden {
  display: none;
}

/* Forzar que Plyr use el 100% del contenedor padre */
.plyr {
  width: 100% !important;
  height: 100% !important;
}
  height: 65px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 4px solid white;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px rgba(229, 9, 20, 0.6);
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sheet-media-play-btn:active {
  transform: translate(-50%, -50%) scale(0.9);
}

.video-container-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  background: #000;
}

/* Iframe para videos que requieren JS (Voex, Streamwish, etc) */
.video-iframe-fallback {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

/* Iframe para videos que requieren JS (Voex, Streamwish, etc) */
.video-iframe-fallback {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
}

.sheet-media-play-btn:active {
  transform: translate(-50%, -50%) scale(0.9);
}

/* Botón de cerrar flotante en la ficha */
.sheet-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(14, 14, 19, 0.6);
  border: var(--border-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 150;
  transition: background-color 0.2s, transform 0.2s;
}

.sheet-close-btn:hover {
  background: rgba(14, 14, 19, 0.9);
}

.sheet-close-btn:active {
  transform: scale(0.92);
}

/* Contenedor de Metadata, Sinopsis y Episodios en móvil */
.sheet-left-column,
.sheet-right-column {
  padding: 16px;
}

/* ================= DISEÑO RESPONSIVO (PC/DESKTOP GRID) ================= */
@media (min-width: 1024px) {
  /* En PC, centramos el bottom-sheet como si fuera un modal grande */
  .bottom-sheet {
    height: 90vh;
    width: 90vw;
    max-width: 1200px;
    left: 50%;
    transform: translate(-50%, 100%);
    border-radius: 12px;
    bottom: 5vh;
  }
  
  .bottom-sheet.open {
    transform: translate(-50%, 0);
  }

  /* Ocultar la barra para arrastrar en PC */
  .drag-handle-wrapper {
    display: none;
  }

  /* Usamos CSS Grid para dividir la pantalla */
  .sheet-body {
    display: grid;
    grid-template-columns: 1fr 400px; /* Video/Info a la izq, Episodios a la der */
    grid-template-rows: auto 1fr;
    grid-template-areas: 
      "header episodes"
      "info episodes";
    height: 100%;
    overflow-y: hidden; /* El scroll lo maneja cada sección ahora */
  }

  .sheet-media-header {
    grid-area: header;
    position: relative; /* Ya no es sticky, es parte del grid izquierdo */
    top: auto;
    aspect-ratio: 16/9;
    height: auto;
    border-radius: 12px 0 0 0;
    overflow: hidden;
  }

  .sheet-left-column {
    grid-area: info;
    overflow-y: auto; /* Scroll independiente para la info */
    padding: 24px;
  }

  .sheet-right-column {
    grid-area: episodes;
    overflow-y: auto; /* Scroll independiente para la lista */
    border-left: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    padding: 24px;
    padding-bottom: 24px;
  }

  .sheet-tabs {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
  }
}

.sheet-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.sheet-meta-tags {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
  color: var(--text-secondary);
}

.tag-accent {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  background-color: rgba(229, 9, 20, 0.12);
  color: var(--accent-red);
  border-radius: 4px;
}

.tag-hd {
  border: 1px solid var(--text-muted);
  color: var(--text-secondary);
  font-weight: 700;
}

..sheet-action-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.sheet-language-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.sheet-language-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-right: 8px;
  font-weight: 700;
}

.sheet-language-option {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.sheet-language-option:hover,
.sheet-language-option.active {
  background: rgba(255,255,255,0.14);
  transform: translateY(-1px);
}

.sheet-synopsis {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Pestañas (Tabs) en Sheet */
.sheet-tabs {
  display: flex;
  border-bottom: 1px solid var(--text-muted);
  margin-bottom: 16px;
}

.sheet-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 0;
  margin-right: 24px;
  cursor: pointer;
  position: relative;
}

.sheet-tab.active {
  color: var(--text-primary);
}

.sheet-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

/* Paneles de Pestañas */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s;
}

/* Lista de Episodios */
.episodes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.episode-card {
  display: flex;
  background-color: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: var(--border-glass);
  cursor: pointer;
}

.episode-card:active {
  transform: scale(0.98);
}

.episode-thumb-wrapper {
  width: 110px;
  aspect-ratio: 16/9;
  position: relative;
  background-color: #000;
}

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

.episode-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.episode-details {
  flex: 1;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

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

.episode-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Ficha Técnica */
.technical-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.tech-row {
  font-size: 13px;
  line-height: 1.4;
}

.tech-row strong {
  color: var(--text-primary);
}

.tech-row span {
  color: var(--text-secondary);
}

/* ================= REPRODUCTOR DE VIDEO (PLYR WRAPPER) ================= */

/* Contenedor del video Plyr para que ocupe todo el header sticky */
.video-container-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  background: #000;
}

/* Iframe para videos que requieren JS (Voex, Streamwish, etc) */
.video-iframe-fallback {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

/* Iframe para videos que requieren JS (Voex, Streamwish, etc) */
.video-iframe-fallback {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  z-index: 200; /* Por encima del banner */
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.video-container-wrapper.hidden {
  display: none !important;
}

/* Botón atrás flotante por encima de Plyr */
.video-back-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 40px;
  height: 40px;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 50%;
  color: #fff;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.2s;
}

.video-container-wrapper:hover .video-back-btn {
  opacity: 1;
}

/* Forzar Plyr a llenar el contenedor */
.plyr {
  width: 100%;
  height: 100%;
}
.plyr__video-wrapper {
  height: 100%;
}
.plyr__video-wrapper video {
  height: 100% !important;
  object-fit: contain;
}

.video-fallback {
  color: #fff;
  max-width: 600px;
  text-align: center;
  padding: 24px;
}

.video-fallback p {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.5;
}

.video-fallback a {
  display: inline-block;
  padding: 12px 20px;
  background: #e50914;
  color: #fff;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.language-select {
  padding: 6px 10px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  min-width: 180px;
  font-size: 14px;
}

.language-select option {
  color: #000;
}

/* Colores personalizados para Plyr */
:root {
  --plyr-color-main: #E50914;
}

/* IOS Scroll Fix global class */
.ios-scroll-locked {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}

/* ================= MODALES Y DIÁLOGOS DE CONTROL ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-secondary);
  border: var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 20px;
  text-align: center;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

/* Selector de Avatares */
.avatar-edit-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.avatar-edit-preview {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 3px solid var(--accent-red);
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.3);
}

.avatar-edit-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-height: 160px;
  overflow-y: auto;
  padding: 8px;
  width: 100%;
}

.avatar-option-item {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.avatar-option-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-option-item.selected {
  border-color: var(--accent-red);
  transform: scale(1.1);
}

/* Formulario */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input {
  background-color: var(--bg-tertiary);
  border: var(--border-glass);
  border-radius: var(--border-radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
}

.form-group input:focus {
  border-color: var(--accent-purple);
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-footer .btn {
  flex: 1;
}

/* Diálogo de Confirmación */
.modal-confirm-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
}

/* Ajustes Sección */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px;
}

.settings-item {
  background-color: var(--bg-secondary);
  border: var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.settings-item:active {
  transform: scale(0.98);
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 14px;
}

.text-danger {
  color: var(--accent-danger);
}

.settings-info-card {
  margin-top: 16px;
  background: radial-gradient(circle at bottom right, rgba(138,43,226,0.1) 0%, rgba(7,7,9,0) 70%);
  border: var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.settings-version {
  font-size: 11px;
  color: var(--text-secondary);
}

.settings-info-card p {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Utilidades generales */
.hidden {
  display: none !important;
}

/* Animación de Transición Genérica */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= OVERLAY DE ANUNCIOS EN PAUSA ================= */
#pause-ad-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Permite clics a través del fondo hacia el botón de play/pause */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  z-index: 5; /* Por encima del video, debajo de los controles */
  padding: 15px 0; /* Separa los anuncios sin invadir el centro del Play/Pause */
}

.pause-ad-content {
  pointer-events: auto; /* Permite clics en el anuncio y botón de cerrar */
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 4px;
  border-radius: 8px;
  max-width: 95vw;
}

.close-pause-ad {
  position: absolute;
  top: -12px;
  right: -12px;
  background: rgba(255, 255, 255, 0.95);
  color: #000;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-weight: 800;
  cursor: pointer;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.close-pause-ad:active {
  transform: scale(0.9);
}
