/* ============================================
   ChefMarket Landing Page - Advanced Animations
   ============================================ */

/* ============================================
   Entrance Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@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 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 slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ============================================
   Floating & Hover Animations
   ============================================ */
@keyframes animate-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

@keyframes gentle-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

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

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

/* ============================================
   Gradient Animations
   ============================================ */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animated-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 5s ease infinite;
}

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

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

/* ============================================
   Text Animations
   ============================================ */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink-cursor {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary);
    }
}

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary);
    white-space: nowrap;
    animation: typewriter 3s steps(30) 1s forwards,
               blink-cursor 0.75s step-end infinite;
}

@keyframes text-glow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(46, 125, 50, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(46, 125, 50, 0.8),
                     0 0 30px rgba(46, 125, 50, 0.6);
    }
}

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

/* ============================================
   Button Animations
   ============================================ */
@keyframes btn-shine {
    0% {
        left: -100%;
    }
    20%, 100% {
        left: 100%;
    }
}

.btn-shine {
    position: relative;
    overflow: hidden;
}

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

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

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
}

.btn-ripple:active::before {
    animation: ripple 0.6s ease-out;
}

/* ============================================
   Card Animations
   ============================================ */
@keyframes card-float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(1deg);
    }
    75% {
        transform: translateY(-5px) rotate(-1deg);
    }
}

.card-float {
    animation: card-float 5s ease-in-out infinite;
}

@keyframes card-glow {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 8px 30px rgba(46, 125, 50, 0.3);
    }
}

.card-glow-hover:hover {
    animation: card-glow 2s ease-in-out infinite;
}

/* ============================================
   Loading Animations
   ============================================ */
@keyframes spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

@keyframes dots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    margin: 0 2px;
    animation: dots 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-100) 0,
        var(--gray-200) 20%,
        var(--gray-100) 40%
    );
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

/* ============================================
   Notification Animations
   ============================================ */
@keyframes notification-slide {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    10%, 90% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification-animated {
    animation: notification-slide 4s ease-in-out forwards;
}

@keyframes bell-shake {
    0%, 100% { transform: rotate(0); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg); }
    20%, 40%, 60%, 80% { transform: rotate(10deg); }
}

.bell-shake {
    animation: bell-shake 0.5s ease-in-out;
}

/* ============================================
   Scroll Reveal Animations
   ============================================ */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Stagger children animations */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

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

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

/* ============================================
   Progress Bar Animation
   ============================================ */
@keyframes progress-fill {
    from {
        width: 0;
    }
}

.progress-animated .progress-fill {
    animation: progress-fill 1s ease-out forwards;
}

/* ============================================
   Counter Animation
   ============================================ */
@keyframes count-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-animated {
    animation: count-up 0.5s ease-out forwards;
}

/* ============================================
   Morphing Shapes
   ============================================ */
@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%;
    }
    75% {
        border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
    }
}

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

/* ============================================
   Parallax Effect
   ============================================ */
.parallax-layer {
    will-change: transform;
    transition: transform 0.1s ease-out;
}

/* ============================================
   3D Card Effect
   ============================================ */
.card-3d {
    perspective: 1000px;
    transform-style: preserve-3d;
}

.card-3d-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-3d:hover .card-3d-inner {
    transform: rotateY(10deg) rotateX(5deg);
}

/* ============================================
   Magnetic Button Effect
   ============================================ */
.magnetic-btn {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ============================================
   Particle Animation
   ============================================ */
@keyframes particle-float {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) translateX(10px);
        opacity: 0.5;
    }
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.5;
    animation: particle-float 3s ease-in-out infinite;
}

.particle:nth-child(1) { animation-delay: 0s; }
.particle:nth-child(2) { animation-delay: 0.5s; }
.particle:nth-child(3) { animation-delay: 1s; }
.particle:nth-child(4) { animation-delay: 1.5s; }
.particle:nth-child(5) { animation-delay: 2s; }

/* ============================================
   Mouse Follow Effect
   ============================================ */
.mouse-follow {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

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

/* ============================================
   Underline Animation
   ============================================ */
.animated-underline {
    position: relative;
    display: inline-block;
}

.animated-underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.animated-underline:hover::after {
    width: 100%;
}

/* ============================================
   Marquee Animation
   ============================================ */
@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.marquee {
    animation: marquee 20s linear infinite;
}

.marquee:hover {
    animation-play-state: paused;
}

/* ============================================
   Focus Ring Animation
   ============================================ */
@keyframes focus-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4);
    }
    100% {
        box-shadow: 0 0 0 10px rgba(46, 125, 50, 0);
    }
}

.focus-ring:focus {
    animation: focus-ring 0.5s ease-out;
}

/* ============================================
   Icon Bounce
   ============================================ */
@keyframes icon-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.icon-bounce:hover i {
    animation: icon-bounce 0.5s ease-in-out;
}

/* ============================================
   Success Checkmark Animation
   ============================================ */
@keyframes checkmark-draw {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.checkmark-animated {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: checkmark-draw 0.5s ease forwards;
}

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