/* Стили для компонента пазл-капчи */
.captcha-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    /* padding: 20px; */
    max-width: 350px;
}

.captcha-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 10px;
}

.captcha-title {
    font-size: 16px;
    color: var(--text-color);
    margin: 0;
    font-weight: 500;
}

.captcha-refresh {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.captcha-refresh:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.captcha-puzzle-area {
    position: relative;
    margin-bottom: 0px;
}

.captcha-background {
    position: relative;
    width: 300px;
    /* height: 150px; */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5f5;
}

.captcha-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.captcha-piece-overlay {
    position: absolute;
    top: 50%;
    left: 0;
    width: 50px;
    height: 50px;
    transform: translateY(-50%);
    z-index: 2;
    transition: left 0.1s ease;
    /* Предотвращаем выход за границы */
    max-width: calc(100% - 50px);
    pointer-events: none; /* Не мешаем взаимодействию с фоном */
}

.captcha-piece-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid #fff;
}

.captcha-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.captcha-instruction {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

.captcha-slider-container {
    position: relative;
    margin-bottom: 0px;
}

.captcha-slider-track {
    position: relative;
    height: 50px;
    background: var(--border-color);
    border-radius: 25px;
    overflow: hidden;
}

.captcha-slider-handle {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 50px;
    background: white;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    cursor: grab;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.captcha-slider-handle:active {
    cursor: grabbing;
    transform: scale(1.05);
}

.captcha-slider-handle svg {
    color: var(--accent-color);
}

.captcha-slider-text {
    position: absolute;
    top: 50%;
    left: 70px;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-secondary);
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.captcha-result {
    margin-top: 10px;
}

.captcha-success,
.captcha-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
}

.captcha-success {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.captcha-error {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* Адаптивность */
@media (max-width: 640px) {
    .captcha-container {
        max-width: 100%;
        padding: 15px;
    }
    
    .captcha-background {
        width: 100%;
        /* max-width: 280px; */
        /* Улучшаем рендеринг на мобильных */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: contents;
    }
    
    .captcha-piece-overlay {
        /* Дополнительная защита от выхода за границы на мобильных */
        max-width: calc(100% - 48px);
        /* Улучшаем производительность на мобильных */
        transform: translateY(-50%) translateZ(0);
        -webkit-transform: translateY(-50%) translateZ(0);
        will-change: left;
    }
    
    .captcha-slider-text {
        left: 120px;
        font-size: 12px;
    }
    
    .captcha-slider-handle {
        /* Улучшаем отзывчивость на touch */
        touch-action: none;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}