/* assets/css/components/cropper.css */

/* 
   Z-INDEX HIERARCHY:
   - Normal Content: 1
   - Navigation: 1000
   - Modals (Create Entry): 100000
   - Tooltips/Toasts: 200000
   - CROPPER OVERLAY: 250000 (Must be on top of everything)
*/

.cropper-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 250000 !important;
    background: var(--overlay-90);
    /* Darker backdrop for focus */
    backdrop-filter: blur(4px);

    display: flex;
    align-items: center;
    /* Center Vertically */
    justify-content: center;
    /* Center Horizontally */

    animation: cropperFadeIn 0.2s ease-out;
}

@keyframes cropperFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.cropper-popup {
    background: var(--bg-card);
    width: 95%;
    max-width: 600px;
    /* Optimal size for desktop */
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    /* Modern slightly rounded look to match theme */
    overflow: hidden;
    box-shadow: 0 10px 40px var(--overlay-50);
    border: 2px solid var(--border-color);
    /* Neo-Brutal Border */
}

/* Header */
.cropper-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-lighter);
    background: var(--bg-card);
    flex-shrink: 0;
    /* Keep header sticky */
}

.cropper-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cropper-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-body);
}

.cropper-close-btn:hover {
    color: var(--color-ink);
}

/* Body / Image Wrapper */
.cropper-body {
    flex: 1;
    overflow: hidden;
    /* Important for CropperJS */
    background: var(--bg-dark);
    /* Dark background behind image */
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cropper-img-wrapper {
    /* Ensure the image container fits within the modal body */
    max-width: 100%;
    max-height: 60vh;
    /* Limit height to viewport height fraction */
    width: 100%;
}

.cropper-img-wrapper img {
    display: block;
    max-width: 100%;
}

/* Footer */
.cropper-footer {
    padding: 1rem;
    border-top: 2px solid var(--border-lighter);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-card);
    flex-shrink: 0;
}

/* Mobile Adjustments */
@media (max-width: 500px) {
    .cropper-popup {
        height: 100%;
        max-height: 100%;
        width: 100%;
        border-radius: 0;
        border: none;
    }

    .cropper-body {
        height: 100%;
    }

    .cropper-img-wrapper {
        max-height: 70vh;
    }
}