/* =====================================================
   MUNDO MÁGICO - Animações CSS
   Efeitos visuais encantadores e performáticos
   ===================================================== */

/* =====================================================
   1. KEYFRAMES - ANIMAÇÕES BASE
   ===================================================== */

/* Float - Flutuação suave */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Bounce - Pulo alegre */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-15px);
    }
    60% {
        transform: translateY(-7px);
    }
}

/* Pulse - Pulsação */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Pulse Glow - Brilho pulsante */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(124, 58, 237, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(124, 58, 237, 0.6), 0 0 50px rgba(244, 114, 182, 0.3);
    }
}

/* Sparkle - Brilho estrela */
@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

/* Twinkle - Piscar de estrela */
@keyframes twinkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

/* Cloud Float - Nuvens flutuando */
@keyframes cloud-float {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(120vw);
    }
}

/* Rainbow Pulse - Arco-íris pulsante */
@keyframes rainbow-pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.05);
    }
}

/* Gradient Shift - Gradiente animado */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Float Around - Elementos flutuando ao redor */
@keyframes float-around {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(20px, -30px) rotate(10deg);
    }
    50% {
        transform: translate(-10px, -50px) rotate(-5deg);
    }
    75% {
        transform: translate(-30px, -20px) rotate(15deg);
    }
}

/* Scroll Down - Indicador de scroll */
@keyframes scroll-down {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(15px);
    }
}

/* Spin Scale - Girar e escalar */
@keyframes spin-scale {
    0% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(90deg) scale(1.2);
    }
    50% {
        transform: rotate(180deg) scale(1);
    }
    75% {
        transform: rotate(270deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Rocket - Foguete subindo */
@keyframes rocket {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Pop In - Aparecer com pop */
@keyframes pop-in {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Wiggle - Balançar alegre */
@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-10deg);
    }
    75% {
        transform: rotate(10deg);
    }
}

/* Particle Float - Partículas flutuando */
@keyframes particle-float {
    0% {
        opacity: 0;
        transform: translateY(100vh) rotate(0deg);
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) rotate(720deg);
    }
}

/* Heartbeat - Batida de coração */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

/* Swing - Balanço de pêndulo */
@keyframes swing {
    0%, 100% {
        transform: rotate(0deg);
        transform-origin: top center;
    }
    25% {
        transform: rotate(15deg);
    }
    75% {
        transform: rotate(-15deg);
    }
}

/* Rubber Band - Elástico */
@keyframes rubber-band {
    0% {
        transform: scaleX(1);
    }
    30% {
        transform: scaleX(1.25) scaleY(0.75);
    }
    40% {
        transform: scaleX(0.75) scaleY(1.25);
    }
    50% {
        transform: scaleX(1.15) scaleY(0.85);
    }
    65% {
        transform: scaleX(0.95) scaleY(1.05);
    }
    75% {
        transform: scaleX(1.05) scaleY(0.95);
    }
    100% {
        transform: scaleX(1);
    }
}

/* Jello - Gelatina */
@keyframes jello {
    0%, 11.1%, 100% {
        transform: none;
    }
    22.2% {
        transform: skewX(-12.5deg) skewY(-12.5deg);
    }
    33.3% {
        transform: skewX(6.25deg) skewY(6.25deg);
    }
    44.4% {
        transform: skewX(-3.125deg) skewY(-3.125deg);
    }
    55.5% {
        transform: skewX(1.5625deg) skewY(1.5625deg);
    }
    66.6% {
        transform: skewX(-0.78125deg) skewY(-0.78125deg);
    }
    77.7% {
        transform: skewX(0.390625deg) skewY(0.390625deg);
    }
    88.8% {
        transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
    }
}

/* Tada - Celebração */
@keyframes tada {
    0% {
        transform: scale(1) rotate(0deg);
    }
    10%, 20% {
        transform: scale(0.9) rotate(-3deg);
    }
    30%, 50%, 70%, 90% {
        transform: scale(1.1) rotate(3deg);
    }
    40%, 60%, 80% {
        transform: scale(1.1) rotate(-3deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Confetti Fall */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Color Cycle - Ciclo de cores do arco-íris */
@keyframes color-cycle {
    0% { color: #ef4444; }
    14% { color: #f97316; }
    28% { color: #fbbf24; }
    42% { color: #22c55e; }
    57% { color: #3b82f6; }
    71% { color: #8b5cf6; }
    85% { color: #ec4899; }
    100% { color: #ef4444; }
}

/* Background Color Cycle */
@keyframes bg-color-cycle {
    0% { background-color: rgba(239, 68, 68, 0.2); }
    14% { background-color: rgba(249, 115, 22, 0.2); }
    28% { background-color: rgba(251, 191, 36, 0.2); }
    42% { background-color: rgba(34, 197, 94, 0.2); }
    57% { background-color: rgba(59, 130, 246, 0.2); }
    71% { background-color: rgba(139, 92, 246, 0.2); }
    85% { background-color: rgba(236, 72, 153, 0.2); }
    100% { background-color: rgba(239, 68, 68, 0.2); }
}

/* Glow Pulse */
@keyframes glow-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 5px currentColor);
    }
    50% {
        filter: drop-shadow(0 0 20px currentColor) drop-shadow(0 0 40px currentColor);
    }
}

/* Flip */
@keyframes flip {
    0% {
        transform: perspective(400px) rotateY(0);
    }
    100% {
        transform: perspective(400px) rotateY(360deg);
    }
}

/* Zoom In Rotate */
@keyframes zoom-in-rotate {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* =====================================================
   2. CLASSES DE ANIMAÇÃO UTILITÁRIAS
   ===================================================== */

/* Animações de entrada */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

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

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

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

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

.animate-wiggle {
    animation: wiggle 1s ease-in-out infinite;
}

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

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

.animate-jello:hover {
    animation: jello 1s ease-in-out;
}

.animate-rubber-band:hover {
    animation: rubber-band 1s ease-in-out;
}

.animate-tada:hover {
    animation: tada 1s ease-in-out;
}

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

.animate-flip:hover {
    animation: flip 0.6s ease-in-out;
}

.animate-color-cycle {
    animation: color-cycle 5s linear infinite;
}

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

/* =====================================================
   3. ANIMAÇÕES DE SCROLL (Intersection Observer)
   ===================================================== */

/* Estados iniciais para elementos animados */
[data-animate] {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-animate="fade-up"] {
    transform: translateY(50px);
}

[data-animate="fade-down"] {
    transform: translateY(-50px);
}

[data-animate="fade-left"] {
    transform: translateX(50px);
}

[data-animate="fade-right"] {
    transform: translateX(-50px);
}

[data-animate="zoom-in"] {
    transform: scale(0.8);
}

[data-animate="zoom-out"] {
    transform: scale(1.2);
}

[data-animate="flip-up"] {
    transform: perspective(1000px) rotateX(45deg);
    transform-origin: bottom;
}

[data-animate="flip-down"] {
    transform: perspective(1000px) rotateX(-45deg);
    transform-origin: top;
}

[data-animate="rotate-in"] {
    transform: rotate(-180deg) scale(0);
}

/* Estados animados - quando visível */
[data-animate].animated {
    opacity: 1;
    transform: none;
}

/* Delays para animações em sequência */
[data-animate-delay="100"] { transition-delay: 100ms; }
[data-animate-delay="200"] { transition-delay: 200ms; }
[data-animate-delay="300"] { transition-delay: 300ms; }
[data-animate-delay="400"] { transition-delay: 400ms; }
[data-animate-delay="500"] { transition-delay: 500ms; }
[data-animate-delay="600"] { transition-delay: 600ms; }
[data-animate-delay="700"] { transition-delay: 700ms; }
[data-animate-delay="800"] { transition-delay: 800ms; }
[data-animate-delay="900"] { transition-delay: 900ms; }
[data-animate-delay="1000"] { transition-delay: 1000ms; }

/* =====================================================
   4. EFEITOS HOVER ESPECIAIS
   ===================================================== */

/* Hover Grow */
.hover-grow {
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hover-grow:hover {
    transform: scale(1.1);
}

/* Hover Shrink */
.hover-shrink {
    transition: transform 0.3s ease;
}

.hover-shrink:hover {
    transform: scale(0.95);
}

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

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

/* Hover Glow */
.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.5), 0 0 60px rgba(244, 114, 182, 0.3);
}

/* Hover Rotate */
.hover-rotate {
    transition: transform 0.5s ease;
}

.hover-rotate:hover {
    transform: rotate(360deg);
}

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

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

/* Hover Underline Magic */
.hover-underline-magic {
    position: relative;
}

.hover-underline-magic::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #7c3aed, #f472b6, #fbbf24);
    transition: width 0.3s ease;
    border-radius: 3px;
}

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

/* Hover Fill */
.hover-fill {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.hover-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #f472b6);
    transition: left 0.3s ease;
    z-index: -1;
}

.hover-fill:hover::before {
    left: 0;
}

/* =====================================================
   5. EFEITOS DE TEXTO
   ===================================================== */

/* Text Rainbow */
.text-rainbow {
    background: linear-gradient(90deg, 
        #ef4444, #f97316, #fbbf24, #22c55e, 
        #3b82f6, #8b5cf6, #ec4899, #ef4444
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s linear infinite;
}

/* Text Shimmer */
.text-shimmer {
    background: linear-gradient(
        90deg,
        var(--color-primary) 0%,
        var(--color-secondary) 25%,
        var(--color-accent-1) 50%,
        var(--color-secondary) 75%,
        var(--color-primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 2s linear infinite;
}

/* Text Shadow Pop */
.text-shadow-pop {
    transition: text-shadow 0.3s ease, transform 0.3s ease;
}

.text-shadow-pop:hover {
    text-shadow: 
        1px 1px 0 #7c3aed,
        2px 2px 0 #a78bfa,
        3px 3px 0 #c4b5fd,
        4px 4px 0 #ddd6fe;
    transform: translate(-4px, -4px);
}

/* Typing Effect Container */
.typing-effect {
    overflow: hidden;
    border-right: 3px solid var(--color-primary);
    white-space: nowrap;
    animation: typing 3s steps(30, 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(--color-primary); }
}

/* =====================================================
   6. EFEITOS DE PARTÍCULAS CSS
   ===================================================== */

/* Confetti Burst */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confetti-fall linear forwards;
}

.confetti:nth-child(odd) {
    background: var(--color-primary);
    border-radius: 50%;
}

.confetti:nth-child(even) {
    background: var(--color-secondary);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

/* Bubble Effect */
.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(124, 58, 237, 0.3));
    animation: float 4s ease-in-out infinite;
}

/* =====================================================
   7. TRANSIÇÕES DE PÁGINA
   ===================================================== */

/* Page Transition Overlay */
.page-transition {
    position: fixed;
    inset: 0;
    background: var(--bg-magic);
    z-index: 10000;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s cubic-bezier(0.86, 0, 0.07, 1);
}

.page-transition.active {
    transform: scaleX(1);
}

.page-transition.out {
    transform-origin: right;
    transform: scaleX(0);
}

/* =====================================================
   8. LOADING ANIMATIONS
   ===================================================== */

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

.loading-dots span {
    width: 12px;
    height: 12px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

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

/* Spinner Magic */
.spinner-magic {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-right-color: var(--color-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Progress Bar Magic */
.progress-magic {
    width: 100%;
    height: 8px;
    background: var(--color-gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-magic::after {
    content: '';
    display: block;
    width: 30%;
    height: 100%;
    background: var(--bg-magic);
    border-radius: 4px;
    animation: progress-slide 1.5s ease-in-out infinite;
}

@keyframes progress-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* =====================================================
   9. EFEITOS ESPECIAIS - CARDS
   ===================================================== */

/* Card Flip 3D */
.card-flip-3d {
    perspective: 1000px;
}

.card-flip-3d-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card-flip-3d:hover .card-flip-3d-inner {
    transform: rotateY(180deg);
}

.card-flip-3d-front,
.card-flip-3d-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.card-flip-3d-back {
    transform: rotateY(180deg);
}

/* Card Shine Effect */
.card-shine {
    position: relative;
    overflow: hidden;
}

.card-shine::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    transform: rotate(45deg) translateX(-100%);
    transition: transform 0.6s ease;
}

.card-shine:hover::before {
    transform: rotate(45deg) translateX(100%);
}

/* =====================================================
   10. RESPONSIVIDADE PARA ANIMAÇÕES
   ===================================================== */

/* Reduzir animações em dispositivos móveis para melhor performance */
@media (max-width: 768px) {
    [data-animate] {
        transition-duration: 0.5s;
    }
    
    .animate-float {
        animation-duration: 4s;
    }
    
    .floating-elements,
    .mascot-sparkles {
        display: none;
    }
    
    .hero__clouds .cloud {
        animation-duration: 40s;
    }
}

/* Respeitar preferência do usuário por movimento reduzido */
@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;
    }
    
    [data-animate] {
        opacity: 1;
        transform: none;
    }
    
    .animate-float,
    .animate-bounce,
    .animate-pulse,
    .animate-sparkle,
    .animate-twinkle {
        animation: none;
    }
}
