/* ==========================================================================
   DELEGATE ERP — Section 4: Interactive Before vs. After Drag Comparison
   Clean, Crisp Light Enterprise SaaS UI
   ========================================================================== */

.ba-section {
  position: relative;
  padding: 72px 0 80px;
  background: #ffffff;
  color: #142217;
  border-top: 1px solid #e4ede7;
}

.ba-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(16px, 2.5vw, 36px);
}

/* ==========================================================================
   Header
   ========================================================================== */
.ba-header {
  text-align: center;
  max-width: 660px;
  margin: 0 auto 32px;
}

.ba-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #15803d;
  margin-bottom: 10px;
}

.ba-eyebrow::before,
.ba-eyebrow::after {
  content: "";
  width: 16px;
  height: 1.5px;
  background: #15803d;
  opacity: 0.55;
  border-radius: 2px;
}

.ba-title {
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(1.6rem, 2.55vw, 2.2rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: #122116;
  margin-bottom: 10px;
}

.ba-title span {
  color: #15803d;
}

.ba-subtitle {
  font-size: 0.94rem;
  line-height: 1.6;
  color: #58695c;
}

/* ==========================================================================
   Quick Controls Strip (Above Slider)
   ========================================================================== */
.ba-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.ba-drag-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #5c6e60;
}

.ba-drag-hint svg {
  width: 15px;
  height: 15px;
  color: #15803d;
}

.ba-presets {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.ba-preset-sep {
  width: 1px;
  height: 12px;
  background: #d5e0d8;
}

.ba-preset-btn {
  position: relative;
  padding: 4px 2px 6px;
  border: none;
  background: transparent;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: #637467;
  cursor: pointer;
  transition: color 180ms ease;
}

.ba-preset-btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: #15803d;
  transform: scaleX(0);
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ba-preset-btn:hover {
  color: #122116;
}

.ba-preset-btn.is-active {
  color: #15803d;
  font-weight: 700;
}

.ba-preset-btn.is-active::after {
  transform: scaleX(1);
}

/* ==========================================================================
   Interactive Before / After Comparison Stage
   ========================================================================== */
.ba-stage {
  --pos: 50%;
  position: relative;
  border-radius: 0;
  border: 1px solid #dde8e0;
  box-shadow:
    0 20px 48px -28px rgba(16, 40, 22, 0.16),
    0 4px 12px -4px rgba(16, 40, 22, 0.05);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  cursor: ew-resize;
}

.ba-stage.is-dragging {
  cursor: grabbing;
}

/* Identical geometry on both layers so every row stays 100% pixel-aligned */
.ba-layer {
  padding: 26px 30px 28px;
}

.ba-layer--after {
  background: radial-gradient(circle at 92% 8%, rgba(21, 128, 61, 0.05) 0%, transparent 45%),
    #ffffff;
}

.ba-layer--before {
  position: absolute;
  inset: 0;
  background: #f5f6f5;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
  pointer-events: none;
}

.ba-stage.is-animating .ba-layer--before {
  transition: clip-path 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ba-stage.is-animating .ba-divider {
  transition: left 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Top Bar inside each layer */
.ba-layer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e6ece8;
  flex-wrap: wrap;
}

.ba-layer--before .ba-layer-head {
  border-bottom-color: #e4e6e4;
}

.ba-badge-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ba-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ba-pill--before {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.ba-pill--after {
  background: #ecfdf5;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.ba-layer-title {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #122116;
}

.ba-layer--before .ba-layer-title {
  color: #3f4742;
}

/* Mini KPI Strip in Layer Header */
.ba-kpis {
  display: flex;
  align-items: center;
  gap: 18px;
}

.ba-kpi {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 0.78rem;
  color: #637367;
}

.ba-kpi strong {
  font-family: "Sora", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
}

.ba-layer--before .ba-kpi strong {
  color: #b91c1c;
}

.ba-layer--after .ba-kpi strong {
  color: #15803d;
}

/* Comparison Rows */
.ba-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ba-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: 0;
}

.ba-layer--before .ba-row {
  background: #ffffff;
  border: 1px solid #e5e7e6;
}

.ba-layer--after .ba-row {
  background: #f9fdfb;
  border: 1px solid #dceee2;
}

.ba-row-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ba-row-icon svg {
  width: 16px;
  height: 16px;
}

.ba-layer--before .ba-row-icon {
  background: #fef2f2;
  color: #dc2626;
}

.ba-layer--after .ba-row-icon {
  background: #e8f8ee;
  color: #15803d;
}

.ba-row-copy {
  min-width: 0;
}

.ba-row-copy h3 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 2px;
}

.ba-layer--before .ba-row-copy h3 {
  color: #363e39;
}

.ba-layer--after .ba-row-copy h3 {
  color: #122116;
}

.ba-row-copy p {
  font-size: 0.8rem;
  line-height: 1.45;
  color: #617165;
}

.ba-row-stat {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.ba-layer--before .ba-row-stat {
  background: #fef2f2;
  color: #b91c1c;
}

.ba-layer--after .ba-row-stat {
  background: #eaf8ef;
  color: #15803d;
}

/* ==========================================================================
   Draggable Vertical Center Line & Tactile Handle
   ========================================================================== */
.ba-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  transform: translateX(-50%);
  background: #15803d;
  box-shadow: 0 0 12px rgba(21, 128, 61, 0.35);
  z-index: 4;
  pointer-events: none;
}

.ba-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #15803d;
  color: #15803d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 8px 22px -6px rgba(16, 40, 22, 0.28),
    0 0 0 5px rgba(21, 128, 61, 0.12);
  pointer-events: auto;
  cursor: ew-resize;
  transition: transform 160ms ease, box-shadow 180ms ease;
}

.ba-handle svg {
  width: 19px;
  height: 19px;
}

.ba-handle:hover,
.ba-stage.is-dragging .ba-handle {
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow:
    0 10px 26px -6px rgba(16, 40, 22, 0.32),
    0 0 0 8px rgba(21, 128, 61, 0.18);
}

.ba-handle:focus-visible {
  outline: 2px solid #15803d;
  outline-offset: 4px;
}

/* ==========================================================================
   Bottom Compact Action Strip
   ========================================================================== */
.ba-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e7efe9;
  flex-wrap: wrap;
}

.ba-footer-note {
  font-size: 0.86rem;
  color: #58695c;
}

.ba-footer-note strong {
  color: #122116;
  font-weight: 700;
}

.ba-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  border: none;
  background: #15803d;
  color: #ffffff;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px rgba(21, 128, 61, 0.55);
  transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.ba-cta-btn svg {
  width: 15px;
  height: 15px;
  transition: transform 180ms ease;
}

.ba-cta-btn:hover {
  background: #166534;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -10px rgba(21, 128, 61, 0.65);
}

.ba-cta-btn:hover svg {
  transform: translateX(3px);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 860px) {
  .ba-layer {
    padding: 18px 16px 20px;
  }

  .ba-kpis {
    display: none;
  }

  .ba-row {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    padding: 11px 12px;
  }

  .ba-row-stat {
    display: none;
  }
}

@media (max-width: 600px) {
  .ba-section {
    padding: 52px 0 60px;
  }

  .ba-controls {
    justify-content: center;
  }

  .ba-handle {
    width: 38px;
    height: 38px;
  }

  .ba-footer {
    flex-direction: column;
    text-align: center;
  }
}
