/**
 * Puzzle Captcha Styles
 * Contains styles for puzzle captcha modal and components
 */

/* Basic flexbox utilities */
.justify-content-center {
    -ms-flex-pack: center !important;
    justify-content: center !important;
}

.d-flex {
    display: -ms-flexbox !important;
    display: flex !important;
}

.position-relative {
    position: relative;
}

.position-absolute {
    position: absolute;
}

.mt-20px {
    margin-top: 20px;
}

/* Puzzle captcha specific styles */
#captchaModal .modal-dialog {
    width: auto;
    max-width: 400px;
}

#captchaModal .puzzle-container {
    overflow: visible;
    border: 2px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

#originalImage {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 2px;
}

#puzzlePiece {
    /* Smooth transition for movements, but not too obvious */
    transition: transform 0.05s ease-out;
    z-index: 10;
    cursor: move;
    /* Disable selection to prevent user interaction issues */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Slider styling */
#slider {
    width: 100%;
    margin: 15px 0;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: linear-gradient(to right, #ddd 0%, #007bff 50%, #ddd 100%);
    border-radius: 4px;
    outline: none;
}

#slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Modal content styling */
#captchaModal .modal-body {
    padding: 20px;
    text-align: center;
}

#captchaModal .modal-body p {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
}

#captchaModal .modal-header {
    border-bottom: 1px solid #ddd;
    padding: 15px 20px;
}

#captchaModal .modal-footer {
    border-top: 1px solid #ddd;
    padding: 15px 20px;
}

/* Loading states */
#captchaModal.loading #originalImage,
#captchaModal.loading #puzzlePiece {
    opacity: 0.5;
}

#captchaModal.loading #slider {
    pointer-events: none;
    opacity: 0.5;
}

/* Responsive design */
@media (max-width: 480px) {
    #captchaModal .modal-dialog {
        margin: 10px;
        width: calc(100% - 20px);
    }
    
    #captchaModal .modal-body {
        padding: 15px;
    }
    
    #slider {
        height: 10px;
    }
    
    #slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    #slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
}

/* Accessibility improvements */
#slider:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

#captchaModal .modal-header .close:focus,
#captchaModal .modal-footer .btn:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Prevent text selection in puzzle area */
#captchaModal .puzzle-container,
#captchaModal .puzzle-container * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}