/**
 * Death Coach - Animations & Transitions
 */

/* ==========================================================================
   BASE TRANSITIONS
   ========================================================================== */

/* Smooth transitions for interactive elements */
button,
.btn,
a,
input,
select,
textarea,
.card,
.nav-link {
  transition: all 0.15s ease;
}

/* ==========================================================================
   KEYFRAME ANIMATIONS
   ========================================================================== */

/* Fade In */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Fade In Down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Left */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade In Right */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Pop In */
@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  70% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

/* Pulse Ring */
@keyframes pulseRing {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

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

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

/* Glow */
@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 85, 0, 0.5); }
  50% { box-shadow: 0 0 20px rgba(255, 85, 0, 0.8); }
}

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

/* Slide In From Top */
@keyframes slideInTop {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Slide In From Bottom */
@keyframes slideInBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Progress Bar Fill */
@keyframes progressFill {
  from { width: 0; }
}

/* Typing indicator */
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Ripple effect */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Shimmer loading effect */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

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

/* Animation classes */
.animate-fadeIn { animation: fadeIn 0.3s ease forwards; }
.animate-fadeInUp { animation: fadeInUp 0.4s ease forwards; }
.animate-fadeInDown { animation: fadeInDown 0.4s ease forwards; }
.animate-fadeInLeft { animation: fadeInLeft 0.4s ease forwards; }
.animate-fadeInRight { animation: fadeInRight 0.4s ease forwards; }
.animate-scaleIn { animation: scaleIn 0.3s ease forwards; }
.animate-popIn { animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.animate-bounce { animation: bounce 0.6s ease infinite; }
.animate-pulse { animation: pulse 2s ease infinite; }
.animate-shake { animation: shake 0.4s ease; }
.animate-wiggle { animation: wiggle 0.5s ease; }
.animate-glow { animation: glow 2s ease infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* Delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

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

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

/* Lift on hover */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Scale on hover */
.hover-scale {
  transition: transform 0.2s ease;
}
.hover-scale:hover {
  transform: scale(1.05);
}

/* Glow on hover */
.hover-glow {
  transition: box-shadow 0.2s ease;
}
.hover-glow:hover {
  box-shadow: 0 0 20px rgba(255, 85, 0, 0.4);
}

/* Border glow on hover */
.hover-border-glow {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.hover-border-glow:hover {
  border-color: var(--accent, #ff5500);
  box-shadow: 0 0 15px rgba(255, 85, 0, 0.2);
}

/* ==========================================================================
   SPECIAL EFFECTS
   ========================================================================== */

/* Shimmer loading placeholder */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-elevated, #1c1c21) 0%,
    var(--bg-card, #16161a) 50%,
    var(--bg-elevated, #1c1c21) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Ripple button effect */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10);
  opacity: 0;
  transition: transform 0.5s, opacity 0.5s;
}
.ripple:active::after {
  transform: scale(0);
  opacity: 1;
  transition: 0s;
}

/* Online status indicator */
.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.status-indicator.online {
  background: #00d26a;
  box-shadow: 0 0 8px rgba(0, 210, 106, 0.6);
  animation: pulse 2s ease infinite;
}
.status-indicator.away {
  background: #ffaa00;
}
.status-indicator.in-match {
  background: #7b68ee;
  animation: pulse 1.5s ease infinite;
}
.status-indicator.offline {
  background: #666;
}

/* Notification badge pulse */
.notif-badge.has-new {
  animation: pulse 1s ease infinite;
}

/* Progress bar animation */
.progress-bar-animated {
  animation: progressFill 1s ease-out forwards;
}

/* Card entrance animation */
.card-animated {
  animation: fadeInUp 0.4s ease forwards;
  opacity: 0;
}

/* Match found overlay effect */
.match-found-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 85, 0, 0.1);
  z-index: 9999;
  pointer-events: none;
  animation: pulseRing 0.5s ease-out forwards;
}

/* Level up effect */
.level-up-effect {
  position: relative;
}
.level-up-effect::before {
  content: '';
  position: absolute;
  inset: -5px;
  border: 2px solid #ffaa00;
  border-radius: inherit;
  animation: pulseRing 1s ease-out infinite;
}

/* XP gain floating text */
.xp-gain {
  position: fixed;
  font-size: 20px;
  font-weight: 700;
  color: #ffaa00;
  text-shadow: 0 2px 10px rgba(255, 170, 0, 0.5);
  pointer-events: none;
  animation: fadeInUp 1s ease forwards, fadeIn 0.3s ease reverse forwards 0.7s;
}

/* MVP star effect */
.mvp-star {
  display: inline-block;
  animation: float 2s ease-in-out infinite, glow 2s ease infinite;
  color: #ffaa00;
  text-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
}

/* Typing indicator dots */
.typing-indicator {
  display: inline-flex;
  gap: 4px;
}
.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted, #888);
  border-radius: 50%;
  animation: typing 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator 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;
  }
}
