/* Advanced Animations CSS - Mesa Santos Coffee Theme */

/* ========================================
   KEYFRAMES - Animaciones Principales
   ======================================== */

/* Fade In Variants */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

/* Bounce Effects */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.08);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceInUp {
    0% {
        opacity: 0;
        transform: translateY(80px) scale(0.9);
    }
    60% {
        opacity: 1;
        transform: translateY(-15px) scale(1.02);
    }
    80% {
        transform: translateY(8px) scale(0.98);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

@keyframes bounceInScale {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-5deg);
    }
    40% {
        transform: scale(1.1) rotate(2deg);
    }
    60% {
        transform: scale(0.95) rotate(-1deg);
    }
    80% {
        transform: scale(1.02) rotate(0.5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

/* Slide with Blur Effect */
@keyframes slideInBlur {
    from {
        opacity: 0;
        transform: translateY(50px);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes slideInBlurLeft {
    from {
        opacity: 0;
        transform: translateX(-80px);
        filter: blur(8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

@keyframes slideInBlurRight {
    from {
        opacity: 0;
        transform: translateX(80px);
        filter: blur(8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

/* Coffee Steam Effect */
@keyframes coffeeFloat {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.8;
    }
    25% {
        transform: translateY(-15px) translateX(5px) scale(1.02);
        opacity: 0.9;
    }
    50% {
        transform: translateY(-25px) translateX(-5px) scale(1.04);
        opacity: 0.7;
    }
    75% {
        transform: translateY(-20px) translateX(3px) scale(1.01);
        opacity: 0.85;
    }
}

@keyframes coffeeSteam {
    0% {
        transform: translateY(0) scaleX(1);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-30px) scaleX(1.3);
        opacity: 0.3;
    }
    100% {
        transform: translateY(-60px) scaleX(0.8);
        opacity: 0;
    }
}

/* Gold Shimmer Effect */
@keyframes shimmerGold {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

@keyframes shimmerFlow {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Pulse & Glow Effects */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(201, 169, 97, 0.5),
                    0 0 10px rgba(201, 169, 97, 0.3),
                    0 0 15px rgba(201, 169, 97, 0.1);
    }
    50% {
        box-shadow: 0 0 15px rgba(201, 169, 97, 0.8),
                    0 0 30px rgba(201, 169, 97, 0.5),
                    0 0 45px rgba(201, 169, 97, 0.3);
    }
}

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

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.08);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.08);
    }
    70% {
        transform: scale(1);
    }
}

/* Floating Elements */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    33% {
        transform: translateY(-15px) rotate(1deg);
    }
    66% {
        transform: translateY(-8px) rotate(-1deg);
    }
}

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-10px) translateX(5px);
    }
    50% {
        transform: translateY(-18px) translateX(0);
    }
    75% {
        transform: translateY(-10px) translateX(-5px);
    }
}

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

@keyframes scaleInRotate {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-15deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

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

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

@keyframes rippleGold {
    0% {
        box-shadow: 0 0 0 0 rgba(201, 169, 97, 0.4);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(201, 169, 97, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(201, 169, 97, 0);
    }
}

/* Text Reveal */
@keyframes typeWriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes textReveal {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

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

/* Shake Effect */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Wobble Effect */
@keyframes wobble {
    0%, 100% {
        transform: translateX(0) rotate(0);
    }
    15% {
        transform: translateX(-12px) rotate(-3deg);
    }
    30% {
        transform: translateX(10px) rotate(2deg);
    }
    45% {
        transform: translateX(-8px) rotate(-2deg);
    }
    60% {
        transform: translateX(6px) rotate(1deg);
    }
    75% {
        transform: translateX(-3px) rotate(-0.5deg);
    }
}

/* Preloader Animation - Coffee Cup */
@keyframes pourCoffee {
    0% {
        height: 0;
        opacity: 0.5;
    }
    100% {
        height: 60%;
        opacity: 1;
    }
}

@keyframes cupWiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(2deg);
    }
    75% {
        transform: rotate(-2deg);
    }
}

/* ========================================
   ANIMATION CLASSES
   ======================================== */

/* Base Animation Class */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                filter 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

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

/* Fade Variants */
.animate-fade-in {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Bounce Variants */
.animate-bounce-in {
    animation: bounceIn 0.9s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.animate-bounce-in-up {
    animation: bounceInUp 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Blur Slide */
.animate-slide-blur {
    animation: slideInBlur 0.9s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-blur-left {
    animation: slideInBlurLeft 0.9s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-blur-right {
    animation: slideInBlurRight 0.9s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Float */
.animate-float {
    animation: float 4s ease-in-out infinite;
}

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

.animate-coffee-float {
    animation: coffeeFloat 5s ease-in-out infinite;
}

/* Pulse & Glow */
.animate-pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

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

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* Shimmer */
.animate-shimmer {
    background: linear-gradient(
        90deg,
        var(--color-secondary) 0%,
        var(--color-white) 25%,
        var(--color-secondary) 50%,
        var(--color-white) 75%,
        var(--color-secondary) 100%
    );
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmerGold 3s linear infinite;
}

/* Scale */
.animate-scale-in {
    animation: scaleIn 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-scale-rotate {
    animation: scaleInRotate 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Rotate */
.animate-rotate {
    animation: rotate360 20s linear infinite;
}

.animate-rotate-in {
    animation: rotateIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Ripple */
.animate-ripple {
    animation: rippleGold 1s ease-out;
}

/* Text */
.animate-text-reveal {
    animation: textReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Gradient */
.animate-gradient {
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite;
}

/* Shake */
.animate-shake {
    animation: shake 0.5s ease-in-out;
}

/* Wobble */
.animate-wobble {
    animation: wobble 1s ease-in-out;
}

/* ========================================
   STAGGER DELAYS - Para Animaciones en Secuencia
   ======================================== */

.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; }
.stagger-7 { animation-delay: 0.7s; }
.stagger-8 { animation-delay: 0.8s; }

/* Auto-stagger para hijos */
.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.8s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.9s; }
.stagger-children > *:nth-child(10) { animation-delay: 1s; }

/* ========================================
   HOVER TRANSITIONS
   ======================================== */

.hover-lift {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.hover-scale {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.hover-glow {
    transition: box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(201, 169, 97, 0.4);
    transform: translateY(-5px);
}

.hover-rotate {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hover-rotate:hover {
    transform: rotate(5deg) scale(1.02);
}

/* ========================================
   PAGE TRANSITIONS
   ======================================== */

.page-enter {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.page-exit {
    animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) reverse forwards;
}

body.page-loaded {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   PRELOADER
   ======================================== */

.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-coffee {
    width: 80px;
    height: 100px;
    position: relative;
}

.preloader-cup {
    width: 60px;
    height: 70px;
    background: var(--color-secondary);
    border-radius: 0 0 30px 30px;
    position: relative;
    animation: cupWiggle 1s ease-in-out infinite;
}

.preloader-cup::before {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    background: var(--color-primary);
    border-radius: 0 0 20px 20px;
    animation: pourCoffee 1.5s ease-in-out infinite;
}

.preloader-steam {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
}

.preloader-steam span {
    width: 4px;
    height: 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    animation: coffeeSteam 1.5s ease-out infinite;
}

.preloader-steam span:nth-child(2) {
    animation-delay: 0.2s;
    height: 25px;
}

.preloader-steam span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@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;
    }
    
    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}
