/* CreaTV — Player + Overlay (rediseño moderno-sobrio) */

#screen-player {
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

/* Video — fondo completo
   ANTES: object-fit: cover llenaba el viewport pero RECORTABA arriba/abajo
   en portrait (cuando el video es 16:9 y la pantalla es 9:16).
   AHORA: contain mantiene el video entero, agregando barras negras a los
   lados si el aspect ratio del viewport no coincide. Es lo correcto para
   IPTV — nunca cortar parte de la imagen.
   Usamos 100dvh (dynamic viewport height) para respetar barras del sistema
   en mobile y evitar overflow. */
#video-player {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  object-fit: contain;
  display: block;
  background: #000;
}

/* ── Overlay (capa de UI sobre el video) ─────────────────────── */
#overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Top-right: logo + botón menú ─────────────────────────────
   Sobrio: pill semitransparente con blur, logo pequeño + 3 líneas
   tipo "hamburger". No muestra info del canal acá — eso va abajo. */
#overlay-menu-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  background: rgba(13, 28, 26, 0.65);
  border: 1px solid rgba(232, 245, 242, 0.08);
  border-radius: 999px;
  cursor: pointer;
  pointer-events: auto;
  font-family: inherit;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background 0.15s ease, border-color 0.15s ease;
}
#overlay-menu-btn:hover,
#overlay-menu-btn.focused {
  background: rgba(22, 37, 33, 0.9);
  border-color: var(--crea-teal);
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.overlay-menu-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  border-radius: 4px;
}

/* Hamburger icon — 3 líneas finas */
.overlay-menu-icon {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 18px;
}
.overlay-menu-icon span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-primary);
  border-radius: 2px;
  transition: background 0.15s ease;
}
#overlay-menu-btn:hover .overlay-menu-icon span,
#overlay-menu-btn.focused .overlay-menu-icon span {
  background: var(--accent-focus);
}

/* ── Bottom-left: pill con logo + (CH número + nombre) ────────
   Mismo lenguaje visual que el botón menú top-right: pill
   redondeado, fondo semitransparente con blur, borde sutil,
   logo a la izquierda y bloque de texto a la derecha. */
#overlay-channel-info {
  position: absolute;
  bottom: 24px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px 10px 10px;
  background: rgba(13, 28, 26, 0.65);
  border: 1px solid rgba(232, 245, 242, 0.08);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  pointer-events: none;
  max-width: calc(100vw - 200px);
}

.overlay-info-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  flex-shrink: 0;
}

.overlay-info-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
  min-width: 0;
}

#overlay-channel-number {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-focus);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

#overlay-channel-name {
  font-size: 25px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 440px;
}

/* ── Buffering ────────────────────────────────────────────────── */
#buffering {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  z-index: 20;
}
#buffering.visible {
  display: flex;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(107, 170, 160, 0.25);
  border-top-color: var(--crea-teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

#buffering-text {
  color: var(--text-secondary);
  font-size: 16px; /* TV 10-foot: mínimo 16 px para legibilidad */
  letter-spacing: 0.3px;
}

/* ── Error de stream ─────────────────────────────────────────── */
#stream-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: none;
}
#stream-error.visible {
  display: block;
}
#stream-error p {
  color: var(--text-secondary);
  font-size: 16px;
  margin-top: 10px;
}

/* ── Responsive: en pantallas pequeñas, ajustar tamaños ──────── */
@media (max-width: 640px) {
  #overlay-menu-btn       { top: 12px; right: 12px; }
  .overlay-menu-logo      { width: 26px; height: 26px; }
  #overlay-channel-info   { bottom: 16px; left: 12px; padding: 8px 20px 8px 8px; gap: 12px; }
  .overlay-info-logo      { width: 46px; height: 46px; }
  #overlay-channel-number { font-size: 16px; } /* mínimo 16 px (10-foot) */
  #overlay-channel-name   { font-size: 19px; max-width: 260px; }
}
