/* Animations & Keyframes */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade In Line (for boot sequence) */
@keyframes fadeInLine {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Cursor Blink */
@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* Scanline Animation */
@keyframes scanline {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(100vh);
    }
}

/* Dots Loading Animation */
@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* Flicker Effect */
@keyframes flicker {
    0% {
        opacity: 0.95;
        text-shadow: 0 0 5px var(--text-glow), 0 0 10px var(--text-glow);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 7px var(--text-glow), 0 0 15px var(--text-glow);
    }
    100% {
        opacity: 0.95;
        text-shadow: 0 0 5px var(--text-glow), 0 0 10px var(--text-glow);
    }
}

/* Glitch Text */
@keyframes glitchText {
    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);
    }
}

/* Type In Effect */
@keyframes typeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Screen Shake */
@keyframes screenShake {
    0%, 100% {
        transform: translate(0, 0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translate(-2px, 2px);
    }
    20%, 40%, 60%, 80% {
        transform: translate(2px, -2px);
    }
}

.shake {
    animation: screenShake 0.5s ease;
}

/* RGB Split / Chromatic Aberration */
@keyframes rgbSplit {
    0%, 100% {
        text-shadow:
            -2px 0 0 rgba(255, 0, 0, 0.7),
            2px 0 0 rgba(0, 255, 255, 0.7);
    }
    50% {
        text-shadow:
            2px 0 0 rgba(255, 0, 0, 0.7),
            -2px 0 0 rgba(0, 255, 255, 0.7);
    }
}

.glitch {
    animation: rgbSplit 0.3s ease infinite;
}

/* Pulse Glow */
@keyframes pulseGlow {
    0%, 100% {
        text-shadow: 0 0 5px var(--accent), 0 0 10px var(--accent);
    }
    50% {
        text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent), 0 0 30px var(--accent);
    }
}

.pulse {
    animation: pulseGlow 2s ease infinite;
}

/* Matrix Rain Effect (for individual characters) */
@keyframes matrixFall {
    0% {
        transform: translateY(-100vh);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* Loading Bar Animation */
@keyframes loadingBar {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

.loading-bar {
    height: 20px;
    background: rgba(0, 255, 0, 0.2);
    border: 1px solid var(--accent);
    position: relative;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--accent);
    animation: loadingBar 2s ease-out forwards;
    box-shadow: 0 0 10px var(--accent);
}

/* Pixelation Wave Effect */
@keyframes pixelWave {
    0%, 100% {
        filter: blur(0px);
    }
    50% {
        filter: blur(2px);
    }
}

/* Scan Effect */
@keyframes scan {
    0% {
        background-position: 0 -100vh;
    }
    100% {
        background-position: 0 100vh;
    }
}

/* Rotate Spinner (for loading states) */
@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.spinner::after {
    content: '◢';
    display: inline-block;
    animation: rotate 1s linear infinite;
}

/* Slide In from Bottom */
@keyframes slideInBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide Out to Bottom */
@keyframes slideOutBottom {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* Typing Cursor Effect */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Utility Classes for Animations */
.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-in {
    animation: slideInBottom 0.5s ease;
}

.typing-effect {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--accent);
    animation: typing 3s steps(40) forwards;
}

/* Hover Effects */
.hover-glow {
    transition: all 0.3s ease;
}

.hover-glow:hover {
    text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
    transform: scale(1.02);
}

/* Data Stream Effect */
@keyframes dataStream {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    90% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

.data-stream {
    position: absolute;
    color: var(--text-primary);
    opacity: 0.3;
    font-size: 0.8rem;
    white-space: nowrap;
    animation: dataStream 10s linear infinite;
}

/* Glitch Overlay Flash */
@keyframes glitchFlash {
    0%, 100% {
        opacity: 0;
    }
    10%, 20% {
        opacity: 0.8;
        transform: translate(-5px, 5px);
    }
    15% {
        opacity: 0.5;
        transform: translate(5px, -5px);
    }
}

.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent);
    opacity: 0;
    pointer-events: none;
    mix-blend-mode: overlay;
    z-index: 9999;
}

.glitch-overlay.active {
    animation: glitchFlash 0.3s ease;
}

/* Neon Border Pulse */
@keyframes neonBorder {
    0%, 100% {
        box-shadow: 0 0 5px var(--accent), 0 0 10px var(--accent), inset 0 0 5px var(--accent);
    }
    50% {
        box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent), inset 0 0 10px var(--accent);
    }
}

.neon-border {
    border: 1px solid var(--accent);
    animation: neonBorder 2s ease infinite;
}

/* Text Reveal Effect */
@keyframes textReveal {
    0% {
        clip-path: inset(0 100% 0 0);
    }
    100% {
        clip-path: inset(0 0 0 0);
    }
}

.text-reveal {
    animation: textReveal 0.8s ease forwards;
}

/* Random Glitch Elements */
.random-glitch {
    position: relative;
}

.random-glitch::before,
.random-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.8;
}

.random-glitch::before {
    animation: glitchTop 1s linear infinite;
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
    transform: translate(-2px, -2px);
}

.random-glitch::after {
    animation: glitchBottom 1.5s linear infinite;
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
    transform: translate(2px, 2px);
}

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

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

/* Breathing Effect */
@keyframes breathe {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

.breathe {
    animation: breathe 3s ease-in-out infinite;
}
