/* 拼图滑块验证码样式 */

.puzzle-captcha {
    width: 310px;
    margin: 15px auto;
}

/* 图片容器 */
.puzzle-image-container {
    position: relative;
    width: 310px;
    height: 155px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #DCDFE6;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.puzzle-image-container.verified {
    border-color: #67C23A;
}

.puzzle-image-container.failed {
    border-color: #F56C6C;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 刷新按钮 */
.puzzle-refresh-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    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: 10;
    transition: all 0.3s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.puzzle-refresh-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: rotate(180deg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.puzzle-refresh-btn svg {
    width: 18px;
    height: 18px;
    color: #606266;
}

.puzzle-refresh-btn:active {
    transform: rotate(180deg) scale(0.95);
}

/* 背景图 */
.puzzle-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 缺口位置 - 使用clip-path创建拼图形状 */
.puzzle-hole {
    position: absolute;
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed #E6A23C;
    border-radius: 2px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.2);
    z-index: 1;
    /* 添加拼图形状的clip-path */
    clip-path: polygon(
        0% 0%, 
        25% 0%, 
        25% 15%, 
        40% 15%, 
        40% 0%, 
        60% 0%, 
        60% 15%, 
        75% 15%, 
        75% 0%, 
        100% 0%, 
        100% 25%, 
        85% 25%, 
        85% 40%, 
        100% 40%, 
        100% 60%, 
        85% 60%, 
        85% 75%, 
        100% 75%, 
        100% 100%, 
        75% 100%, 
        75% 85%, 
        60% 85%, 
        60% 100%, 
        40% 100%, 
        40% 85%, 
        25% 85%, 
        25% 100%, 
        0% 100%, 
        0% 75%, 
        15% 75%, 
        15% 60%, 
        0% 60%, 
        0% 40%, 
        15% 40%, 
        15% 25%, 
        0% 25%
    );
}

/* 拼图滑块 - 与缺口形状一致 */
.puzzle-slider {
    position: absolute;
    left: 0;
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid #409EFF;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #409EFF;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3), 
                0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    z-index: 2;
    transition: transform 0.3s, box-shadow 0.3s;
    /* 添加拼图形状的clip-path */
    clip-path: polygon(
        0% 0%, 
        25% 0%, 
        25% 15%, 
        40% 15%, 
        40% 0%, 
        60% 0%, 
        60% 15%, 
        75% 15%, 
        75% 0%, 
        100% 0%, 
        100% 25%, 
        85% 25%, 
        85% 40%, 
        100% 40%, 
        100% 60%, 
        85% 60%, 
        85% 75%, 
        100% 75%, 
        100% 100%, 
        75% 100%, 
        75% 85%, 
        60% 85%, 
        60% 100%, 
        40% 100%, 
        40% 85%, 
        25% 85%, 
        25% 100%, 
        0% 100%, 
        0% 75%, 
        15% 75%, 
        15% 60%, 
        0% 60%, 
        0% 40%, 
        15% 40%, 
        15% 25%, 
        0% 25%
    );
}

.puzzle-slider:active {
    cursor: grabbing;
    box-shadow: 0 3px 12px rgba(64, 158, 255, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

.puzzle-slider svg {
    pointer-events: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
    z-index: 3;
}

/* 滑动条 */
.puzzle-slider-bar {
    margin-top: 15px;
    padding: 0 5px;
    position: relative;
}

.slider-bar-track {
    position: relative;
    width: 100%;
    height: 40px;
    background: #f5f7fa;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #DCDFE6;
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 提示文字 */
.slider-bar-hint {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 13px;
    color: #909399;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

.slider-bar-progress {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, #67C23A 0%, #85ce61 100%);
    border-radius: 20px;
    transition: width 0.3s;
}

.slider-bar-knob {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #409EFF 0%, #66b1ff 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(64, 158, 255, 0.3);
    z-index: 3;
    transition: transform 0.3s, box-shadow 0.3s;
}

.slider-bar-knob:active {
    cursor: grabbing;
    box-shadow: 0 3px 8px rgba(64, 158, 255, 0.5);
}

.slider-bar-knob svg {
    pointer-events: none;
}

.slider-bar-knob.verified {
    background: linear-gradient(135deg, #67C23A 0%, #85ce61 100%);
    box-shadow: 0 2px 6px rgba(103, 194, 58, 0.3);
}

/* 操作按钮 */
.puzzle-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    padding: 0 5px;
    min-height: 20px;
}

.puzzle-status {
    font-size: 13px;
    color: #909399;
    transition: color 0.3s;
    font-weight: 500;
}

.puzzle-status.verified {
    color: #67C23A;
    font-weight: 600;
}

.puzzle-status.failed {
    color: #F56C6C;
    font-weight: 600;
}

/* 成功动画 */
@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.puzzle-image-container.verified {
    animation: successPulse 0.5s ease;
}

.puzzle-image-container.verified .puzzle-slider {
    background: rgba(103, 194, 58, 0.9);
    border-color: #67C23A;
    box-shadow: 0 2px 8px rgba(103, 194, 58, 0.4);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .puzzle-captcha {
        width: 100%;
        max-width: 310px;
    }
    
    .puzzle-image-container {
        width: 100%;
    }
    
    .slider-bar-track {
        height: 36px;
    }
    
    .slider-bar-knob {
        width: 36px;
        height: 36px;
        font-size: 11px;
    }
}
