/* ═══════════════════════════════════════════════════════
   WPCM Video Player v7.4.0 – Stylesheet
   ═══════════════════════════════════════════════════════ */

:root {
  --wpcm-accent: #e50914;
  --wpcm-radius: 12px;
  --wpcm-max-width: 640px;
}

/* ── Base Container ── */
.wpcm-vp-wrap {
  position: relative;
  width: 100%;
  max-width: var(--wpcm-max-width);
  max-height: 80vh;
  margin: 1.5em auto;
  border-radius: var(--wpcm-radius);
  overflow: hidden;
  background: #000;
  line-height: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  /* Garante que videos verticais nao explodam a pagina */
  display: flex;
  align-items: center;
  justify-content: center;
}

.wpcm-vp-wrap *,
.wpcm-vp-wrap *::before,
.wpcm-vp-wrap *::after {
  box-sizing: border-box;
}

/* ── Video Element (self-hosted) ── */
.wpcm-vp-wrap video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
}

/* ── States ── */
.wpcm-vp-wrap.wpcm-playing .wpcm-vp-overlay {
  opacity: 0;
  pointer-events: none;
}
.wpcm-vp-wrap.wpcm-paused .wpcm-vp-overlay {
  opacity: 1;
  pointer-events: auto;
}
.wpcm-vp-wrap.wpcm-playing .wpcm-vp-controls {
  opacity: 1;
}
.wpcm-vp-wrap.wpcm-idle .wpcm-vp-controls {
  opacity: 0;
}
.wpcm-vp-wrap.wpcm-idle {
  cursor: none;
}

/* ── Spinner ── */
.wpcm-vp-spinner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 8;
  pointer-events: none;
}
.wpcm-vp-wrap.wpcm-buffering .wpcm-vp-spinner {
  display: flex;
}
.wpcm-vp-spinner::after {
  content: "";
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--wpcm-accent);
  border-radius: 50%;
  animation: wpcm-spin 0.75s linear infinite;
}
@keyframes wpcm-spin {
  to { transform: rotate(360deg); }
}

/* ── Play Overlay ── */
.wpcm-vp-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  transition: opacity 0.25s ease;
  z-index: 10;
  cursor: pointer;
}
.wpcm-vp-overlay svg {
  width: 60px;
  height: 60px;
  fill: #fff;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  transition: transform 0.2s ease;
}
.wpcm-vp-overlay:hover svg {
  transform: scale(1.1);
}

/* ── Error Pane ── */
.wpcm-vp-error {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  z-index: 20;
  gap: 12px;
  padding: 24px;
  text-align: center;
  line-height: 1.5;
  font-size: 14px;
}
.wpcm-vp-wrap.wpcm-error .wpcm-vp-error {
  display: flex;
}
.wpcm-vp-error button {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  background: var(--wpcm-accent);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.wpcm-vp-error button:hover {
  background: #b0070f;
}

/* ── Action Toast ── */
.wpcm-vp-action-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  z-index: 25;
  white-space: nowrap;
}
.wpcm-vp-action-toast.wpcm-show {
  animation: wpcm-toast-pop 0.8s ease forwards;
}
@keyframes wpcm-toast-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  12%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  72%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
}

/* ── Resume Toast ── */
.wpcm-vp-toast {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 18;
  cursor: pointer;
  transition: opacity 0.4s;
  white-space: nowrap;
}
.wpcm-vp-toast.wpcm-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Preview Tooltip (canvas fallback) ── */
.wpcm-vp-preview {
  position: absolute;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: 160px;
  height: 90px;
  border: 2px solid #fff;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 16;
}
.wpcm-vp-preview.wpcm-visible {
  opacity: 1;
}
.wpcm-vp-preview canvas {
  width: 100%;
  height: 100%;
}

/* ── Preview Tooltip (VTT sprite) ── */
.wpcm-vp-preview-sprite {
  position: absolute;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: 160px;
  height: 90px;
  border: 2px solid #fff;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 16;
}
.wpcm-vp-preview-sprite.wpcm-visible {
  opacity: 1;
}

/* ── Controls Bar ── */
.wpcm-vp-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 0 12px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  transition: opacity 0.3s ease;
  z-index: 15;
}

/* ── Progress Bar ── */
.wpcm-vp-progress {
  position: relative;
  width: 100%;
  height: 5px;
  margin-bottom: 8px;
  cursor: pointer;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  transition: height 0.12s ease;
}
.wpcm-vp-progress:hover {
  height: 9px;
}
.wpcm-vp-buffer {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  pointer-events: none;
}
.wpcm-vp-played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--wpcm-accent);
  border-radius: 3px;
  pointer-events: none;
}
.wpcm-vp-played::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 14px;
  height: 14px;
  background: var(--wpcm-accent);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease;
}
.wpcm-vp-progress:hover .wpcm-vp-played::after {
  transform: translateY(-50%) scale(1);
}

/* ── Control Buttons ── */
.wpcm-vp-btn {
  background: none;
  border: none;
  color: #fff;
  padding: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s;
  outline: none;
}
.wpcm-vp-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.wpcm-vp-btn:active {
  background: rgba(255, 255, 255, 0.2);
}
.wpcm-vp-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  pointer-events: none;
}

/* ── Volume ── */
.wpcm-vp-vol-wrap {
  display: flex;
  align-items: center;
  margin-left: 2px;
}
.wpcm-vp-vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 64px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin-left: 4px;
}
.wpcm-vp-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
}
.wpcm-vp-vol-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  background: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* ── Time ── */
.wpcm-vp-time {
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  margin: 0 8px;
  white-space: nowrap;
  line-height: 1;
  user-select: none;
}

/* ── Spacer ── */
.wpcm-vp-spacer {
  flex: 1;
}

/* ── Gear Menu ── */
.wpcm-vp-gear-wrap {
  position: relative;
}
.wpcm-vp-gear-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: rgba(18, 18, 18, 0.96);
  border-radius: 8px;
  padding: 6px 0;
  display: none;
  z-index: 22;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
}
.wpcm-vp-gear-wrap.wpcm-open .wpcm-vp-gear-menu {
  display: block;
}
.wpcm-vp-gear-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  color: #ccc;
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
  text-align: left;
}
.wpcm-vp-gear-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.wpcm-vp-gear-menu button .wpcm-val {
  color: var(--wpcm-accent);
  font-weight: 600;
}
.wpcm-vp-gear-sub {
  display: none;
  padding: 4px 0;
}
.wpcm-vp-gear-sub.wpcm-open {
  display: block;
}
.wpcm-vp-gear-sub button.wpcm-active {
  color: var(--wpcm-accent);
}

/* ── Embed Wrapper ── */
.wpcm-vp-embed-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  overflow: hidden;
  background: #000;
}
.wpcm-vp-embed-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Overlay sobre o iframe — bloqueia cliques diretos.
   z-index ABAIXO dos controles para nao atrapalhar botoes. */
.wpcm-vp-embed-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
}

/* Barra opaca no topo — esconde titulo do YouTube */
.wpcm-vp-yt-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.92) 40%, transparent);
  z-index: 6;
  pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .wpcm-vp-controls {
    padding: 0 6px 6px;
  }
  .wpcm-vp-btn svg {
    width: 18px;
    height: 18px;
  }
  .wpcm-vp-time {
    font-size: 11px;
    margin: 0 5px;
  }
  .wpcm-vp-vol-slider {
    width: 48px;
  }
  .wpcm-vp-overlay svg {
    width: 44px;
    height: 44px;
  }
  .wpcm-vp-preview,
  .wpcm-vp-preview-sprite {
    width: 120px;
    height: 68px;
  }
  .wpcm-vp-action-toast {
    font-size: 13px;
    padding: 8px 16px;
  }
}

@media (max-width: 380px) {
  .wpcm-vp-vol-wrap {
    display: none;
  }
}
