/* ======================
   滑块验证码公共样式（优化版）
   特性：
   - 平滑动画效果
   - 响应式设计
   - 更好的视觉反馈
   - 移动端优化
====================== */

/* 遮罩层 */
.captcha-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 验证码盒子 */
.captcha-box {
    background: #fff;
    width: 100%;
    max-width: 380px;
    padding: 28px;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 关闭按钮 */
.captcha-close {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    font-size: 18px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    transition: all 0.2s ease;
}

.captcha-close:hover {
    background: #eee;
    transform: scale(1.1);
}

.captcha-close:active {
    transform: scale(0.95);
}

/* 拼图区域 */
.captcha-puzzle {
    position: relative;
    width: 300px;
    height: 150px;
    background: #eee;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 背景图 */
.captcha-puzzle-bg {
    width: 300px;
    height: 150px;
    background-size: 300px 150px !important;
    background-position: 0 0 !important;
    background-repeat: no-repeat !important;
}

/* 凹槽（已删除，保留样式以防万一） */
.captcha-hole {
    position: absolute;
    width: 55px;
    height: 55px;
    background: #000 !important;
    opacity: 0.7 !important;
    border-radius: 6px;
    z-index: 1;
    box-shadow: 0 0 3px #fff;
}

/* 拼图块 */
.captcha-block {
    position: absolute;
    width: 55px !important;
    height: 55px !important;
    background-size: 55px 55px !important;
    background-position: 0 0 !important;
    background-repeat: no-repeat !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    border-radius: 4px;
    z-index: 10;
    left: 0;
    /* top 值将在 JavaScript 中动态设置 */
    transition: left 0.3s ease;
}

/* 滑块容器 */
.captcha-slider {
    position: relative;
    width: 300px;
    height: 48px;
    background: #f0f2f5;
    border-radius: 24px;
    overflow: hidden;
    margin-left: auto;
    margin-right: auto;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 填充区域 */
.captcha-slider-fill {
    position: absolute;
    left: 0;
    top: 0;
    width: calc(0% + 48px);
    height: 100%;
    background: linear-gradient(135deg, #bbdcff 0%, #9bc8f5 100%);
    border-radius: 24px;
    z-index: 1;
    box-sizing: border-box;
    transition: width 0.3s ease;
}

/* 文字提示 */
.captcha-slider-text {
    position: absolute;
    width: 100%;
    text-align: center;
    line-height: 48px;
    font-size: 15px;
    color: #555;
    user-select: none;
    pointer-events: none;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* 滑块手柄 */
.captcha-slider-handle {
    position: absolute;
    left: 0;
    top: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #409EFF 0%, #66b1ff 100%) !important;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3), 0 0 0 2px rgba(255, 255, 255, 0.8) !important;
    z-index: 20;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.captcha-slider-handle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(64, 158, 255, 0.4), 0 0 0 2px rgba(255, 255, 255, 0.9) !important;
}

.captcha-slider-handle:active {
    transform: scale(0.98);
}

/* 刷新按钮 */
.captcha-refresh {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    z-index: 30;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.captcha-refresh:hover {
    background: #f5f7fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.captcha-refresh:active {
    transform: scale(0.95);
}

.captcha-refresh.rotating {
    animation: rotate 0.4s ease;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 结果提示 */
.captcha-result {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-width: 80%;
    text-align: center;
}

.captcha-result.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.captcha-result.success {
    background: linear-gradient(135deg, #07c160 0%, #13d17d 100%);
}

.captcha-result.fail {
    background: linear-gradient(135deg, #f56c6c 0%, #ff7878 100%);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .captcha-overlay {
        padding: 10px;
    }

    .captcha-box {
        max-width: 100%;
        padding: 20px;
    }

    .captcha-puzzle,
    .captcha-slider {
        width: 100%;
        max-width: 300px;
    }

    .captcha-slider-text {
        font-size: 14px;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .captcha-box {
        background: #1e1e1e;
        color: #e0e0e0;
    }

    .captcha-slider {
        background: #2d2d2d;
    }

    .captcha-slider-text {
        color: #b0b0b0;
    }

    .captcha-close {
        background: #2d2d2d;
        color: #b0b0b0;
    }

    .captcha-close:hover {
        background: #3d3d3d;
    }

    .captcha-refresh {
        background: #2d2d2d;
    }
}

/* 加载状态 */
.captcha-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* 禁用状态 */
.captcha-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}