/* 滑动拼图验证码样式 - 纯前端实现 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.captcha-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.captcha-container {
    width: 380px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
}

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

/* 头部 */
.captcha-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 2px;
}

.captcha-header i {
    margin-right: 8px;
    font-size: 24px;
}

/* 主体区域 */
.captcha-body {
    padding: 30px;
}

.captcha-tip {
    text-align: center;
    color: #666;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.6;
}

/* 拼图容器 */
.puzzle-wrapper {
    position: relative;
    width: 300px;
    height: 160px;
    margin: 0 auto 20px;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.piece-canvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: grab;
    z-index: 10;
    transition: transform 0.05s ease-out, filter 0.3s ease;
    filter: drop-shadow(2px 4px 8px rgba(102, 126, 234, 0.35));
    border-radius: 8px;
}

.piece-canvas:hover {
    filter: drop-shadow(4px 6px 12px rgba(102, 126, 234, 0.5)) brightness(1.05);
}

.piece-canvas:active {
    cursor: grabbing;
}

/* 刷新按钮 */
.refresh-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    color: #666;
    font-size: 16px;
}

.refresh-btn:hover {
    background: #fff;
    transform: rotate(180deg);
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 滑块容器 */
.slider-wrapper {
    position: relative;
    width: 300px;
    height: 50px;
    margin: 0 auto;
}

.slider-track {
    position: relative;
    width: 100%;
    height: 100%;
    background: #e8e8e8;
    border-radius: 25px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.slider-bg {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 25px;
    transition: width 0.05s ease-out;
}

.slider-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 14px;
    pointer-events: none;
    user-select: none;
    z-index: 5;
    white-space: nowrap;
}

.slider-button {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
}

.slider-button:hover {
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
    transform: scale(1.05);
}

.slider-button:active,
.slider-button.is-dragging {
    cursor: grabbing;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transform: scale(0.98);
}

.slider-button i {
    display: none;
}

.slider-button span {
    display: block;
}

/* 状态提示 */
.captcha-status {
    text-align: center;
    margin-top: 16px;
    min-height: 24px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.captcha-status.success {
    color: #52c41a;
    animation: pulse 0.5s ease-in-out;
}

.captcha-status.error {
    color: #ff4d4f;
    animation: shake 0.5s ease-in-out;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* 验证成功动画 */
.captcha-container.success .puzzle-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(82, 196, 26, 0.2);
    animation: successFlash 0.6s ease-out;
    pointer-events: none;
    z-index: 30;
}

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

/* 响应式适配 */
@media (max-width: 480px) {
    .captcha-container {
        width: 95%;
        max-width: 340px;
    }

    .captcha-body {
        padding: 20px;
    }

    .puzzle-wrapper,
    .slider-wrapper {
        width: 100%;
        max-width: 280px;
    }

    #puzzleCanvas {
        width: 280px !important;
        height: 150px !important;
    }
}
