/* Keyframe Animations */

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

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

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

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

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px var(--accent-red); }
    50% { box-shadow: 0 0 20px var(--accent-red), 0 0 40px var(--accent-red); }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

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

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

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

@keyframes scan {
    0% { top: -10%; }
    100% { top: 110%; }
}

/* Animation Classes */
.animate-fadeIn { animation: fadeIn 0.6s ease-out forwards; }
.animate-fadeInLeft { animation: fadeInLeft 0.6s ease-out forwards; }
.animate-fadeInRight { animation: fadeInRight 0.6s ease-out forwards; }
.animate-scaleIn { animation: scaleIn 0.4s ease-out forwards; }
.animate-slideUp { animation: slideUp 0.5s ease-out forwards; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-glow { animation: glow 2s infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-rotate { animation: rotate 2s linear infinite; }
.animate-blink { animation: blink 1s infinite; }

/* Delay Classes */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s, box-shadow 0.3s;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.hover-glow {
    transition: box-shadow 0.3s;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(255, 0, 64, 0.4);
}

.hover-scale {
    transition: transform 0.3s;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Scroll Reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* 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(--accent-red);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--accent-cyan);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(31px, 9999px, 94px, 0); }
    20% { clip: rect(6px, 9999px, 14px, 0); }
    40% { clip: rect(89px, 9999px, 44px, 0); }
    60% { clip: rect(12px, 9999px, 56px, 0); }
    80% { clip: rect(67px, 9999px, 23px, 0); }
    100% { clip: rect(3px, 9999px, 78px, 0); }
}

@keyframes glitch-anim2 {
    0% { clip: rect(65px, 9999px, 99px, 0); }
    20% { clip: rect(34px, 9999px, 12px, 0); }
    40% { clip: rect(23px, 9999px, 67px, 0); }
    60% { clip: rect(89px, 9999px, 34px, 0); }
    80% { clip: rect(12px, 9999px, 89px, 0); }
    100% { clip: rect(56px, 9999px, 23px, 0); }
}

/* Scanline Animation */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background: rgba(255, 0, 64, 0.1);
    opacity: 0.4;
    animation: scan 6s linear infinite;
    pointer-events: none;
    z-index: 9999;
}

/* Matrix Rain Effect */
.matrix-drop {
    position: absolute;
    color: var(--accent-green);
    font-family: var(--font-mono);
    font-size: 14px;
    animation: fall linear infinite;
    opacity: 0.8;
}

@keyframes fall {
    to { transform: translateY(100vh); }
}

/* Loading Screen */
.loader {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.loader-text {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    margin-top: 1rem;
    animation: blink 1s infinite;
}

/* Progress Ring */
.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.35s;
    transform-origin: 50% 50%;
}

/* Particle Effects */
.particle {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    animation: particle-float 3s ease-out forwards;
}

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

/* Cyber Button Effect */
.cyber-btn {
    position: relative;
    overflow: hidden;
}

.cyber-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.cyber-btn:hover::before {
    left: 100%;
}

/* Text Scramble Effect */
.scramble-text {
    display: inline-block;
}

/* Card Flip */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

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

/* Neon Border */
.neon-border {
    position: relative;
}

.neon-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--accent-red), var(--accent-cyan), var(--accent-purple));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
}

.neon-border:hover::before {
    opacity: 1;
    filter: blur(10px);
}

/* Responsive Animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}