/* Oculta el dropdown original de color, pero WooCommerce lo sigue usando internamente. */
.variations_form select.d4l-original-color-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* El label "ARENA" / "ROSA" etc. se mueve al lado del <th> "COLOR"
   usando position absolute relativo al <tr> de la variación */
.variations tr {
  position: relative;
}

.variations .label {
  position: relative;
}

.d4l-selected-color-label {
  display: none;
  font-size: 0.85em;
  font-weight: 600;
  color: #888;
  margin-left: 8px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.d4l-color-swatches {
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 14px;
  width: auto !important;
}

.d4l-color-swatches .d4l-color-swatch,
button.d4l-color-swatch {
  display: inline-block !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(0, 0, 0, .18) !important;
  background-color: var(--d4l-swatch-color) !important;
  background-image: none;
  cursor: pointer;
  padding: 0 !important;
  margin: 0 !important;
  position: relative;
  box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0, 0, 0, .12) !important;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
  text-indent: -9999px;
  overflow: hidden;
  line-height: 0 !important;
  font-size: 0 !important;
}

.d4l-color-swatches .d4l-color-swatch:hover,
button.d4l-color-swatch:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(0, 0, 0, .12) !important;
}

.d4l-color-swatches .d4l-color-swatch.is-selected,
button.d4l-color-swatch.is-selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111 !important;
}

.d4l-color-swatches .d4l-color-swatch.is-disabled,
button.d4l-color-swatch.is-disabled {
  opacity: .35;
  cursor: not-allowed;
}

.d4l-color-swatch.is-disabled::after {
  content: '';
  position: absolute;
  width: 130%;
  height: 1px;
  background: rgba(0, 0, 0, .45);
  top: 50%;
  left: -15%;
  transform: rotate(-38deg);
}

.d4l-color-swatches .d4l-color-swatch.is-white,
button.d4l-color-swatch.is-white {
  border-color: rgba(0, 0, 0, .25) !important;
}

.d4l-color-swatches .d4l-color-swatch.has-image,
button.d4l-color-swatch.has-image {
  background-image: var(--d4l-swatch-image) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.d4l-merulina-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.d4l-merulina-gallery-item {
  display: block;
  overflow: hidden;
  background: #f5f1ee;
}

.d4l-merulina-gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* ── Galería Vertical ─────────────────────────────────────── */

.d4l-vgallery-wrap {
  display: flex;
  gap: 12px;
  width: 100%;
  align-items: flex-start;
  container-type: inline-size;
}

/* Columna de thumbnails */
.d4l-vgallery-thumbs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 160px;
  min-width: 120px;
  max-width: 180px;
  flex-shrink: 0;
  max-height: 700px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.d4l-vgallery-thumbs::-webkit-scrollbar {
  display: none;
}

.d4l-vgallery-thumb {
  display: block;
  width: 100%;
  border: 2px solid transparent;
  border-radius: 15px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  margin: 0;
  background: none !important;
  transition: border-color .18s ease;
  flex-shrink: 0;
  position: relative;
  line-height: 0 !important;
  font-size: 0 !important;
}

.d4l-vgallery-thumb img {
  display: block;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0;
}

.d4l-vgallery-thumb.is-active {
  border-color: #111;
}

.d4l-vgallery-thumb:hover {
  border-color: rgba(0, 0, 0, .35);
}

.d4l-vgallery-thumbs .d4l-vgallery-thumb,
button.d4l-vgallery-thumb {
  color: inherit !important;
  text-decoration: none !important;
  box-shadow: none !important;
  outline: none !important;
}

.d4l-vgallery-thumbs .d4l-vgallery-thumb:hover,
button.d4l-vgallery-thumb:hover,
.d4l-vgallery-thumbs .d4l-vgallery-thumb:focus,
button.d4l-vgallery-thumb:focus {
  background: none !important;
  color: inherit !important;
  box-shadow: none !important;
  transform: none !important;
}

.d4l-vgallery-thumb-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #f0ede9;
  border: none;
  border-radius: 4px;
  height: 28px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: #555;
  padding: 0;
  flex-shrink: 0;
}

.d4l-vgallery-thumb-nav:hover {
  background: #e0dbd4;
}

/* Imagen principal */
.d4l-vgallery-main-wrap {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  border-radius: 25px;
  background: #f5f1ee;
}

.d4l-vgallery-main-link {
  display: block;
  width: 100%;
}

.d4l-vgallery-zoom-wrap {
  overflow: hidden;
  border-radius: 25px;
  cursor: zoom-in;
}

.d4l-vgallery-main-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform .4s ease;
  will-change: transform;
}

.d4l-vgallery-zoom-wrap:hover .d4l-vgallery-main-img {
  transform: scale(1.06);
}

/* Móvil: ocultar el layout vertical y mostrar slider */
.d4l-vgallery-mobile-wrap {
  display: none !important;
}

@media (max-width: 767px) {
  .d4l-vgallery-wrap {
    display: none !important;
  }

  .d4l-vgallery-mobile-wrap {
    display: block !important;
    width: 100%;
    min-height: 300px;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
  }

  .d4l-vgallery-mobile-slider {
    display: flex !important;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-radius: 15px;
    min-height: 300px;
    width: 100% !important;
  }

  .d4l-vgallery-mobile-slider .d4l-merulina-gallery-item {
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    background: #f5f1ee;
    display: block !important;
    overflow: hidden;
    visibility: visible !important;
  }

  .d4l-vgallery-mobile-slider .d4l-merulina-gallery-item img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    visibility: visible !important;
  }

  .d4l-vgallery-mobile-wrap .d4l-merulina-gallery-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
  }
}

/* ── Fin galería vertical ─────────────────────────────────── */

@media (max-width: 767px) {
  .d4l-merulina-gallery-grid {
    display: flex;
    grid-template-columns: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .d4l-merulina-gallery-grid::-webkit-scrollbar {
    display: none;
  }

  .d4l-merulina-gallery-item {
    flex: 0 0 100%;
    width: 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  .d4l-merulina-gallery-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
  }

  .d4l-merulina-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .18);
    transition: background-color .2s ease, width .2s ease;
  }

  .d4l-merulina-dot.is-active {
    background: #111;
    width: 18px;
    border-radius: 999px;
  }

  .d4l-color-swatches .d4l-color-swatch,
  button.d4l-color-swatch {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
  }
}
