/* =====================================================================
 * Before After Slider Widget
 * Reveal mechanism: two full-size images, after image revealed via
 * clip-path. Critical image geometry is forced so theme/Elementor
 * `img { height: auto }` resets cannot collapse the images.
 * ===================================================================== */

/* Alignment row (alignment control toggles justify-content here) */
.bas-outer {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Wrapper holds the max-width */
.bas-wrapper {
  width: 100%;
  max-width: 540px;
}

/* Container */
.bas-container {
  position: relative;
  width: 100%;
  height: 600px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(25, 21, 18, 0.16);
  cursor: ew-resize;
  user-select: none;
  touch-action: none;
  outline: none;
}
.bas-container.bas-orient-vertical {
  cursor: ns-resize;
}
.bas-container:focus-visible {
  box-shadow: 0 0 0 3px rgba(184, 144, 106, 0.5);
}

/* Both image layers fill the container identically */
.bas-before-layer,
.bas-after-layer {
  position: absolute;
  inset: 0;
}
.bas-before-layer { z-index: 1; }
.bas-after-layer {
  z-index: 2;
  /* Initial clip is set inline (PHP) and updated by JS */
  -webkit-clip-path: inset(0 50% 0 0);
  clip-path: inset(0 50% 0 0);
  will-change: clip-path;
}

/* Images — geometry forced to beat theme/Elementor `img{height:auto}` resets.
 * object-fit is intentionally NOT forced so the Image Fit control still works. */
.bas-container .bas-img {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-position: center;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  object-fit: cover;
}

/* Placeholder (empty state) */
.bas-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.4);
  font-size: 13px;
  font-style: italic;
}

/* Divider line */
.bas-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  width: 3px;
  background: #ffffff;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.bas-orient-vertical .bas-divider {
  top: auto;
  left: 0;
  right: 0;
  bottom: auto;
  transform: translateY(-50%);
  width: auto;
  height: 3px;
}

/* Handle */
.bas-handle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: all;
  transition: transform 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}
.bas-handle:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: #f0f0f0;
}
.bas-container.bas-dragging .bas-handle {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.05);
}

/* Handle icon variants */
.bas-handle-icon {
  font-size: 14px;
  color: #191512;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  user-select: none;
}
.bas-handle-icon svg {
  width: 14px;
  height: 14px;
}
.bas-handle-arrows {
  gap: 2px;
  letter-spacing: -2px;
  font-family: sans-serif;
}
.bas-handle-dots {
  letter-spacing: 1px;
  font-size: 16px;
}
.bas-handle-lines {
  flex-direction: column;
  gap: 3px;
}
.bas-handle-lines span {
  display: block;
  width: 14px;
  height: 2px;
  background: #191512;
  border-radius: 1px;
}
.bas-orient-vertical .bas-handle-arrows {
  flex-direction: column;
  letter-spacing: 0;
  gap: 2px;
}

/* Labels */
.bas-label {
  position: absolute;
  z-index: 5;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 100px;
  pointer-events: none;
  white-space: nowrap;
  font-family: sans-serif;
  font-weight: 500;
}
.bas-pos-tl { top: 16px;    left: 16px;  right: auto; bottom: auto; }
.bas-pos-tr { top: 16px;    right: 16px; left: auto;  bottom: auto; }
.bas-pos-bl { bottom: 16px; left: 16px;  right: auto; top: auto;    }
.bas-pos-br { bottom: 16px; right: 16px; left: auto;  top: auto;    }

.bas-label-before {
  background: rgba(25, 21, 18, 0.7);
}
.bas-label-after {
  background: linear-gradient(90deg, #D6357F, #A8295F);
}

/* Load animation hint */
.bas-container.bas-anim-load .bas-after-layer {
  transition: -webkit-clip-path 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              clip-path 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.bas-container.bas-anim-load .bas-divider {
  transition: left 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              top 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Responsive fallback (Elementor responsive controls override these) */
@media (max-width: 600px) {
  .bas-container {
    max-width: 100%;
    height: 350px;
    border-radius: 12px;
  }
}
