/* Fade In Animation */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease forwards;
}

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

/* Slide In Animations */
.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    animation: slideInLeft 0.8s ease forwards;
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    animation: slideInRight 0.8s ease forwards;
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Scale In Animation */
.scale-in {
    opacity: 0;
    transform: scale(0.8);
    animation: scaleIn 0.6s ease forwards;
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotate In Animation */
.rotate-in {
    opacity: 0;
    transform: rotate(-180deg);
    animation: rotateIn 0.8s ease forwards;
}

@keyframes rotateIn {
    to {
        opacity: 1;
        transform: rotate(0);
    }
}

/* Bounce Animation */
.bounce {
    animation: bounce 2s ease infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

/* Pulse Glow Animation */
.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px var(--glow-primary);
    }
    50% {
        box-shadow: 0 0 40px var(--glow-primary), 0 0 60px var(--primary-color);
    }
}

/* Floating Animation */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Scan Line Effect */
.scan-line {
    position: relative;
    overflow: hidden;
}

.scan-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    animation: scanLine 3s linear infinite;
}

@keyframes scanLine {
    0% {
        top: 0;
    }
    100% {
        top: 100%;
    }
}

/* Typing Effect */
.typing {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--primary-color);
    animation: typing 3s steps(40, end), blink 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary-color);
    }
}

/* Neon Flicker */
.neon-flicker {
    animation: neonFlicker 2s ease-in-out infinite;
}

@keyframes neonFlicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        text-shadow:
            0 0 4px var(--primary-color),
            0 0 11px var(--primary-color),
            0 0 19px var(--primary-color),
            0 0 40px var(--secondary-color);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* Matrix Rain Effect (for background) */
.matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.1;
}

/* Cyber Border Animation */
.cyber-border {
    position: relative;
    border: 2px solid var(--primary-color);
    overflow: hidden;
}

.cyber-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--primary-color));
    background-size: 400% 400%;
    animation: cyberBorder 3s ease infinite;
    z-index: -1;
}

@keyframes cyberBorder {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Holographic Effect */
.holographic {
    background: linear-gradient(
        135deg,
        rgba(0, 255, 255, 0.1) 0%,
        rgba(255, 0, 255, 0.1) 50%,
        rgba(0, 255, 255, 0.1) 100%
    );
    background-size: 200% 200%;
    animation: holographicShift 5s ease infinite;
}

@keyframes holographicShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Glitch Text Effect (enhanced) */
.glitch-enhanced {
    position: relative;
}

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

.glitch-enhanced::before {
    color: var(--secondary-color);
    animation: glitchEnhanced1 0.3s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch-enhanced::after {
    color: var(--primary-color);
    animation: glitchEnhanced2 0.3s infinite;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitchEnhanced1 {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-3px, 3px);
    }
    40% {
        transform: translate(-3px, -3px);
    }
    60% {
        transform: translate(3px, 3px);
    }
    80% {
        transform: translate(3px, -3px);
    }
    100% {
        transform: translate(0);
    }
}

@keyframes glitchEnhanced2 {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(3px, -3px);
    }
    40% {
        transform: translate(3px, 3px);
    }
    60% {
        transform: translate(-3px, -3px);
    }
    80% {
        transform: translate(-3px, 3px);
    }
    100% {
        transform: translate(0);
    }
}

/* Energy Wave Animation */
.energy-wave {
    position: relative;
}

.energy-wave::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: energyWave 2s ease-out infinite;
}

@keyframes energyWave {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* Circuit Pattern Animation */
.circuit-pattern {
    background-image: 
        linear-gradient(90deg, var(--primary-color) 1px, transparent 1px),
        linear-gradient(var(--primary-color) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: circuitPattern 10s linear infinite;
}

@keyframes circuitPattern {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 20px 20px;
    }
}

/* Data Stream Animation */
.data-stream {
    position: relative;
    overflow: hidden;
}

.data-stream::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 255, 0.1) 2px,
        rgba(0, 255, 255, 0.1) 4px
    );
    animation: dataStream 2s linear infinite;
}

@keyframes dataStream {
    0% {
        top: -100%;
    }
    100% {
        top: 100%;
    }
}

/* Loading Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 255, 255, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Progress Bar Animation */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 255, 255, 0.2);
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 0;
    }
    50% {
        width: 100%;
    }
    100% {
        width: 0;
    }
}

/* Particle Explosion */
.particle-explosion {
    position: relative;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: particleExplode 1s ease-out forwards;
}

@keyframes particleExplode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* Scroll Reveal Animation */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger Animation for Lists */
.stagger-item {
    opacity: 0;
    animation: staggerIn 0.5s ease forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }

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

/* Morphing Border */
.morphing-border {
    animation: morphBorder 3s ease-in-out infinite;
}

@keyframes morphBorder {
    0%, 100% {
        border-radius: 10px 10px 10px 10px;
    }
    25% {
        border-radius: 50% 10px 50% 10px;
    }
    50% {
        border-radius: 10px 50% 10px 50%;
    }
    75% {
        border-radius: 50% 50% 10px 10px;
    }
}

/* Color Shift Animation */
.color-shift {
    animation: colorShift 5s ease-in-out infinite;
}

@keyframes colorShift {
    0%, 100% {
        color: var(--primary-color);
    }
    33% {
        color: var(--secondary-color);
    }
    66% {
        color: var(--accent-color);
    }
}

/* 3D Flip Animation */
.flip-3d {
    perspective: 1000px;
}

.flip-3d-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-3d:hover .flip-3d-inner {
    transform: rotateY(180deg);
}

.flip-3d-front,
.flip-3d-back {
    backface-visibility: hidden;
}

.flip-3d-back {
    transform: rotateY(180deg);
}

/* Shake Animation */
.shake {
    animation: shake 0.5s ease-in-out;
}

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