/* ============================================================
   MotorPress Player — Custom Skin
   Basado en el diseño del reproductor de Auto Test (screenshot)
   ============================================================ */

/* ── Variables por defecto (sobreescritas por --mp-color inline) ── */
.mp-player-wrap {
  --mp-color: #d40000;
  --mp-bg: #1a1a1a;
  --mp-text: #ffffff;
  --mp-bar-height: 44px;
  position: relative;
  width: 100%;
  max-width: 100%;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Contenedor del video ────────────────────────────────────────── */
.mp-player-wrap .mp-video {
  width: 100%;
}

/* ── Skin base del player ────────────────────────────────────────── */
.mp-player-wrap .video-js {
  color: var(--mp-text);
  font-size: 14px;
}

/* ── Barra de controles ─────────────────────────────────────────── */
.mp-player-wrap .vjs-control-bar {
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
  height: var(--mp-bar-height);
  display: flex;
  align-items: center;
  padding: 0 6px;
  bottom: 0;
}

/* ── Progress bar ──────────────────────────────────────────────── */
.mp-player-wrap .vjs-progress-control {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
}

.mp-player-wrap .vjs-progress-holder {
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  transition: height 0.15s;
}

.mp-player-wrap .vjs-progress-control:hover .vjs-progress-holder {
  height: 6px;
}

.mp-player-wrap .vjs-play-progress {
  background: var(--mp-color);
  border-radius: 2px;
}

.mp-player-wrap .vjs-play-progress::before {
  color: var(--mp-color);
  top: -4px;
  font-size: 12px;
}

.mp-player-wrap .vjs-load-progress {
  background: rgba(255,255,255,0.2);
}

.mp-player-wrap .vjs-load-progress div {
  background: rgba(255,255,255,0.25);
}

/* ── Botones de control ──────────────────────────────────────────── */
.mp-player-wrap .vjs-control {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  transition: color 0.15s;
  flex-shrink: 0;
}

.mp-player-wrap .vjs-control:hover {
  color: var(--mp-color);
}

.mp-player-wrap .vjs-button > .vjs-icon-placeholder::before {
  font-size: 18px;
  line-height: 36px;
}

/* ── Botón Play / Pause ──────────────────────────────────────────── */
.mp-player-wrap .vjs-play-control {
  width: 36px;
}

/* ── Botón Rewind 10s ────────────────────────────────────────────── */
.mp-player-wrap .vjs-rewind-button {
  order: 2;
}

.mp-player-wrap .mp-rewind-icon::before {
  font-family: VideoJS;
  content: '\f124'; /* replay icon */
  font-size: 16px;
  line-height: 36px;
  display: block;
}

/* Fallback SVG si la fuente no carga */
.mp-player-wrap .mp-rewind-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z'/%3E%3Ctext x='8' y='14' font-size='7' fill='white' font-weight='bold'%3E10%3C/text%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px;
  width: 20px;
  height: 20px;
  display: inline-block;
}

.mp-player-wrap .mp-rewind-icon::before {
  display: none;
}

/* ── Volumen ──────────────────────────────────────────────────────── */
.mp-player-wrap .vjs-volume-panel {
  width: auto;
  display: flex;
  align-items: center;
}

.mp-player-wrap .vjs-volume-bar {
  background: rgba(255,255,255,0.3);
}

.mp-player-wrap .vjs-volume-level {
  background: var(--mp-color);
}

.mp-player-wrap .vjs-volume-level::before {
  color: var(--mp-color);
}

/* ── Tiempo ──────────────────────────────────────────────────────── */
.mp-player-wrap .vjs-time-control {
  display: flex;
  align-items: center;
  padding: 0 4px;
  font-size: 12px;
  min-width: auto;
  white-space: nowrap;
  color: rgba(255,255,255,0.9);
  font-variant-numeric: tabular-nums;
}

.mp-player-wrap .vjs-current-time,
.mp-player-wrap .vjs-duration {
  display: block;
}

.mp-player-wrap .vjs-time-divider {
  min-width: auto;
  padding: 0 1px;
}

/* ── Spacer ─────────────────────────────────────────────────────── */
.mp-player-wrap .vjs-spacer,
.mp-player-wrap .vjs-custom-control-spacer {
  flex: 1;
}

/* ── Título en control bar ───────────────────────────────────────── */
.mp-player-wrap .vjs-title-component {
  display: flex;
  align-items: center;
  flex: 1;
  overflow: hidden;
  padding: 0 8px;
}

.mp-player-wrap .mp-player-title span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Logo en control bar ─────────────────────────────────────────── */
.mp-player-wrap .vjs-logo-component {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  flex-shrink: 0;
}

/* ── Fullscreen ──────────────────────────────────────────────────── */
.mp-player-wrap .vjs-fullscreen-control {
  margin-left: auto;
}

/* ── Playback rate ───────────────────────────────────────────────── */
.mp-player-wrap .vjs-playback-rate .vjs-playback-rate-value {
  font-size: 11px;
  line-height: 36px;
}

/* ── Big play button — triángulo simple, sin caja ────────────────── */
.mp-player-wrap .vjs-big-play-button {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin: 0 !important;
  width: auto !important;
  height: auto !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  transition: transform 0.15s, opacity 0.15s;
}

.mp-player-wrap .vjs-big-play-button .vjs-icon-placeholder::before {
  font-size: 80px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.90);
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
  display: block;
  position: static !important;
  top: auto !important;
  left: auto !important;
  width: auto !important;
  height: auto !important;
  transition: color 0.15s;
}

.mp-player-wrap .video-js:hover .vjs-big-play-button .vjs-icon-placeholder::before {
  color: #ffffff;
}

.mp-player-wrap .video-js:hover .vjs-big-play-button {
  transform: translate(-50%, -50%) scale(1.08) !important;
}

/* Una vez que empezó, el botón desaparece para siempre */
.mp-player-wrap .video-js.vjs-has-started .vjs-big-play-button {
  display: none !important;
}

/* ── Loading spinner ─────────────────────────────────────────────── */
.mp-player-wrap .vjs-loading-spinner {
  border-color: var(--mp-color);
}

.mp-player-wrap .vjs-loading-spinner::before,
.mp-player-wrap .vjs-loading-spinner::after {
  border-color: var(--mp-color);
}

/* ── Poster ──────────────────────────────────────────────────────── */
.mp-player-wrap .vjs-poster {
  background-size: cover;
  background-position: center;
}

/* ── Ad container ────────────────────────────────────────────────── */
.mp-player-wrap .mp-ad-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99;
}

/* .ima-ad-container mantiene su pointer-events:auto nativo del IMA SDK.
   El overlay de desktop (z-index:2000) se desactiva durante el anuncio por JS,
   permitiendo que el botón skip sea clickeable. */

.mp-player-wrap.mp-ad-playing .mp-ad-container {
  pointer-events: auto;
}

/* Ocultar controles de YouTube durante el anuncio */
.mp-player-wrap .mp-ad-playing .vjs-control-bar {
  z-index: 101;
}

/* ── Skip ad button (IMA default override) ───────────────────────── */
.mp-player-wrap .ima-skip-ad-container button {
  background: var(--mp-color) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600 !important;
}

/* ── Countdown ad overlay ────────────────────────────────────────── */
.mp-player-wrap .ima-countdown-div {
  background: rgba(0,0,0,0.6) !important;
  color: #fff !important;
  font-size: 12px !important;
  padding: 4px 8px !important;
  border-radius: 3px !important;
}

/* ── Controles nativos de YouTube ocultos ────────────────────────── */
.mp-player-wrap .vjs-tech {
  pointer-events: none;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .mp-player-wrap .vjs-title-component {
    display: none;
  }

  .mp-player-wrap .vjs-playback-rate {
    display: none;
  }
}

/* ── Variantes por sitio (colores extra si se necesitan) ─────────── */
.mp-site-at { --mp-color: #d40000; }
.mp-site-lm { --mp-color: #e65c00; }
.mp-site-tm { --mp-color: #0066cc; }

/* Si el color llega override inline prevalece sobre la clase */
