/**
 * stream_webgl.css
 * Estilos adicionales para la vista comparativa WebGL (/stream/webgl.php).
 * Se carga DESPUÉS de stream.css y no modifica la vista clásica.
 */

/* ── Indicador de renderer activo ──────────────────────────────────────── */

.stream-render-badge {
  font-size: 10px;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  white-space: nowrap;
}

.stream-render-badge.is-webgl {
  border-color: rgba(76, 175, 80, 0.5);
  color: #4caf50;
}

/* Botón de redirección entre la vista clásica y la vista WebGL.
   Se usa botón + window.location (no <a>) por compatibilidad con la PWA. */
.stream-view-btn {
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}

.stream-view-btn:hover {
  color: inherit;
  border-color: currentColor;
}

/* Selector de reproductor: «Opción 1 | Opción 2». La opción en uso va en
   verde (.is-activa) en las DOS vistas; la otra navega a su vista. Botones +
   window.location (no <a>) por compatibilidad con la PWA. */
.stream-opciones {
  display: inline-flex;
  gap: 6px;
}

.stream-opcion {
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}

.stream-opcion:hover {
  color: inherit;
  border-color: currentColor;
}

.stream-opcion.is-activa,
.stream-opcion.is-activa:hover {
  border-color: rgba(76, 175, 80, 0.5);
  color: #4caf50;
  cursor: default;
}

/* ── Grid en modo WebGL ────────────────────────────────────────────────── */

/* Un solo canvas WebGL cubre todo el grid; las tarjetas son "ventanas". */
.stream-players--gl {
  position: relative;
}

.stream-gl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 5;
}

/* Las tarjetas NO deben crear stacking context propio: sus overlays
   (label, dot, loading, botón fullscreen) se elevan individualmente por
   encima del canvas único (z-index 20 > 5), mientras el fondo negro de
   la tarjeta queda por debajo del video. */
.stream-players--gl .stream-card {
  will-change: auto;
  transform: none;
}

.stream-players--gl .stream-card__label,
.stream-players--gl .stream-card__dot,
.stream-players--gl .stream-card__fs {
  z-index: 20;
}

.stream-players--gl .stream-card__loading {
  z-index: 20;
  background: #000;
}

/* ── Fullscreen de una tarjeta (modo WebGL) ────────────────────────────── */

.stream-glfs {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: none;
}

.stream-glfs.is-active {
  display: block;
}

/* iOS en portrait: rotar el contenedor completo (canvas incluido). */
.stream-glfs--rotated {
  inset: auto;
  top: 0;
  left: 100vw;
  width: 100vh;
  height: 100vw;
  transform: rotate(90deg);
  transform-origin: left top;
}

.stream-glfs .stream-gl-canvas {
  z-index: 1;
}

.stream-glfs__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
