/**
 * GPU-Accelerated CSS Animations
 * Performance Optimization #7
 * 
 * This file contains optimized CSS for hardware-accelerated animations
 * All animations use transform and opacity for GPU rendering
 */

/* ============================================
   GPU-ACCELERATED BASE STYLES
   ============================================ */

.gpu-accelerated {
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ============================================
   LEADERBOARD ANIMATIONS
   ============================================ */

.player-item {
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backface-visibility: hidden;
}

.player-item.entering {
  animation: player-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.player-item.leaving {
  animation: player-leave 0.3s cubic-bezier(0.4, 0, 1, 1);
}

.player-item.rank-up {
  animation: rank-up 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.player-item.rank-down {
  animation: rank-down 0.4s cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes player-enter {
  0% {
    transform: translate3d(100%, 0, 0) scale(0.8);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
}

@keyframes player-leave {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate3d(-100%, 0, 0) scale(0.8);
    opacity: 0;
  }
}

@keyframes rank-up {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -20px, 0) scale(1.1);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes rank-down {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, 10px, 0) scale(0.95);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* ============================================
   COIN ANIMATIONS
   ============================================ */

.coin-animation {
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
  animation: coin-fly 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

@keyframes coin-fly {
  0% {
    transform: translate3d(0, 0, 0) scale(0) rotate(0deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--target-x, 0), var(--target-y, -100px), 0) 
               scale(1.5) 
               rotate(720deg);
    opacity: 0;
  }
}

.coin-burst {
  will-change: transform, opacity;
  animation: coin-burst 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes coin-burst {
  0% {
    transform: translate3d(0, 0, 0) scale(0);
    opacity: 1;
  }
  50% {
    transform: translate3d(var(--burst-x, 0), var(--burst-y, 0), 0) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--burst-x, 0), var(--burst-y, 0), 0) scale(0.8);
    opacity: 0;
  }
}

/* ============================================
   MULTIPLIER EFFECTS
   ============================================ */

.multiplier-active {
  will-change: transform, opacity;
  animation: multiplier-pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes multiplier-pulse {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate3d(0, 0, 0) scale(1.05);
    opacity: 0.8;
  }
}

.multiplier-indicator {
  will-change: transform;
  transform: translate3d(0, 0, 0);
  animation: multiplier-float 3s ease-in-out infinite;
}

@keyframes multiplier-float {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotateY(0deg);
  }
  50% {
    transform: translate3d(0, -10px, 0) rotateY(180deg);
  }
}

/* ============================================
   TEAM BATTLE EFFECTS
   ============================================ */

.team-score-update {
  will-change: transform;
  animation: score-bounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes score-bounce {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -10px, 0) scale(1.2);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.team-leader-glow {
  will-change: filter;
  animation: leader-glow 2s ease-in-out infinite;
}

@keyframes leader-glow {
  0%, 100% {
    filter: drop-shadow(0 0 10px currentColor);
  }
  50% {
    filter: drop-shadow(0 0 20px currentColor);
  }
}

/* ============================================
   MATCH STATUS TRANSITIONS
   ============================================ */

.match-starting {
  will-change: transform, opacity;
  animation: match-start 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes match-start {
  0% {
    transform: translate3d(0, 100%, 0) scale(0.5);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
}

.match-ending {
  will-change: transform, opacity;
  animation: match-end 0.8s cubic-bezier(0.4, 0, 1, 1);
}

@keyframes match-end {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate3d(0, -100%, 0) scale(0.5);
    opacity: 0;
  }
}

/* ============================================
   COUNTDOWN TIMER
   ============================================ */

.timer-critical {
  will-change: transform, color;
  animation: timer-pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes timer-pulse {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
    color: #f56565;
  }
  50% {
    transform: translate3d(0, 0, 0) scale(1.1);
    color: #fc8181;
  }
}

/* ============================================
   BADGE & ACHIEVEMENT ANIMATIONS
   ============================================ */

.badge-earned {
  will-change: transform, opacity;
  animation: badge-earn 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badge-earn {
  0% {
    transform: translate3d(0, 100px, 0) scale(0) rotate(-180deg);
    opacity: 0;
  }
  60% {
    transform: translate3d(0, -10px, 0) scale(1.2) rotate(10deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
    opacity: 1;
  }
}

.badge-shimmer {
  will-change: transform;
  animation: badge-shimmer 3s linear infinite;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
}

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

/* ============================================
   PARTICLE EFFECTS
   ============================================ */

.particle {
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
  animation: particle-float 2s ease-out forwards;
}

@keyframes particle-float {
  0% {
    transform: translate3d(
      var(--start-x, 0),
      var(--start-y, 0),
      0
    ) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate3d(
      var(--end-x, 0),
      var(--end-y, -200px),
      0
    ) scale(0);
    opacity: 0;
  }
}

/* ============================================
   COMBO EFFECTS
   ============================================ */

.combo-text {
  will-change: transform, opacity;
  animation: combo-appear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes combo-appear {
  0% {
    transform: translate3d(0, 50px, 0) scale(0);
    opacity: 0;
  }
  50% {
    transform: translate3d(0, -10px, 0) scale(1.3);
    opacity: 1;
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
}

.combo-multiplier {
  will-change: transform;
  animation: combo-bounce 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

@keyframes combo-bounce {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -5px, 0) scale(1.1);
  }
}

/* ============================================
   POWER-UP EFFECTS
   ============================================ */

.powerup-active {
  will-change: transform, filter;
  animation: powerup-glow 1s ease-in-out infinite;
}

@keyframes powerup-glow {
  0%, 100% {
    transform: translate3d(0, 0, 0);
    filter: drop-shadow(0 0 5px currentColor) brightness(1);
  }
  50% {
    transform: translate3d(0, -2px, 0);
    filter: drop-shadow(0 0 15px currentColor) brightness(1.2);
  }
}

/* ============================================
   LOADING & SKELETON
   ============================================ */

.skeleton-pulse {
  will-change: opacity;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
}

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

/* ============================================
   PERFORMANCE HINTS
   ============================================ */

/* Force GPU compositing for critical elements */
.overlay-container,
.leaderboard-container,
.match-timer,
.team-scores {
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-perspective: 1000;
  perspective: 1000;
}

/* Optimize text rendering */
.player-name,
.score-value,
.timer-display {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Prevent layout shifts */
.coin-count,
.rank-position {
  font-variant-numeric: tabular-nums;
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */

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