/**
 * Клиентский кроп: сцена внутри GcModal + оверрайды Cropper.js.
 * Модалка — `.modal.gc-modal` (не отдельный overlay).
 */

.gc-image-crop-modal.modal.gc-modal {
    --gc-modal-content-max-height: min(90dvh, calc(100vh - 4rem));
}

@media (min-width: 768px) {
    .gc-image-crop-modal .modal-dialog {
        max-width: 52rem;
        width: min(52rem, calc(100vw - var(--space-8)));
    }
}

.gc-image-crop {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.gc-image-crop__stage {
    position: relative;
    min-height: 16rem;
    max-height: min(50vh, 28rem);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-sunken);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-16);
    overflow: hidden;
}

.gc-image-crop__stage img {
    display: block;
    max-width: 100%;
    max-height: min(50vh, 28rem);
}

.gc-image-crop__stage .cropper-container {
    max-width: 100%;
}

.gc-image-crop__product-preview {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
    width: 100%;
}

.gc-image-crop__product-preview-label {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-size-13);
    font-weight: 500;
}

/*
 * Превью слота карточки: на всю ширину модалки. Файл 16:9, слот кропает до 5:2
 * (--gc-event-index-card-cover-aspect; object-fit: cover).
 */
.gc-image-crop__product-preview--eventCard .gc-image-crop__product-preview-frame {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: var(--gc-event-index-card-cover-aspect);
    border-radius: var(--radius-16) var(--radius-16) 0 0;
    overflow: hidden;
    background: var(--surface-secondary);
    border: 1px solid var(--border-subtle);
    border-bottom: 0;
}

@media (max-width: 767.98px) {
    .gc-image-crop__product-preview--eventCard .gc-image-crop__product-preview-frame {
        border-radius: var(--radius-12) var(--radius-12) 0 0;
    }
}

.gc-image-crop__product-preview-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.gc-image-crop__product-preview-placeholder {
    width: 100%;
    height: 100%;
    background: var(--surface-sunken);
}

.gc-image-crop__toolbar {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.gc-image-crop__ratios.gc-tabs {
    width: fit-content;
    max-width: 100%;
}

.gc-image-crop__meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-8);
}

.gc-image-crop__hint {
    color: var(--text-secondary);
    font-size: var(--font-size-13);
}

.gc-image-crop__size {
    color: var(--text-primary);
    font-size: var(--font-size-13);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .gc-image-crop__stage {
        min-height: 12rem;
        max-height: 40vh;
    }

    .gc-image-crop__stage img {
        max-height: 40vh;
    }

    .gc-image-crop__meta {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-1);
    }
}

/* Cropper.js — semantic tokens, не --accent-link-rgb */
.gc-image-crop .cropper-container {
    font-family: var(--font-family-base);
}

.gc-image-crop .cropper-view-box {
    outline: 1px solid color-mix(in srgb, var(--accent-link) 75%, transparent);
}

.gc-image-crop .cropper-line,
.gc-image-crop .cropper-point {
    background-color: var(--accent-link);
}

.gc-image-crop .cropper-point.point-se {
    width: 10px;
    height: 10px;
    opacity: 1;
}

.gc-image-crop .cropper-dashed {
    border-color: color-mix(in srgb, var(--accent-link) 40%, transparent);
}

.gc-image-crop .cropper-center {
    opacity: 1;
}

.gc-image-crop .cropper-center:before,
.gc-image-crop .cropper-center:after {
    background-color: var(--accent-link);
}

.gc-image-crop .cropper-modal {
    background: var(--fill-emphasis);
}
