/* Captcha Container */
.captcha-container {
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    margin: 20px 0;
    max-width: 340px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.captcha-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.captcha-title {
    font-weight: 600;
    color: #495057;
    font-size: 16px;
}

.captcha-refresh {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s;
    font-size: 14px;
}

.captcha-refresh:hover {
    color: #495057;
    background: #e9ecef;
    transform: rotate(180deg);
}

/* Canvas Container */
.captcha-canvas-container {
    position: relative;
    width: 300px;
    height: 150px;
    margin-bottom: 20px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.captcha-background {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.captcha-puzzle {
    position: absolute;
    z-index: 2;
    cursor: move;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-radius: 4px;
    border: 2px solid #fff;
    transition: transform 0.1s ease;
}

.captcha-puzzle:hover {
    transform: scale(1.02);
}

/* Slider */
.captcha-slider {
    margin-bottom: 15px;
}

.slider-track {
    position: relative;
    width: 100%;
    height: 44px;
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
    border-radius: 22px;
    border: 2px solid #dee2e6;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.slider-thumb {
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
    border-radius: 20px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    box-shadow: 0 3px 6px rgba(13, 110, 253, 0.3);
    transition: all 0.3s ease;
    border: 3px solid #fff;
}

.slider-thumb:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 12px rgba(13, 110, 253, 0.4);
}

.slider-thumb.dragging {
    cursor: grabbing;
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 8px 16px rgba(13, 110, 253, 0.5);
}

.slider-text {
    text-align: center;
    font-size: 13px;
    color: #6c757d;
    margin-top: 10px;
    font-weight: 500;
}

/* Status */
.captcha-status {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.captcha-status.loading {
    color: #0d6efd;
    background: #e7f1ff;
    border: 1px solid #b6d7ff;
}

.captcha-status.ready {
    color: #6c757d;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.captcha-status.dragging {
    color: #fd7e14;
    background: #fff3cd;
    border: 1px solid #ffecb5;
}

.captcha-status.success {
    color: #198754;
    background: #d1e7dd;
    border: 1px solid #badbcc;
}

.captcha-status.error {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c2c7;
}

/* Form Integration */
.form-with-captcha .form-submit {
    display: none;
}

.form-with-captcha.captcha-verified .form-submit {
    display: block;
    animation: fadeInUp 0.5s ease;
}

.form-with-captcha.captcha-verified .captcha-container {
    display: none;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .captcha-container {
        max-width: 100%;
        padding: 15px;
    }

    .captcha-canvas-container {
        width: 280px;
        transform: scale(0.93);
        transform-origin: left top;
    }

    .captcha-title {
        font-size: 14px;
    }

    .slider-text {
        font-size: 12px;
    }
}

/* Animations */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.captcha-status.loading {
    animation: pulse 1.5s infinite;
}

/* Accessibility */
.captcha-container:focus-within {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.slider-thumb:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .captcha-container {
        border-color: #000;
    }

    .slider-thumb {
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .slider-thumb,
    .captcha-puzzle,
    .captcha-status {
        transition: none;
    }

    .captcha-status.loading {
        animation: none;
    }
}