/**
 * Majarra Labs - Advanced Animations
 * Creative CSS animations inspired by space, AI, and technology
 */

/* ===================================
   Keyframe Animations
=================================== */

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-15px) rotate(1deg);
    }
    50% {
        transform: translateY(-5px) rotate(-1deg);
    }
    75% {
        transform: translateY(-20px) rotate(0.5deg);
    }
}

/* Pulse Glow */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.3),
                    0 0 40px rgba(99, 102, 241, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(99, 102, 241, 0.5),
                    0 0 60px rgba(99, 102, 241, 0.2),
                    0 0 80px rgba(34, 211, 238, 0.1);
    }
}

/* Gradient Shift */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

/* Scale Pulse */
@keyframes scalePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

/* Neural Pulse */
@keyframes neuralPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Orbit */
@keyframes orbit {
    from {
        transform: rotate(0deg) translateX(100px) rotate(0deg);
    }
    to {
        transform: rotate(360deg) translateX(100px) rotate(-360deg);
    }
}

/* Typewriter Cursor */
@keyframes cursorBlink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* Wave */
@keyframes wave {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-5px);
    }
    75% {
        transform: translateY(5px);
    }
}

/* Morph */
@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

/* Slide In Variations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

/* Fade In Scale */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Glitch Effect */
@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);
    }
}

/* Matrix Rain */
@keyframes matrixRain {
    0% {
        transform: translateY(-100%);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* Circuit Trace */
@keyframes circuitTrace {
    0% {
        stroke-dashoffset: 1000;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* ===================================
   Animation Classes
=================================== */

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-pulse-glow {
    animation: pulseGlow 3s ease-in-out infinite;
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

.animate-rotate {
    animation: rotate 20s linear infinite;
}

.animate-scale-pulse {
    animation: scalePulse 2s ease-in-out infinite;
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

.animate-morph {
    animation: morph 8s ease-in-out infinite;
}

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

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

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

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
}

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

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

/* ===================================
   Scroll Reveal Animations
=================================== */

[data-aos="fade-up"] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos="fade-up"].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

[data-aos="fade-left"] {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos="fade-left"].aos-animate {
    opacity: 1;
    transform: translateX(0);
}

[data-aos="fade-right"] {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos="fade-right"].aos-animate {
    opacity: 1;
    transform: translateX(0);
}

[data-aos="zoom-in"] {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos="zoom-in"].aos-animate {
    opacity: 1;
    transform: scale(1);
}

/* ===================================
   Special Effect Classes
=================================== */

/* Gradient Text Animation */
.gradient-text-animated {
    background: linear-gradient(
        90deg,
        var(--primary-light),
        var(--accent),
        var(--primary-light)
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s linear infinite;
}

/* Neon Glow Text */
.neon-text {
    text-shadow:
        0 0 10px rgba(99, 102, 241, 0.8),
        0 0 20px rgba(99, 102, 241, 0.6),
        0 0 30px rgba(99, 102, 241, 0.4),
        0 0 40px rgba(99, 102, 241, 0.2);
}

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

.ai-processing::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(99, 102, 241, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

/* Circuit Board Lines */
.circuit-lines {
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Holographic Effect */
.holographic {
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.3) 0%,
        rgba(34, 211, 238, 0.3) 25%,
        rgba(129, 140, 248, 0.3) 50%,
        rgba(34, 211, 238, 0.3) 75%,
        rgba(99, 102, 241, 0.3) 100%
    );
    background-size: 400% 400%;
    animation: gradientShift 5s ease infinite;
}

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

.data-stream-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--accent),
        transparent
    );
    animation: dataStream 3s linear infinite;
}

/* Neural Pulse Effect */
.neural-pulse {
    position: relative;
}

.neural-pulse::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary);
    transform: translate(-50%, -50%);
    animation: neuralPulse 2s ease-in-out infinite;
}

/* Orbit Animation Container */
.orbit-container {
    position: relative;
}

.orbit-item {
    position: absolute;
    animation: orbit 10s linear infinite;
}

.orbit-item:nth-child(2) {
    animation-delay: -3.33s;
}

.orbit-item:nth-child(3) {
    animation-delay: -6.66s;
}

/* ===================================
   Loading Animations
=================================== */

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

/* Dots Loading */
.dots-loading {
    display: flex;
    gap: 8px;
}

.dots-loading span {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: wave 1.2s ease-in-out infinite;
}

.dots-loading span:nth-child(2) {
    animation-delay: 0.15s;
}

.dots-loading span:nth-child(3) {
    animation-delay: 0.3s;
}

/* AI Loading Bar */
.ai-loading-bar {
    width: 100%;
    height: 4px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.ai-loading-bar::before {
    content: '';
    display: block;
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    animation: shimmer 1.5s infinite;
}

/* ===================================
   Interactive Elements
=================================== */

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.6s, opacity 0.6s;
}

.ripple:active::after {
    transform: translate(-50%, -50%) scale(40);
    opacity: 1;
    transition: 0s;
}

/* Magnetic Hover */
.magnetic {
    transition: transform 0.3s ease;
}

/* Tilt Effect (requires JS) */
.tilt {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* ===================================
   Page Transitions
=================================== */

.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-transition-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ===================================
   Reduced Motion
=================================== */

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

    .animate-float,
    .animate-pulse-glow,
    .animate-gradient,
    .animate-rotate,
    .animate-scale-pulse,
    .animate-shimmer,
    .animate-morph {
        animation: none;
    }
}

/* ===================================
   Performance Optimizations
=================================== */

.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

.smooth-scroll {
    scroll-behavior: smooth;
}

/* Lazy load animation */
.lazy-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.lazy-animate.loaded {
    opacity: 1;
    transform: translateY(0);
}
