/* Puzzle Captcha Styles */
#slider-captcha {
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.slider-captcha-container {
    width: 100%;
    max-width: 100%;
    margin: 15px auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    box-sizing: border-box;
    overflow: hidden;
    border: 2px solid #e9ecef;
}

.captcha-canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 280px;
    height: 180px;
    margin: 0 auto 15px;
    border-radius: 8px;
    overflow: visible;
    background: #ffffff;
    box-sizing: border-box;
    border: 2px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Contenedor para la pieza del puzzle */
.puzzle-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    z-index: 15;
}

.puzzle-drop-zone {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px dashed #6c757d;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 117, 125, 0.1);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 5;
}

.puzzle-drop-zone.drag-over {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.1);
}

.puzzle-drop-zone.success {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.puzzle-drop-zone.error {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.drop-zone-text {
    color: #6c757d;
    font-size: 14px;
    text-align: center;
    pointer-events: none;
}

.puzzle-piece-container {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 60px;
    height: 60px;
    border: 2px solid #007bff;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    cursor: move;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    z-index: 20;
    touch-action: none;
}

.puzzle-piece-container:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.puzzle-piece-container.dragging {
    transform: scale(1.1);
    z-index: 1000;
    cursor: grabbing;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.puzzle-piece {
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
}

.captcha-image {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 6px;
    user-select: none;
    pointer-events: none;
}

.puzzle-instructions {
    text-align: center;
    margin-bottom: 15px;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
}

.puzzle-instructions i {
    color: #007bff;
    margin-right: 8px;
}

/* Eliminamos estilos del slider ya que ahora usamos drag & drop */

.captcha-refresh-btn {
    display: block;
    margin: 15px auto 0;
    padding: 8px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    width: auto;
    max-width: 200px;
    font-weight: 500;
}

.captcha-refresh-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.captcha-refresh-btn:active {
    background: #004085;
    transform: translateY(0);
}

.captcha-status {
    text-align: center;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.captcha-status.show {
    opacity: 1;
    transform: translateY(0);
}

.captcha-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.captcha-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.captcha-status.loading {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.captcha-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.captcha-loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes shake {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateY(-50%) translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateY(-50%) translateX(5px); }
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Responsive */
@media (max-width: 768px) {
    .slider-captcha-container {
        max-width: 100%;
        padding: 8px;
        margin: 10px auto;
    }
    
    .captcha-canvas-wrapper,
    .slider-track {
        width: 100%;
        max-width: 260px;
    }
    
    .captcha-canvas-wrapper {
        height: 120px;
    }
    
    .slider-button {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .slider-text {
        left: 40px;
        width: calc(100% - 40px);
        font-size: 11px;
    }
    
    .captcha-refresh-btn {
        font-size: 11px;
        padding: 5px 12px;
    }
}

/* Ajustes específicos para el formulario de registro */
.login-box .slider-captcha-container {
    margin: 10px 0;
    padding: 8px;
}

.login-box .captcha-canvas-wrapper,
.login-box .slider-track {
    max-width: 100%;
    width: 100%;
}

@media (max-width: 480px) {
    .captcha-canvas-wrapper,
    .slider-track {
        max-width: 240px;
    }
    
    .captcha-canvas-wrapper {
        height: 100px;
    }
    
    .slider-button {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .slider-text {
        left: 35px;
        width: calc(100% - 35px);
        font-size: 10px;
    }
}

/* Accesibilidad */
.slider-button:focus {
    outline: 2px solid #2196F3;
    outline-offset: 2px;
}

/* Animación de éxito */
@keyframes successPulse {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); }
}

.slider-button.success {
    animation: successPulse 0.6s ease-in-out;
}

/* Deshabilitar interacción durante validación */
.slider-captcha-container.validating .slider-button,
.slider-captcha-container.validating .captcha-puzzle {
    pointer-events: none;
    opacity: 0.6;
}

