/* ==========================================================================
   Product Crop Modal Styles
   ========================================================================== */

.prd-crop-modal {
    display: none;
    position: fixed;
    z-index: 1050; /* Higher than checkout modal */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    align-items: center;
    justify-content: center;
}

.prd-crop-modal__content {
    background-color: #fff;
    padding: 2rem;
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 600px;
    text-align: center;
}

.prd-crop-modal__image-container {
    margin: 1.5rem 0;
    height: 400px;
    background-color: #f0f0f0;
    position: relative; /* For safe zone positioning */
}

#imageToCrop {
    max-width: 100%;
    height: auto;
    opacity: 0; /* Hide until cropper is ready */
}

.prd-crop-modal__actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Cropper.js overrides */
.cropper-view-box {
    outline: 2px solid var(--color-primary);
    outline-color: var(--color-primary);
}

/* Safe Zone Overlay - Corrected */
.prd-crop-modal__safe-zone {
    position: absolute;
    top: 8%;
    left: 8%;
    width: 84%;
    height: 84%;
    border: 2px dashed rgba(255, 255, 255, 0.9);
    pointer-events: none; /* Allows clicks to pass through */
    z-index: 10;
    box-sizing: border-box;
}

.prd-crop-modal__safe-zone::after {
    content: 'VISIBLE AREA';
    position: absolute;
    top: -25px; /* Position label outside the box */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

/* New Controls Styles */
.prd-crop-modal__controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 1rem;
}

.prd-crop-modal__zoom-controls,
.prd-crop-modal__color-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.prd-crop-modal__controls label {
    font-weight: var(--font-weight-bold);
}

.btn--icon {
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
    padding: 0;
    line-height: 36px;
}

#backgroundColorPicker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 36px;
    height: 36px;
    background-color: transparent;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    cursor: pointer;
}

#backgroundColorPicker::-webkit-color-swatch {
    border-radius: 50%;
    border: none;
}

#backgroundColorPicker::-moz-color-swatch {
    border-radius: 50%;
    border: none;
}

/* Shimmer Loader */
.prd-crop-modal__loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    display: none; /* Hidden by default */
}

.prd-crop-modal__image-container.loading .prd-crop-modal__loader {
    display: block;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Transparent-background toggle (apparel default) */
.prd-crop-modal__transparent-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.prd-crop-modal__transparent-toggle input {
    accent-color: var(--color-primary, #e05a00);
}
