/* Roberto Manfinfla — reproductor de video propio (videos self-hosted)
 *
 * AUTOCONTENIDO A PROPOSITO. Los colores van como valores literales copiados de
 * los tokens de PRODUCCION (--accent-cyan rgb(80,200,255), --bg-card #1a0f40,
 * --text-primary #e8e4f0, etc.), NO como var(--...). Motivo: el style.css local
 * define esos tokens distinto al de produccion (rediseño riso pausado), asi que
 * con variables el reproductor se veria bien en un entorno y mal en el otro.
 * Mismo criterio ya validado en la pagina /music/.
 *
 * Todas las clases llevan prefijo rmp- y cuelgan de .rmp-player, que no existe en
 * ninguna otra parte del sitio. Este archivo no puede alterar el diseño actual.
 */

/* Se monta dentro de .lightbox-iframe-wrap, que ya aporta la caja 16:9, el
 * border-radius y la sombra. Solo nos posicionamos adentro. */
.lightbox-iframe-wrap .rmp-player {
  position: absolute;
  inset: 0;
}

.rmp-player {
  --rmp-cyan: rgb(80, 200, 255);
  --rmp-magenta: rgb(255, 0, 255);
  overflow: hidden;
  background: #000;
  font-family: 'Avant', 'Century Gothic', sans-serif;
  color: #e8e4f0;
  user-select: none;
  -webkit-user-select: none;
}

.rmp-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

/* ---- Boton de play central ---- */
.rmp-big-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(26, 15, 64, 0.82);
  box-shadow: 0 0 0 2px rgba(80, 200, 255, 0.55), 0 8px 32px rgba(0, 0, 0, 0.55);
  color: var(--rmp-cyan);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s linear, visibility 0.2s linear;
}
.rmp-big-play svg { width: 34px; height: 34px; margin-left: 5px; fill: currentColor; }
.rmp-big-play:hover,
.rmp-big-play:focus-visible {
  transform: translate(-50%, -50%) scale(1.08);
  background: rgba(26, 15, 64, 0.95);
  box-shadow: 0 0 0 2px var(--rmp-cyan), 0 10px 40px rgba(80, 200, 255, 0.3);
}
.rmp-player[data-state="playing"] .rmp-big-play,
.rmp-player[data-state="loading"] .rmp-big-play,
.rmp-player[data-state="error"] .rmp-big-play {
  opacity: 0;
  visibility: hidden;
}

/* ---- Spinner de carga ---- */
.rmp-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border: 3px solid rgba(80, 200, 255, 0.2);
  border-top-color: var(--rmp-cyan);
  border-radius: 50%;
  opacity: 0;
  visibility: hidden;
  animation: rmp-spin 0.8s linear infinite;
}
.rmp-player[data-state="loading"] .rmp-spinner { opacity: 1; visibility: visible; }
@keyframes rmp-spin { to { transform: rotate(360deg); } }

/* ---- Mensaje de error ---- */
.rmp-error {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: #0d0628;
}
.rmp-player[data-state="error"] .rmp-error { display: flex; }
.rmp-error strong { font-size: 1.05rem; color: #e8e4f0; }
.rmp-error span { font-size: 0.9rem; color: #9088b0; }

/* ---- Barra de controles ---- */
.rmp-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 30px 14px 10px;
  background: linear-gradient(to top, rgba(4, 2, 12, 0.92) 0%, rgba(4, 2, 12, 0.65) 45%, transparent 100%);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.rmp-player[data-idle="true"] .rmp-bar {
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
}
.rmp-player[data-idle="true"] { cursor: none; }
.rmp-player[data-state="error"] .rmp-bar { display: none; }

.rmp-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.rmp-spacer { flex: 1; }

.rmp-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #e8e4f0;
  cursor: pointer;
  transition: color 0.18s linear, background 0.18s linear;
}
.rmp-btn svg { width: 19px; height: 19px; fill: currentColor; pointer-events: none; }
.rmp-btn:hover { color: var(--rmp-cyan); background: rgba(80, 200, 255, 0.12); }

.rmp-time {
  font-size: 0.82rem;
  color: #e8e4f0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 0 4px;
}

/* ---- Barra de progreso ---- */
.rmp-seek {
  position: relative;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.rmp-seek-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: rgba(232, 228, 240, 0.22);
  transition: height 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.rmp-seek:hover .rmp-seek-track,
.rmp-seek:focus-visible .rmp-seek-track,
.rmp-seek[data-scrubbing="true"] .rmp-seek-track { height: 6px; }

.rmp-seek-buffered,
.rmp-seek-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 3px;
}
.rmp-seek-buffered { background: rgba(232, 228, 240, 0.3); width: 0; }
.rmp-seek-fill {
  background: linear-gradient(90deg, var(--rmp-cyan), var(--rmp-magenta));
  width: 0;
}
.rmp-seek-handle {
  position: absolute;
  top: 50%;
  left: 0;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: var(--rmp-cyan);
  box-shadow: 0 0 10px rgba(80, 200, 255, 0.65);
  opacity: 0;
  transition: opacity 0.15s linear;
}
.rmp-seek:hover .rmp-seek-handle,
.rmp-seek:focus-visible .rmp-seek-handle,
.rmp-seek[data-scrubbing="true"] .rmp-seek-handle { opacity: 1; }

/* ---- Volumen ---- */
.rmp-vol {
  width: 0;
  overflow: hidden;
  opacity: 0;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s linear;
}
.rmp-row:hover .rmp-vol,
.rmp-vol:focus-within { width: 74px; opacity: 1; }

.rmp-vol-input {
  width: 68px;
  height: 18px;
  margin: 0 3px;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.rmp-vol-input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 3px;
  background: rgba(232, 228, 240, 0.28);
}
.rmp-vol-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -3.5px;
  border: none;
  border-radius: 50%;
  background: var(--rmp-cyan);
}
.rmp-vol-input::-moz-range-track {
  height: 4px;
  border-radius: 3px;
  background: rgba(232, 228, 240, 0.28);
}
.rmp-vol-input::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: none;
  border-radius: 50%;
  background: var(--rmp-cyan);
}

/* ---- Foco visible (accesibilidad) ---- */
.rmp-player :focus-visible {
  outline: 2px solid var(--rmp-cyan);
  outline-offset: 2px;
}

/* ---- Pantalla completa ---- */
.rmp-player:fullscreen { width: 100vw; height: 100vh; }
.rmp-player:fullscreen .rmp-video { object-fit: contain; }

/* ---- Responsive ---- */
@media (max-width: 560px) {
  .rmp-big-play { width: 64px; height: 64px; }
  .rmp-big-play svg { width: 26px; height: 26px; }
  .rmp-bar { padding: 26px 8px 6px; }
  .rmp-time { font-size: 0.74rem; }
  /* En tactil no hay hover: el volumen queda siempre visible pero compacto. */
  .rmp-vol { width: 58px; opacity: 1; }
  .rmp-vol-input { width: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .rmp-big-play,
  .rmp-bar,
  .rmp-seek-track,
  .rmp-seek-handle,
  .rmp-vol { transition: none; }
  .rmp-spinner { animation-duration: 1.6s; }
}
