/* =====================================================
   ANIMATIONS.CSS - Sistema de Animações Reutilizáveis
   Freresia - v1.0
   ===================================================== */

/* ==================== VARIÁVEIS ==================== */
:root {
  --duration-instant: 100ms;
  --duration-fast: 200ms;
  --duration-normal: 300ms;
  --duration-slow: 400ms;
  --duration-slower: 600ms;

  --ease-standard: cubic-bezier(0.4, 0.0, 0.2, 1);
  --ease-decelerate: cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-accelerate: cubic-bezier(0.4, 0.0, 1, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==================== FADE ANIMATIONS ==================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

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

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

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

/* ==================== SCALE ANIMATIONS ==================== */
@keyframes scaleIn {
  from { transform: scale(0.9); }
  to { transform: scale(1); }
}

@keyframes scaleOut {
  from { transform: scale(1); }
  to { transform: scale(0.9); }
}

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

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

@keyframes pulseGlow {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(240, 192, 64, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 20px 10px rgba(240, 192, 64, 0);
  }
}

/* ==================== SLIDE ANIMATIONS ==================== */
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slideOutRight {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes slideOutLeft {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@keyframes slideInUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideInDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

/* ==================== ROTATE ANIMATIONS ==================== */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

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

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

@keyframes shakeVertical {
  0%, 100% { transform: translateY(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateY(-5px); }
  20%, 40%, 60%, 80% { transform: translateY(5px); }
}

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

/* ==================== BOUNCE ANIMATIONS ==================== */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

/* ==================== RIPPLE EFFECT ==================== */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* ==================== LOADING ANIMATIONS ==================== */
@keyframes spinnerRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

@keyframes barSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ==================== BORDER ANIMATIONS ==================== */
@keyframes borderDash {
  to { stroke-dashoffset: 0; }
}

@keyframes borderGlow {
  0%, 100% {
    border-color: rgba(240, 192, 64, 0.4);
    box-shadow: 0 0 5px rgba(240, 192, 64, 0.2);
  }
  50% {
    border-color: rgba(240, 192, 64, 0.8);
    box-shadow: 0 0 20px rgba(240, 192, 64, 0.6);
  }
}

/* ==================== SKELETON SCREEN ==================== */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* ==================== CONFETTI/PARTICLES ==================== */
@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(1000px) rotate(720deg);
    opacity: 0;
  }
}

/* ==================== UTILITY CLASSES ==================== */
.animate-fade-in {
  animation: fadeIn var(--duration-fast) var(--ease-standard);
}

.animate-fade-out {
  animation: fadeOut var(--duration-fast) var(--ease-standard);
}


/* ==================== RIPPLE CONTAINER ==================== */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  pointer-events: none;
  animation: ripple var(--duration-slower) ease-out;
}

/* ==================== LOADING STATES ==================== */
.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinnerRotate 0.6s linear infinite;
}


/* ==================== LOTTERY FAB PULSE ==================== */
@keyframes lotteryPulse {
    0%   { transform: scale(1);    box-shadow: 0 0 10px rgba(240,192,64,0.7), 0 0 0 0 rgba(240,192,64,0.9);   border-color: #f0c040; }
    25%  { transform: scale(1.35); box-shadow: 0 0 30px rgba(255,80,80,1),   0 0 0 22px rgba(255,80,80,0);   border-color: #ff5050; }
    50%  { transform: scale(1);    box-shadow: 0 0 10px rgba(80,200,255,0.7), 0 0 0 0 rgba(80,200,255,0.9);  border-color: #50c8ff; }
    75%  { transform: scale(1.35); box-shadow: 0 0 30px rgba(160,80,255,1),  0 0 0 22px rgba(160,80,255,0);  border-color: #a050ff; }
    100% { transform: scale(1);    box-shadow: 0 0 10px rgba(240,192,64,0.7), 0 0 0 0 rgba(240,192,64,0.9);   border-color: #f0c040; }
}
.lottery-pulse {
    animation: lotteryPulse 1.4s ease-in-out infinite !important;
}

/* ==================== 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-pulse,
  .animate-bounce,
  .animate-spin {
    animation: none !important;
  }
}
