
/* [#271] - popup video */
.video-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 158px;
  height: 275px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  border-radius: 15px;
  z-index: 9999;
  background: #000;
  display: none; /* cachée par défaut */
  transition: opacity 0.4s ease, transform 0.4s ease;
  opacity: 0;
  transform: translateY(20px);
}

.video-popup .video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3; /* au-dessus de l’iframe mais sous le bouton close */
  cursor: pointer;
  background: transparent;
}

.video-popup.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
  border: 2px solid #000;
}

.video-popup iframe {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  border-radius: 15px;
}

.close-popup {
    position: absolute;
    top: -12px;
    right: -12px;
    font-size: 22px;
    cursor: pointer;
    color: #fff;
    background: #000;
    border-radius: 50%;
    padding: 2px 6px;
    z-index: 2;
    width: 23px;
    height: 23px;
    padding: 0;
    margin: 0;
    text-align: center;
    line-height: 22px;
}

/* Bloque l'effet "fluid-width-video-wrapper" sur la popup */
#video-popup .fluid-width-video-wrapper {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  padding: 0 !important;
}

#video-popup .fluid-width-video-wrapper iframe {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

/* 🧱 Responsive */
@media (max-width: 768px) {
  .video-popup {
    width: 140px;
    height: 250px;
    bottom: 10px;
    right: 10px;
  }
  .close-popup {
    font-size: 16px;
    z-index:100;
  }
}

@media (max-width: 600px) {

     .video-popup {
        width: 140px;
        height: 140px;
        bottom: 10px;
        right: 10px;
        overflow: hidden;
    }

    #video-popup .fluid-width-video-wrapper {
        width: 180% !important;
        height: 180% !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin-left: -40%;
        margin-top: -50%;
    }

    .close-popup {
        top: 5px;
        right: 5px;
    }

    .video-popup.show {
        border: 4px solid #000;
    }
}

/* === POPIN CENTRALE === */
.video-popin {
  display: none;
  position: fixed;
  z-index: 10000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
}

.video-popin.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.video-popin-content {
  background: #fff;
  border-radius: 12px;
  max-width: 800px;
  width: 90%;
  max-height: 90%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  animation: popIn 0.3s ease;
}

.video-popin .close-popin {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 26px;
  cursor: pointer;
  color: #fff;
  background: #000;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  text-align: center;
  line-height: 28px;
  z-index: 2;
}

#video-popin .video-wrapper {
  width: auto;
  height: 80vh;
  background: #000;
  border-radius: 0.5rem;
}

#video-popin .video-wrapper iframe {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  border-radius: 0.5rem;
}

#video-popin .product-card {
  position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.50rem;
    display: flex;
    align-items: center;
    gap: 0.50rem;
    padding: 0.55rem 0.5rem;
    width: calc(100% - 25px);
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(12px) saturate(1.5);
    -webkit-backdrop-filter: blur(12px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 5px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 5;
    color: #fff;
    overflow: hidden;
}

#video-popin .product-card img {
    width: 70px;
    height: 70px;
    border-radius: 0;
    object-fit: cover;
}

#video-popin .product-info {
  flex: 1;
  width: 100%;
  min-width: 0;
}

#video-popin .product-title {
    font-weight: 600;
    margin: 0;
    color: #18181e;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
}

#video-popin .product-price {
  color: #18181e;
  margin: 5px 0;
  text-align: left;
}

#video-popin .product-link {
  display: inline-block;
  background: #18181e;
  color: #fff;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 0;
  font-weight: bold;
  width: 100%;
  transition: background 0.2s ease;
}

#video-popin .product-link:hover {
  background: #333;
}

.video-popin .video-wrapper {
  position: relative;
  width: 100%;
  /* on force le ratio 9:16 vertical */
  aspect-ratio: 9 / 16;
  max-height: 80vh;
  overflow: hidden;
  background: #000;
}

/* Neutralise l'effet du wrapper "fluid-width-video-wrapper" dans la popin */
.video-popin .fluid-width-video-wrapper {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  padding: 0 !important;
}

.video-popin .fluid-width-video-wrapper iframe,
.video-popin iframe {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border: 0;
  border-radius: 0;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.video-popin {
  display: none;
  position: fixed;
  z-index: 10000;
  inset: 0;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
}
.video-popin.show { display: flex; animation: fadeIn 0.25s ease; }

.video-popin .video-popin-content {
  border-radius: 12px;
  width: auto;               /* s’adapte au calcul ci-dessous */
  padding: 0;
  overflow: hidden;
  position: relative;
}

/* Zone vidéo : on fixe la HAUTEUR à 80vh et on calcule la largeur en 9:16 (vertical) */
.video-popin .video-wrapper {
  position: relative;
  height: 80vh;
  width: min(calc(80vh * 9 / 16), 90vw); /* garde le ratio et ne dépasse pas 90vw */
  max-width: 800px;                      /* optionnel */
  background: #000;
  overflow: hidden;
  margin: 0 auto;
}

/* Neutralise l'effet 'fluid-width-video-wrapper' s'il est injecté */
.video-popin .fluid-width-video-wrapper {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.video-popin .fluid-width-video-wrapper iframe,
.video-popin .video-wrapper > iframe {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border: 0;
}

/* Bandeau produit sous la vidéo (optionnel, si tu l’affiches) */
.video-popin .product-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #f8f8f8;
  z-index: 5;
  position: relative;
}
.video-popin .product-card img {
  width: 90px; height: 90px; object-fit: cover; border-radius: 8px;
}

/* Close bouton */
.video-popin .close-popin {
  position: absolute; top: 10px; right: 15px;
  font-size: 26px; cursor: pointer; color: #fff; background: #000;
  border-radius: 50%; width: 30px; height: 30px; text-align: center; line-height: 28px; z-index: 2;
}

video-wrapper {
  position: relative;
  z-index: 1;
}

/* Overlay central pour fermer la popin */
.video-overlay-central {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: transparent;
  cursor: pointer;
}

/* Carte produit en bas de la vidéo */
.video-popin .product-card {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 5; /* au-dessus du voile et de la vidéo */
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  padding: 0.75rem 1rem;
  backdrop-filter: blur(4px);
}

.video-popin .product-card img {
  width: 70px;
  height: 70px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.video-popin .product-info {
  flex: 1;
}

.video-popin .product-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0;
  color: #18181e;
}

.video-popin .product-price {
  font-size: 0.85rem;
  margin: 4px 0;
  color: #444;
}

.video-popin .product-link {
  display: inline-block;
  background: #18181e;
  color: #fff;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  transition: background 0.2s ease;
}
.video-popin .product-link:hover {
  background: #333;
}

/* Responsive : un peu plus petit sur mobile */
@media (max-width: 768px) {
  .video-popin .product-card {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    padding: 0.5rem 0.75rem;
  }
  .video-popin .product-card img {
    width: 60px; height: 60px;
  }

  /* [#280] Position vidéo sur fiche produit*/
  #product .video-popup {
     bottom:75px; 
  }
}

/* Anim */
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }