/**
 * Styles pour le Puzzle Slider CAPTCHA
 */

.puzzle-captcha {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.puzzle-captcha-loading,
.puzzle-captcha-error {
    text-align: center;
    padding: 40px 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 4px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.puzzle-captcha-error p {
    color: #dc2626;
    margin-bottom: 16px;
}

.retry-button {
    padding: 8px 16px;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.retry-button:hover {
    background: #4338ca;
}

.puzzle-captcha-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
    color: #374151;
}

.puzzle-icon {
    font-size: 20px;
}

.puzzle-instruction {
    font-weight: 500;
}

.puzzle-canvas-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: #f3f4f6;
    border-left: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    overflow: hidden;
    user-select: none;
}

.puzzle-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.puzzle-piece-container {
    position: absolute;
    left: 0;
    transition: transform 0.1s ease-out;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.puzzle-piece-container.success {
    animation: successPulse 0.5s ease-out;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.puzzle-piece-container.shake {
    animation: shake 0.5s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.puzzle-piece {
    display: block;
    width: 60px;
    height: 60px;
    pointer-events: none;
}

.puzzle-slider-container {
    padding: 20px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
}

.puzzle-slider-track {
    position: relative;
    width: 100%;
    height: 40px;
    background: #f3f4f6;
    border-radius: 20px;
    border: 2px solid #e5e7eb;
}

.puzzle-slider-thumb {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    user-select: none;
}

.puzzle-slider-thumb:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.puzzle-slider-thumb:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.puzzle-slider-thumb.dragging {
    cursor: grabbing;
    transform: translateY(-50%) scale(1.1);
}

.puzzle-slider-thumb.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    animation: successBounce 0.5s ease-out;
}

@keyframes successBounce {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.2); }
}

.puzzle-slider-thumb.shake {
    animation: thumbShake 0.5s ease-out;
}

@keyframes thumbShake {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    25% { transform: translateY(-50%) translateX(-5px); }
    75% { transform: translateY(-50%) translateX(5px); }
}

.slider-icon {
    display: block;
    font-weight: bold;
}

.puzzle-captcha-status {
    min-height: 40px;
    padding: 0 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.status-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.status-icon {
    font-size: 18px;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 640px) {
    .puzzle-captcha {
        max-width: 100%;
    }
    
    .puzzle-captcha-header {
        font-size: 13px;
        padding: 10px 12px;
    }
    
    .puzzle-slider-thumb {
        width: 45px;
        height: 45px;
    }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    .puzzle-piece-container,
    .puzzle-slider-thumb,
    .status-message {
        transition: none;
        animation: none;
    }
}

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    .puzzle-captcha-header {
        background: #1f2937;
        border-color: #374151;
        color: #e5e7eb;
    }
    
    .puzzle-slider-track {
        background: #374151;
        border-color: #4b5563;
    }
    
    .puzzle-captcha-status {
        background: #1f2937;
        border-color: #374151;
    }
}
