:root {
  /* Default accent (overridden per-product by clickmarket-bridge.js) */
  --cm-accent: #00cdcd;
  --cm-accent-rgb: 0 205 205;
  /* Responsive play button sizing: scales with viewport, capped for readability */
  --cm-play-w: clamp(60px, 8vw, 140px);
  --cm-play-h: clamp(36px, 5vw, 84px);
  --cm-play-svg: none;
}

.cm-vsl-container {
  width: 100%;
  max-width: 100%;
  display: block;
}

/* Reserve stable layout space for the hero VSL (prevents CTA overlap while JS/video loads). */
.cm-vsl-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  background: #000;
  overflow: hidden;
}

/* Pre-JS placeholder for deterministic VSL mount nodes (shows while clickmarket-bridge resolves the video). */
.cm-vsl-mount {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  background: #000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  color: rgb(255 255 255 / 0.86);
  font: 13px/1.3 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  text-align: center;
}

.cm-vsl-mount::before {
  content: '';
  width: var(--cm-play-w);
  height: var(--cm-play-h);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: var(--cm-play-svg);
  opacity: 0.92;
}

.cm-vsl-mount::after {
  content: 'Loading video…';
}

.cm-vsl-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(180deg, rgb(0 0 0 / 0.55), rgb(0 0 0 / 0.82));
  color: rgb(255 255 255 / 0.9);
  text-align: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity 180ms ease;
}

.cm-vsl-loading__badge {
  width: var(--cm-play-w);
  height: var(--cm-play-h);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: var(--cm-play-svg);
  opacity: 0.92;
}

.cm-vsl-loading__text {
  font: 13px/1.3 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  letter-spacing: 0.01em;
}

.cm-vsl-loading--hidden {
  opacity: 0;
}

/* Hide embedded checkout/pricing blocks even before JS runs (removed at runtime too). */
[id^='Pricing'],
[id^='pricing'],
.wcf-embed-checkout-form,
form.woocommerce-checkout,
.woocommerce-checkout,
#order_review,
#payment {
  display: none !important;
}

.cm-vsl-missing-message {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px dashed rgb(var(--cm-accent-rgb) / 0.55);
  background: rgb(var(--cm-accent-rgb) / 0.08);
  color: #111;
  font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

.cm-vsl.video-js {
  width: 100%;
  height: auto;
}

.cm-vsl-frame .cm-vsl.video-js {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.cm-vsl.video-js .vjs-control-bar {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Speed control should remain visible even on small layouts (ClickMarket allows speed changes). */
.cm-vsl.video-js.vjs-layout-small .vjs-playback-rate,
.cm-vsl.video-js.vjs-layout-tiny .vjs-playback-rate,
.cm-vsl.video-js.vjs-layout-x-small .vjs-playback-rate {
  display: flex !important;
}

/* Theme the progress/volume bars using the product accent. */
.cm-vsl.video-js .vjs-play-progress,
.cm-vsl.video-js .vjs-volume-level {
  background-color: rgb(var(--cm-accent-rgb) / 0.95) !important;
}

.cm-vsl.video-js .vjs-slider-bar::before {
  background-color: rgb(var(--cm-accent-rgb) / 0.95) !important;
}

/* Big play button: custom SVG badge (generated dynamically per product). */
.cm-vsl.video-js .vjs-big-play-button {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) scale(1) !important;
  width: var(--cm-play-w) !important;
  height: var(--cm-play-h) !important;
  border: 0 !important;
  background: transparent !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  /* Apply shadow at the element level (avoids hover aliasing artifacts in some browsers). */
  filter: drop-shadow(0 10px 12px rgb(0 0 0 / 0.18)) drop-shadow(0 4px 6px rgb(0 0 0 / 0.22));
  will-change: transform;
  transition: transform 160ms ease;
}

.cm-vsl.video-js.vjs-playing:not(.cm-vsl-preview) .vjs-big-play-button {
  display: none !important;
}

.cm-vsl.video-js.vjs-paused.vjs-has-started .vjs-big-play-button,
.cm-vsl.video-js:not(.vjs-has-started) .vjs-big-play-button {
  display: flex !important;
}

.cm-vsl.video-js .vjs-big-play-button .vjs-icon-placeholder {
  display: none !important;
}

.cm-vsl.video-js .vjs-big-play-button::before {
  content: '';
  width: 100%;
  height: 100%;
  display: block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: var(--cm-play-svg);
  filter: none;
  transition: filter 160ms ease;
}

.cm-vsl.video-js .vjs-big-play-button:hover {
  transform: translate(-50%, -50%) scale(1.1) !important;
}

/* Hover: brighten slightly (desktop pointer only). */
@media (hover: hover) and (pointer: fine) {
  .cm-vsl.video-js .vjs-big-play-button:hover::before {
    filter: brightness(1.07);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cm-vsl.video-js .vjs-big-play-button {
    transition: none !important;
  }

  .cm-vsl.video-js .vjs-big-play-button::before {
    transition: none !important;
  }
}

/* Mobile sizing: slightly more square-ish, but still readable. */
/* Mobile sizing handled by clamp() in :root now */

/* Smaller buttons for testimonial videos (cards) */
.cm-testimonial-container .vjs-big-play-button,
[data-cm-testimonial-mount] .vjs-big-play-button {
  --cm-play-w: clamp(40px, 18%, 80px) !important;
  --cm-play-h: clamp(24px, 11%, 48px) !important;
}

/* Fix HearthWell Gap: Collapse spacer widgets after VSL mount */
.cm-vsl-mount+.elementor-widget-spacer,
.elementor-shortcode+.elementor-widget-spacer {
  display: none !important;
}

/* Debug overlay (shown when ?vsl_debug=1) */
.cm-debug-overlay {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 2147483647;
  max-width: calc(100vw - 24px);
  padding: 10px 12px;
  border-radius: 10px;
  background: rgb(0 0 0 / 0.68);
  color: #fff;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  white-space: pre-wrap;
}

/* ---------- Testimonial video containers ---------- */
/*
 * These CSS rules fix the spacing issues from old Spotlightr iframe containers
 * that had `padding-bottom:56.25%` and `height:310%` inline styles.
 */
.cm-testimonial-container {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}

/* Elementor sometimes stretches these cards to equal height, creating huge blank gaps. */
.cm-testimonial-card {
  height: auto !important;
  min-height: 0 !important;
  align-self: flex-start !important;
  justify-content: flex-start !important;
}

.cm-testimonial-card.e-con {
  --justify-content: flex-start !important;
  --align-items: stretch !important;
  --align-self: flex-start !important;
  --flex-grow: 0 !important;
  --container-widget-height: initial !important;
  --container-widget-flex-grow: 0 !important;
  --container-widget-align-self: flex-start !important;
  flex-grow: 0 !important;
  align-self: flex-start !important;
}

/* Testimonial video styling */
.cm-testimonial.video-js {
  width: 100%;
  height: auto;
  aspect-ratio: var(--cm-testimonial-aspect, 16 / 9);
}

/* Fix the Elementor HTML widget wrapper that contained the old Spotlightr iframe */
.elementor-widget-html .cm-testimonial-video {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  padding-bottom: 0 !important;
  min-width: unset !important;
}

/* Remove excess spacing from spacer widgets after testimonials */
.elementor-widget-html+.elementor-widget-spacer .elementor-spacer {
  height: auto !important;
  min-height: 0 !important;
  max-height: 16px !important;
}
