/* ========================================
   Interactive Demo Widget
   ======================================== */

.demo-widget {
    max-width: 640px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 16px;
    border: 1px solid #e9ecef;
}

/* Upload Zone */
.demo-upload-zone {
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.demo-upload-zone:hover {
    border-color: #4338ca;
    background: rgba(67, 56, 202, 0.02);
}

.demo-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 2rem;
    cursor: pointer;
}

.demo-upload-icon {
    width: 48px;
    height: 48px;
    color: #4338ca;
    margin-bottom: 1rem;
}

.demo-upload-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.25rem;
}

.demo-upload-hint {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Comparison */
.demo-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.demo-comparison-item {
    text-align: center;
}

.demo-comparison-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.demo-canvas-wrap {
    background: #fff;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.demo-canvas-wrap canvas {
    display: block;
    max-width: 100%;
    border-radius: 4px;
}

/* Шахматный фон для прозрачности */
.demo-canvas-wrap--transparent {
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
}

.demo-comparison-arrow {
    font-size: 1.5rem;
    color: #4338ca;
    font-weight: bold;
}

/* Slider */
.demo-slider-wrap {
    margin-bottom: 1.5rem;
}

.demo-slider-label {
    display: block;
}

.demo-slider-label span {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.demo-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #c7d2fe 0%, #4338ca 100%);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.demo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #4338ca;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.demo-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #4338ca;
    cursor: pointer;
}

.demo-slider-hints {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Buttons */
.demo-actions {
    display: flex;
    gap: 0.75rem;
}

.demo-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
}

.demo-btn--primary {
    background: #0088cc;
    color: #fff;
}

.demo-btn--primary:hover {
    background: #006699;
}

.demo-btn--primary svg {
    flex-shrink: 0;
}

.demo-btn--secondary {
    background: #fff;
    color: #495057;
    border: 1px solid #dee2e6;
}

.demo-btn--secondary:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

/* Loading */
.demo-loading {
    text-align: center;
    padding: 3rem;
}

.demo-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top-color: #4338ca;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile */
@media (max-width: 540px) {
    .demo-comparison {
        flex-direction: column;
    }

    .demo-comparison-arrow {
        transform: rotate(90deg);
    }

    .demo-actions {
        flex-direction: column;
    }
}
