/**
 * NEF Image Cropper Styles
 *
 * Styling for the interactive image crop modal.
 *
 * @package NEF_Platform_Core
 * @since 1.4.1
 */

/* Modal overlay and container */
.nef-crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nef-crop-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
}

.nef-crop-modal-container {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    max-width: 95vw;
    max-height: 95vh;
    width: 1000px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

/* Modal header */
.nef-crop-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.nef-crop-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.nef-crop-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.nef-crop-modal-close:hover {
    background: #e9ecef;
    color: #333;
}

/* Modal body - image container */
.nef-crop-modal-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #1a1a1a;
    min-height: 0;
}

.nef-crop-image-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#nef-crop-image,
#nef-crop-image-global {
    display: block;
    max-width: 100%;
    max-height: 100%;
    /* Hide the original image - Cropper.js will replace it */
    opacity: 0;
}

/* Toolbar */
.nef-crop-modal-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.nef-crop-toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nef-crop-toolbar-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

/* Buttons */
.nef-crop-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
}

.nef-crop-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.nef-crop-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.nef-crop-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Aspect ratio buttons */
.nef-crop-aspect-btn.is-active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.nef-crop-aspect-btn.is-active:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* Icon buttons (zoom/rotate) */
.nef-crop-zoom-btn,
.nef-crop-rotate-btn {
    padding: 8px;
    min-width: 36px;
}

.nef-crop-zoom-btn .dashicons,
.nef-crop-rotate-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Modal footer */
.nef-crop-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #e9ecef;
}

.nef-crop-cancel-btn {
    background: #ffffff;
}

.nef-crop-apply-btn {
    background: #10b981;
    border-color: #10b981;
    color: #ffffff;
    padding: 10px 24px;
    font-weight: 600;
}

.nef-crop-apply-btn:hover {
    background: #059669;
    border-color: #059669;
}

/* Loading overlay */
.nef-crop-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
}

.nef-crop-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: nef-spin 0.8s linear infinite;
}

@keyframes nef-spin {
    to {
        transform: rotate(360deg);
    }
}

.nef-crop-loading-text {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* Body class when modal is open */
body.nef-modal-open {
    overflow: hidden;
}

/* Cropper.js customizations */
.nef-crop-image-container .cropper-container {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0;
    left: 0;
}

.cropper-view-box,
.cropper-face {
    border-radius: 0;
}

.cropper-line {
    background-color: rgba(255, 255, 255, 0.5);
}

.cropper-point {
    background-color: #3b82f6;
    width: 10px;
    height: 10px;
    opacity: 1;
}

.cropper-point.point-se {
    width: 12px;
    height: 12px;
}

/* Ensure cropper canvas fills the container */
.cropper-canvas,
.cropper-drag-box,
.cropper-crop-box,
.cropper-modal {
    position: absolute;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .nef-crop-modal-container {
        max-width: 98vw;
        max-height: 98vh;
        width: 100%;
        height: 90vh;
        border-radius: 8px;
    }

    .nef-crop-modal-body {
        min-height: 200px;
    }

    .nef-crop-modal-toolbar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .nef-crop-toolbar-group {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nef-crop-aspect-ratios {
        flex-direction: column;
        align-items: stretch;
    }

    .nef-crop-aspect-ratios .nef-crop-toolbar-label {
        text-align: center;
        margin-bottom: 4px;
    }

    .nef-crop-aspect-ratios .nef-crop-aspect-btn {
        flex: 1;
    }

    .nef-crop-modal-footer {
        padding: 12px 16px;
    }

    .nef-crop-btn {
        padding: 10px 12px;
        font-size: 12px;
    }

    .nef-crop-apply-btn {
        flex: 1;
    }
}

@media screen and (max-width: 480px) {
    .nef-crop-modal-header h3 {
        font-size: 16px;
    }

    .nef-crop-modal-body {
        min-height: 250px;
    }

    .nef-crop-zoom-controls,
    .nef-crop-rotate-controls {
        gap: 4px;
    }
}
