/* PotatoGuard - Animations */

/* ========================================
   MICRO-INTERACTIONS
======================================== */

/* Float Animation */
@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

.float {
  animation: float 4s ease-in-out infinite;
}

/* Breathe Animation */
@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

.breathe {
  animation: breathe 3s ease-in-out infinite;
}

/* Fade In */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn var(--transition-base) ease forwards;
}

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp var(--transition-bounce) ease forwards;
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-in {
  animation: scaleIn var(--transition-base) ease forwards;
}

/* Pulse Glow (for scan button) */
@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(132, 204, 22, 0.4);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(132, 204, 22, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(132, 204, 22, 0);
  }
}

.pulse-glow {
  animation: pulseGlow 2s infinite;
}

/* Scan Line Animation */
@keyframes scanLine {
  0% {
    top: 10%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: 90%;
    opacity: 0;
  }
}

.scan-line {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 10px var(--accent);
  animation: scanLine 2s ease-in-out infinite;
  z-index: 10;
}

/* Button Ripple Effect */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.4) 10%,
    transparent 10.01%
  );
  transform: scale(10);
  opacity: 0;
  transition:
    transform 0.5s,
    opacity 0.8s;
}

.btn:active::after {
  transform: scale(0);
  opacity: 1;
  transition: 0s;
}

/* Loading Dots */
@keyframes loadingDots {
  0%,
  20% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.5);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
}

.loading-dots {
  display: flex;
  gap: var(--space-sm);
}

.loading-dots span {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: var(--radius-full);
  animation: loadingDots 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* Shake Animation (for errors) */
@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.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Success Check Animation */
@keyframes checkmark {
  0% {
    stroke-dashoffset: 50;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.success-check {
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: checkmark 0.5s ease forwards 0.2s;
}

/* Progress Fill */
@keyframes progressFill {
  from {
    width: 0;
  }
}

.progress-animated {
  animation: progressFill var(--transition-slow) ease forwards;
}

/* ========================================
   PAGE TRANSITIONS
======================================== */
.screen {
  opacity: 0;
  transform: scale(0.98);
  transition:
    opacity var(--transition-base),
    transform var(--transition-base);
}

.screen.active {
  opacity: 1;
  transform: scale(1);
}

/* ========================================
   REDUCED MOTION
======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
