/* 验证码触发按钮样式 - 极验风格 */
.captcha-trigger-container {
    width: 100%;
}

.captcha-trigger-btn {
    width: 100%;
    height: 42px;
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: none;
    position: relative;
}

.captcha-trigger-btn:hover {
    border-color: #1991fa;
    color: #1991fa;
}

.captcha-trigger-btn:active {
    transform: none;
}

.captcha-trigger-btn.verified {
    background: #f3fcf5;
    border-color: #52c41a;
    color: #52c41a;
}

.captcha-trigger-btn.verified:hover {
    border-color: #52c41a;
}

.captcha-trigger-btn .gi-shield {
    font-size: 16px;
}

/* 验证码弹窗样式 - 极验风格 */
.captcha-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.captcha-modal.show {
    opacity: 1;
}

.captcha-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 0;
    border-radius: 3px;
    width: 90%;
    max-width: 360px;
    position: relative;
    transform: translateY(-30px);
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    touch-action: none; /* 防止移动端触摸时页面滚动 */
    user-select: none; /* 防止拖动时选中文本 */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.captcha-modal.show .captcha-modal-content {
    transform: translateY(0);
}

.captcha-close {
    color: #999;
    position: absolute;
    right: 12px;
    top: 12px;
    font-size: 20px;
    font-weight: normal;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
}

.captcha-close:hover,
.captcha-close:focus {
    color: #333;
}

.captcha-modal-content h3 {
    color: #45494c;
    margin: 0;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: normal;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
    background: #fafafa;
}

/* 自定义验证码样式 - 极验风格 */
.custom-captcha-container {
    width: 100%;
    padding: 20px;
    background: #fff;
}

.captcha-panel {
    position: relative;
    width: 100%;
    max-width: 320px;
    height: 160px;
    margin: 0 auto 20px;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #f9f9f9;
    border: 1px solid #e6e6e6;
}

#captchaCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.block-canvas {
    position: absolute;
    top: 0;
    left: 0;
    /* Canvas边框通过JavaScript绘制，CSS只负责过渡效果 */
    transition: transform 0.3s ease;
    touch-action: none; /* 移动端防止触摸滚动 */
    cursor: grab;
}

/* 拖拽时的额外高亮效果 */
.block-canvas.dragging {
    transform: scale(1.05);
    z-index: 10;
    filter: brightness(1.1);
    cursor: grabbing;
}

/* 验证成功时的高亮效果 */
.block-canvas.success {
    filter: brightness(1.2) saturate(1.3);
}

/* 验证失败时的闪烁效果 */
.block-canvas.error {
    animation: errorBlink 0.5s ease-in-out;
}

@keyframes errorBlink {
    0%, 100% { 
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }
    50% { 
        filter: brightness(1.3) saturate(1.5) hue-rotate(-10deg);
        transform: scale(1.03);
    }
}

.refresh-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s;
    box-shadow: none;
}

.refresh-btn svg {
    color: #fff;
    transition: transform 0.3s ease;
}

.refresh-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.refresh-btn:hover svg {
    transform: rotate(180deg);
}

.slider-container {
    position: relative;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.slider-track {
    height: 40px;
    background: #f7f9fa;
    border-radius: 2px;
    position: relative;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.slider-track-fill {
    height: 100%;
    background: #d1e9fe;
    border-radius: 0;
    width: 0;
    transition: width 0.05s linear;
    position: relative;
}

.slider-track-fill::before {
    display: none;
}

.slider-btn {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
    transition: background 0.2s;
    border: none;
    user-select: none;
}

.slider-btn:hover {
    background: #1991fa;
}

.slider-btn:hover svg {
    color: #fff;
}

.slider-btn.active {
    background: #1991fa;
    box-shadow: 0 0 5px rgba(25, 145, 250, 0.5);
}

.slider-btn.active svg {
    color: #fff;
}

.slider-btn svg {
    color: #888;
    transition: color 0.2s;
}

.slider-text {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 50px;
    color: #45494c;
    font-size: 14px;
    pointer-events: none;
    user-select: none;
}

.captcha-status {
    margin-top: 12px;
    text-align: center;
    font-size: 13px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: normal;
    color: #999;
}

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

.captcha-status.error {
    color: #ff6e76;
}

/* 验证成功/失败动画 */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.4s;
}

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

.success-animation {
    animation: success 0.4s;
}

/* 适配登录页面样式 */
.custom-captcha-container .input-group-addon {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.custom-captcha-container {
    background: transparent !important;
    border: none !important;
}

/* 响应式设计 - 移动端优化 */
@media (max-width: 768px) {
    .captcha-modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .captcha-panel,
    .slider-container {
        width: 100%;
        max-width: 320px;
    }
    
    /* 增大滑块按钮尺寸，便于手指操作 */
    .slider-btn {
        width: 50px;
        height: 50px;
    }
    
    .slider-btn svg {
        font-size: 20px;
    }
    
    /* 增加滑块轨道高度 */
    .slider-track {
        height: 50px;
    }
    
    #sliderText {
        line-height: 50px;
    }
    
    #captchaCanvas {
        width: 100%;
        height: auto;
    }
}