/* 
 * Threat Neutralization Matrix Animation
 * Designed for executive visual demonstration of Detect -> Explain -> Remediate
 */

.threat-matrix-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: radial-gradient(circle at center, rgba(30, 20, 60, 0.4) 0%, rgba(10, 10, 30, 0.9) 100%);
    border-radius: var(--r-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    perspective: 1000px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* The Isometric Grid */
.matrix-grid {
    position: absolute;
    width: 200%;
    height: 200%;
    background-image: 
        linear-gradient(rgba(124, 58, 237, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: rotateX(60deg) rotateZ(-45deg) translateZ(-100px);
    transform-origin: center;
    animation: grid-pulse 8s infinite alternate ease-in-out;
}

@keyframes grid-pulse {
    0% { opacity: 0.3; transform: rotateX(60deg) rotateZ(-45deg) translateZ(-100px) translateY(0); }
    100% { opacity: 0.6; transform: rotateX(60deg) rotateZ(-45deg) translateZ(-100px) translateY(20px); }
}

/* The Node (Threat -> Secure) */
.matrix-node {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ef4444;
    box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.6);
    z-index: 10;
    animation: node-cycle 12s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes node-cycle {
    0%, 15% {
        /* Idle -> Threat appears */
        background: rgba(255, 255, 255, 0.2);
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
        transform: translate(-50%, -50%) scale(0.5);
    }
    20%, 45% {
        /* Threat Active (DETECT) */
        background: #ef4444;
        box-shadow: 0 0 30px 10px rgba(239, 68, 68, 0.8);
        transform: translate(-50%, -50%) scale(1.2);
    }
    50%, 75% {
        /* Analysis Phase (EXPLAIN) */
        background: #ef4444;
        box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.5);
        transform: translate(-50%, -50%) scale(1);
    }
    80%, 95% {
        /* Remediated (REMEDIATE) */
        background: #22c55e;
        box-shadow: 0 0 30px 10px rgba(34, 197, 94, 0.8);
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        background: rgba(255, 255, 255, 0.2);
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
        transform: translate(-50%, -50%) scale(0.5);
    }
}

/* Sonar Scan Rings (DETECT) */
.sonar-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    border: 2px solid #ef4444;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    z-index: 5;
    animation: sonar-ping 12s infinite;
}

.sonar-ring:nth-child(2) { animation-delay: 0.3s; }
.sonar-ring:nth-child(3) { animation-delay: 0.6s; }

@keyframes sonar-ping {
    0%, 20% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    25% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    40%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(4); border-color: rgba(239, 68, 68, 0); }
}

/* HUD Overlay (EXPLAIN) */
.hud-panel {
    position: absolute;
    top: 15%;
    right: 10%;
    background: rgba(10, 15, 30, 0.85);
    border: 1px solid rgba(124, 58, 237, 0.4);
    border-left: 4px solid #ef4444;
    padding: 12px 16px;
    border-radius: 4px;
    color: white;
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    backdrop-filter: blur(8px);
    z-index: 20;
    opacity: 0;
    transform: translateX(20px);
    animation: hud-cycle 12s infinite;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

@keyframes hud-cycle {
    0%, 45% { opacity: 0; transform: translateX(20px); }
    50%, 75% { opacity: 1; transform: translateX(0); }
    80%, 100% { opacity: 0; transform: translateX(-20px); }
}

.hud-panel .threat-level {
    color: #ef4444;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: hud-text-blink 0.5s infinite alternate;
}

@keyframes hud-text-blink {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

/* Remediation Beam (REMEDIATE) */
.remediation-beam {
    position: absolute;
    top: 0;
    left: 50%;
    width: 100%;
    height: 50%;
    background: linear-gradient(to bottom, rgba(34, 197, 94, 0) 0%, rgba(34, 197, 94, 0.6) 100%);
    transform: translateX(-50%);
    clip-path: polygon(45% 0, 55% 0, 52% 100%, 48% 100%);
    opacity: 0;
    z-index: 15;
    transform-origin: top;
    animation: beam-strike 12s infinite;
}

@keyframes beam-strike {
    0%, 75% { opacity: 0; transform: translateX(-50%) scaleY(0); }
    78% { opacity: 1; transform: translateX(-50%) scaleY(1); }
    85%, 100% { opacity: 0; transform: translateX(-50%) scaleY(1); }
}

/* PR Badge (Resolution) */
.pr-badge {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translate(-50%, 20px);
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #4ade80;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    z-index: 20;
    backdrop-filter: blur(4px);
    animation: pr-cycle 12s infinite;
}

@keyframes pr-cycle {
    0%, 82% { opacity: 0; transform: translate(-50%, 20px); }
    85%, 95% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -10px); }
}

/* Connecting Line HUD to Node */
.hud-line {
    position: absolute;
    top: 25%;
    right: 35%;
    width: 15%;
    height: 25%;
    border-top: 1px dashed rgba(239, 68, 68, 0.6);
    border-left: 1px dashed rgba(239, 68, 68, 0.6);
    z-index: 10;
    opacity: 0;
    animation: line-cycle 12s infinite;
}

@keyframes line-cycle {
    0%, 48% { opacity: 0; }
    50%, 75% { opacity: 1; }
    80%, 100% { opacity: 0; }
}

/* Matrix scanning bars */
.scan-bar {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(124, 58, 237, 0.4);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.6);
    z-index: 2;
    animation: scan-move 4s infinite linear;
}

@keyframes scan-move {
    0% { top: -10%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 110%; opacity: 0; }
}
