/* =============================================================
   YT Secure Player — Estilos v1.3
   Para cambiar colores de marca busca:
     #1a1a2e  → fondo barra de controles custom
     #e94560  → color acento (progreso, spinner, velocidad)
   ============================================================= */

/* ── Wrapper externo ─────────────────────────────────────────── */
.ytsp-wrapper {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Zona de vídeo: overflow hidden corta lo que salga ───────── */
.ytsp-frame-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
  overflow: hidden;
}

/* ── Div raíz del IFrame API ─────────────────────────────────── */
.ytsp-frame-wrap > div[id$="-yt"],
.ytsp-frame-wrap > div[id$="-yt"] > div {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
}

/* ── El iframe se sobredimensiona para empujar la barra fuera ── */
/* La barra nativa de YouTube mide ~46px. +56px garantiza que    */
/* queda fuera del overflow hidden del wrapper.                   */
.ytsp-frame-wrap iframe {
  position: absolute;
  top: -1px;
  left: 0;
  width: 100% !important;
  height: calc(100% + 56px) !important;
  border: 0;
  pointer-events: none;
}

/* ── Overlay general: captura clics en el área del vídeo ─────── */
.ytsp-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  background: transparent;
  cursor: pointer;
}

/* ── Bloque superior: tapa título, Ver más tarde, Compartir ───── */
.ytsp-top-block {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  z-index: 9999 !important;
  background: #000 !important;
  pointer-events: auto;
  cursor: default;
}

/* ── Bloque esquina: tapa el logo/watermark de YouTube ───────── */
.ytsp-logo-block {
  position: absolute;
  bottom: 8px;
  right: 10px;
  width: 90px;
  height: 36px;
  z-index: 9999 !important;
  background: transparent;
  pointer-events: auto;
}

.ytsp-logo-block-link {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
}

/* ── Bloque inferior: reemplazado por técnica de recorte ─────── */
.ytsp-controls-block {
  display: none;
}

/* ── Barra de controles custom ───────────────────────────────── */
.ytsp-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #1a1a2e;
  border-top: 2px solid #e94560;
}

/* ── Botones ─────────────────────────────────────────────────── */
.ytsp-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
  line-height: 1;
}

.ytsp-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.1);
}

.ytsp-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
}

.ytsp-speed {
  font-size: 12px;
  font-weight: 700;
  min-width: 28px;
  color: #e94560;
}

/* ── Barra de progreso ───────────────────────────────────────── */
.ytsp-progress-wrap {
  flex: 1;
  cursor: pointer;
  padding: 10px 0;
  position: relative;
}

.ytsp-progress-bg {
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  position: relative;
  transition: height 0.15s;
}

.ytsp-progress-wrap:hover .ytsp-progress-bg {
  height: 6px;
}

.ytsp-progress-bar {
  height: 100%;
  background: #e94560;
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
}

.ytsp-progress-thumb {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.ytsp-progress-wrap:hover .ytsp-progress-thumb {
  opacity: 1;
}

/* ── Tiempo ──────────────────────────────────────────────────── */
.ytsp-time {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Slider de volumen ───────────────────────────────────────── */
.ytsp-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}

.ytsp-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
}

.ytsp-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* ── Loader ──────────────────────────────────────────────────── */
.ytsp-loader {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #111;
}

.ytsp-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #e94560;
  border-radius: 50%;
  animation: ytsp-spin 0.8s linear infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes ytsp-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── Error ───────────────────────────────────────────────────── */
.ytsp-error {
  color: #ff6b6b;
  text-align: center;
  padding: 30px;
  background: #1a1a1a;
  margin: 0;
  font-size: 14px;
}

/* ── Pantalla completa ───────────────────────────────────────── */
.ytsp-wrapper:fullscreen {
  border-radius: 0;
}

.ytsp-wrapper:fullscreen .ytsp-frame-wrap {
  padding-bottom: 0;
  height: calc(100vh - 54px);
}

.ytsp-wrapper:fullscreen .ytsp-frame-wrap iframe {
  height: calc(100% + 56px) !important;
}

/* ── Responsive mobile ───────────────────────────────────────── */
@media (max-width: 480px) {
  .ytsp-volume-slider {
    display: none;
  }
  .ytsp-controls {
    gap: 5px;
    padding: 8px 10px;
  }
  .ytsp-time {
    font-size: 11px;
  }
}
