/**
 * Passport Photo Cropper Styles
 */

/* Cropper container */
.cropper-container {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cropper-container img {
    max-width: 100%;
    max-height: 600px;
}

/* Cropper controls */
.cropper-controls {
    padding: 12px 0;
}

.cropper-controls button {
    font-size: 0.875rem;
    padding: 6px 12px;
}

.cropper-controls .form-range {
    height: 6px;
}

.cropper-controls .form-range::-webkit-slider-thumb {
    background: #0f172a;
    border: 2px solid #fff;
    cursor: pointer;
}

.cropper-controls .form-range::-moz-range-thumb {
    background: #0f172a;
    border: 2px solid #fff;
    cursor: pointer;
}

/* Modal customization */
#cropperModal .modal-header {
    background: #f8f9fa;
    padding: 1.25rem;
}

#cropperModal .modal-header .modal-title {
    color: #0f172a;
    font-weight: 600;
}

#cropperModal .modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Preview card */
#cropperModal .card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#cropperModal .card-body {
    padding: 1.5rem;
}

#cropperModal .card-title {
    color: #0f172a;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Preview image */
#cropPreview {
    object-fit: cover;
    border-radius: 4px;
}

/* Alert styles */
#cropperModal .alert-info {
    background-color: #e0f2fe;
    border-color: #0ea5e9;
    color: #0369a1;
    border-radius: 6px;
    margin-top: auto;
    font-size: 0.8rem;
}

#cropperModal .alert-info strong {
    color: #0c4a6e;
}

/* Modal footer */
#cropperModal .modal-footer {
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

/* Button styles in modal */
#cropperModal .btn-primary {
    background-color: #0f172a;
    border-color: #0f172a;
    font-weight: 600;
}

#cropperModal .btn-primary:hover {
    background-color: #1e293b;
    border-color: #1e293b;
}

#cropperModal .btn-outline-secondary {
    border-color: #d1d5db;
    color: #374151;
    font-weight: 600;
}

#cropperModal .btn-outline-secondary:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

/* Cropper.js library default styles */
.cropper-container {
    position: relative;
    direction: ltr;
    font-size: 0;
    text-align: center;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.cropper-container img {
    max-width: 100%;
}

.cropper-modal {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    display: block;
    background: rgba(0, 0, 0, 0.3);
}

.cropper-wrap-box {
    position: absolute;
    top: 0;
    left: 0;
    cursor: move;
}

.cropper-canvas {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.cropper-drag-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: move;
}

.cropper-crop-box {
    position: absolute;
    border: 1px solid #39f;
    background: rgba(51, 153, 255, 0.1);
    outline: 1px solid rgba(51, 153, 255, 0.5);
}

.cropper-crop-box.modal {
    outline: 500px solid rgba(0, 0, 0, 0.3);
}

.cropper-crop-box.hidden {
    display: none;
}

.cropper-crop-box.fixed {
    position: fixed;
}

.cropper-crop-box .cropper-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(51, 153, 255, 0.3);
    cursor: move;
    border-radius: 4px;
}

.cropper-crop-box .cropper-face:hover {
    background: rgba(51, 153, 255, 0.4);
}

.cropper-crop-box .cropper-line {
    position: absolute;
    display: block;
    background: #39f;
}

.cropper-crop-box .cropper-line.line-h {
    width: 100%;
    height: 1px;
}

.cropper-crop-box .cropper-line.line-v {
    width: 1px;
    height: 100%;
}

.cropper-crop-box .cropper-line.line-east {
    top: 0;
    right: -3px;
    width: 5px;
    height: 100%;
    cursor: e-resize;
}

.cropper-crop-box .cropper-line.line-north {
    top: -3px;
    left: 0;
    width: 100%;
    height: 5px;
    cursor: n-resize;
}

.cropper-crop-box .cropper-line.line-west {
    top: 0;
    left: -3px;
    width: 5px;
    height: 100%;
    cursor: w-resize;
}

.cropper-crop-box .cropper-line.line-south {
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 5px;
    cursor: s-resize;
}

.cropper-crop-box .cropper-point {
    position: absolute;
    display: block;
    width: 5px;
    height: 5px;
    background: #39f;
    opacity: 0.75;
}

.cropper-crop-box .cropper-point.point-e {
    top: 50%;
    right: -3px;
    margin-top: -3px;
    cursor: e-resize;
}

.cropper-crop-box .cropper-point.point-n {
    top: -3px;
    left: 50%;
    margin-left: -3px;
    cursor: n-resize;
}

.cropper-crop-box .cropper-point.point-ne {
    top: -3px;
    right: -3px;
    cursor: ne-resize;
}

.cropper-crop-box .cropper-point.point-nw {
    top: -3px;
    left: -3px;
    cursor: nw-resize;
}

.cropper-crop-box .cropper-point.point-s {
    bottom: -3px;
    left: 50%;
    margin-left: -3px;
    cursor: s-resize;
}

.cropper-crop-box .cropper-point.point-se {
    bottom: -3px;
    right: -3px;
    cursor: se-resize;
}

.cropper-crop-box .cropper-point.point-sw {
    bottom: -3px;
    left: -3px;
    cursor: sw-resize;
}

.cropper-crop-box .cropper-point.point-w {
    top: 50%;
    left: -3px;
    margin-top: -3px;
    cursor: w-resize;
}

.cropper-face {
    top: 0;
    left: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #cropperModal .modal-dialog {
        margin: 0.5rem;
    }

    #cropperModal .row {
        flex-direction: column;
    }

    #cropperModal .col-md-8,
    #cropperModal .col-md-4 {
        width: 100% !important;
        margin-bottom: 1rem;
    }

    .cropper-container {
        min-height: 300px;
    }

    .cropper-container img {
        max-height: 400px;
    }

    .cropper-controls {
        flex-wrap: wrap;
        gap: 8px !important;
    }

    .cropper-controls button {
        flex: 1;
        min-width: 80px;
    }

    .cropper-controls .d-flex {
        width: 100%;
        margin-top: 8px;
    }
}

/* Accessibility */
.cropper-crop-box:focus {
    outline: 2px solid #0f172a;
    outline-offset: 2px;
}

.cropper-controls button:focus,
#cropperModal button:focus {
    outline: 2px solid #0f172a;
    outline-offset: 2px;
}

/* Loading state */
.cropper-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.cropper-loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top-color: #0f172a;
    border-radius: 50%;
    animation: cropper-spin 1s linear infinite;
}

@keyframes cropper-spin {
    to {
        transform: rotate(360deg);
    }
}
