/*********************/
/*    Demo Section   */
/*********************/
.demo-section {
    padding-top: 5rem;
    padding-bottom: 5rem;
}

.demo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
}

@media (min-width: 1024px) {
    .demo-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Left Side - Text */
.demo-text-container {
    text-align: left;
}

.demo-text-item {
    padding: 1.5rem;
    border-left: 4px solid transparent;
    /* transparent border for inactive state */
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.demo-text-item.active {
    border-left: 4px solid #594cda;
    background-color: #f9fafb;
    opacity: 1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-radius: 0 0.5rem 0.5rem 0;
}

.demo-text-item h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #252c38;
}

.demo-text-item p {
    margin-bottom: 0;
    font-size: 0.95rem;
}

/* Right Side - Visuals */
.demo-visuals {
    position: relative;
    /* height: 350px; Removed fixed height */
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

.demo-image-group {
    /* position: absolute; Removed absolute positioning */
    grid-area: 1 / 1;
    /* Stack them on top of each other */
    width: 100%;
    max-width: 450px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: translateY(20px);
}

.demo-image-group.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.demo-card-frame {
    position: relative;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transform-style: preserve-3d;
    display: grid;
    /* Use grid for stacking */
    place-items: center;
}

.captcha-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    /* Ensure aspect ratio or height if needed, but grid usually handles content */
}

.captcha-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Requested 'cover' functionality */
    transition: opacity 0.3s ease;
}

.captcha-img.after {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    z-index: 5;
}

/* Spinner Styles */
.loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    /* Semi-transparent overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
}

.loading-spinner i {
    font-size: 3rem;
    color: #594cda;
}

/* Animation States */

/* Processing State: Show Spinner */
.processing .loading-spinner {
    opacity: 1;
    visibility: visible;
}

/* Solved State: Show After Image */
.solved .captcha-img.after {
    opacity: 1;
}

/* Scanning Overlay (Optional, can keep or remove if spinner replaces it, but keeping as requested 'scanning') */
.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(89, 76, 218, 0.3), transparent);
    transform: translateY(-100%);
    pointer-events: none;
    z-index: 12;
}

.processing .scan-overlay {
    animation: scanEffect 1.5s ease-in-out infinite;
}

@keyframes scanEffect {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(100%);
    }
}

.solver-badge {
    position: absolute;
    bottom: -15px;
    right: -15px;
    background: #10b981;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 20;
}

.solved .solver-badge {
    opacity: 1;
    transform: scale(1);
}