/* ==========================================================================
   Roger Editor — "Antes / Después" (comparador con divisor arrastrable).
   Réplica 1:1 de style.css del prototipo (.product-antes-despues,
   .pdp-antes-despues, .antes-despues-*, .ad-*). Compartido entre el
   carrusel de "Productos destacados" (grid_productos, botón solo visible
   al hover de la tarjeta) y la ficha de producto (producto_ficha, botón
   siempre visible porque ahí no hay "tarjeta" sobre la que hacer hover). */

.product-antes-despues {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(36, 27, 33, .72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .02em;
  border: none;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.product-card:hover .product-antes-despues { opacity: 1; visibility: visible; }
.product-antes-despues:hover { background: var(--color-marca); }

.pdp-antes-despues {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(36, 27, 33, .72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  border: none;
  cursor: pointer;
  transition: background .2s ease;
}
.pdp-antes-despues:hover { background: var(--color-marca); }

/* ---------- Modal ---------- */
.antes-despues-overlay {
  position: fixed; inset: 0;
  background: rgba(36, 27, 33, .55);
  opacity: 0; visibility: hidden;
  transition: opacity .3s;
  z-index: 9995;
}
.antes-despues-overlay.abierto { opacity: 1; visibility: visible; }

.antes-despues-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  width: min(520px, 92vw);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 9996;
}
.antes-despues-modal.abierto {
  opacity: 1; visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.antes-despues-panel {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: 0 30px 60px -18px rgba(74, 42, 58, .4);
  position: relative;
}
.antes-despues-cerrar {
  position: absolute; top: 16px; right: 16px; z-index: 3;
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-muted); font-size: 16px;
  cursor: pointer;
  transition: background .2s;
}
.antes-despues-cerrar:hover { background: var(--bg-muted); }
.antes-despues-titulo { font-size: 20px; margin: 0 0 4px; padding-right: 32px; color: var(--fg); }
.antes-despues-nota { font-size: 12.5px; color: var(--fg-muted); margin: 0 0 18px; }

.ad-slider {
  position: relative;
  width: 100%; aspect-ratio: 4/5;
  min-height: 340px;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
}
/* Selector de 2 clases a propósito: WooCommerce mete ".woocommerce-page img"
   (1 clase + 1 elemento) con height:auto en woocommerce-layout.css, que
   tiene MÁS especificidad que un simple ".ad-img" (1 clase) y ganaba la
   cascada sin importar el orden de carga — dejaba el height:100% sin
   aplicarse y la foto se veía chica y sin llenar el recuadro. */
.ad-slider .ad-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}
.ad-antes { clip-path: inset(0 50% 0 0); }

.ad-label {
  position: absolute; top: 14px; z-index: 2;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: #fff; background: rgba(36, 27, 33, .55);
  padding: 5px 12px; border-radius: 100px;
}
.ad-label-antes { left: 14px; }
.ad-label-despues { right: 14px; }

.ad-handle {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  transform: translateX(-50%);
}
.ad-handle::before {
  content: '';
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 3px; background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}
.ad-handle-flechas {
  position: relative; z-index: 1;
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-hover);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--color-plum); font-weight: 700;
  letter-spacing: -2px;
}
