/**
 * 滑动验证码样式
 */

.captcha-container {
    margin-bottom: 20px;
    user-select: none;
}

.captcha-box {
    position: relative;
    width: 100%;
    height: 44px;
    background: #f7f9fa;
    border: 2px solid #e4e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.captcha-box.active {
    border-color: #ff9800;
}

.captcha-box.success {
    border-color: #52c41a;
    background: #f6ffed;
}

.captcha-box.error {
    border-color: #ff4d4f;
    background: #fff1f0;
}

.captcha-track {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #91d5ff 0%, #40a9ff 100%);
    width: 0;
    transition: width 0.3s ease;
}

.captcha-box.success .captcha-track {
    background: linear-gradient(90deg, #b7eb8f 0%, #52c41a 100%);
    width: 100%;
}

.captcha-box.error .captcha-track {
    background: linear-gradient(90deg, #ffccc7 0%, #ff4d4f 100%);
}

.captcha-text {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8c8c8c;
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
    transition: color 0.3s;
}

.captcha-box.active .captcha-text {
    color: #595959;
}

.captcha-box.success .captcha-text {
    color: #52c41a;
}

.captcha-box.error .captcha-text {
    color: #ff4d4f;
}

.captcha-slider {
    position: absolute;
    left: 0;
    top: 0;
    width: 44px;
    height: 44px;
    background: #fff;
    border: 2px solid #e4e7eb;
    border-radius: 8px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s, box-shadow 0.3s;
    z-index: 2;
}

.captcha-slider:hover {
    border-color: #ff9800;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.captcha-slider:active {
    cursor: grabbing;
}

.captcha-box.success .captcha-slider {
    border-color: #52c41a;
    background: #52c41a;
}

.captcha-box.error .captcha-slider {
    border-color: #ff4d4f;
    background: #ff4d4f;
}

.captcha-icon {
    font-size: 18px;
    color: #8c8c8c;
    transition: color 0.3s;
}

.captcha-slider:hover .captcha-icon {
    color: #ff9800;
}

.captcha-box.success .captcha-icon {
    color: #fff;
}

.captcha-box.error .captcha-icon {
    color: #fff;
}

/* 加载动画 */
.captcha-loading {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #e4e7eb;
    border-top-color: #ff9800;
    border-radius: 50%;
    animation: captcha-spin 0.8s linear infinite;
    display: none;
    z-index: 3;
}

.captcha-box.verifying .captcha-loading {
    display: block;
}

@keyframes captcha-spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* 震动动画（验证失败时） */
@keyframes captcha-shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.captcha-box.error {
    animation: captcha-shake 0.5s;
}

/* 禁用状态 */
.captcha-box.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.captcha-box.disabled .captcha-slider {
    cursor: not-allowed;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .captcha-text {
        font-size: 12px;
    }
}
