/* CSS Global & Variáveis de Design */
:root {
  --primary-color: #ff2a5f; /* Cor padrão (estilo VTURB/Hotmart) */
  --bg-color: #0b0c10;
  --overlay-bg: rgba(11, 12, 16, 0.85);
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --cta-bg: #ff2a5f;
  --cta-text: #ffffff;
  --cta-border: #ff2a5f;
  --cta-hover: #ff6b8b;
  --font-family: 'Outfit', sans-serif;
  --border-radius: 16px;
  --progress-height: 5px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  font-family: var(--font-family);
  overflow: hidden;
  color: var(--text-primary);
  user-select: none; /* Previne cópia e arrasto de texto */
  -webkit-user-select: none;
}

/* Container do Player */
.vsl-player-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background-color: #000;
}

.vsl-media-stage {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background-color: #000;
}

.vsl-player-container.media-natural {
  align-items: stretch;
  justify-content: flex-start;
}

.vsl-player-container.media-natural .vsl-media-stage {
  height: auto;
  flex: 0 0 auto;
  aspect-ratio: var(--stage-aspect-ratio, 16 / 9);
}

/* Vídeo HTML5 */
video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Faz o vídeo preencher o contêiner. JS pode mudar para contain se necessário */
  pointer-events: auto; /* Controlado via JS */
  cursor: pointer;
}

/* Remove os controles nativos do iOS no modo fullscreen se ativados acidentalmente */
video::-webkit-media-controls {
  display: none !important;
}

/* Barra de Progresso Customizada */
.vsl-progress-container {
  position: absolute;
  left: 0;
  width: 100%;
  height: 10px;
  z-index: 10;
  cursor: default;
  pointer-events: none;
  touch-action: none;
}

/* Posição padrão da barra: topo. Pode ser configurado para o rodapé */
.vsl-progress-container.top {
  top: 0;
}

.vsl-progress-container.bottom {
  bottom: 0;
}

.vsl-progress-track,
.vsl-progress-bar {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 5px;
  border-radius: 999px;
}

.vsl-progress-track {
  width: 100%;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.vsl-progress-bar {
  width: 100%;
  background: linear-gradient(90deg, var(--primary-color) 0%, #ff6b8b 100%);
  box-shadow: 0 0 10px var(--primary-color);
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}

.vsl-progress-knob {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  left: 0%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 42, 95, 0.22), 0 0 18px rgba(255, 42, 95, 0.5);
  opacity: 0.96;
}

/* Spinner de Carregamento (Buffering) */
.vsl-loader {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: auto;
  height: auto;
  min-width: 64px;
  min-height: 64px;
  padding: 12px 14px;
  border-radius: 999px;
  background: rgba(8, 9, 12, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.vsl-loader.active {
  opacity: 1;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@media (max-width: 768px) {
  .vsl-loader {
    right: 12px;
    bottom: 12px;
    min-width: 54px;
    min-height: 54px;
    padding: 10px 12px;
  }

  .spinner {
    width: 22px;
    height: 22px;
  }
}

/* Estilo Base dos Overlays */
.vsl-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.vsl-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.empty-state-overlay {
  z-index: 24;
}

.empty-state-card {
  text-align: center;
  padding: 44px 40px;
  max-width: 520px;
  width: 90%;
  border-radius: 20px;
  background: rgba(4, 5, 8, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.empty-state-card .overlay-text {
  margin-top: 10px;
}

/* Conteúdo do Smart Autoplay */
.smart-autoplay-content {
  text-align: center;
  padding: 40px;
  max-width: 480px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.overlay-kicker {
  margin: 0 0 12px;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 700;
}

/* Ícone de Som Pulsante */
.pulse-speaker-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 25px;
  color: var(--text-primary);
}

.speaker-icon {
  width: 45px;
  height: 45px;
  animation: shake 1.5s infinite ease-in-out;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: ring-pulse 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* Títulos e Textos dos Overlays */
.overlay-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.overlay-text {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 30px;
  font-weight: 300;
  line-height: 1.6;
  max-width: 32ch;
}

.overlay-note {
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

/* Botões Customizados */
.overlay-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 18px 38px;
  font-size: 18px;
  font-weight: 800;
  border-radius: var(--border-radius);
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(255, 42, 95, 0.4);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.5px;
}

.overlay-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 30px rgba(255, 42, 95, 0.6);
}

.overlay-btn:active {
  transform: scale(0.98);
}

/* Overlay de Pausa */
.play-icon-wrapper {
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 25px;
  color: #fff;
  transition: all 0.3s ease;
}

.replay-icon-wrapper {
  background: rgba(255, 42, 95, 0.12);
  border-color: rgba(255, 42, 95, 0.24);
}

.play-icon {
  width: 35px;
  height: 35px;
  margin-left: 6px; /* Ajuste visual do triângulo de play */
}

.replay-icon {
  margin-left: 0;
}

.pause-overlay-content {
  text-align: center;
  padding: 40px;
  max-width: 480px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.replay-overlay-content {
  text-align: center;
  padding: 40px;
  max-width: 480px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pause-overlay-content:hover .play-icon-wrapper {
  background: var(--primary-color);
  border-color: var(--primary-color);
  box-shadow: 0 0 25px var(--primary-color);
  transform: scale(1.1);
}

.replay-overlay-content:hover .replay-icon-wrapper {
  background: rgba(255, 42, 95, 0.22);
  border-color: var(--primary-color);
  box-shadow: 0 0 25px rgba(255, 42, 95, 0.35);
  transform: scale(1.1);
}

/* Modal do Smart Resume */
.resume-modal {
  background: rgba(20, 21, 26, 0.9);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 35px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.resume-overlay.active .resume-modal {
  transform: translateY(0);
}

.resume-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.resume-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 25px;
}

.cta-overlay {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: rgba(11, 12, 16, 0.38);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.cta-overlay[data-placement="overlay"] {
  align-items: center;
  justify-content: center;
}

.cta-overlay[data-placement="dock"] {
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 28px;
}

.cta-overlay[data-placement="dock"] .cta-card {
  width: min(760px, 100%);
  max-width: 760px;
  margin-bottom: 0;
}

.cta-overlay[data-placement="inline"] {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  width: 100%;
  height: auto;
  order: 99;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
  margin-top: 0;
  background-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: none;
  opacity: 0;
  pointer-events: none;
}

.cta-overlay[data-placement="inline"].active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.cta-overlay[data-placement="inline"] .cta-card {
  width: 100%;
  max-width: none;
  margin: 0;
}

.cta-overlay[data-placement="inline"] .cta-html-container {
  width: 100%;
  max-width: none;
}

.vsl-player-container.cta-inline-mode .cta-overlay[data-placement="inline"] {
  width: 100%;
}

.vsl-player-container.cta-inline-mode {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.vsl-player-container.cta-inline-mode .vsl-media-stage {
  flex: 1 1 auto;
  margin-bottom: 18px;
}

.vsl-player-container.cta-inline-mode .cta-overlay[data-placement="inline"] {
  flex: 0 0 auto;
}

.vsl-player-container.cta-page-mode {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.vsl-player-container.cta-page-mode .vsl-media-stage {
  flex: 0 0 auto;
  margin-bottom: 18px;
}

.vsl-player-container.cta-page-mode .cta-overlay[data-placement="page"] {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  order: 99;
  width: 100%;
  height: auto;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 22px 0 0;
  background-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: visible;
  display: none;
  opacity: 0;
  pointer-events: none;
}

.vsl-player-container.cta-page-mode .cta-overlay[data-placement="page"].active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.cta-overlay[data-placement="page"] {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  background-color: rgba(11, 12, 16, 0.98);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: auto;
  z-index: 23;
}

.cta-overlay[data-placement="page"].active {
  pointer-events: auto;
}

.cta-overlay[data-placement="page"] .cta-card {
  width: 100%;
  max-width: none;
  min-height: auto;
  margin: 0;
  padding: 28px 0 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.cta-overlay[data-placement="page"] .cta-html-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  width: 100%;
  max-width: none;
}

.cta-overlay[data-placement="page"] .cta-html-container > * {
  width: 100% !important;
  max-width: none !important;
}

.cta-overlay[data-placement="hidden"] {
  display: none;
}

.cta-card {
  max-width: 420px;
  width: min(100%, 420px);
  padding: 24px;
  margin: 0;
  border-radius: 22px;
  background: rgba(15, 17, 23, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.cta-card.is-minimal {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.cta-card.is-minimal .cta-title,
.cta-card.is-minimal .cta-text,
.cta-card.is-minimal .cta-subtext {
  text-align: center;
}

.cta-card[data-mode="html"] .cta-kicker,
.cta-card[data-mode="html"] .cta-title,
.cta-card[data-mode="html"] .cta-text,
.cta-card[data-mode="html"] .cta-button,
.cta-card[data-mode="html"] .cta-subtext {
  display: none !important;
}

.cta-card[data-mode="html"] .cta-html-container {
  margin-bottom: 0;
}

.cta-kicker[hidden],
.overlay-kicker[hidden] {
  display: none !important;
}

.cta-title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.cta-title[hidden],
.cta-text[hidden],
.cta-subtext[hidden] {
  display: none !important;
}

.cta-text,
.cta-subtext {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.55;
}

.cta-text {
  margin-bottom: 18px;
}

.cta-html-container {
  margin-bottom: 16px;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.cta-button {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--cta-bg);
  color: var(--cta-text);
  border: 1px solid var(--cta-border);
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 14px 30px rgba(255, 42, 95, 0.28);
}

.cta-button:hover {
  transform: translateY(-1px);
  background: var(--cta-hover);
}

.cta-subtext {
  margin-top: 12px;
  font-size: 13px;
}

.cta-html-container > * {
  max-width: 100%;
}

.cta-html-frame {
  display: block;
  width: 100%;
  min-height: clamp(540px, 72vh, 1200px);
  border: 0;
  background: transparent;
}

.cta-overlay[data-placement="page"] .cta-html-frame {
  min-height: 78vh;
}

.cta-overlay[data-placement="inline"] .cta-html-frame {
  min-height: clamp(640px, 82vh, 1320px);
}

.cta-html-container[data-has-frame="true"] {
  display: block;
}

.cta-html-container a,
.cta-html-container button {
  cursor: pointer;
}

.cta-empty {
  color: var(--text-secondary);
  font-size: 14px;
  padding: 10px 0;
}

.cta-html-container img,
.cta-html-container iframe {
  max-width: 100%;
}

#resumeTimeDisplay {
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.resume-buttons {
  display: flex;
  gap: 15px;
}

.replay-overlay {
  z-index: 22;
}

.access-denied-content {
  text-align: center;
  padding: 40px;
  max-width: 520px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.access-denied-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.access-domain-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 13px;
}

.resume-btn {
  flex: 1;
  border: none;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.resume-btn.btn-primary {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 5px 15px rgba(255, 42, 95, 0.3);
}

.resume-btn.btn-primary:hover {
  background: #ff4775;
  transform: translateY(-2px);
}

.resume-btn.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.resume-btn.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

@media (max-width: 720px) {
  .smart-autoplay-content,
  .pause-overlay-content,
  .replay-overlay-content,
  .resume-modal,
  .access-denied-content,
  .cta-card {
    width: 92%;
    padding: 28px 22px;
  }

  .overlay-title {
    font-size: 24px;
  }

  .overlay-text {
    font-size: 15px;
    max-width: 28ch;
  }

  .overlay-btn {
    width: 100%;
    justify-content: center;
  }

  .resume-buttons {
    flex-direction: column;
  }

  .access-denied-list {
    gap: 8px;
  }

  .cta-overlay {
    padding: 16px;
  }

  .play-icon-wrapper {
    width: 82px;
    height: 82px;
  }

  .speaker-icon {
    width: 40px;
    height: 40px;
  }
}

/* ANIMAÇÕES CSS */

/* Rotação Spinner */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Pulsação do Botão */
.pulsate {
  animation: button-pulse 1.8s infinite alternate-reverse;
}

@keyframes button-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 10px 25px rgba(255, 42, 95, 0.4);
  }
  100% {
    transform: scale(1.05);
    box-shadow: 0 15px 35px rgba(255, 42, 95, 0.7);
  }
}

/* Animação do Círculo de Som */
@keyframes ring-pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Tremor do Speaker */
@keyframes shake {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(3deg); }
  20% { transform: rotate(-3deg); }
  30% { transform: rotate(3deg); }
  40% { transform: rotate(-3deg); }
  50% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

/* CAMADA ANALÍTICA DE RETENÇÃO (EXCLUSIVO ADMIN) */
.vsl-analytics-layer {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  height: 90px;
  background: rgba(4, 5, 8, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 8;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(10px);
}

.vsl-analytics-layer[hidden] {
  display: none !important;
}

.vsl-player-container:hover .vsl-analytics-layer:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.analytics-layer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.analytics-layer-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a0aec0;
  font-weight: 700;
}

.analytics-layer-badge {
  font-size: 0.72rem;
  background: rgba(255, 42, 95, 0.15);
  border: 1px solid rgba(255, 42, 95, 0.25);
  color: #ffb3c5;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 700;
}

.analytics-heatmap-container {
  position: relative;
  height: 52px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  overflow: visible;
  cursor: crosshair;
}

.analytics-heatmap-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.analytics-heatmap-path {
  transition: d 0.3s ease;
}

.analytics-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 4px rgba(255, 42, 95, 0.8);
  pointer-events: none;
  left: 0;
}

.analytics-layer-tooltip {
  position: absolute;
  bottom: 60px;
  background: #0b0c10;
  border: 1px solid rgba(255, 42, 95, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 12;
  transform: translateX(-50%);
  transition: left 0.1s linear;
}

.analytics-layer-tooltip strong {
  color: #ff2a5f;
  font-weight: 700;
}
