/* styles/animations.css - Animation definitions */

/* Keyframe animations */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

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

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

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

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

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes pulse-ghost {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

@keyframes zero-pair-glow {
  0% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.8); }
  100% { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); }
}

@keyframes success-flash {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes float-up {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(-50px);
    opacity: 0;
  }
}

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

/* Animation classes */
.animate-pulse {
  animation: pulse 0.5s ease-in-out;
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

.animate-fade-out {
  animation: fadeOut 0.3s ease-in-out;
}

.animate-bounce-in {
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

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

/* Transition utilities */
.transition-all {
  transition: all 0.3s ease;
}

.transition-transform {
  transition: transform 0.3s ease;
}

.transition-opacity {
  transition: opacity 0.3s ease;
}

.transition-colors {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Hover effects */
.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow:hover {
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.5);
}

/* Success/complete states */
.success-glow {
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.6);
}

.complete-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Confetti particle */
.confetti-particle {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
}

/* Floating text */
.floating-text {
  position: absolute;
  pointer-events: none;
  z-index: 1000;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Transition overlays */
.transition-overlay {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
}

/* Level complete message */
.level-complete-message {
  position: fixed;
  text-align: center;
  color: white;
  z-index: 9999;
  pointer-events: none;
}

.level-complete-message h2 {
  font-size: 48px;
  margin: 0 0 20px 0;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.level-complete-message .stars {
  font-size: 36px;
  animation: pulse 1s ease-in-out infinite;
}

/* Solve ring effect */
.solve-ring {
  position: fixed;
  border: 4px solid #4ade80;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
}

/* Ghost arrow animation */
.ghost-arrow {
  animation: pulse-ghost 2s infinite;
}

/* Zero pair tiles */
.zero-pair-tile {
  opacity: 0.7;
  animation: zero-pair-glow 1s;
}

/* Dragging states */
.tile.dragging {
  opacity: 0.7;
  z-index: 1000;
  cursor: grabbing !important;
}

/* Invalid position indicator */
.tile.invalid-position {
  opacity: 0.5;
  border-color: #ff4444 !important;
}

/* Selected tiles */
.tile.selected {
  animation: pulse 1s ease-in-out infinite;
}

/* Challenge display states */
#challenge-display {
  transition: background-color 0.3s ease;
}

#challenge-display.has-correct-tiles {
  animation: pulse 0.5s ease-in-out;
}

#challenge-display.complete {
  animation: pulse 0.5s ease-in-out;
}

/* Add to animations.css or create new solve-animation.css */

/* Arena success state */
#arena.solve-success {
  border: 3px solid #4ade80 !important;
  box-shadow: 0 0 30px rgba(74, 222, 128, 0.6);
  animation: pulse-success 0.5s ease-in-out;
}

@keyframes pulse-success {
  0% { 
    transform: scale(1);
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
  }
  50% { 
    transform: scale(1.02);
    box-shadow: 0 0 40px rgba(74, 222, 128, 0.8);
  }
  100% { 
    transform: scale(1);
    box-shadow: 0 0 30px rgba(74, 222, 128, 0.6);
  }
}

/* Confetti particles */
.confetti-particle {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  border-radius: 50%;
  animation: confetti-spin 2s linear infinite;
}

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

/* Success message */
.level-complete-message {
  position: fixed;
  text-align: center;
  color: white;
  z-index: 10001;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
  animation: bounce-in 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.level-complete-message h2 {
  font-size: 48px;
  margin: 0 0 20px 0;
  background: linear-gradient(45deg, #4ade80, #22c55e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.level-complete-message .stars {
  font-size: 36px;
  animation: pulse 1s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

/* Slider during animation */
#slider.animating {
  transition: none !important; /* Remove transitions for smooth animation */
}

/* Next button hover effect during solve */
#next-puzzle-btn:not(:disabled):hover {
  background-color: #22c55e;
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(74, 222, 128, 0.4);
}

/* Tile glow during solve (optional) */
.tile.solve-glow {
  animation: tile-success-glow 1s ease-in-out;
}

@keyframes tile-success-glow {
  0%, 100% {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.8);
  }
}