/**
 * Custom Slider Captcha Styles
 * Drag-based verification with mobile support and theme awareness
 */

/* Light Theme (Default) */
.slider-captcha {
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    margin: 15px 0;
}

.slider-captcha-instruction {
    text-align: center;
    color: #1f2937;
    margin-bottom: 12px;
    font-size: 13px;
}

.slider-captcha-instruction .target-value {
    color: #2563eb;
    font-weight: bold;
    font-size: 16px;
}

.slider-captcha-track {
    position: relative;
    height: 44px;
    background: #e5e7eb;
    border-radius: 22px;
    margin-bottom: 8px;
    overflow: visible;
    border: 2px solid #d1d5db;
    cursor: default;
    touch-action: none;
}

.slider-captcha-fill {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: none;
    border-radius: 25px;
    pointer-events: none;
    width: 0;
}

/* Dark Theme */
[data-theme="dark"] .slider-captcha {
    background: #1a1a1a;
    border-color: #3c3c3c;
}

[data-theme="dark"] .slider-captcha-instruction {
    color: #f5f5f5;
}

[data-theme="dark"] .slider-captcha-instruction .target-value {
    color: #06b6d4;
}

[data-theme="dark"] .slider-captcha-track {
    background: #2b2b2b;
    border-color: #3c3c3c;
}

[data-theme="dark"] .slider-captcha-fill {
    background: linear-gradient(90deg, #06b6d4, #8b5cf6);
}

.slider-captcha-target {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    z-index: 1;
    pointer-events: none;
}

.slider-captcha-target-line {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #10b981;
    background: rgba(16, 185, 129, 0.15);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

[data-theme="dark"] .slider-captcha-target-line {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.15);
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.9);
    }
}

.slider-captcha-handle {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    cursor: grab;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.2s, transform 0.1s;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.slider-captcha-handle svg path {
    stroke: #3b82f6;
}

[data-theme="dark"] .slider-captcha-handle {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .slider-captcha-handle svg path {
    stroke: #06b6d4;
}

.slider-captcha-handle:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.slider-captcha-handle:active,
.slider-captcha-handle.dragging {
    cursor: grabbing;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.6);
    transform: translateY(-50%) scale(1.1);
}

.slider-captcha-handle.verified {
    background: #10b981;
    cursor: default;
    animation: success-pop 0.3s ease-out;
}

[data-theme="dark"] .slider-captcha-handle:hover {
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

[data-theme="dark"] .slider-captcha-handle:active,
[data-theme="dark"] .slider-captcha-handle.dragging {
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.6);
}

[data-theme="dark"] .slider-captcha-handle.verified {
    background: #4caf50;
}

@keyframes success-pop {
    0% {
        transform: translateY(-50%) scale(1);
    }
    50% {
        transform: translateY(-50%) scale(1.2);
    }
    100% {
        transform: translateY(-50%) scale(1);
    }
}

.slider-captcha-handle.verified svg path {
    stroke: white;
}

.slider-captcha-value {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    z-index: 1;
}

.slider-captcha-status {
    text-align: center;
    font-size: 13px;
    min-height: 18px;
    margin-top: 4px;
    font-weight: 500;
}

.slider-captcha-status.success {
    color: #10b981;
    font-weight: bold;
}

.slider-captcha-status.error {
    color: #ef4444;
}

[data-theme="dark"] .slider-captcha-value {
    color: #888;
}

[data-theme="dark"] .slider-captcha-status.success {
    color: #4caf50;
}

[data-theme="dark"] .slider-captcha-status.error {
    color: #f44336;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .slider-captcha {
        padding: 10px 12px;
    }

    .slider-captcha-track {
        height: 50px;
        border-radius: 25px;
    }

    .slider-captcha-handle {
        width: 46px;
        height: 46px;
    }

    .slider-captcha-handle svg {
        width: 22px;
        height: 22px;
    }

    .slider-captcha-instruction {
        font-size: 14px;
    }

    .slider-captcha-instruction .target-value {
        font-size: 16px;
    }
}

/* Prevent pull-to-refresh on mobile during drag */
.slider-captcha-track,
.slider-captcha-handle {
    overscroll-behavior: contain;
}

/* Focus styles for accessibility */
.slider-captcha-handle:focus-visible {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}

/* Disable track interaction */
.slider-captcha-track::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: not-allowed;
    z-index: 0;
}

/* Focus styles for accessibility */
[data-theme="dark"] .slider-captcha-handle:focus-visible {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}
