/* ── Image Preview Container ─────────────────── */
.image-preview-container {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 20px 0;
}

.image-preview-canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 300px;
  max-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#f0f0f0 0% 25%, #fff 0% 50%) 50% / 16px 16px;
  overflow: hidden;
}

.image-preview-canvas-wrap img,
.image-preview-canvas-wrap canvas {
  max-width: 100%;
  max-height: 500px;
  display: block;
  object-fit: contain;
}

.image-preview-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  font-size: 13px;
  color: var(--color-text-secondary);
}

.image-preview-info .info-left {
  display: flex;
  gap: 16px;
}

.image-preview-info .info-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.image-preview-info .info-tag svg {
  width: 14px;
  height: 14px;
}

/* ── Before/After Comparison Slider ──────────── */
.compare-slider {
  position: relative;
  width: 100%;
  min-height: 300px;
  max-height: 500px;
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
  background: repeating-conic-gradient(#f0f0f0 0% 25%, #fff 0% 50%) 50% / 16px 16px;
}

.compare-slider .compare-before,
.compare-slider .compare-after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-slider .compare-before img,
.compare-slider .compare-after img {
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
}

.compare-slider .compare-before {
  clip-path: inset(0 var(--clip-right, 50%) 0 0);
}

.compare-slider .compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--divider-x, 50%);
  width: 3px;
  background: #fff;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
  z-index: 5;
  transform: translateX(-50%);
}

.compare-slider .compare-handle {
  position: absolute;
  top: 50%;
  left: var(--divider-x, 50%);
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-handle svg {
  width: 20px;
  height: 20px;
  color: var(--color-text-secondary);
}

.compare-labels {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  z-index: 4;
  pointer-events: none;
}

.compare-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.5);
  color: #fff;
}

/* ── Crop Overlay ────────────────────────────── */
.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

.crop-overlay .crop-dim {
  position: absolute;
  background: rgba(0,0,0,0.5);
}

.crop-box {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
  cursor: move;
}

.crop-box .crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--color-brand);
  border-radius: 2px;
}

.crop-handle.tl { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle.tr { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle.bl { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle.br { bottom: -6px; right: -6px; cursor: se-resize; }
.crop-handle.tm { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.crop-handle.bm { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.crop-handle.ml { top: 50%; left: -6px; transform: translateY(-50%); cursor: w-resize; }
.crop-handle.mr { top: 50%; right: -6px; transform: translateY(-50%); cursor: e-resize; }

.crop-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.crop-grid-line {
  position: absolute;
  background: rgba(255,255,255,0.4);
}

.crop-grid-line.h1 { top: 33.33%; left: 0; right: 0; height: 1px; }
.crop-grid-line.h2 { top: 66.66%; left: 0; right: 0; height: 1px; }
.crop-grid-line.v1 { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.crop-grid-line.v2 { left: 66.66%; top: 0; bottom: 0; width: 1px; }

.crop-info {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.7);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
