/* ═══════════════════════════════════════════════════════════
   KS Before After Slider – shared styles (frontend + editor)
   ═══════════════════════════════════════════════════════════ */

/* ── Wrapper ── */
.ks-bf-slider {
  width: 100%;
}

/* ── Comparison container ── */
.ks-bf-comparison {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: #222;
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 18px 54px rgba(0, 0, 0, .42);
  user-select: none;
  touch-action: none;
}

/* ── Images ── */
.ks-bf-img {
  display: block;
  width: 100%;
  pointer-events: none;
}

.ks-bf-before {
  position: relative;
  height: auto;
  z-index: 1;
}

.ks-bf-after {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 2;
  clip-path: inset(0 calc(100% - var(--ks-bf-position, 50%)) 0 0);
}

/* ── Edge shades ── */
.ks-bf-shade-left,
.ks-bf-shade-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18%;
  z-index: 3;
  pointer-events: none;
}

.ks-bf-shade-left {
  left: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, .38), transparent);
}

.ks-bf-shade-right {
  right: 0;
  background: linear-gradient(270deg, rgba(0, 0, 0, .32), transparent);
}

/* ── Labels ── */
.ks-bf-label {
  position: absolute;
  top: 18px;
  z-index: 4;
  padding: 9px 13px;
  border-radius: 999px;
  font-weight: 800;
  font-size: clamp(12px, 1.5vw, 15px);
  letter-spacing: .04em;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
}

.ks-bf-label-after {
  left: 18px;
  background: #ff9d00;
  color: #111;
}

.ks-bf-label-before {
  right: 18px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .28);
}

/* ── Handle ── */
.ks-bf-handle-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--ks-bf-position, 50%);
  width: 4px;
  transform: translateX(-50%);
  background: #fff;
  z-index: 5;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .18), 0 0 28px rgba(255, 157, 0, .52);
  pointer-events: none;
}

.ks-bf-handle {
  position: absolute;
  top: 50%;
  left: var(--ks-bf-position, 50%);
  width: clamp(54px, 6vw, 74px);
  height: clamp(54px, 6vw, 74px);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: #fff;
  color: #111;
  z-index: 6;
  display: grid;
  place-items: center;
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 900;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .34);
  pointer-events: none;
}

/* ── Invisible range input (captures pointer) ── */
.ks-bf-range {
  position: absolute;
  inset: 0;
  z-index: 7;
  opacity: 0;
  cursor: ew-resize;
  width: 100%;
  height: 100%;
  margin: 0;
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .ks-bf-comparison {
    border-radius: 18px;
  }
}

/* ═══════════════════════════════════════════════════════════
   Editor-only styles (placeholder, upload buttons, actions)
   ═══════════════════════════════════════════════════════════ */

/* ── Placeholder when images missing ── */
.ks-bf-editor-placeholder {
  display: flex;
  gap: 16px;
  padding: 24px;
  background: #f7f7f7;
  border: 2px dashed #ccc;
  border-radius: 12px;
}

/* ── Upload button (each half) ── */
.ks-bf-editor-upload-btn {
  flex: 1;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 180px;
  border-radius: 8px !important;
  overflow: hidden;
  background: #fff;
  border: 2px dashed #ddd !important;
  cursor: pointer;
  padding: 0 !important;
  transition: border-color .2s;
}

.ks-bf-editor-upload-btn:hover {
  border-color: #ff9d00 !important;
}

.ks-bf-editor-upload-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ks-bf-editor-upload-text {
  padding: 20px;
  text-align: center;
  font-size: 15px;
  color: #666;
  line-height: 1.5;
}

/* ── Action row below preview ── */
.ks-bf-editor-actions {
  display: flex;
  gap: 10px;
  padding: 12px 0 0;
}
