/*
 * =====================================
 * WIZARD ANIMATIONS - ONDA 3 Item 13
 * =====================================
 * Animações CSS temáticas para melhorar UX do wizard
 * Zero dependências, 100% CSS puro
 * Mobile-optimized com suporte a prefers-reduced-motion
 */

/* ================================
   ANIMAÇÕES BASE
   ================================ */

/* Fade Slide Up (entrada de cards) */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-slide-up {
    animation: fadeSlideUp 0.5s ease-out;
}

/* Fade Scale (modais) */
@keyframes fadeScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-scale {
    animation: fadeScale 0.5s ease-out;
}

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

.animate-bounce-in {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Shimmer (loading states) */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Pulse Ring (notificações, badges) */
@keyframes pulseRing {
    0% {
        transform: scale(0.95);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.95);
        opacity: 1;
    }
}

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

/* Typing Indicator (bot escrevendo) */
@keyframes typing {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: typing 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

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

/* Slide In Right (notificações lateral) */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Slide Out Right (fechar notificações) */
@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.animate-slide-out-right {
    animation: slideOutRight 0.3s ease-in;
}

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

/* Page Transition Enter (próximo step) */
.page-transition-enter {
    opacity: 0;
    transform: translateX(100px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.4s ease-out;
}

/* Page Transition Exit (voltar step) */
.page-transition-exit {
    opacity: 1;
    transform: translateX(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateX(-100px);
    transition: all 0.4s ease-in;
}

/* ================================
   EFEITOS ESPECIAIS
   ================================ */

/* Gradient Flow (backgrounds animados) */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.bg-gradient-flow {
    background-size: 200% 200%;
    animation: gradientFlow 5s ease infinite;
}

/* Glow Effect (botões importantes) */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(147, 51, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(147, 51, 234, 0.8);
    }
}

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

/* Float (ícones decorativos) */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

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

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

.animate-rotate {
    animation: rotate 1s linear infinite;
}

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

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

/* Confetti (celebrações) */
@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(720deg);
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9999;
    animation: confettiFall 3s linear forwards;
    pointer-events: none;
}

/* ================================
   ANIMAÇÕES SEQUENCIAIS
   ================================ */

/* Stagger Children (listas animadas) */
.stagger-children > * {
    opacity: 0;
    animation: fadeSlideUp 0.5s ease-out forwards;
}

.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(n+9) { animation-delay: 0.9s; }

/* Progress Bar Fill */
@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: var(--progress-width, 100%);
    }
}

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

/* ================================
   HOVER EFFECTS
   ================================ */

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

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

/* Scale on Hover (botões) */
.hover-scale {
    transition: transform 0.2s ease;
}

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

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

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

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(147, 51, 234, 0.6);
}

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

/* Reduzir animações em dispositivos com prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-shimmer,
    .animate-pulse-ring,
    .animate-float,
    .btn-glow,
    .bg-gradient-flow {
        animation: none !important;
    }
}

/* Mobile: animações mais rápidas e suaves */
@media (max-width: 768px) {
    .animate-fade-slide-up,
    .animate-fade-scale,
    .animate-bounce-in {
        animation-duration: 0.3s;
    }
    
    .stagger-children > * {
        animation-duration: 0.3s;
    }
    
    .stagger-children > *:nth-child(n) {
        animation-delay: 0.05s;
    }
    
    /* Reduzir hover effects em mobile */
    .hover-lift:hover {
        transform: translateY(-4px);
    }
}

/* ================================
   UTILITY CLASSES
   ================================ */

/* Fade In (genérico) */
.fade-in {
    animation: fadeSlideUp 0.6s ease-out;
}

/* Delay variants */
.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; }

/* Duration variants */
.duration-fast { animation-duration: 0.2s; }
.duration-normal { animation-duration: 0.5s; }
.duration-slow { animation-duration: 1s; }

/* ================================
   PERFORMANCE OPTIMIZATIONS
   ================================ */

/* Force GPU acceleration for smooth animations */
.animate-fade-slide-up,
.animate-fade-scale,
.animate-bounce-in,
.animate-slide-in-right,
.hover-lift,
.hover-scale {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Remove will-change after animation completes */
.animation-complete {
    will-change: auto;
}
