/* Puzzle Captcha Styles */
.puzzle-captcha-wrapper {
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f9f9f9;
    padding: 15px;
    margin: 15px 0;
    max-width: 350px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.puzzle-captcha-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.puzzle-captcha-title {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.puzzle-captcha-refresh {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: all 0.2s;
}

.puzzle-captcha-refresh:hover {
    background: #e0e0e0;
    color: #333;
}

.puzzle-captcha-canvas {
    position: relative;
    width: 300px;
    height: 150px;
    margin: 0 auto 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0),
                linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.puzzle-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="150"><rect width="300" height="150" fill="%23e8f4f8"/><circle cx="75" cy="75" r="30" fill="%23bee5eb" opacity="0.7"/><circle cx="225" cy="45" r="20" fill="%23a8dadc" opacity="0.6"/><circle cx="180" cy="110" r="25" fill="%23457b9d" opacity="0.5"/></svg>') center/cover;
}

.puzzle-hole {
    position: absolute;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.15);
    border: 2px dashed #999;
    border-radius: 8px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    top: 50px; /* Фиксированная позиция по Y */
}

.puzzle-piece {
    position: absolute;
    top: 50px; /* Точно такая же позиция по Y как у отверстия */
    left: 10px;
    width: 50px;
    height: 50px;
    cursor: grab;
    transition: transform 0.1s ease;
    z-index: 10;
}

.puzzle-piece.dragging {
    cursor: grabbing;
}

.puzzle-piece-inner {
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50"><rect width="50" height="50" fill="%23007bff"/><circle cx="25" cy="25" r="15" fill="%23ffffff" opacity="0.8"/><text x="25" y="30" text-anchor="middle" fill="%23007bff" font-size="12" font-weight="bold">✓</text></svg>') center/cover;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
    border: 2px solid #007bff;
}

.puzzle-captcha-slider {
    margin-bottom: 15px;
}

.slider-track {
    position: relative;
    height: 40px;
    background: linear-gradient(to right, #e9ecef, #f8f9fa);
    border: 1px solid #ced4da;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.slider-handle {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 40px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 20px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.4);
    z-index: 10;
}

.slider-handle:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    box-shadow: 0 3px 8px rgba(0, 123, 255, 0.6);
}

.slider-handle.dragging {
    cursor: grabbing;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.8);
}

.slider-text {
    position: absolute;
    top: 50%;
    left: 60px;
    right: 10px;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    pointer-events: none;
    user-select: none;
}

.puzzle-captcha-result {
    display: none;
}

.puzzle-captcha-result .alert {
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 13px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.puzzle-captcha-result .alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.puzzle-captcha-result .alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Verified state */
.puzzle-captcha-wrapper.verified .slider-handle {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

.puzzle-captcha-wrapper.verified .slider-track {
    background: linear-gradient(to right, #d4edda, #c3e6cb);
    border-color: #28a745;
}

.puzzle-captcha-wrapper.verified .puzzle-hole {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .puzzle-captcha-wrapper {
        max-width: 100%;
        margin: 10px 0;
        padding: 10px;
    }
    
    .puzzle-captcha-canvas {
        width: 280px;
        height: 140px;
    }
    
    .puzzle-captcha-title {
        font-size: 13px;
    }
}

/* Loading animation */
.puzzle-captcha-refresh i {
    transition: transform 0.3s ease;
}

.puzzle-captcha-refresh:active i {
    transform: rotate(180deg);
}

/* Accessibility */
.puzzle-captcha-wrapper:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.slider-handle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Smooth animations */
.puzzle-piece {
    will-change: transform;
}

.slider-handle {
    will-change: transform;
}