/* Crop Modal Styles */
#crop-modal .modal-dialog {
    max-width: 700px;
}

.crop-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    user-select: none;
}

.crop-container {
    position: relative;
    width: 500px;
    height: 500px;
    margin: 0 auto;
    overflow: hidden;
}

.crop-image {
    position: absolute;
    top: 0;
    left: 0;
    cursor: move;
    transition: transform 0.1s ease;
    user-select: none;
    display: block;
}

.crop-box {
    position: absolute;
    border: 2px solid #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    cursor: move;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    z-index: 10;
    /* Size will be set dynamically by JavaScript */
}

.crop-handles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border: 1px solid #fff;
    pointer-events: all;
    z-index: 11;
}

.handle-nw { top: -4px; left: -4px; cursor: nw-resize; }
.handle-ne { top: -4px; right: -4px; cursor: ne-resize; }
.handle-sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.handle-se { bottom: -4px; right: -4px; cursor: se-resize; }
.handle-n { top: -4px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.handle-s { bottom: -4px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.handle-w { top: 50%; left: -4px; transform: translateY(-50%); cursor: w-resize; }
.handle-e { top: 50%; right: -4px; transform: translateY(-50%); cursor: e-resize; }

.crop-controls {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.crop-controls .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.crop-controls .btn {
    min-width: 40px;
}

.crop-controls .form-range {
    margin-top: 0.5rem;
}

.crop-controls .form-range::-webkit-slider-thumb {
    background: #3b82f6;
}

.crop-controls .form-range::-moz-range-thumb {
    background: #3b82f6;
    border: none;
}

/* Loading state for crop */
.crop-container.loading {
    pointer-events: none;
    opacity: 0.7;
}

.crop-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* RTL Support */
[dir="rtl"] .crop-controls .d-flex {
    flex-direction: row-reverse;
}

/* Responsive Design */
@media (max-width: 768px) {
    #crop-modal .modal-dialog {
        max-width: 95%;
        margin: 1rem;
    }
    
    .crop-wrapper {
        height: 400px;
    }
    
    .crop-container {
        width: 100%;
        height: 400px;
    }
    
    .crop-controls {
        padding: 0.75rem;
    }
    
    .crop-controls .btn {
        min-width: 35px;
        padding: 0.375rem 0.5rem;
    }
}

@media (max-width: 576px) {
    .crop-wrapper {
        height: 300px;
    }
    
    .crop-container {
        height: 300px;
    }
    
    .crop-controls .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .crop-controls .btn {
        width: 100%;
    }
}
