/* ==========================================================================
   Image Cropper Modal
   ========================================================================== */

.image-cropper-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  background: var(--color-bg-overlay, rgba(0, 0, 0, 0.85));
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
}

.image-cropper-modal--open {
  display: flex;
}

body.image-cropper-modal-open {
  overflow: hidden;
}

.image-cropper-modal__panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #000;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.image-cropper-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--spacing-4);
  flex-shrink: 0;
}

.image-cropper-modal__title {
  flex: 1;
  text-align: center;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: #fff;
}

.image-cropper-modal__btn {
  background: transparent;
  border: 0;
  padding: var(--spacing-2) var(--spacing-3);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-width: 60px;
}

.image-cropper-modal__btn--primary {
  font-weight: var(--font-weight-semibold);
}

.image-cropper-modal__btn:active {
  opacity: 0.7;
}

.image-cropper-modal__stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.image-cropper-modal__image {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* Cropper.js overrides for our modal aesthetic */
.image-cropper-modal .cropper-modal {
  background-color: #000;
  opacity: 0.75;
}

/* Frame outline stays visible on any image (incl. pure black/white) via
   white line + dark halo combo. */
.image-cropper-modal .cropper-view-box {
  outline: 3px solid #fff;
  outline-color: rgba(255, 255, 255, 1);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}

.image-cropper-modal .cropper-line,
.image-cropper-modal .cropper-point {
  background-color: transparent;
}

.image-cropper-modal .cropper-dashed {
  border-color: transparent;
}

/* Light tint on the kept (inside) area so it's visually distinct from the
   dimmed cut area — even when the source image has a pure black background.
   Without this, a black photo + 75% black dim outside both look identical. */
.image-cropper-modal .cropper-face {
  background-color: #fff;
  opacity: 0.3;
}

/* Circle mask for avatar (1:1) */
.image-cropper-modal__stage--circle .cropper-view-box,
.image-cropper-modal__stage--circle .cropper-face,
.image-cropper-modal__stage--circle .cropper-crop-box {
  border-radius: 50%;
}

.image-cropper-modal__stage--circle .cropper-view-box {
  outline: 0;
  box-shadow: none;
}

/* Ring + dim live on the crop-box (parent of view-box) — view-box has
   overflow:hidden which clips inset shadows, so we apply an OUTSET ring
   here on the unclipped parent. */
.image-cropper-modal__stage--circle .cropper-crop-box {
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 1),
    0 0 0 9999px rgba(0, 0, 0, 0.75);
}

.image-cropper-modal__stage--circle .cropper-modal {
  opacity: 0;
}

.image-cropper-modal__hint {
  text-align: center;
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--spacing-3) var(--spacing-4) var(--spacing-4);
  flex-shrink: 0;
  margin: 0;
}
