/* ========================================
   SPLINTER CELL NIGHT VISION ANIMATIONS
   Additional visual effects and animations
   ======================================== */

/* ========================================
   SCREEN NOISE/GRAIN EFFECT
   ======================================== */

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9997;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    opacity: 0.3;
    animation: noise 0.2s infinite;
}

@keyframes noise {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.35; }
}

/* ========================================
   TEXT GLITCH EFFECT
   ======================================== */

.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--nv-red);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--nv-blue);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(61px, 9999px, 52px, 0);
    }
    5% {
        clip: rect(33px, 9999px, 144px, 0);
    }
    10% {
        clip: rect(65px, 9999px, 13px, 0);
    }
    15% {
        clip: rect(86px, 9999px, 75px, 0);
    }
    20% {
        clip: rect(26px, 9999px, 99px, 0);
    }
    25% {
        clip: rect(3px, 9999px, 111px, 0);
    }
    30% {
        clip: rect(89px, 9999px, 42px, 0);
    }
    35% {
        clip: rect(21px, 9999px, 130px, 0);
    }
    40% {
        clip: rect(97px, 9999px, 8px, 0);
    }
    45% {
        clip: rect(55px, 9999px, 76px, 0);
    }
    50% {
        clip: rect(16px, 9999px, 138px, 0);
    }
    55% {
        clip: rect(72px, 9999px, 31px, 0);
    }
    60% {
        clip: rect(44px, 9999px, 105px, 0);
    }
    65% {
        clip: rect(91px, 9999px, 19px, 0);
    }
    70% {
        clip: rect(7px, 9999px, 123px, 0);
    }
    75% {
        clip: rect(68px, 9999px, 47px, 0);
    }
    80% {
        clip: rect(38px, 9999px, 94px, 0);
    }
    85% {
        clip: rect(82px, 9999px, 25px, 0);
    }
    90% {
        clip: rect(11px, 9999px, 117px, 0);
    }
    95% {
        clip: rect(58px, 9999px, 63px, 0);
    }
    100% {
        clip: rect(29px, 9999px, 88px, 0);
    }
}

/* ========================================
   TYPING INDICATOR
   ======================================== */

.typing-indicator {
    display: inline-flex;
    gap: 4px;
}

.typing-indicator span {
    width: 4px;
    height: 4px;
    background-color: var(--nv-green);
    border-radius: 50%;
    animation: typing 1.4s infinite;
    box-shadow: 0 0 4px var(--nv-green-glow);
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   FADE IN ANIMATIONS
   ======================================== */

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.4s ease forwards;
}

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

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

.slide-in-right {
    animation: slideInRight 0.3s ease forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.3s ease forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   GLOW EFFECTS
   ======================================== */

.glow-intense {
    animation: glowIntense 2s ease-in-out infinite;
}

@keyframes glowIntense {
    0%, 100% {
        text-shadow: 0 0 4px var(--nv-green-glow),
                     0 0 8px var(--nv-green-glow);
    }
    50% {
        text-shadow: 0 0 8px var(--nv-green-glow),
                     0 0 16px var(--nv-green-glow),
                     0 0 24px var(--nv-green-glow);
    }
}

/* ========================================
   ATTENTION/ALERT ANIMATIONS
   ======================================== */

.alert-pulse {
    animation: alertPulse 1s ease-in-out infinite;
}

@keyframes alertPulse {
    0%, 100% {
        color: var(--nv-red);
        text-shadow: 0 0 4px var(--nv-red-glow);
    }
    50% {
        color: var(--nv-amber);
        text-shadow: 0 0 8px rgba(255, 170, 0, 0.8);
    }
}

.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--nv-green-darker);
    border-top-color: var(--nv-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   HOVER GLOW EFFECT
   ======================================== */

.hover-glow {
    transition: all var(--transition-normal);
}

.hover-glow:hover {
    text-shadow: 0 0 8px var(--nv-green-glow-strong),
                 0 0 16px var(--nv-green-glow);
    transform: scale(1.02);
}

/* ========================================
   PROGRESS BAR
   ======================================== */

.progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--nv-darker-green);
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--nv-green-darker),
        var(--nv-green),
        var(--nv-green-darker)
    );
    background-size: 200% 100%;
    box-shadow: 0 0 8px var(--nv-green-glow);
    animation: progress-shimmer 2s linear infinite;
    transition: width var(--transition-normal);
}

@keyframes progress-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   NOTIFICATION BADGE
   ======================================== */

.notification-badge {
    position: relative;
}

.notification-badge::after {
    content: attr(data-count);
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--nv-red);
    color: var(--nv-black);
    font-size: var(--font-size-xs);
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 0 8px var(--nv-red-glow);
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ========================================
   CRT SCREEN FLICKER
   ======================================== */

@keyframes crt-flicker {
    0% {
        opacity: 0.97;
    }
    5% {
        opacity: 1;
    }
    10% {
        opacity: 0.96;
    }
    20% {
        opacity: 1;
    }
    30% {
        opacity: 0.98;
    }
    50% {
        opacity: 1;
    }
    70% {
        opacity: 0.97;
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0.98;
    }
}

/* Apply subtle flicker to entire screen */
body.crt-effect {
    animation: crt-flicker 0.15s infinite;
}

/* ========================================
   GRID OVERLAY (Optional - for extra effect)
   ======================================== */

.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9996;
    background-image:
        linear-gradient(rgba(0, 255, 65, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.3;
}

/* ========================================
   STATUS INDICATORS
   ======================================== */

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: var(--spacing-xs);
}

.status-indicator.online {
    background-color: var(--nv-green);
    box-shadow: 0 0 6px var(--nv-green-glow);
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.offline {
    background-color: var(--nv-red);
    box-shadow: 0 0 6px var(--nv-red-glow);
}

.status-indicator.warning {
    background-color: var(--nv-amber);
    box-shadow: 0 0 6px rgba(255, 170, 0, 0.5);
    animation: pulse 1s ease-in-out infinite;
}
