/* =====================================================
   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);
}

.animate-fade-in-up {
  animation: fadeInUp var(--duration-normal) var(--ease-decelerate);
}

.animate-fade-out-down {
  animation: fadeOutDown var(--duration-normal) var(--ease-accelerate);
}

.animate-scale-bounce {
  animation: scaleBounce var(--duration-normal) var(--ease-bounce);
}

.animate-slide-in-right {
  animation: slideInRight var(--duration-normal) var(--ease-decelerate);
}

.animate-slide-out-right {
  animation: slideOutRight var(--duration-normal) var(--ease-accelerate);
}

.animate-shake {
  animation: shake var(--duration-slower) var(--ease-standard);
}

.animate-bounce {
  animation: bounce var(--duration-slower) var(--ease-standard) infinite;
}

.animate-pulse {
  animation: pulse 2s var(--ease-standard) infinite;
}

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

/* ==================== 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;
}

/* ==================== SKELETON SCREEN ==================== */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
  border-radius: 4px;
}

.skeleton-text {
  height: 12px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 20px;
  margin-bottom: 12px;
  width: 60%;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* ==================== STAGGER ANIMATIONS ==================== */
.stagger-item {
  opacity: 0;
  animation: fadeInUp var(--duration-normal) var(--ease-decelerate) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 50ms; }
.stagger-item:nth-child(3) { animation-delay: 100ms; }
.stagger-item:nth-child(4) { animation-delay: 150ms; }
.stagger-item:nth-child(5) { animation-delay: 200ms; }
.stagger-item:nth-child(6) { animation-delay: 250ms; }
.stagger-item:nth-child(7) { animation-delay: 300ms; }
.stagger-item:nth-child(8) { animation-delay: 350ms; }
.stagger-item:nth-child(9) { animation-delay: 400ms; }
.stagger-item:nth-child(10) { animation-delay: 450ms; }

/* ==================== 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;
  }
}
