/* ==================== Animation Durations & Easings ==================== */
/* Already defined in main.css variables:
   --duration-instant: 100ms
   --duration-fast: 200ms
   --duration-normal: 300ms
   --duration-slow: 400ms
   --ease-default: cubic-bezier(0.4, 0, 0.2, 1)
*/

/* ==================== Fade Animations ==================== */
.fade-in {
  animation: fadeIn var(--duration-normal) var(--ease-default);
}

.fade-out {
  animation: fadeOut var(--duration-normal) var(--ease-default);
}

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

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

/* ==================== Slide Animations ==================== */
.slide-in-right {
  animation: slideInRight var(--duration-normal) var(--ease-default);
}

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

.slide-in-down {
  animation: slideInDown var(--duration-fast) var(--ease-default);
}

.slide-in-up {
  animation: slideInUp var(--duration-fast) var(--ease-default);
}

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

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

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

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

/* ==================== Scale/Zoom Animations ==================== */
.scale-in {
  animation: scaleIn var(--duration-normal) var(--ease-default);
}

.scale-out {
  animation: scaleOut var(--duration-normal) var(--ease-default);
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes scaleOut {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.95);
    opacity: 0;
  }
}

/* ==================== Button Click Animation ==================== */
.btn-click {
  animation: btnClick var(--duration-instant) var(--ease-default);
}

@keyframes btnClick {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}

/* ==================== Shake Animation (Error States) ==================== */
.shake {
  animation: shake var(--duration-slow) var(--ease-default);
}

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

/* ==================== Float/Hover Animation ==================== */
.float {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* ==================== Pulse Animation (Hot/New badges) ==================== */
.pulse {
  animation: pulse 2s ease-in-out infinite;
}

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

/* ==================== Favorite Heart Animation ==================== */
.heart-beat {
  animation: heartBeat var(--duration-slow) var(--ease-default);
}

@keyframes heartBeat {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.3) rotate(5deg);
  }
  50% {
    transform: scale(1.3) rotate(-5deg);
  }
  75% {
    transform: scale(1.3) rotate(5deg);
  }
  100% {
    transform: scale(1);
  }
}

/* ==================== Spin Animation (Loading states) ==================== */
.spin {
  animation: spin 1s linear infinite;
}

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

/* ==================== Shimmer Animation (Skeleton loading) ==================== */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-card) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ==================== Bounce Animation ==================== */
.bounce {
  animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

/* ==================== Rotate Animation (Random button) ==================== */
.rotate-360 {
  animation: rotate360 var(--duration-slow) var(--ease-default);
}

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

/* ==================== Underline Expand (Links) ==================== */
.underline-expand {
  position: relative;
}

.underline-expand::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-primary);
  transition: width var(--duration-fast) var(--ease-default);
}

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

/* ==================== Card Lift (Game cards hover) ==================== */
.card-lift {
  transition: all var(--duration-normal) var(--ease-default);
}

.card-lift:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

/* ==================== Image Zoom (Game card images) ==================== */
.image-zoom-container {
  overflow: hidden;
}

.image-zoom {
  transition: transform var(--duration-normal) var(--ease-default);
}

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

/* ==================== Glow Animation (Buttons, focus states) ==================== */
.glow {
  position: relative;
  overflow: hidden;
}

.glow::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(53, 160, 255, 0.3) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-default);
}

.glow:hover::before {
  opacity: 1;
}

/* ==================== Backdrop Blur Animation ==================== */
.backdrop-blur-in {
  animation: backdropBlurIn var(--duration-fast) var(--ease-default);
}

@keyframes backdropBlurIn {
  from {
    backdrop-filter: blur(0px);
    background: rgba(0, 0, 0, 0);
  }
  to {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.6);
  }
}

/* ==================== Focus Ring Animation ==================== */
.focus-ring {
  outline: none;
  transition: box-shadow var(--duration-fast) var(--ease-default);
}

.focus-ring:focus {
  box-shadow: 0 0 0 3px rgba(53, 160, 255, 0.3);
}

/* ==================== Slide Content Transition (Category switch) ==================== */
.content-transition-out {
  animation: contentTransitionOut var(--duration-fast) var(--ease-default);
}

.content-transition-in {
  animation: contentTransitionIn var(--duration-normal) var(--ease-default);
}

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

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

/* ==================== Notification Slide In ==================== */
.notification-enter {
  animation: notificationEnter var(--duration-normal) var(--ease-default);
}

.notification-exit {
  animation: notificationExit var(--duration-normal) var(--ease-default);
}

@keyframes notificationEnter {
  from {
    transform: translateX(calc(100% + var(--space-lg)));
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes notificationExit {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(calc(100% + var(--space-lg)));
    opacity: 0;
  }
}

/* ==================== Progress Bar Animation ==================== */
.progress-bar {
  position: relative;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-default);
}

.progress-bar-indeterminate {
  animation: progressIndeterminate 1.5s ease-in-out infinite;
}

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

/* ==================== Ripple Effect (Button clicks) ==================== */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.ripple-effect:active::after {
  width: 100px;
  height: 100px;
  animation: ripple 0.6s ease-out;
}

/* ==================== Reduce Motion (Accessibility) ==================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================== Utility Animation Classes ==================== */
.animate-once {
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}

.animate-infinite {
  animation-iteration-count: infinite;
}

.animate-delay-100 {
  animation-delay: 100ms;
}

.animate-delay-200 {
  animation-delay: 200ms;
}

.animate-delay-300 {
  animation-delay: 300ms;
}

/* GPU acceleration hint */
.gpu-accelerate {
  transform: translateZ(0);
  will-change: transform;
}
