/* =============================================
   MOBIX Presentation - Animations
   ============================================= */

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--gray-900);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-max);
    transition: opacity var(--transition-slow);
}

.loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-8);
}

.loading-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(14, 165, 233, 0.2);
    border-top-color: var(--primary-400);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Slide Transitions */
.slide-enter {
    animation: slideEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.slide-exit {
    animation: slideExit 0.4s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes slideEnter {
    from {
        opacity: 0;
        transform: translateX(60px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideExit {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-60px) scale(0.98);
    }
}

/* Content Animations */
.animate-fade-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUp 0.6s ease-out forwards;
}

.animate-fade-up:nth-child(1) { animation-delay: 0.1s; }
.animate-fade-up:nth-child(2) { animation-delay: 0.2s; }
.animate-fade-up:nth-child(3) { animation-delay: 0.3s; }
.animate-fade-up:nth-child(4) { animation-delay: 0.4s; }
.animate-fade-up:nth-child(5) { animation-delay: 0.5s; }
.animate-fade-up:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
}

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

.animate-scale-in {
    opacity: 0;
    transform: scale(0.9);
    animation: scaleIn 0.5s ease-out forwards;
}

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

/* Stagger Animation for Lists */
.stagger-animation > * {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-animation.animate > *:nth-child(1) { animation: fadeUp 0.4s ease-out 0.05s forwards; }
.stagger-animation.animate > *:nth-child(2) { animation: fadeUp 0.4s ease-out 0.1s forwards; }
.stagger-animation.animate > *:nth-child(3) { animation: fadeUp 0.4s ease-out 0.15s forwards; }
.stagger-animation.animate > *:nth-child(4) { animation: fadeUp 0.4s ease-out 0.2s forwards; }
.stagger-animation.animate > *:nth-child(5) { animation: fadeUp 0.4s ease-out 0.25s forwards; }
.stagger-animation.animate > *:nth-child(6) { animation: fadeUp 0.4s ease-out 0.3s forwards; }
.stagger-animation.animate > *:nth-child(7) { animation: fadeUp 0.4s ease-out 0.35s forwards; }
.stagger-animation.animate > *:nth-child(8) { animation: fadeUp 0.4s ease-out 0.4s forwards; }

/* Hover Animations */
.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-glow-lg);
}

.hover-glow {
    transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow);
}

/* Floating Animation */
.float {
    animation: floating 3s ease-in-out infinite;
}

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

/* Pulse Animation */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

/* Shimmer Effect */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* Typing Effect */
.typing-effect {
    overflow: hidden;
    border-right: 2px solid var(--primary-400);
    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(--primary-400); }
}

/* Counter Animation */
.count-up {
    display: inline-block;
}

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

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Gradient Text Animation */
.gradient-text-animated {
    background: linear-gradient(
        90deg,
        var(--primary-400),
        var(--accent-cyan),
        var(--accent-teal),
        var(--primary-400)
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientMove 5s linear infinite;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* Particle Float */
.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-400);
    border-radius: 50%;
    opacity: 0.3;
    animation: particleFloat 10s infinite;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(100px, -50px) rotate(90deg);
    }
    50% {
        transform: translate(50px, -100px) rotate(180deg);
    }
    75% {
        transform: translate(-50px, -50px) rotate(270deg);
    }
}

/* =============================================
   MOBILE ANIMATION OPTIMIZATIONS
   ============================================= */

@media (max-width: 480px) {
    /* Reduce animation intensity on mobile for performance */
    .loading-logo {
        width: 80px;
        height: 80px;
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
        border-width: 2px;
    }
    
    /* Simpler slide transitions on mobile */
    @keyframes slideEnter {
        from {
            opacity: 0;
            transform: translateX(30px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    @keyframes slideExit {
        from {
            opacity: 1;
            transform: translateX(0);
        }
        to {
            opacity: 0;
            transform: translateX(-30px);
        }
    }
    
    /* Reduce hover animations on mobile */
    .hover-lift:hover,
    .hover-scale:hover {
        transform: translateY(-3px);
    }
    
    /* Smaller floating animation */
    @keyframes floatLogo {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-8px); }
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
