/* ============================================================
   EVA X — ANIMATIONS
   All keyframes and motion patterns
   ============================================================ */

/* ── Reduced Motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Core Keyframes ──────────────────────────────────────── */

/* Screen transition */
@keyframes screen-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Chat message appear */
@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Typing dots bounce */
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* Shimmer skeleton */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Nav indicator line */
@keyframes nav-line-in {
  from { width: 0; opacity: 0; }
  to   { width: 32px; opacity: 1; }
}

/* Card stagger entrance */
@keyframes card-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Panel slide up */
@keyframes panel-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* Fade in */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Scale pop (follow button, etc.) */
@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* Pulse ring (call avatar) */
@keyframes pulse-ring {
  0%   { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Spin (loading) */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Wave (mic / voice) */
@keyframes wave-bar {
  0%, 100% { transform: scaleY(0.3); }
  50%       { transform: scaleY(1); }
}

/* Notification shake */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%        { transform: translateX(-4px); }
  40%        { transform: translateX(4px); }
  60%        { transform: translateX(-3px); }
  80%        { transform: translateX(2px); }
}

/* Gradient shift (logo, banners) */
@keyframes grad-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Component-specific animations ──────────────────────── */

/* Character cards stagger */
.char-card:nth-child(1)  { animation: card-in 0.35s 0.03s ease both; }
.char-card:nth-child(2)  { animation: card-in 0.35s 0.07s ease both; }
.char-card:nth-child(3)  { animation: card-in 0.35s 0.11s ease both; }
.char-card:nth-child(4)  { animation: card-in 0.35s 0.15s ease both; }
.char-card:nth-child(5)  { animation: card-in 0.35s 0.19s ease both; }
.char-card:nth-child(6)  { animation: card-in 0.35s 0.23s ease both; }
.char-card:nth-child(7)  { animation: card-in 0.35s 0.27s ease both; }
.char-card:nth-child(8)  { animation: card-in 0.35s 0.31s ease both; }
.char-card:nth-child(n+9){ animation: card-in 0.35s 0.35s ease both; }

/* Follow button pop */
.follow-btn.followed {
  animation: pop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

/* Call avatar pulse rings */
.pulse-ring {
  position: absolute;
  inset: -8px;
  border-radius: var(--r-full);
  border: 2px solid var(--accent);
  animation: pulse-ring 1.4s infinite ease-out;
}
.pulse-ring:nth-child(2) { animation-delay: 0.4s; }
.pulse-ring:nth-child(3) { animation-delay: 0.8s; }

/* Spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: var(--r-full);
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-lg {
  width: 36px; height: 36px;
  border-width: 3px;
}

/* Wave bars (voice indicator) */
.wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 16px;
}

.wave-bar {
  width: 3px;
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  animation: wave-bar 1s infinite ease-in-out;
  transform-origin: bottom;
}
.wave-bar:nth-child(1) { animation-delay: 0s; }
.wave-bar:nth-child(2) { animation-delay: 0.15s; }
.wave-bar:nth-child(3) { animation-delay: 0.3s; }
.wave-bar:nth-child(4) { animation-delay: 0.15s; }
.wave-bar:nth-child(5) { animation-delay: 0s; }

/* Animated gradient logo */
.logo-gradient {
  background: linear-gradient(270deg, #c026d3, #8b5cf6, #06b6d4, #8b5cf6, #c026d3);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: grad-shift 5s ease infinite;
}

/* Notification badge shake */
.badge-shake { animation: shake 0.4s ease; }

/* Toast notification */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--sp-3));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-5);
  font-size: 0.875rem;
  color: var(--tx);
  font-weight: 500;
  z-index: 9999;
  transition: var(--ease-out);
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(34,197,94,0.3); color: var(--success); }
.toast.error   { border-color: rgba(239,68,68,0.3); color: var(--danger); }

/* ── Transitions ─────────────────────────────────────────── */

/* Page transition helper */
.page-enter { animation: screen-in 0.28s cubic-bezier(0.16,1,0.3,1) both; }
.page-exit  { animation: fade-in 0.2s ease reverse both; }

/* Stat cards stagger (profile/dashboard) */
.stat-card:nth-child(1) { animation: card-in 0.3s 0.05s ease both; }
.stat-card:nth-child(2) { animation: card-in 0.3s 0.10s ease both; }
.stat-card:nth-child(3) { animation: card-in 0.3s 0.15s ease both; }
.stat-card:nth-child(4) { animation: card-in 0.3s 0.20s ease both; }
