/* ============================================================
   PMK Video Mockup — Stylesheet
   v1.1.0 | GaiaLab

   NOTA COMPATIBILITÀ:
   Tutti i selettori per elementi interni (.pmk-screen, .pmk-clip,
   .pmk-video, .pmk-controls, .pmk-btn, .pmk-progress, …) sono
   racchiusi sotto .pmk-v2 per evitare conflitti con implementazioni
   precedenti che usano le stesse classi CSS sullo stesso sito.
   ============================================================ */

/* ── 1. WRAPPER ─────────────────────────────────────────────── */

/* .pmk-v2 è la classe univoca del nuovo sistema (aggiunta dal plugin) */
.pmk-v2 {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  /* CSS custom property per colore accent (overridden inline dallo shortcode) */
  --pmk-accent: #7c5cfc;
}

/* ── 2. PHONE FRAME ─────────────────────────────────────────── */

.pmk-phone-frame {
  position: relative;
  border-radius: 52px;           /* Override via Elementor slider */
  width: 280px;                  /* Override via Elementor slider */
  flex-shrink: 0;
  box-sizing: border-box;
  /* Padding interno: top/bottom riservati al notch + chin,
     left/right per lo spessore del frame laterale              */
  padding: 55px 12px 24px;
}

/* ── Frame: Dark (Space Black) ── */
.pmk-frame-dark .pmk-phone-frame {
  background: #1c1c1e;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 30px 70px -10px rgba(0, 0, 0, 0.50);
}

/* ── Frame: Light (Starlight / Silver) ── */
.pmk-frame-light .pmk-phone-frame {
  background: linear-gradient(160deg, #e8e8ed 0%, #c8c8ce 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.70),
    0 0 0 1px rgba(0, 0, 0, 0.15),
    0 30px 70px -10px rgba(0, 0, 0, 0.25);
}

/* ── Frame: Gold ── */
.pmk-frame-gold .pmk-phone-frame {
  background: linear-gradient(145deg, #dbb36c 0%, #b8892a 50%, #cfa348 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    0 0 0 1px rgba(0, 0, 0, 0.30),
    0 30px 70px -10px rgba(0, 0, 0, 0.40);
}

/* ── Frame: None (solo schermo, nessun frame) ── */
.pmk-frame-none .pmk-phone-frame {
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

/* ── 3. NOTCH ─────────────────────────────────────────────── */

.pmk-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 42%;
  height: 34px;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  border-radius: 0 0 24px 24px;
  pointer-events: none;
}

.pmk-frame-dark  .pmk-notch { background: #1c1c1e; }
.pmk-frame-light .pmk-notch { background: #c8c8ce; }
.pmk-frame-gold  .pmk-notch { background: #b8892a; }

/* Pill del notch (capsula interna visibile sullo schermo) */
.pmk-notch__pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 26px;
  background: #000;
  border-radius: 14px;
  position: relative;
  /* Visible only when the notch pill peeks into the screen area */
}

/* Camerino frontale */
.pmk-notch__cam {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #0f1012;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.08),
    0 0 6px 1px rgba(80, 140, 220, 0.20);
}

/* ── 4. TASTI LATERALI (decorativi) ─────────────────────────── */

/* Tasto power — lato destro */
.pmk-side-btn {
  position: absolute;
  border-radius: 2px;
}

.pmk-side-btn--power {
  right: -5px;
  top: 23%;
  width: 5px;
  height: 65px;
  border-radius: 0 3px 3px 0;
}

/* Pulsanti volume — lato sinistro */
.pmk-side-btn--vol-up {
  left: -5px;
  top: 20%;
  width: 5px;
  height: 42px;
  border-radius: 3px 0 0 3px;
}

.pmk-side-btn--vol-dn {
  left: -5px;
  top: calc(20% + 55px);
  width: 5px;
  height: 42px;
  border-radius: 3px 0 0 3px;
}

/* Colori tasti per variante frame */
.pmk-frame-dark  .pmk-side-btn { background: #2c2c30; }
.pmk-frame-light .pmk-side-btn { background: #b0b0b8; }
.pmk-frame-gold  .pmk-side-btn { background: #9a7020; }

/* ── 5. SCREEN (scoped sotto .pmk-v2) ────────────────────────── */

.pmk-v2 .pmk-screen {
  position: relative;
  overflow: hidden;
  /* Aspect ratio iPhone 13/14: 390×844 ≈ 9:19.47 */
  aspect-ratio: 9 / 19.5;
  width: 100%;
  border-radius: 41px;           /* frame_border_radius - 11px dal controllo */
  background: #000;
}

.pmk-frame-none .pmk-v2 > .pmk-phone-frame > .pmk-screen {
  border-radius: 0;
}

/* ── 6. VIDEO CLIP + VIDEO (scoped) ─────────────────────────── */

.pmk-v2 .pmk-clip {
  position: absolute;
  inset: 0;
  /* GPU compositing layer */
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  isolation: isolate;
}

.pmk-v2 .pmk-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* GPU compositing */
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* ── 7. IFRAME YouTube / Vimeo (scoped) ─────────────────────── */

.pmk-v2 .pmk-iframe {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  display: block !important;
  background: #000;
}

/* Override wrapper Vimeo Player SDK (è un div con padding-top) */
.pmk-v2 .pmk-clip > div {
  position: absolute !important;
  inset: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

/* Overlay trasparente per catturare hover/click sull'iframe */
.pmk-v2 .pmk-iframe-cover {
  position: absolute;
  inset: 0;
  z-index: 10;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ── 8. CONTROLS OVERLAY (scoped) ────────────────────────────── */

.pmk-v2 .pmk-controls {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 20;
  /* Gradiente scuro dal basso verso l'alto */
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.82) 0%,
    rgba(0, 0, 0, 0.45) 55%,
    transparent 100%
  );
  padding-top: 48px;
  /* Visibilità: nascosti di default, visibili all'hover via JS */
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.pmk-v2 .pmk-controls.pmk-controls--visible {
  opacity: 1;
  pointer-events: auto;
}

/* Inner: riga con i controlli */
.pmk-v2 .pmk-controls__inner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px 16px;
}

/* ── 9. BOTTONI (scoped) ─────────────────────────────────────── */

.pmk-v2 .pmk-btn {
  flex-shrink: 0;
  background: #4F1D8A !important;  /* colore brand viola */
  border: none !important;
  cursor: pointer;
  padding: 3px !important;
  color: #fff;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s ease, transform 0.1s ease;
  outline: none !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent;
}

/* Bottone audio: icone impilate verticalmente */
.pmk-v2 .pmk-btn--audio {
  flex-direction: column;
  gap: 2px;
}

.pmk-v2 .pmk-btn:hover {
  background: #6B2EC7 !important;
}

.pmk-v2 .pmk-btn:active {
  transform: scale(0.90);
  background: #3D1570 !important;
}

.pmk-v2 .pmk-btn:focus,
.pmk-v2 .pmk-btn:focus-visible {
  outline: none;
  box-shadow: none !important;
  background: #4F1D8A !important;
}

.pmk-v2 .pmk-btn svg {
  fill: #fff;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

/* ── Switching icone Play / Pause (scoped) ── */

.pmk-v2 .pmk-icon--pause { display: none; }
.pmk-v2 .pmk-btn--play.pmk-playing .pmk-icon--play  { display: none; }
.pmk-v2 .pmk-btn--play.pmk-playing .pmk-icon--pause { display: block; }

/* ── Switching icone Muted / Sound (scoped) ──
   Quando il video è in muto: entrambe le icone (muted + sound) sono visibili.
   Quando l'audio è attivo: solo l'icona sound è visibile. ── */

.pmk-v2 .pmk-btn--audio.pmk-audio-on .pmk-icon--muted { display: none; }

/* ── 10. IMMAGINE FRAME PNG (scoped) ────────────────────────── */

/* Overlay immagine telefono custom (PNG con area schermo trasparente).
   Posizionata in cima a tutto; pointer-events:none lascia i controlli cliccabili. */
.pmk-v2 .pmk-frame-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;        /* si adatta esattamente al contenitore */
  pointer-events: none;
  z-index: 50;             /* sopra i controlli (z-index 20) */
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}

/* Quando si usa un PNG custom, nasconde il frame CSS per evitare sovrapposizioni */
.pmk-has-frame-img .pmk-phone-frame {
  background: transparent !important;
  box-shadow: none !important;
}
.pmk-has-frame-img .pmk-notch,
.pmk-has-frame-img .pmk-side-btn {
  display: none !important;
}
.pmk-has-frame-img .pmk-v2 .pmk-screen {
  border-radius: 0;
}

/* ── 11. BARRA DI PROGRESSO (scoped) ────────────────────────── */

.pmk-v2 .pmk-progress {
  flex: 1;
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.30);
  border-radius: 99px;
  cursor: pointer;
  touch-action: none;      /* evita scroll durante il drag */
  transition: height 0.15s ease;
  /* Aumenta l'area di click con padding verticale via pseudo-element */
}

/* Area di hit più grande senza aumentare l'altezza visiva */
.pmk-v2 .pmk-progress::before {
  content: '';
  position: absolute;
  inset: -10px 0;
  z-index: 1;
}

/* Ingrandisce la barra all'hover / active per feedback visivo */
.pmk-v2 .pmk-progress:hover,
.pmk-v2 .pmk-progress[data-dragging] {
  height: 6px;
}

/* Fill (progresso attuale) */
.pmk-v2 .pmk-progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--pmk-accent, #7c5cfc); /* colore override via Elementor o shortcode */
  border-radius: 99px;
  pointer-events: none;
  /* Transizione fluida aggiornata ogni ~16ms via timeupdate */
}

/* Thumb (pallino di seek) */
.pmk-v2 .pmk-progress__thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%) scale(0);
  width: 14px;
  height: 14px;
  background: var(--pmk-accent, #7c5cfc);
  border-radius: 50%;
  pointer-events: none;
  transition:
    transform 0.15s ease,
    background 0.15s ease;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}

/* Mostra il thumb all'hover e durante il drag */
.pmk-v2 .pmk-progress:hover .pmk-progress__thumb,
.pmk-v2 .pmk-progress[data-dragging] .pmk-progress__thumb {
  transform: translate(-50%, -50%) scale(1);
}

/* ── 12. PLACEHOLDER (solo editor Elementor) ─────────────────── */

.pmk-mockup-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 32px 24px;
  background: #f8f8f8;
  border: 2px dashed #d0d0d5;
  border-radius: 12px;
  color: #888;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-align: center;
  line-height: 1.5;
}

.pmk-mockup-placeholder p {
  margin: 0;
  color: #999;
}

/* ── 13. RESPONSIVE ──────────────────────────────────────────── */

@media (max-width: 767px) {
  .pmk-v2 .pmk-video,
  .pmk-v2 .pmk-iframe {
    transform: translate3d(0, 0, 0) !important;
  }

  .pmk-v2 .pmk-btn {
    padding: 4px;
  }

  .pmk-v2 .pmk-progress {
    height: 5px;
  }
}

/* ── 14. COMPATIBILITÀ ELEMENTOR ─────────────────────────────── */

.elementor-widget-pmk-video-mockup .pmk-v2 .pmk-clip,
.elementor-widget-pmk-video-mockup .pmk-v2 .pmk-video {
  transform: translateZ(0) !important;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

@media (max-width: 767px) {
  .elementor-widget-pmk-video-mockup .pmk-v2 .pmk-video {
    transform: translate3d(0, 0, 0) !important;
  }
}
/* ── 15. SUPPORTO HTML CUSTOM (.pmk-mockup senza .pmk-v2) ─────────
   Usato dalle pagine con blocchi HTML diretti (Easy Custom JS & CSS).
   will-change: transform crea un layer GPU senza conflitti con il
   "transform:none!important" che le pagine usano per neutralizzare
   gli effetti di Elementor sul wrapper.
   ─────────────────────────────────────────────────────────────────── */

.pmk-mockup:not(.pmk-v2) .pmk-clip {
  will-change: transform;
  isolation: isolate;
}

.pmk-mockup:not(.pmk-v2) .pmk-video {
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Controlla la visualizzazione dei controlli solo all'hover su desktop */
@media (hover: hover) and (pointer: fine) {
  .pmk-mockup:not(.pmk-v2) .pmk-controls:not(.pmk-controls--visible) {
    opacity: 0;
    pointer-events: none;
  }
}