/**
 * Effects CSS - Animations and styles for visual effects system
 */

/* Electric glow animation */
@keyframes electric-glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3),
                0 0 20px rgba(0, 212, 255, 0.2),
                0 0 30px rgba(0, 212, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5),
                0 0 30px rgba(0, 212, 255, 0.3),
                0 0 45px rgba(0, 212, 255, 0.2);
  }
}

@keyframes electric-pulse {
  0%, 100% {
    filter: brightness(1) drop-shadow(0 0 5px rgba(0, 212, 255, 0.5));
  }
  50% {
    filter: brightness(1.2) drop-shadow(0 0 10px rgba(0, 212, 255, 0.8));
  }
}

/* Storm flash overlay */
@keyframes storm-flash {
  0% {
    opacity: 0;
  }
  10% {
    opacity: 0.3;
  }
  20% {
    opacity: 0.1;
  }
  30% {
    opacity: 0.4;
  }
  100% {
    opacity: 0;
  }
}

.storm-flash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(68, 136, 255, 0.3) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1000;
  animation: storm-flash 0.5s ease-out forwards;
}

/* Combo intensity animations */
@keyframes combo-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

.combo-active {
  animation: combo-pulse 0.5s ease-in-out infinite;
}

/* Edge lightning fallback */
@keyframes edge-lightning-top {
  0% {
    background: linear-gradient(180deg, rgba(68, 136, 255, 0.5) 0%, transparent 100%);
    opacity: 0.8;
  }
  100% {
    background: linear-gradient(180deg, rgba(68, 136, 255, 0) 0%, transparent 100%);
    opacity: 0;
  }
}

@keyframes edge-lightning-left {
  0% {
    background: linear-gradient(90deg, rgba(68, 136, 255, 0.5) 0%, transparent 100%);
    opacity: 0.8;
  }
  100% {
    background: linear-gradient(90deg, rgba(68, 136, 255, 0) 0%, transparent 100%);
    opacity: 0;
  }
}

.edge-lightning {
  position: fixed;
  pointer-events: none;
  z-index: 999;
}

.edge-lightning.top {
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  animation: edge-lightning-top 0.4s ease-out forwards;
}

.edge-lightning.left {
  top: 0;
  left: 0;
  bottom: 0;
  width: 100px;
  animation: edge-lightning-left 0.4s ease-out forwards;
}

/* Power indicator ring */
@keyframes power-ring-expand {
  0% {
    transform: scale(0.5);
    opacity: 1;
    border-color: rgba(0, 212, 255, 0.8);
  }
  100% {
    transform: scale(2);
    opacity: 0;
    border-color: rgba(0, 212, 255, 0);
  }
}

.power-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(0, 212, 255, 0.8);
  pointer-events: none;
  animation: power-ring-expand 0.5s ease-out forwards;
}

/* Generator electric aura */
.generator-aura {
  animation: electric-glow 2s ease-in-out infinite;
}

/* Surge spawn effect */
@keyframes surge-spawn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.surge-spawning {
  animation: surge-spawn 0.3s ease-out forwards;
}

/* Surge hover glow */
@keyframes surge-hover-glow {
  0%, 100% {
    filter: drop-shadow(0 0 8px currentColor);
  }
  50% {
    filter: drop-shadow(0 0 15px currentColor);
  }
}

.surge-sprite:hover {
  animation: surge-hover-glow 0.5s ease-in-out infinite;
  cursor: pointer;
}

/* Click ripple effect */
@keyframes click-ripple {
  0% {
    transform: scale(0.5);
    opacity: 0.8;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

.click-ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
  pointer-events: none;
  animation: click-ripple 0.4s ease-out forwards;
}

/* Screen shake animation */
@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-2px, -1px); }
  20% { transform: translate(2px, 1px); }
  30% { transform: translate(-1px, 2px); }
  40% { transform: translate(1px, -2px); }
  50% { transform: translate(-2px, 2px); }
  60% { transform: translate(2px, -1px); }
  70% { transform: translate(-1px, -2px); }
  80% { transform: translate(1px, 1px); }
  90% { transform: translate(-1px, 1px); }
}

.screen-shaking {
  animation: screen-shake 0.2s ease-in-out;
}

/* Prestige effect */
@keyframes prestige-burst {
  0% {
    transform: scale(0);
    opacity: 1;
    background: radial-gradient(circle, rgba(155, 89, 182, 0.8) 0%, transparent 70%);
  }
  100% {
    transform: scale(5);
    opacity: 0;
    background: radial-gradient(circle, rgba(155, 89, 182, 0) 0%, transparent 70%);
  }
}

.prestige-burst {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  margin: -100px 0 0 -100px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1001;
  animation: prestige-burst 0.8s ease-out forwards;
}

/* Singularity effect */
@keyframes singularity-converge {
  0% {
    transform: scale(3);
    opacity: 0;
    filter: blur(20px);
  }
  50% {
    filter: blur(5px);
    opacity: 1;
  }
  100% {
    transform: scale(0);
    opacity: 0;
    filter: blur(0);
  }
}

.singularity-effect {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 400px;
  margin: -200px 0 0 -200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(142, 68, 173, 1) 0%, rgba(44, 62, 80, 0.5) 50%, transparent 70%);
  pointer-events: none;
  z-index: 1002;
  animation: singularity-converge 1.5s ease-in-out forwards;
}

/* Intensity settings indicator */
.effects-intensity-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
}

.effects-intensity-indicator .bar {
  width: 8px;
  height: 16px;
  background: rgba(68, 136, 255, 0.3);
  border-radius: 2px;
  transition: background 0.3s ease;
}

.effects-intensity-indicator .bar.active {
  background: rgba(68, 136, 255, 1);
  box-shadow: 0 0 5px rgba(68, 136, 255, 0.5);
}

/* Building purchase effect */
@keyframes building-bounce {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.building-purchased {
  animation: building-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Building glow effect */
@keyframes building-glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.8), 0 0 30px rgba(0, 212, 255, 0.5);
  }
}

.building-glow {
  animation: building-glow 1s ease-in-out;
}

/* Number fly-up animation */
@keyframes number-fly-up {
  0% {
    transform: translateY(0) scale(0.8);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translateY(-80px) scale(1);
    opacity: 0;
  }
}

.number-fly-up {
  animation: number-fly-up 1s ease-out forwards;
  position: absolute;
  pointer-events: none;
  font-weight: bold;
  z-index: 1000;
}

/* Achievement trophy bounce */
@keyframes trophy-bounce {
  0% {
    transform: scale(0) translateY(-100px);
    opacity: 0;
  }
  60% {
    transform: scale(1.2) translateY(0);
    opacity: 1;
  }
  80% {
    transform: scale(0.9) translateY(0);
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.achievement-trophy {
  animation: trophy-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Confetti fall */
@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(400px) rotate(720deg);
    opacity: 0;
  }
}

.confetti-particle {
  animation: confetti-fall 1.5s ease-in forwards;
  position: absolute;
  pointer-events: none;
}

/* Boss entrance vignette */
@keyframes boss-vignette {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 0;
  }
}

.boss-entrance-vignette {
  animation: boss-vignette 1s ease-in-out forwards;
}

/* Damage number pop */
@keyframes damage-pop {
  0% {
    transform: translateY(0) scale(0.5);
    opacity: 0;
  }
  30% {
    transform: translateY(-20px) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translateY(-80px) scale(1);
    opacity: 0;
  }
}

.damage-number {
  animation: damage-pop 0.8s ease-out forwards;
  position: absolute;
  pointer-events: none;
  font-weight: bold;
  z-index: 1000;
}

/* Button ripple effect */
@keyframes button-ripple {
  0% {
    transform: scale(0);
    opacity: 0.6;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

.button-ripple {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  animation: button-ripple 0.6s ease-out forwards;
  transform-origin: center;
}

/* Modal entrance */
@keyframes modal-entrance {
  0% {
    transform: scale(0.7) translateY(-50px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal-entering {
  animation: modal-entrance 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Progress bar shimmer */
@keyframes progress-shimmer {
  0% {
    background-position: -100% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.progress-bar-shimmer {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: progress-shimmer 2s infinite;
}

/* Glow pulse */
@keyframes glow-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 5px currentColor);
  }
  50% {
    filter: drop-shadow(0 0 15px currentColor);
  }
}

.glow-pulse {
  animation: glow-pulse 1s ease-in-out infinite;
}

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

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

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

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

/* Slide in animations */
@keyframes slide-in-left {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-in-right {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-in-top {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slide-in-bottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.slide-in-left {
  animation: slide-in-left 0.3s ease-out;
}

.slide-in-right {
  animation: slide-in-right 0.3s ease-out;
}

.slide-in-top {
  animation: slide-in-top 0.3s ease-out;
}

.slide-in-bottom {
  animation: slide-in-bottom 0.3s ease-out;
}

/* Fade animations */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

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

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

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

.rotate {
  animation: rotate 1s linear infinite;
}

/* Critical hit pop */
@keyframes critPop {
  0% {
    transform: translateX(-50%) scale(0.5);
    opacity: 0;
  }
  30% {
    transform: translateX(-50%) scale(1.3);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) scale(1) translateY(-30px);
    opacity: 0;
  }
}

.crit-indicator {
  animation: critPop 0.5s ease-out forwards;
}

/* Highlight flash */
@keyframes highlight-flash {
  0%, 100% {
    background-color: transparent;
  }
  50% {
    background-color: rgba(255, 255, 0, 0.3);
  }
}

.highlight-flash {
  animation: highlight-flash 1s ease-in-out;
}

/* Badge pulse */
@keyframes badge-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

.badge-pulse {
  animation: badge-pulse 0.4s ease-in-out;
}

/* Loading spinner */
@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 212, 255, 0.3);
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

/* Power meter pulse */
@keyframes power-meter-pulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.8), 0 0 30px rgba(0, 212, 255, 0.4);
  }
}

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

/* Electricity arc animation */
@keyframes electricity-arc {
  0%, 100% {
    opacity: 0.3;
    transform: scaleX(1);
  }
  50% {
    opacity: 0.8;
    transform: scaleX(1.1);
  }
}

.electricity-arc {
  animation: electricity-arc 0.5s ease-in-out infinite;
}

/* Prestige implosion */
@keyframes prestige-implosion {
  0% {
    transform: scale(3);
    opacity: 0;
  }
  50% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

.prestige-implosion {
  animation: prestige-implosion 0.6s ease-in-out;
}

/* Prestige explosion */
@keyframes prestige-explosion {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(5);
    opacity: 0;
  }
}

.prestige-explosion {
  animation: prestige-explosion 0.8s ease-out;
}

/* Screen wipe */
@keyframes screen-wipe-right {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.screen-wipe {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(155, 89, 182, 0.8) 50%, transparent 100%);
  pointer-events: none;
  z-index: 9999;
  animation: screen-wipe-right 1s ease-in-out;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .generator-aura,
  .surge-sprite:hover,
  .combo-active,
  .glow-pulse,
  .power-meter-pulse,
  .electricity-arc,
  .progress-bar-shimmer,
  .loading-spinner {
    animation: none;
  }

  .storm-flash-overlay,
  .click-ripple,
  .power-ring,
  .prestige-burst,
  .singularity-effect,
  .building-purchased,
  .building-glow,
  .number-fly-up,
  .achievement-trophy,
  .confetti-particle,
  .damage-number,
  .button-ripple,
  .modal-entering,
  .shake,
  .bounce,
  .slide-in-left,
  .slide-in-right,
  .slide-in-top,
  .slide-in-bottom,
  .fade-in,
  .fade-out,
  .prestige-implosion,
  .prestige-explosion,
  .screen-wipe {
    animation-duration: 0.01ms;
  }
}
