/* =================================================================
   entity-image-crop.css — Crop / framing modal for the per-entity
   user-image feature. Opens after the file picker, lets the user pan
   and zoom inside a 380×380 stage with a circular preview mask, then
   ships the framed region to main as a 512×512 PNG.

   Visual idiom mirrors modals.css (.settings-modal* + .settings-btn*)
   and coverViewer.css (dark scrim, rounded panel, soft shadow). Don't
   invent a new visual language here — these classes ride on the same
   tokens (--bg-card, --accent-gradient, --border-subtle, etc.).
   ================================================================= */

.entity-crop-modal {
    position: fixed;
    inset: 0;
    background: var(--surface-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6100;          /* above coverViewer (6000) so a stray cover
                               popup never sits on top of an active crop */
    padding: 20px;
    animation: fadeIn 0.15s ease-out;
}

.entity-crop-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    width: 520px;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.entity-crop-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-subtle);
}

.entity-crop-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entity-crop-body {
    padding: 22px 22px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

/* Stage = the visible crop window. Hard-pinned at 380×380 so the
   pan/zoom math in entityImageCropModal.js (STAGE constant) matches. */
.entity-crop-stage {
    position: relative;
    width: 380px;
    height: 380px;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
    cursor: grab;
    user-select: none;
    flex: 0 0 auto;
}

.entity-crop-stage:active {
    cursor: grabbing;
}

.entity-crop-stage-img {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    pointer-events: none;
    -webkit-user-drag: none;
    will-change: transform;
}

/* Circular preview mask — purely visual feedback that the avatar
   render sites will clip to a circle. The crop window is the full
   stage; this overlay just dims the corners so the user sees the
   final framing at a glance. */
.entity-crop-stage-mask {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.entity-crop-hint {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.entity-crop-controls {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
}

.entity-crop-controls .entity-crop-reset {
    flex: 0 0 auto;
}

.entity-crop-zoom {
    flex: 1 1 auto;
    accent-color: var(--accent-primary);
}

.entity-crop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--border-subtle);
}
