/* ============================================
   FIDEM Animations
   Pulse wave, fade transitions, particles
   ============================================ */

/* --- Pulse wave (waiting screen) --- */
.pulse-container {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: pulse-wave 3s ease-out infinite;
}

.pulse-ring:nth-child(2) {
  animation-delay: 0.6s;
}

.pulse-ring:nth-child(3) {
  animation-delay: 1.2s;
}

.pulse-ring:nth-child(4) {
  animation-delay: 1.8s;
}

.pulse-core {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 2px solid var(--accent);
  animation: pulse-core-beat 2s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-core svg {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

@keyframes pulse-wave {
  0% {
    transform: scale(0.4);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

@keyframes pulse-core-beat {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 var(--accent-glow);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 20px 4px var(--accent-glow);
  }
}

/* --- Golden time pulse --- */
.golden-pulse {
  animation: golden-glow 2s ease-in-out infinite;
}

@keyframes golden-glow {
  0%, 100% {
    box-shadow: 0 0 4px var(--accent-glow);
  }
  50% {
    box-shadow: 0 0 16px var(--accent-glow);
  }
}

/* --- Fade transitions --- */
.fade-enter {
  opacity: 0;
  transform: translateY(8px);
}

.fade-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--transition-normal),
              transform var(--transition-normal);
}

.fade-exit {
  opacity: 1;
  transform: translateY(0);
}

.fade-exit-active {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity var(--transition-normal),
              transform var(--transition-normal);
}

/* --- Hint text crossfade --- */
.hint-text {
  position: relative;
  min-height: 24px;
  overflow: hidden;
}

.hint-text span {
  display: block;
  animation: hint-fade 6s ease-in-out;
}

@keyframes hint-fade {
  0% { opacity: 0; transform: translateY(8px); }
  10% { opacity: 1; transform: translateY(0); }
  85% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}

/* --- Celebration (first call, badge earn) --- */
.celebrate {
  animation: celebrate-pop 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes celebrate-pop {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* --- Spin (loading) --- */
.spin {
  animation: spin 1s linear infinite;
}

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

/* --- Connection established effect --- */
.connected-flash {
  animation: flash-accent 600ms ease-out;
}

@keyframes flash-accent {
  0% {
    background-color: var(--accent-glow);
  }
  100% {
    background-color: transparent;
  }
}

/* --- Slide up (bottom sheet) --- */
.slide-up {
  animation: slide-up 300ms ease-out forwards;
}

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

/* --- Heart pop (rating) --- */
.heart-pop {
  animation: heart-pop 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes heart-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* --- Dot loading --- */
.dots-loading {
  display: inline-flex;
  gap: 4px;
}

.dots-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-bounce 1.2s ease-in-out infinite;
}

.dots-loading span:nth-child(2) {
  animation-delay: 0.15s;
}

.dots-loading span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes dot-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 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;
  }

  .pulse-ring,
  .pulse-core,
  .golden-pulse,
  .dots-loading span {
    animation: none !important;
  }

  .pulse-ring {
    opacity: 0.2 !important;
    transform: scale(1) !important;
  }
}
