/* Fixed-frame photo crop — dot.cards style (pan image, pinch/slider zoom) */

.ab-photo-crop[hidden] {
  display: none !important;
}

.ab-photo-crop {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  color: #fff;
  font-family: inherit;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.ab-photo-crop__top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
  padding: max(0.75rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) 0.5rem max(1rem, env(safe-area-inset-left, 0px));
}

.ab-photo-crop__close {
  appearance: none;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
}

.ab-photo-crop__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ab-photo-crop__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.ab-photo-crop__layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.ab-photo-crop__image-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  will-change: transform;
  transform: translate(-50%, -50%);
}

.ab-photo-crop__image {
  display: block;
  width: auto;
  height: auto;
  max-width: none !important;
  max-height: none !important;
  pointer-events: none;
  -webkit-user-drag: none;
}

.ab-photo-crop__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ab-photo-crop__shade--circle {
  background: rgba(0, 0, 0, 0.52);
  -webkit-mask-image: radial-gradient(circle at center, transparent var(--ab-crop-r), #000 calc(var(--ab-crop-r) + 1px));
  mask-image: radial-gradient(circle at center, transparent var(--ab-crop-r), #000 calc(var(--ab-crop-r) + 1px));
}

.ab-photo-crop__shade--rect {
  left: 50%;
  top: 50%;
  width: var(--ab-crop-w);
  height: var(--ab-crop-h);
  transform: translate(-50%, -50%);
  inset: auto;
  background: transparent;
  border-radius: 0.35rem;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.52);
}

.ab-photo-crop__frame {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.ab-photo-crop__frame--circle {
  width: calc(var(--ab-crop-r) * 2);
  height: calc(var(--ab-crop-r) * 2);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.92);
}

.ab-photo-crop__frame--rect {
  width: var(--ab-crop-w);
  height: var(--ab-crop-h);
  border-radius: 0.35rem;
  border: 2px solid rgba(255, 255, 255, 0.92);
}

.ab-photo-crop__controls {
  flex-shrink: 0;
  padding: 1.1rem 1.25rem max(1.25rem, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.35) 100%);
}

.ab-photo-crop__zoom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ab-photo-crop__zoom-icon {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1;
}

.ab-photo-crop__zoom-input {
  flex: 1;
  appearance: none;
  height: 0.25rem;
  margin: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

.ab-photo-crop__zoom-input::-webkit-slider-thumb {
  appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.ab-photo-crop__zoom-input::-moz-range-thumb {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.ab-photo-crop__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.ab-photo-crop__btn {
  appearance: none;
  min-height: 3rem;
  margin: 0;
  padding: 0 1rem;
  border-radius: 0.85rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ab-photo-crop__btn--ghost {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.ab-photo-crop__btn--ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

.ab-photo-crop__btn--primary {
  border: none;
  background: #fff;
  color: #0a0a0a;
}

.ab-photo-crop__btn--primary:hover {
  background: #f1f5f9;
}

body.ab-photo-crop-open {
  overflow: hidden;
}
