/* ═══════════════════════════════════════════════════════════
   SQUISHY LAND — MODULE VIDÉO PRODUIT & CATALOGUE
   Zéro CLS, Glassmorphism, Bouton direct sur photo & Hover déporté
   ═══════════════════════════════════════════════════════════ */

/* ── 1. BOUTON DÉCLENCHEUR SUR L'IMAGE PRINCIPALE ────────── */
.sl-gallery-video-trigger {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 28;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #E11D48;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid rgba(225, 29, 72, 0.25);
  box-shadow: 0 8px 24px -4px rgba(225, 29, 72, 0.22), 0 2px 6px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.sl-gallery-video-trigger .sl-video-badge-icon {
  width: 15px;
  height: 15px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.sl-gallery-video-trigger:hover {
  background: #E11D48;
  color: #ffffff;
  border-color: #E11D48;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 28px -4px rgba(225, 29, 72, 0.38);
}

.sl-gallery-video-trigger:hover .sl-video-badge-icon {
  transform: scale(1.15);
}

.sl-gallery-video-trigger:active {
  transform: translateY(0) scale(0.98);
}

@media (max-width: 640px) {
  .sl-gallery-video-trigger {
    right: 12px;
    bottom: 12px;
    padding: 6px 12px;
    font-size: 0.75rem;
  }
}

/* ── 2. LECTEUR EN SURIMPRESSION SUR LA GALERIE ──────────── */
.sl-gallery-video-overlay {
  position: absolute;
  inset: 0;
  z-index: 35;
  border-radius: inherit;
  background: #09070d;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.97);
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.sl-gallery-video-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Barre supérieure de l'overlay */
.sl-gallery-overlay-topbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  pointer-events: none;
}

.sl-gallery-overlay-topbar > * {
  pointer-events: auto;
}

.sl-gallery-overlay-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(18, 14, 26, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sl-gallery-overlay-badge svg {
  width: 13px;
  height: 13px;
  fill: #FF4D6D;
}

/* Bouton fermer / retour aux photos */
.sl-btn-close-overlay {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(18, 14, 26, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.sl-btn-close-overlay svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.sl-btn-close-overlay:hover {
  background: #E11D48;
  border-color: #E11D48;
  transform: translateY(-1px);
}

/* Viewport vidéo centré */
.sl-gallery-overlay-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sl-gallery-overlay-viewport .sl-video-el {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
}

/* Barre de contrôles inférieure de l'overlay */
.sl-gallery-overlay-controls {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}

.sl-gallery-overlay-controls > * {
  pointer-events: auto;
}

/* ── 3. BOUTONS DE CONTRÔLE GIVRÉS (PLAY/PAUSE & SON) ─────── */
.sl-btn-control {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(18, 14, 26, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.sl-btn-control svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.sl-btn-control:hover {
  background: #E11D48;
  border-color: #E11D48;
  color: #ffffff;
  transform: translateY(-1px);
}

/* État actif quand le son est allumé */
.sl-btn-control[aria-pressed="true"] {
  background: #E11D48;
  border-color: #E11D48;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.4);
}

/* Indicateur Play central */
.sl-video-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(18, 14, 26, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 8;
}

.is-paused .sl-video-play-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.sl-video-play-overlay svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  margin-left: 3px;
}

/* ── 4. STYLES POUR LES MODES STANDALONE (Si activés) ────── */
.sl-video-widget {
  margin-top: 24px;
  margin-bottom: 32px;
  font-family: inherit;
  clear: both;
}

.sl-video-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.sl-video-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #FFF1F2 0%, #FFE4E6 100%);
  color: #E11D48;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(225, 29, 72, 0.18);
}

.sl-video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 20px;
  overflow: hidden;
  background-color: #0f0d13;
  border: 2px solid rgba(255, 107, 107, 0.15);
  box-shadow: 0 12px 32px -8px rgba(30, 27, 24, 0.16);
}

.sl-video-frame .sl-video-el {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
  cursor: pointer;
}

.sl-video-controls {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 5;
  pointer-events: none;
}

.sl-video-controls > * {
  pointer-events: auto;
}

.sl-video-caption {
  margin: 10px 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #4b5563;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
}

.sl-layout-gallery {
  width: 100%;
  max-width: 360px;
  margin: 24px auto 32px;
}

@media (min-width: 1024px) {
  .woocommerce div.product:has(.sl-layout-gallery) .summary.entry-summary,
  body.has-product-video-gallery .woocommerce div.product .summary.entry-summary {
    grid-column: 2 !important;
    grid-row: 1 / span 10 !important;
  }
  .woocommerce div.product .sl-video-widget.sl-layout-gallery {
    grid-column: 1 !important;
    grid-row: 2 !important;
    max-width: 360px;
    margin: 24px auto 32px;
  }
}

.sl-layout-summary {
  max-width: 320px;
  margin-top: 24px;
  margin-bottom: 24px;
}

.sl-layout-floating {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 148px;
  z-index: 995;
  border-radius: 18px;
  box-shadow: 0 20px 40px -10px rgba(30, 27, 24, 0.35);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ── 5. APERÇU VIDÉO AU SURVOL SUR LES CARTES CATALOGUE ──── */
.badge-video {
  background: rgba(225, 29, 72, 0.9) !important;
  color: #ffffff !important;
  font-size: 0.72rem !important;
  padding: 3px 6px !important;
  border-radius: 6px !important;
}

.product-card-image {
  position: relative;
  overflow: hidden;
}

/* Vidéo injectée dynamiquement au survol bureau */
.card-video-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
  pointer-events: none;
  background-color: #000000;
}

.card-video-preview.is-loaded {
  opacity: 1;
}

/* ── ACCESSIBILITÉ ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .sl-gallery-video-trigger,
  .sl-gallery-video-overlay,
  .sl-btn-control,
  .card-video-preview {
    transition: none !important;
  }
}
