/* Progress Bar Animations */
.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  border-radius: 10px;
  animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes progressShimmer {
  0%,
  100% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(100%);
  }
}

/* Action Quick Bar Animations */
.action-quick-bar {
  animation: quickBarSlideIn var(--quick-bar-animation) ease-out;
}

@keyframes quickBarSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Button Animations */
.btn.action-available {
  background: linear-gradient(45deg, #ffd93d, #fdcb6e);
  color: #333;
  box-shadow: 0 0 20px rgba(255, 217, 61, 0.4);
  animation: actionPulse 2s ease-in-out infinite;
}

@keyframes actionPulse {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(255, 217, 61, 0.4);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 217, 61, 0.7);
  }
}

/* Enhanced Stat Change Animations */
.stat-change-enhanced {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: bold;
  font-size: 1.1em;
  pointer-events: none;
  z-index: 15;
  background: rgba(0, 0, 0, 0.9);
  padding: 4px 8px;
  border-radius: 6px;
  border: 2px solid;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stat-change-enhanced.positive {
  color: #4ecdc4;
  border-color: #4ecdc4;
  animation: statChangeEnhancedUp var(--stat-change-animation) ease-out;
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.4);
}

.stat-change-enhanced.negative {
  color: #ff6b6b;
  border-color: #ff6b6b;
  animation: statChangeEnhancedDown var(--stat-change-animation) ease-out;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

@keyframes statChangeEnhancedUp {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  20% {
    transform: translate(-50%, -80%) scale(1.4);
    opacity: 1;
  }
  70% {
    transform: translate(-50%, -100%) scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -120%) scale(1);
    opacity: 0;
  }
}

@keyframes statChangeEnhancedDown {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  20% {
    transform: translate(-50%, -20%) scale(1.4);
    opacity: 1;
  }
  70% {
    transform: translate(-50%, 0%) scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, 20%) scale(1);
    opacity: 0;
  }
}

/* Player Stat Highlighting */
.stat-item.highlight {
  background: rgba(255, 217, 61, 0.3) !important;
  border-color: rgba(255, 217, 61, 0.6) !important;
  box-shadow: 0 0 15px rgba(255, 217, 61, 0.4);
  animation: statHighlight var(--stat-highlight-duration) ease-out;
}

@keyframes statHighlight {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(255, 217, 61, 0.4);
  }
  50% {
    box-shadow: 0 0 25px rgba(255, 217, 61, 0.7);
  }
}

.health-bar.highlight {
  animation: healthBarPulse var(--stat-highlight-duration) ease-out;
}

@keyframes healthBarPulse {
  0%,
  100% {
    box-shadow: none;
  }
  50% {
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.6);
  }
}

/* Card-based Stat Change Animations */
.stat-change-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: bold;
  font-size: 0.9em;
  pointer-events: none;
  z-index: 10;
  background: rgba(0, 0, 0, 0.8);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid;
}

.stat-change-card.positive {
  color: #4ecdc4;
  border-color: #4ecdc4;
  animation: statChangeCardUp var(--card-stat-change-animation) ease-out;
}

.stat-change-card.negative {
  color: #ff6b6b;
  border-color: #ff6b6b;
  animation: statChangeCardDown var(--card-stat-change-animation) ease-out;
}

@keyframes statChangeCardUp {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -80%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -100%) scale(1);
    opacity: 0;
  }
}

@keyframes statChangeCardDown {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -20%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, 0%) scale(1);
    opacity: 0;
  }
}

/* Health Change Animations */
.health-change {
  position: absolute;
  top: -10px;
  right: 10px;
  font-weight: bold;
  font-size: 1.2em;
  pointer-events: none;
  z-index: 10;
}

.health-change.positive {
  color: #4ecdc4;
  animation: healthUp var(--health-change-animation) ease-out;
}

.health-change.negative {
  color: #ff6b6b;
  animation: healthDown var(--health-change-animation) ease-out;
}

@keyframes healthUp {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-20px) scale(1.3);
    opacity: 1;
  }
  100% {
    transform: translateY(-40px) scale(1);
    opacity: 0;
  }
}

@keyframes healthDown {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-20px) scale(1.3);
    opacity: 1;
  }
  100% {
    transform: translateY(-40px) scale(1);
    opacity: 0;
  }
}

/* Modal Animations */
.outcome-content {
  animation: outcomeAppear var(--outcome-modal-animation) ease-out;
}

@keyframes outcomeAppear {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Toast Animations */
.toast {
  transform: translateX(100%);
  animation: slideIn 0.3s ease forwards;
}

.toast.removing {
  animation: slideOut var(--toast-slide-animation) ease forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Winner Announcement Animation */
.winner-announcement.pulse {
  animation: winnerPulse 1.5s ease-in-out infinite;
}

@keyframes winnerPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.4);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 40px rgba(78, 205, 196, 0.7);
  }
}

/* How to Play Modal Entrance Animation */
.how-to-play-content {
  animation: howToPlaySlideIn 0.5s ease-out;
}

@keyframes howToPlaySlideIn {
  0% {
    transform: translateY(-30px) scale(0.95);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Drink Selection Animation */
.drink.selected {
  animation: drinkSelected 0.3s ease-out;
}

@keyframes drinkSelected {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.15);
  }
  100% {
    transform: translateY(-5px) scale(1.1);
  }
}

/* Player Turn Highlight Animation */
.player.current-turn {
  animation: playerTurnHighlight 2s ease-in-out infinite;
}

@keyframes playerTurnHighlight {
  0%,
  100% {
    box-shadow: 0 0 30px rgba(255, 217, 61, 0.5);
  }
  50% {
    box-shadow: 0 0 45px rgba(255, 217, 61, 0.8);
  }
}

/* Sabotage Point Spending Animation */
.sabotage-spending {
  animation: sabotageSpend 1.5s ease-out;
}

@keyframes sabotageSpend {
  0% {
    transform: scale(1);
    background: rgba(255, 217, 61, 0.2);
  }
  50% {
    transform: scale(1.1);
    background: rgba(255, 217, 61, 0.4);
  }
  100% {
    transform: scale(1);
    background: rgba(255, 217, 61, 0.2);
  }
}

/* Drink Modification Animations */
.drink.neutralized {
  animation: drinkNeutralized 1s ease-out;
}

@keyframes drinkNeutralized {
  0% {
    border-color: #666;
    box-shadow: none;
  }
  50% {
    border-color: #74b9ff;
    box-shadow: 0 0 25px rgba(116, 185, 255, 0.7);
  }
  100% {
    border-color: #74b9ff;
    box-shadow: 0 0 15px rgba(116, 185, 255, 0.5);
  }
}

.drink.spiked {
  animation: drinkSpiked 1s ease-out;
}

@keyframes drinkSpiked {
  0% {
    border-color: #666;
    box-shadow: none;
  }
  50% {
    border-color: #ff6b6b;
    box-shadow: 0 0 25px rgba(255, 107, 107, 0.7);
  }
  100% {
    border-color: #ff6b6b;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
  }
}

/* Game Over Animation */
.game-over-fade {
  animation: gameOverFade 2s ease-out;
}

@keyframes gameOverFade {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0.3;
  }
}

/* Loading/Thinking Animation for AI */
.ai-thinking {
  animation: aiThinking 1.5s ease-in-out infinite;
}

@keyframes aiThinking {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* Drink Consumption Animation */
.drink-consuming {
  animation: drinkConsume 0.8s ease-out;
}

@keyframes drinkConsume {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-10px) scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: translateY(0) scale(0.9);
    opacity: 0.3;
  }
}

/* New Round Transition */
.new-round-transition {
  animation: newRoundTransition 1s ease-out;
}

@keyframes newRoundTransition {
  0% {
    transform: scale(0.95);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.02);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Hover Effects for Interactive Elements */
.quick-action-btn:hover:not(.disabled) {
  animation: quickActionHover 0.3s ease-out;
}

@keyframes quickActionHover {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-2px);
  }
}

/* Elimination Animation */
.player.eliminated {
  animation: playerEliminated 1s ease-out;
}

@keyframes playerEliminated {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.95);
  }
  100% {
    opacity: 0.7;
    transform: scale(1);
  }
}

/* Toxin Damage Animation */
.toxin-damage {
  animation: toxinDamage 2s ease-out;
}

@keyframes toxinDamage {
  0% {
    background: rgba(255, 107, 107, 0.1);
  }
  25% {
    background: rgba(255, 107, 107, 0.3);
  }
  50% {
    background: rgba(255, 107, 107, 0.2);
  }
  75% {
    background: rgba(255, 107, 107, 0.1);
  }
  100% {
    background: rgba(255, 107, 107, 0.1);
  }
}

/* Action Success Animation */
.action-success {
  animation: actionSuccess 0.8s ease-out;
}

@keyframes actionSuccess {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(78, 205, 196, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.6);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(78, 205, 196, 0.4);
  }
}

/* Health Critical Animation */
.health-critical {
  animation: healthCritical 1s ease-in-out infinite;
}

@keyframes healthCritical {
  0%,
  100% {
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.4);
  }
  50% {
    border-color: #d63031;
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.7);
  }
}

/* Mobile-specific animations */
@media (max-width: 767px) {
  .quick-action-btn:hover:not(.disabled) {
    animation: none;
  }

  .player.current-turn {
    animation: playerTurnHighlightMobile 2s ease-in-out infinite;
  }

  @keyframes playerTurnHighlightMobile {
    0%,
    100% {
      box-shadow: 0 0 15px rgba(255, 217, 61, 0.5);
    }
    50% {
      box-shadow: 0 0 25px rgba(255, 217, 61, 0.8);
    }
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .progress-fill::after {
    animation: none;
  }

  .player.current-turn {
    animation: none;
  }

  .winner-announcement.pulse {
    animation: none;
  }
}
