/**
 * YMY 滑动验证码样式
 * 
 * @package YMY
 * @since 1.0.0
 */

/* 验证码容器 */
.ymy-captcha-wrapper {
    margin: 16px 0;
}

.ymy-captcha {
    background: #f6f7f9;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e1e4e8;
    transition: all 0.3s;
}

.ymy-captcha-success {
    background: #f0f9ff;
    border-color: #00a32a;
}

.ymy-captcha-fail {
    background: #fcf0f1;
    border-color: #d63638;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* 标题 */
.ymy-captcha-title {
    font-size: 13px;
    color: #646970;
    margin-bottom: 12px;
    font-weight: 500;
}

/* 验证区域 */
.ymy-captcha-canvas {
    position: relative;
    width: 100%;
    height: 180px;
    background: #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid #ddd;
}

/* 背景图片 */
.ymy-captcha-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
}

/* 背景图片遮罩 */
.ymy-captcha-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
}

/* 拼图块目标位置阴影 */
.ymy-captcha-puzzle-shadow {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    z-index: 3;
    display: none;
}

/* 拼图块 */
.ymy-captcha-puzzle {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 0 0 2px #5a67d8;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.ymy-captcha-puzzle::before {
    content: '🔒';
    font-size: 24px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.ymy-captcha-success .ymy-captcha-puzzle::before {
    content: '✓';
    color: #00a32a;
    font-size: 28px;
    font-weight: bold;
}

/* 刷新按钮 */
.ymy-captcha-refresh {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #ddd;
}

.ymy-captcha-refresh:hover {
    background: #fff;
    transform: rotate(180deg);
}

.ymy-captcha-refresh svg {
    color: #5a67d8;
}

/* 滑块轨道 */
.ymy-captcha-slider {
    position: relative;
    height: 50px;
    background: #f7f9fa;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e4e7eb;
}

.ymy-captcha-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.ymy-captcha-track-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #f7f9fa;
}

.ymy-captcha-track-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #d1e9ff 0%, #b8deff 100%);
    pointer-events: none;
    border-right: 1px solid #b8deff;
}

/* 滑块按钮 - 与轨道融为一体 */
.ymy-captcha-btn {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 50px;  /* 与轨道高度一致 */
    background: linear-gradient(180deg, #fff 0%, #f5f7fa 100%);
    border-radius: 4px;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.12);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border: 1px solid #ddd;
    user-select: none;
    touch-action: none;
}

.ymy-captcha-btn::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 10px;
    border-color: transparent transparent transparent #1991FA;
}

.ymy-captcha-btn:hover {
    background: linear-gradient(180deg, #fff 0%, #eef1f6 100%);
}

.ymy-captcha-btn.ymy-is-dragging {
    cursor: grabbing;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    background: linear-gradient(180deg, #f5f7fa 0%, #e8ebf0 100%);
}

.ymy-captcha-btn svg {
    display: none;
}

.ymy-captcha-success .ymy-captcha-btn {
    background: linear-gradient(180deg, #52c41a 0%, #3ba715 100%);
    border-color: #3ba715;
}

.ymy-captcha-success .ymy-captcha-btn::before {
    content: '✓';
    border: none;
    width: auto;
    height: auto;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
}

.ymy-captcha-fail .ymy-captcha-btn {
    background: linear-gradient(180deg, #ff4d4f 0%, #e63939 100%);
    border-color: #e63939;
}

.ymy-captcha-fail .ymy-captcha-btn::before {
    content: '✗';
    border: none;
    width: auto;
    height: auto;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
}

/* 提示文字 */
.ymy-captcha-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: #45494c;
    pointer-events: none;
    transition: opacity 0.2s;
    user-select: none;
    font-weight: 500;
}

.ymy-captcha-success .ymy-captcha-text {
    color: #52c41a;
    opacity: 0;
}

.ymy-captcha-fail .ymy-captcha-text {
    color: #ff4d4f;
}

/* 状态提示 */
.ymy-captcha-status {
    margin-top: 8px;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
    font-weight: 500;
}

/* 响应式 */
@media (max-width: 480px) {
    .ymy-captcha-canvas {
        height: 120px;
    }
    
    .ymy-captcha-puzzle {
        width: 40px;
        height: 40px;
    }
    
    .ymy-captcha-puzzle::before {
        font-size: 20px;
    }
    
    .ymy-captcha-btn {
        width: 40px;
        height: 40px;
    }
    
    .ymy-captcha-track {
        height: 40px;
    }
    
    .ymy-captcha-text {
        font-size: 12px;
    }
}
