/* ecvproductvideos - estilos front */

/* --- Miniatura de vídeo en la galería --- */
.ecv-video-thumb {
  cursor: pointer;
  list-style: none; /* sin viñeta aunque el tema no la quite */
}

.ecv-video-thumb::marker {
  content: "";
}

.ecv-thumb-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.ecv-thumb-img {
  display: block;
  object-fit: cover;
}

.ecv-play-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.ecv-play-badge::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -7px 0 0 -4px;
  border-style: solid;
  border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent #fff;
}

.ecv-video-thumb .ecv-play-badge {
  z-index: 2;
}

.ecv-video-thumb.ecv-selected .ecv-thumb-wrap {
  outline: 2px solid #2fb5d2;
  outline-offset: 1px;
}

/* --- Modo Splide: slide de vídeo en el visor principal --- */
.ecv-video-slide {
  cursor: pointer;
}

.ecv-video-box {
  position: relative;
  width: 100%;
  /* misma proporción que las fotos desde el primer render (JS la afina):
     sin saltos al pasar de foto a vídeo */
  aspect-ratio: 1;
  overflow: hidden;
  background: #000;
  border-radius: 0.5rem;
}

.ecv-video-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ecv-video-box[data-fit="contain"] .ecv-video-poster,
.ecv-video-box[data-fit="white"] .ecv-video-poster {
  object-fit: contain;
}

/* Bandas blancas: mismo encaje que bandas negras, con fondo blanco */
.ecv-video-box[data-fit="white"],
.ecv-player-dynamic[data-fit="white"],
.ecv-player-dynamic[data-fit="white"]:fullscreen {
  background: #fff;
}

.ecv-big-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.ecv-big-play:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: scale(1.07);
}

.ecv-big-play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -14px 0 0 -9px;
  border-style: solid;
  border-width: 14px 0 14px 23px;
  border-color: transparent transparent transparent #fff;
}

/* --- Reproductor --- */
.ecv-player {
  position: relative;
  width: 100%;
  background: #000;
  z-index: 9999;
}

.ecv-player .ecv-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Reproductor dinámico: llena el hueco de las fotos; el iframe se centra y
   se dimensiona por JS según el relleno elegido (recortar / bandas) */
.ecv-player-dynamic {
  overflow: hidden;
  width: 100%;
}

.ecv-player-dynamic .ecv-iframe {
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.ecv-player-dynamic:fullscreen {
  background: #000;
  /* en pantalla completa manda la pantalla, no la altura de la galería */
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
}

/* En pantalla completa el iframe llena la pantalla por CSS puro: el giro del
   móvil se adapta al instante y el reproductor centra el vídeo entero */
.ecv-player-dynamic:fullscreen .ecv-iframe {
  top: 0 !important;
  left: 0 !important;
  transform: none !important;
  width: 100% !important;
  height: 100% !important;
}

/* El reproductor rellena la caja ya dimensionada. Aparece con un fundido
   sobre el póster cuando el vídeo ya está cargado (sin parpadeos) */
.ecv-player-splide {
  position: absolute;
  inset: 0;
  height: 100% !important;
  background: transparent;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ecv-player-splide.ecv-ready {
  opacity: 1;
  background: #000;
}

.ecv-player-splide[data-fit="white"].ecv-ready {
  background: #fff;
}

/* Botón propio de pantalla completa (modo recorte) */
.ecv-fs-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  z-index: 3;
  transition: background 0.15s ease;
}

.ecv-fs-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.ecv-fs-btn::after {
  content: "⛶";
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

/* Mientras se reproduce un vídeo (modo genérico), desactivar capas de zoom */
.ecv-video-playing .layer,
.ecv-video-playing [data-action="zoom"] {
  display: none !important;
}

.ecv-video-playing {
  position: relative;
}

/* --- Textos SEO dentro de las bandas del vídeo: solo móvil --- */
.ecv-band-title,
.ecv-band-desc {
  display: none;
}

@media (max-width: 767px) {
  /* Título: banda superior, a la izquierda, con cuerpo */
  .ecv-band-title {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000; /* por encima del reproductor (la banda queda libre) */
    display: flex;
    align-items: center;
    padding: 4px 14px;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: #562e05;
    overflow: hidden;
    pointer-events: none;
  }

  .ecv-video-box[data-fit="contain"] .ecv-band-title {
    color: #f0f0f0;
  }

  /* Descripción: banda inferior, a la izquierda, con "Ver más" */
  .ecv-band-desc {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    display: block;
    padding: 6px 14px 8px;
    text-align: left;
    overflow: hidden;
    background: #fff;
    box-sizing: border-box;
  }

  .ecv-video-box[data-fit="contain"] .ecv-band-desc {
    background: #000;
  }

  .ecv-band-desc-text {
    margin: 0;
    font-size: 12px;
    line-height: 15px;
    color: #555;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .ecv-video-box[data-fit="contain"] .ecv-band-desc-text {
    color: #ccc;
  }

  .ecv-band-desc-more {
    border: 0;
    background: none;
    padding: 3px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: #2fb5d2;
    cursor: pointer;
  }

  /* Desplegada: crece hacia arriba sobre el vídeo, sin mover la galería */
  .ecv-band-desc.ecv-expanded {
    height: auto !important;
    max-height: 100%;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.96);
  }

  .ecv-video-box[data-fit="contain"] .ecv-band-desc.ecv-expanded {
    background: rgba(0, 0, 0, 0.92);
  }

  .ecv-band-desc.ecv-expanded .ecv-band-desc-text {
    display: block;
    -webkit-line-clamp: unset !important;
    overflow: visible;
  }
}

/* --- Botón "Ver vídeo" bajo la galería: solo móvil --- */
.ecv-mobile-videos-btn {
  display: none;
}

@media (max-width: 767px) {
  .ecv-mobile-videos-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 10px auto 4px;
    padding: 7px 14px;
    border: 1px solid #d9d2c7;
    border-radius: 999px;
    background: #fff;
    color: #562e05;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }

  .ecv-mobile-videos-btn:active {
    background: #f3ece4;
  }

  .ecv-mini-play {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #562e05;
    flex: 0 0 22px;
  }

  .ecv-mini-play::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -5px 0 0 -3px;
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent #fff;
  }

  .ecv-mini-duration {
    color: #8a7a65;
    font-weight: 400;
    font-size: 12px;
  }
}

/* --- Modal de zoom del tema: adaptado a la pantalla (estilo Amazon) ---
   Solo CSS del módulo: no se toca ningún archivo del tema */
#product-modal > div {
  width: auto !important;
  min-width: 0 !important;
  max-width: calc(100vw - 48px) !important;
  max-height: calc(100vh - 48px) !important;
  overflow-y: auto !important;
  box-sizing: border-box;
}

@media (min-width: 1100px) {
  #product-modal > div {
    width: 1000px !important;
  }
}

#product-modal .product-cover-modal {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: calc(100vh - 400px) !important;
  min-height: 240px;
  object-fit: contain;
  margin: 0 auto;
}

#product-modal .ecv-modal-player {
  max-height: calc(100vh - 300px);
}

/* --- Modal de zoom del tema: pestañas Imágenes / Vídeos --- */
.ecv-modal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 16px;
}

.ecv-modal-tab {
  border: 0;
  background: none;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.ecv-modal-tab:hover {
  color: #222;
}

.ecv-modal-tab.ecv-active {
  color: #562e05;
  border-bottom-color: #562e05;
}

.ecv-tab-count {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #eee;
  font-size: 12px;
  color: #555;
  text-align: center;
}

.ecv-modal-videos {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.ecv-modal-main {
  flex: 1 1 auto;
  min-width: 0;
}

.ecv-modal-player {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.ecv-modal-player .ecv-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Texto visible del vídeo: el mismo que enviamos a Google en el JSON-LD */
.ecv-modal-caption {
  margin-top: 12px;
}

.ecv-modal-caption-title {
  font-size: 15px;
  font-weight: 600;
  color: #222;
  margin: 0 0 4px;
}

.ecv-modal-caption-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #555;
  margin: 0;
}

.ecv-modal-list {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 560px;
  overflow-y: auto;
}

.ecv-modal-item {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f7f7f7;
  padding: 6px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ecv-modal-item:hover {
  background: #efefef;
}

.ecv-modal-item.ecv-selected {
  border-color: #562e05;
  background: #f3ece4;
}

.ecv-modal-item-thumb {
  position: relative;
  flex: 0 0 72px;
  width: 72px;
  height: 54px;
  border-radius: 5px;
  background-color: #2b2b2b;
  background-size: cover;
  background-position: center;
}

.ecv-modal-item-thumb .ecv-play-badge {
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
}

.ecv-modal-item-thumb .ecv-play-badge::after {
  margin: -5px 0 0 -3px;
  border-width: 5px 0 5px 8px;
}

/* Duración sobre la miniatura, como Amazon */
.ecv-modal-item-duration {
  position: absolute;
  right: 3px;
  bottom: 3px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
}

.ecv-modal-item-title {
  font-size: 13px;
  line-height: 1.3;
  color: #333;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Móvil: lista de vídeos debajo del reproductor */
@media (max-width: 767px) {
  .ecv-modal-videos {
    flex-direction: column;
  }

  .ecv-modal-list {
    flex: 1 1 auto;
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
    width: 100%;
  }

  .ecv-modal-item {
    flex: 1 1 45%;
  }
}

/* --- Fallback bajo la galería / ficha --- */
.ecv-fallback-active {
  margin: 1.25rem 0;
}

.ecv-fallback-video {
  margin-bottom: 1rem;
}

.ecv-fallback-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.ecv-fallback-desc {
  margin-top: 0.5rem;
  font-size: 0.9em;
  color: #595959;
  max-width: 640px;
}

.ecv-fallback-play {
  position: relative;
  display: block;
  width: 100%;
  max-width: 640px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  background-color: #2b2b2b;
  background-size: cover;
  background-position: center;
}

.ecv-fallback-play .ecv-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
}

.ecv-fallback-play .ecv-play-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -12px 0 0 -7px;
  border-style: solid;
  border-width: 12px 0 12px 19px;
  border-color: transparent transparent transparent #2b2b2b;
}

.ecv-player-inline {
  max-width: 640px;
  border-radius: 6px;
  overflow: hidden;
  /* la altura la fija sizePlayer() según el formato elegido del vídeo */
}

.ecv-fallback-active .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
