/* Animations and Keyframes */

/* Glitch Effect */
.glitch {
    position: relative;
    animation: glitch 2s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: var(--accent-cyan);
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: var(--accent-purple);
    z-index: -2;
}

@keyframes glitch {
    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 glitch-1 {
    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 glitch-2 {
    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); }
}

/* Typing Animation */
.typing-text {
    overflow: hidden;
    border-right: 2px solid var(--accent-green);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent-green); }
}

/* Typing Command Animation */
.typing-command {
    overflow: hidden;
    border-right: 2px solid var(--accent-green);
    white-space: nowrap;
    animation: typing-command 2s steps(30, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing-command {
    from { width: 0; }
    to { width: 100%; }
}

/* Fade In Animations */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeIn 1s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-delay-1 { animation-delay: 0.2s; }
.fade-in-delay-2 { animation-delay: 0.4s; }
.fade-in-delay-3 { animation-delay: 0.6s; }
.fade-in-delay-4 { animation-delay: 0.8s; }

/* Slide In Animations */
.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    animation: slideInLeft 0.8s ease forwards;
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    animation: slideInRight 0.8s ease forwards;
}

@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-up {
    opacity: 0;
    transform: translateY(50px);
    animation: slideInUp 0.8s ease forwards;
}

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-down {
    opacity: 0;
    transform: translateY(-50px);
    animation: slideInDown 0.8s ease forwards;
}

@keyframes slideInDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scale Animations */
.scale-in {
    opacity: 0;
    transform: scale(0.8);
    animation: scaleIn 0.6s ease forwards;
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in-bounce {
    opacity: 0;
    transform: scale(0.3);
    animation: scaleInBounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes scaleInBounce {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotate Animations */
.rotate-in {
    opacity: 0;
    transform: rotate(-180deg);
    animation: rotateIn 0.8s ease forwards;
}

@keyframes rotateIn {
    to {
        opacity: 1;
        transform: rotate(0deg);
    }
}

/* Pulse Animations */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse-glow {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 65, 0.5); }
    50% { box-shadow: 0 0 40px rgba(0, 255, 65, 0.8); }
}

/* 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); }
}

/* Bounce Animation */
.bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Wiggle Animation */
.wiggle {
    animation: wiggle 0.5s ease-in-out;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

/* Counter Animation */
.counter {
    animation: counterUp 2s ease-out;
}

@keyframes counterUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 255, 65, 0.3);
    border-top: 4px solid var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-large {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* Progress Bar Animation */
.progress-bar {
    position: relative;
    overflow: hidden;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Hover Effects */
.hover-glow:hover {
    box-shadow: 0 0 20px var(--accent-green);
    transition: box-shadow 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
    transition: transform 0.3s ease;
}

/* RGB Split Effect */
.rgb-split {
    position: relative;
    transition: all 0.3s ease;
}

.rgb-split:hover {
    animation: rgbSplit 0.3s ease;
}

@keyframes rgbSplit {
    0% { filter: hue-rotate(0deg); }
    25% { filter: hue-rotate(90deg) blur(1px); }
    50% { filter: hue-rotate(180deg) blur(2px); }
    75% { filter: hue-rotate(270deg) blur(1px); }
    100% { filter: hue-rotate(360deg); }
}

/* Matrix Rain Effect */
.matrix-rain {
    position: relative;
    overflow: hidden;
}

.matrix-rain::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(transparent 0%, rgba(0, 255, 65, 0.1) 50%, transparent 100%);
    animation: matrixRain 3s linear infinite;
}

@keyframes matrixRain {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* Terminal Cursor Blink */
.terminal-cursor {
    animation: terminalBlink 1s infinite;
}

@keyframes terminalBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Success Animation */
.success-animation {
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Error Animation */
.error-animation {
    animation: errorShake 0.5s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Notification Slide In */
.notification-slide {
    animation: notificationSlide 0.5s ease;
}

@keyframes notificationSlide {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Confetti Animation */
.confetti {
    position: relative;
    overflow: hidden;
}

.confetti::before,
.confetti::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent-green);
    animation: confettiFall 3s linear infinite;
}

.confetti::before {
    left: 20%;
    animation-delay: 0s;
}

.confetti::after {
    left: 80%;
    animation-delay: 1s;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Stagger Animation */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* Page Transition */
.page-transition {
    animation: pageTransition 0.5s ease;
}

@keyframes pageTransition {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.loading-content {
    text-align: center;
    color: var(--accent-green);
}

.loading-text {
    margin-top: 1rem;
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

/* Responsive Animations */
@media (max-width: 768px) {
    .glitch {
        animation: none;
    }
    
    .glitch::before,
    .glitch::after {
        display: none;
    }
    
    .typing-text {
        animation: none;
        border-right: none;
    }
    
    .typing-command {
        animation: none;
        border-right: none;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .glitch::before,
    .glitch::after {
        display: none;
    }
    
    .typing-text,
    .typing-command {
        border-right: none;
    }
}
