/* AI-Themed Animations */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-20px) rotate(1deg);
    }
    66% {
        transform: translateY(-10px) rotate(-1deg);
    }
}

@keyframes flow {
    0% {
        transform: scaleX(0);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scaleX(1);
        opacity: 0;
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 217, 255, 0.6);
    }
}

@keyframes neural-pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes data-flow {
    0% {
        transform: translateX(-100%) scaleX(0);
    }
    50% {
        transform: translateX(50%) scaleX(1);
    }
    100% {
        transform: translateX(200%) scaleX(0);
    }
}

@keyframes typing {
    0%, 50% {
        width: 0;
    }
    100% {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        border-right-color: var(--primary-color);
    }
    51%, 100% {
        border-right-color: transparent;
    }
}

@keyframes matrix {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    50% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(20px);
    }
}

@keyframes circuit-flow {
    0% {
        stroke-dashoffset: 100;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 0;
    }
}

@keyframes hologram {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1) rotateX(0deg);
    }
    25% {
        opacity: 0.9;
        transform: scale(1.02) rotateX(1deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) rotateX(0deg);
    }
    75% {
        opacity: 0.9;
        transform: scale(1.02) rotateX(-1deg);
    }
}

@keyframes ai-thinking {
    0% {
        opacity: 0.3;
    }
    33% {
        opacity: 0.7;
    }
    66% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

/* Floating Particles Animation */
.floating-particles::before,
.floating-particles::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: float 15s ease-in-out infinite;
}

.floating-particles::before {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 20s;
}

.floating-particles::after {
    top: 60%;
    right: 15%;
    animation-delay: 5s;
    animation-duration: 25s;
}

/* Neural Network Background Animation */
.neural-bg::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 30%, rgba(0, 217, 255, 0.03) 50%, transparent 70%);
    animation: neural-sweep 10s ease-in-out infinite;
}

@keyframes neural-sweep {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Counter Animation */
.counting {
    animation: countUp 2s ease-out forwards;
}

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

/* 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%;
}

.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: var(--primary-color);
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: var(--secondary-color);
    z-index: -2;
}

@keyframes glitch {
    0% {
        text-shadow: 0.05em 0 0 var(--primary-color), -0.05em -0.025em 0 var(--secondary-color),
                     0.025em 0.05em 0 var(--accent-color);
    }
    15% {
        text-shadow: 0.05em 0 0 var(--primary-color), -0.05em -0.025em 0 var(--secondary-color),
                     0.025em 0.05em 0 var(--accent-color);
    }
    16% {
        text-shadow: -0.05em -0.025em 0 var(--primary-color), 0.025em 0.025em 0 var(--secondary-color),
                     -0.05em -0.05em 0 var(--accent-color);
    }
    49% {
        text-shadow: -0.05em -0.025em 0 var(--primary-color), 0.025em 0.025em 0 var(--secondary-color),
                     -0.05em -0.05em 0 var(--accent-color);
    }
    50% {
        text-shadow: 0.025em 0.05em 0 var(--primary-color), 0.05em 0 0 var(--secondary-color),
                     0 -0.05em 0 var(--accent-color);
    }
    99% {
        text-shadow: 0.025em 0.05em 0 var(--primary-color), 0.05em 0 0 var(--secondary-color),
                     0 -0.05em 0 var(--accent-color);
    }
    100% {
        text-shadow: -0.025em 0 0 var(--primary-color), -0.025em -0.025em 0 var(--secondary-color),
                     -0.025em -0.05em 0 var(--accent-color);
    }
}

/* Scroll Animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-on-scroll.in-view {
    opacity: 1;
    transform: translateY(0);
}

.animate-fade {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.animate-fade.in-view {
    opacity: 1;
}

.animate-slide-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s ease;
}

.animate-slide-left.in-view {
    opacity: 1;
    transform: translateX(0);
}

.animate-slide-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s ease;
}

.animate-slide-right.in-view {
    opacity: 1;
    transform: translateX(0);
}

.animate-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s ease;
}

.animate-scale.in-view {
    opacity: 1;
    transform: scale(1);
}

/* Button Hover Animations */
.btn-hover-glow:hover {
    animation: glow 0.5s ease-in-out;
}

.btn-hover-pulse:hover {
    animation: pulse 0.5s ease-in-out;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

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

/* AI Processing Animation */
.ai-processing {
    position: relative;
    overflow: hidden;
}

.ai-processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.4), transparent);
    animation: ai-scan 2s ease-in-out infinite;
}

@keyframes ai-scan {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Typewriter Effect */
.typewriter {
    border-right: 2px solid var(--primary-color);
    animation: blink 1s infinite;
}

.typewriter.typing {
    animation: typing 3s steps(30) 1s forwards, blink 1s infinite;
}

/* Hover Effects for Cards */
.card-hover-effect {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card-hover-effect:hover {
    transform: translateY(-10px) rotateX(5deg);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 0 30px rgba(0, 217, 255, 0.3);
}

/* Staggered Animation Delays */
.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; }
.stagger-6 { animation-delay: 0.6s; }

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.will-change-auto {
    will-change: auto;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .floating-particles::before,
    .floating-particles::after {
        display: none;
    }
    
    .neural-bg::before {
        display: none;
    }
}