/* =====================================================
   ANALYSIS ANIMATION SYSTEM
   Premium Full-Screen Data Visualization
   ===================================================== */

/* ===== FULL SCREEN OVERLAY & CANVAS ===== */

#analysisOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#analysisOverlay.active {
    opacity: 1;
    visibility: visible;
}

#analysisOverlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* NEW: Results reveal back-out overshoot */
#resultsDisplay {
    opacity: 1 !important;
    transform: scale(1) !important;
    transition: opacity 800ms cubic-bezier(0.34, 1.56, 0.64, 1), 
                transform 800ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

#resultsDisplay.pop-in {
    opacity: 1 !important;
    transform: scale(1.02) !important; /* Micro overshoot */
}

/* Canvas element fills the viewport */
#analysisCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Status text that appears during animation */
.analysis-status {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10001;
    opacity: 0;
    animation: statusFadeIn 0.5s ease forwards;
    animation-delay: 0.3s;
}

.analysis-status h3 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 8px 0;
    letter-spacing: 0.5px;
}

.analysis-status p {
    font-size: 13px;
    color: #9ca3af;
    margin: 0;
}

@media (max-width: 768px) {
    .analysis-status {
        bottom: 40px;
    }

    .analysis-status h3 {
        font-size: 16px;
    }

    .analysis-status p {
        font-size: 12px;
    }
}

/* ===== ANIMATIONS ===== */

@keyframes statusFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes scannerGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 0, 128, 0.5),
                    0 0 40px rgba(121, 40, 202, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 0, 128, 0.7),
                    0 0 60px rgba(121, 40, 202, 0.5);
    }
}

@keyframes particlePulse {
    0%, 100% {
        opacity: 0.6;
        filter: blur(0px);
    }
    50% {
        opacity: 1;
        filter: blur(0.5px);
    }
}

@keyframes networkCollapse {
    from {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    to {
        transform: scale(0.1) translateY(200px);
        opacity: 0;
    }
}

@keyframes resultRevealSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MOBILE RESPONSIVENESS ===== */

@media (max-width: 480px) {
    #analysisOverlay {
        background: rgba(5, 5, 5, 0.98);
    }

    .analysis-status {
        bottom: 30px;
    }

    .analysis-status h3 {
        font-size: 14px;
    }

    .analysis-status p {
        font-size: 11px;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

#analysisOverlay canvas {
    will-change: transform;
    /* Hardware acceleration (WebGL fallback) */
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* GPU acceleration hints */
.analysis-overlay-active {
    contain: layout style paint;
}

/* Disable text selection during animation */
#analysisOverlay {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
