/**
 * 自建滑块验证码样式
 * RiPro Slide Captcha - 现代风格
 */

/* 容器 */
.rsc-container {
    position: relative;
    width: 100%;
    height: 44px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf0 100%);
    border: 1px solid #d9d9d9;
    border-radius: 22px;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    margin: 0;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
    /* iOS 触摸优化 */
    touch-action: pan-x;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.rsc-container:hover {
    border-color: #40a9ff;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
}

/* 进度背景 */
.rsc-bg {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(135deg, #73d13d 0%, #52c41a 100%);
    border-radius: 22px 0 0 22px;
    transition: none;
}

/* 滑块按钮 */
.rsc-slider {
    position: absolute;
    left: 0;
    top: 0;
    width: 44px;
    height: 100%;
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
    border-radius: 50%;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: transform 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    /* iOS 触摸优化 - 全面修复 */
    touch-action: pan-x;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-drag: none;
    outline: none;
}

.rsc-slider:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.rsc-slider:active {
    cursor: grabbing;
    transform: scale(1.02);
}

.rsc-slider-icon {
    font-size: 16px;
    color: #1890ff;
    font-weight: bold;
    letter-spacing: -2px;
    font-style: normal;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rsc-slider-icon svg {
    display: block;
}

/* SVG 图标旋转动画（加载状态） */
.rsc-icon-spin {
    animation: rsc-spin 1s linear infinite;
}

/* 提示文字 */
.rsc-text {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 50px;
    padding-right: 15px;
    color: #8c8c8c;
    font-size: 14px;
    pointer-events: none;
    box-sizing: border-box;
    overflow: hidden;
}

.rsc-text-icon {
    display: none;
}

.rsc-text-content {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: linear-gradient(
        90deg, 
        #8c8c8c 0%, 
        #8c8c8c 40%, 
        #595959 50%, 
        #8c8c8c 60%, 
        #8c8c8c 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rsc-shimmer 2.5s ease-in-out infinite;
}

/* 扫光动画 */
@keyframes rsc-shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

/* 验证成功状态 */
.rsc-container.rsc-success {
    border-color: #52c41a;
    background: linear-gradient(135deg, #73d13d 0%, #52c41a 100%);
    box-shadow: 0 4px 16px rgba(82, 196, 26, 0.4);
}

.rsc-container.rsc-success .rsc-bg {
    width: 100% !important;
    background: transparent;
    transition: width 0.3s ease;
    border-radius: 22px;
}

.rsc-container.rsc-success .rsc-slider {
    left: calc(100% - 44px) !important;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: left 0.3s ease;
    transform: none;
}

.rsc-container.rsc-success .rsc-slider:hover {
    transform: none;
}

.rsc-container.rsc-success .rsc-slider-icon {
    color: #52c41a;
    font-size: 18px;
}

.rsc-container.rsc-success .rsc-text {
    padding-left: 0;
    justify-content: center;
    background: transparent;
}

.rsc-container.rsc-success .rsc-text-icon {
    display: none;
}

.rsc-container.rsc-success .rsc-text-content {
    background: none;
    -webkit-text-fill-color: #fff;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 3px;
    animation: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* 验证失败状态 */
.rsc-container.rsc-fail {
    animation: rsc-shake 0.5s ease;
    border-color: #ff4d4f;
    background: linear-gradient(135deg, #ff7875 0%, #ff4d4f 100%);
    box-shadow: 0 4px 16px rgba(255, 77, 79, 0.4);
}

.rsc-container.rsc-fail .rsc-bg {
    background: transparent;
    width: 100% !important;
    border-radius: 22px;
}

.rsc-container.rsc-fail .rsc-slider {
    left: calc(100% - 44px) !important;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: none;
}

.rsc-container.rsc-fail .rsc-slider:hover {
    transform: none;
}

.rsc-container.rsc-fail .rsc-slider-icon {
    color: #ff4d4f;
    font-size: 18px;
}

.rsc-container.rsc-fail .rsc-text {
    background: transparent;
    justify-content: center;
    padding-left: 0;
}

.rsc-container.rsc-fail .rsc-text-icon {
    display: none;
}

.rsc-container.rsc-fail .rsc-text-content {
    animation: none;
    background: none;
    -webkit-text-fill-color: #fff;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 2px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* 锁定状态 */
.rsc-container.rsc-locked {
    border-color: #d9d9d9;
    background: linear-gradient(135deg, #f0f0f0 0%, #e8e8e8 100%);
    cursor: not-allowed;
}

.rsc-container.rsc-locked .rsc-slider {
    cursor: not-allowed;
    background: #f5f5f5;
    box-shadow: none;
}

.rsc-container.rsc-locked .rsc-slider:hover {
    transform: none;
    box-shadow: none;
}

.rsc-container.rsc-locked .rsc-slider-icon {
    color: #999;
    font-size: 14px;
}

.rsc-container.rsc-locked .rsc-text {
    justify-content: center;
    padding-left: 50px;
}

.rsc-container.rsc-locked .rsc-text-content {
    animation: none;
    background: none;
    -webkit-text-fill-color: #999;
    color: #999;
    font-weight: normal;
    font-size: 13px;
}

/* 抖动动画 */
@keyframes rsc-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* 重置动画 */
.rsc-container.rsc-reset .rsc-slider {
    transition: left 0.3s ease;
    left: 0 !important;
}

.rsc-container.rsc-reset .rsc-bg {
    transition: width 0.3s ease;
    width: 0 !important;
}

/* 加载状态 */
.rsc-container.rsc-loading .rsc-slider-icon {
    animation: rsc-spin 1s linear infinite;
}

.rsc-container.rsc-loading .rsc-text-content {
    animation: none;
    -webkit-text-fill-color: #8c8c8c;
}

@keyframes rsc-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 禁用状态 */
.rsc-container.rsc-disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* 隐藏域 */
.rsc-token {
    display: none;
}

/* ========================================
   主题弹窗和页面样式
   ======================================== */

/* 滑块包装器 */
.rsc-captcha-wrapper {
    width: 100%;
    margin: 10px 0;
    box-sizing: border-box;
}

/* 主题登录弹窗 */
.modal-body .rsc-captcha-wrapper,
.card .rsc-captcha-wrapper,
.ajax-signup-form .rsc-captcha-wrapper {
    width: 100%;
    padding: 0;
}

/* col-12 容器内 */
.col-12 .rsc-captcha-wrapper {
    width: 100%;
    padding: 0 15px;
    box-sizing: border-box;
}

.col-12 .rsc-captcha-wrapper .rsc-container {
    width: 100%;
}

/* 用户中心页面 */
.col-sm-9 .rsc-captcha-wrapper,
.input-group .rsc-captcha-wrapper {
    width: 100%;
}

.no-gutters .rsc-captcha-wrapper {
    width: 100%;
}

/* 隐藏原腾讯验证码按钮（无条件隐藏，防止闪烁） */
.TencentCaptchaBtn,
#TencentCaptchaBtn,
button[data-appid],
button[data-cbfn="qq_aptcha_callback"] {
    display: none !important;
}

/* ========================================
   wp-login.php 页面样式
   ======================================== */

.login .rsc-login-wrapper {
    margin: 16px 0;
    width: 100%;
}

.login .rsc-captcha-wrapper {
    width: 100%;
}

.login .rsc-container {
    width: 100%;
    height: 44px;
    margin: 0;
    border-radius: 22px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf0 100%);
    border: 1px solid #d9d9d9;
}

.login .rsc-slider {
    left: 0;
    width: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.login .rsc-text {
    padding-left: 50px;
    justify-content: center;
    font-size: 14px;
}

.login .rsc-container.rsc-success,
.login .rsc-container.rsc-fail {
    border-radius: 22px !important;
    overflow: hidden !important;
}

.login .rsc-container.rsc-success .rsc-bg,
.login .rsc-container.rsc-fail .rsc-bg {
    border-radius: 22px !important;
}

.login .rsc-container.rsc-success .rsc-slider,
.login .rsc-container.rsc-fail .rsc-slider {
    left: calc(100% - 44px) !important;
    border-radius: 50% !important;
}

/* ========================================
   响应式适配
   ======================================== */

@media (max-width: 480px) {
    .rsc-container {
        height: 40px;
        border-radius: 20px;
    }
    
    .rsc-slider {
        width: 40px;
    }
    
    .rsc-text {
        font-size: 12px;
        padding-left: 46px;
    }
    
    .rsc-container.rsc-success .rsc-slider,
    .rsc-container.rsc-fail .rsc-slider {
        left: calc(100% - 40px) !important;
    }
    
    .col-12 .rsc-captcha-wrapper {
        padding: 0 10px;
    }
}

/* ========================================
   深色模式适配
   ======================================== */

@media (prefers-color-scheme: dark) {
    .rsc-container {
        background: #1f1f1f;
        border-color: #404040;
    }
    
    .rsc-slider {
        background: #2d2d2d;
        border-right-color: #404040;
    }
    
    .rsc-slider:hover {
        background: #3d3d3d;
    }
    
    .rsc-slider-icon {
        color: #40a9ff;
    }
    
    .rsc-text-content {
        background: linear-gradient(
            90deg, 
            #888 0%, 
            #888 40%, 
            #bbb 50%, 
            #888 60%, 
            #888 100%
        );
        background-size: 200% 100%;
        -webkit-background-clip: text;
        background-clip: text;
    }
}

/* ========================================
   滑块验证码容器适配
   ======================================== */

/* 自动初始化容器 */
.rsc-auto-init {
    width: 100%;
    margin-bottom: 15px;
}

.rsc-auto-init .rsc-container {
    width: 100%;
}

/* 保留在各容器中的样式兼容 */
.col-12 > .rsc-auto-init,
.col-lg-12 > .rsc-auto-init {
    padding: 0;
}
