/* ==========================================================================
   MarketingJoy - Animations & Micro-interactions
   ========================================================================== */

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

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

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

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

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

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

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate(-50%, 0);
    }
    40%, 43% {
        transform: translate(-50%, -10px);
    }
    70% {
        transform: translate(-50%, -5px);
    }
    90% {
        transform: translate(-50%, -2px);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 5px var(--accent-blue);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 20px var(--accent-blue), 0 0 30px var(--accent-blue);
    }
}

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

@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

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

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

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

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.4s ease-out forwards;
}

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

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

/* Animation Delays */
.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; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ==========================================================================
   Micro-interactions
   ========================================================================== */

/* Hover Effects */
.hover-lift {
    transition: var(--transition-normal);
}

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

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

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.hover-scale {
    transition: var(--transition-fast);
}

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

/* Button Interactions */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

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

.btn-ripple:active::before {
    width: 200%;
    height: 200%;
}

/* Shimmer Effect */
.shimmer {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Gradient Animation */
.animated-gradient {
    background: linear-gradient(
        45deg,
        var(--accent-blue),
        #8b5cf6,
        var(--accent-blue),
        #06b6d4
    );
    background-size: 300% 300%;
    animation: gradientShift 4s ease infinite;
}

/* Typewriter Effect */
.typewriter {
    border-right: 2px solid var(--accent-blue);
    white-space: nowrap;
    overflow: hidden;
    animation: typewriter 4s steps(40, end), blink 0.5s step-end infinite alternate;
}

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

.loading-dots::after {
    content: '';
    animation: loadingDots 1.4s infinite;
}

@keyframes loadingDots {
    0%, 80%, 100% {
        content: '';
    }
    20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60% {
        content: '...';
    }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-top: 3px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-pulse {
    width: 20px;
    height: 20px;
    background: var(--accent-blue);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

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

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

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

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

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

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

/* Modal Animations */
.modal-enter {
    opacity: 0;
    transform: scale(0.8);
}

.modal-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-exit {
    opacity: 1;
    transform: scale(1);
}

.modal-exit-active {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop-enter {
    opacity: 0;
}

.modal-backdrop-enter-active {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-backdrop-exit {
    opacity: 1;
}

.modal-backdrop-exit-active {
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Staggered Animation */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-children.animate > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.animate > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.animate > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.animate > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.animate > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.animate > *:nth-child(6) { transition-delay: 0.6s; }

.stagger-children.animate > * {
    opacity: 1;
    transform: translateY(0);
}

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

/* Magnetic Effect */
.magnetic {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.magnetic:hover {
    transform: translate3d(0, -2px, 0);
}

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

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

/* Parallax Scroll */
.parallax-element {
    transition: transform 0.1s ease-out;
}

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

/* Will-change for better performance */
.will-change-transform {
    will-change: transform;
}

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

.will-change-scroll {
    will-change: scroll-position;
}

/* GPU Acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Reduced Motion Support */
@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;
    }
    
    .parallax-element {
        transform: none !important;
    }
    
    .animate-float {
        animation: none;
    }
    
    .animate-pulse-glow {
        animation: none;
    }
}

/* ==========================================================================
   Dark Theme Animation Adjustments
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .shimmer {
        background: linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.05),
            transparent
        );
    }
}