/* ============================================================
   ProfeAcademī · TV App
   Estilos del reproductor, botón fullscreen, vista previa y carga.
   ============================================================ */

/* Garantiza que los elementos con [hidden] no sean sobreescritos por reglas display */
#tv-manager[hidden],
#tv-player[hidden],
#tv-loading[hidden] { display: none !important; }

/* ── Shell en modo reproductor ── */
#tv-shell.tv-player-active {
  max-width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ── Estado de carga ── */
.tv-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  color: #9ca3af;
  font-size: 0.9rem;
}

.tv-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(167, 139, 250, 0.2);
  border-top-color: #7c3aed;
  animation: tv-spin 0.8s linear infinite;
}

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

/* ── Botón Vista Previa (en el hero del gestor) ── */
.tv-preview-btn {
  white-space: nowrap;
  align-self: flex-start;
}

/* ── Vista del reproductor ── */
#tv-player {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4.5rem 1rem 1.5rem;
}

/* ── Contenedor principal del slideshow ── */
.tv-player-wrap {
  position: relative;
  width: 100%;
  max-width: min(96vw, calc((100vh - 6rem) * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #050010;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(76, 29, 149, 0.35),
    0 0 0 1px rgba(167, 139, 250, 0.15),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  isolation: isolate;
}

/* Fullscreen */
.tv-player-wrap:fullscreen {
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  aspect-ratio: unset;
  border-radius: 0;
}
.tv-player-wrap:-webkit-full-screen {
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  aspect-ratio: unset;
  border-radius: 0;
}
.tv-player-wrap:-moz-full-screen {
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  aspect-ratio: unset;
  border-radius: 0;
}

/* ── Track y slides ── */
.tv-track {
  position: absolute;
  inset: 0;
}

.tv-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.1s ease, transform 8s ease-out;
  pointer-events: none;
}

.tv-slide.is-active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.tv-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.tv-slide.is-active img {
  animation: tv-kenburns 12s ease-out forwards;
}

@keyframes tv-kenburns {
  from { transform: scale(1.0); }
  to   { transform: scale(1.06); }
}

/* Velo degradado para legibilidad de controles */
.tv-slide::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(5,0,16,0.55) 100%),
    linear-gradient(90deg, rgba(5,0,16,0.2), transparent 20%, transparent 80%, rgba(5,0,16,0.2));
  pointer-events: none;
}

/* ── Flechas de navegación ── */
.tv-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 0, 16, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.25s, background 0.2s, transform 0.2s;
}
.tv-player-wrap:hover .tv-arrow { opacity: 1; }
.tv-arrow:hover {
  background: rgba(124, 58, 237, 0.7);
  transform: translateY(-50%) scale(1.08);
}
.tv-prev { left: 16px; }
.tv-next { right: 16px; }

/* ── Indicadores (dots) ── */
.tv-dots-wrap {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.tv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: width 0.3s ease, background 0.3s ease;
}

.tv-dot.is-active {
  width: 26px;
  border-radius: 4px;
  background: linear-gradient(90deg, #a78bfa, #f0abfc);
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.7);
}

/* ── Estado vacío ── */
.tv-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: rgba(226, 220, 255, 0.85);
  text-align: center;
  padding: 1.5rem;
}

.tv-empty-icon {
  font-size: 3rem;
  filter: drop-shadow(0 4px 14px rgba(124, 58, 237, 0.5));
}

.tv-empty h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  background: linear-gradient(135deg, #c4b5fd, #f0abfc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tv-empty p {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(196, 181, 253, 0.7);
  max-width: 360px;
}

/* ── Botón Pantalla Completa ── */
.tv-fs-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 15;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 0, 16, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: background 0.2s, transform 0.15s, opacity 0.25s;
}
.tv-player-wrap:hover .tv-fs-btn { opacity: 1; }
.tv-fs-btn:hover {
  background: rgba(124, 58, 237, 0.65);
  transform: scale(1.08);
}

.tv-fs-btn svg { pointer-events: none; display: block; }
.tv-fs-icon-compress { display: none; }
.tv-fs-btn.is-fullscreen .tv-fs-icon-expand   { display: none; }
.tv-fs-btn.is-fullscreen .tv-fs-icon-compress { display: block; }

/* En fullscreen: controles siempre visibles */
.tv-player-wrap:fullscreen .tv-fs-btn,
.tv-player-wrap:fullscreen .tv-arrow,
.tv-player-wrap:fullscreen .tv-back-btn,
.tv-player-wrap:-webkit-full-screen .tv-fs-btn,
.tv-player-wrap:-webkit-full-screen .tv-arrow,
.tv-player-wrap:-webkit-full-screen .tv-back-btn { opacity: 1; }

/* ── Botón Volver al Gestor ── */
.tv-back-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 15;
  padding: 0.45rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 0, 16, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: background 0.2s, transform 0.15s, opacity 0.25s;
}
.tv-player-wrap:hover .tv-back-btn { opacity: 1; }
.tv-back-btn:hover {
  background: rgba(124, 58, 237, 0.65);
  transform: translateY(-1px);
}

/* ── Responsivo ── */
@media (max-width: 640px) {
  #tv-player { padding: 3.5rem 0.4rem 0.8rem; }
  .tv-player-wrap { border-radius: 14px; }
  .tv-arrow { width: 38px; height: 38px; font-size: 1.3rem; }
  /* En móvil los controles siempre visibles (no hay hover) */
  .tv-fs-btn,
  .tv-back-btn { opacity: 1; }
  .tv-fs-btn { top: 10px; right: 10px; width: 36px; height: 36px; }
  .tv-back-btn { top: 10px; left: 10px; font-size: 0.75rem; padding: 0.32rem 0.65rem; }
}
