/* ===================================
   Advanced Animations
   =================================== */

/* Matrix Rain Effect (handled in JS, but styles here) */
#matrixCanvas {
    opacity: 0.3;
}

/* Glowing Pulse Animation */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary-color),
                    0 0 10px var(--primary-color),
                    0 0 20px var(--primary-color);
    }
    50% {
        box-shadow: 0 0 10px var(--primary-color),
                    0 0 20px var(--primary-color),
                    0 0 40px var(--primary-color),
                    0 0 60px var(--primary-color);
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 3s infinite;
}

/* Typing Animation */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typing-effect {
    overflow: hidden;
    border-right: 3px solid var(--primary-color);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}

/* Particle System */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 8s ease-in-out infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}

/* Scanning Animation */
.scanning-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--primary-color),
        transparent
    );
    box-shadow: 0 0 20px var(--primary-color);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% {
        top: 0;
    }
    100% {
        top: 100%;
    }
}

/* Radar Pulse */
@keyframes radarPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.radar-pulse {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: radarPulse 2s ease-out infinite;
}

/* Digital Counter */
@keyframes countUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.counter-digit {
    display: inline-block;
    overflow: hidden;
    height: 1em;
    line-height: 1em;
}

.counter-digit span {
    display: block;
    animation: countUp 0.3s ease-out;
}

/* Holographic Effect */
.holographic {
    position: relative;
    background: linear-gradient(
        45deg,
        #667eea 0%,
        #764ba2 25%,
        #f093fb 50%,
        #667eea 75%,
        #764ba2 100%
    );
    background-size: 400% 400%;
    animation: holographicShift 10s ease infinite;
}

@keyframes holographicShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Glitch Effect */
@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

.glitch {
    animation: glitch 0.3s infinite;
}

/* Data Stream */
@keyframes dataStream {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

.data-stream {
    position: absolute;
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
    font-size: 12px;
    animation: dataStream 5s linear infinite;
}

/* Circuit Lines */
@keyframes circuitFlow {
    0% {
        stroke-dashoffset: 1000;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.circuit-line {
    stroke: var(--primary-color);
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 10;
    animation: circuitFlow 20s linear infinite;
}

/* Loading Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Progress Bar */
@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

.progress-bar {
    height: 4px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    animation: progressFill 2s ease-out forwards;
}

/* Fade In Animations */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    animation: fadeInLeft 0.6s ease-out forwards;
}

@keyframes fadeInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    animation: fadeInRight 0.6s ease-out forwards;
}

@keyframes fadeInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale Animations */
.scale-in {
    opacity: 0;
    transform: scale(0.8);
    animation: scaleIn 0.5s ease-out forwards;
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotate Animations */
.rotate-in {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
    animation: rotateIn 0.6s ease-out forwards;
}

@keyframes rotateIn {
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* Slide Animations */
.slide-in-bottom {
    transform: translateY(100px);
    opacity: 0;
    animation: slideInBottom 0.6s ease-out forwards;
}

@keyframes slideInBottom {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Bounce Animations */
.bounce-in {
    animation: bounceIn 0.8s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.5s;
}

/* Delayed Animations */
.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}

/* Intersection Observer Animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Button Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Gradient Animation */
.gradient-animate {
    background: linear-gradient(
        -45deg,
        #667eea,
        #764ba2,
        #f093fb,
        #667eea
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Text Glow */
.text-glow {
    animation: textGlow 2s ease-in-out infinite;
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 5px var(--primary-color),
                     0 0 10px var(--primary-color);
    }
    50% {
        text-shadow: 0 0 10px var(--primary-color),
                     0 0 20px var(--primary-color),
                     0 0 30px var(--primary-color);
    }
}

/* Border Animation */
.border-animate {
    position: relative;
    background: var(--dark-card);
}

.border-animate::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    background-size: 400% 400%;
    animation: gradientShift 3s ease infinite;
}

/* Neon Glow */
.neon-glow {
    text-shadow: 0 0 5px var(--primary-color),
                 0 0 10px var(--primary-color),
                 0 0 20px var(--primary-color),
                 0 0 40px var(--primary-color);
    animation: neonFlicker 3s ease-in-out infinite;
}

@keyframes neonFlicker {
    0%, 100% {
        opacity: 1;
    }
    41%, 42%, 43%, 45%, 46% {
        opacity: 0.8;
    }
}
