/* ============================================================
   Sayo Animations
   Micro-interactions, transitions, loading states
   ============================================================ */

/* ── Page fade in ────────────────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fade-in 0.4s ease both;
}

.fade-in-delay-1 { animation-delay: 0.05s; }
.fade-in-delay-2 { animation-delay: 0.1s; }
.fade-in-delay-3 { animation-delay: 0.15s; }
.fade-in-delay-4 { animation-delay: 0.2s; }
.fade-in-delay-5 { animation-delay: 0.25s; }

/* ── Live pulse ──────────────────────────────────────────── */
@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.3); }
}

/* ── Speaking ring ───────────────────────────────────────── */
@keyframes speaking-ring {
  0%, 100% { box-shadow: 0 0 0 4px var(--color-bg), 0 0 0 6px var(--color-primary); }
  50%      { box-shadow: 0 0 0 4px var(--color-bg), 0 0 0 8px rgba(59, 75, 219, 0.5); }
}

/* ── Waveform bars ───────────────────────────────────────── */
@keyframes waveform {
  0%, 100% { transform: scaleY(0.4); }
  50%      { transform: scaleY(1); }
}

/* ── Toast notifications ─────────────────────────────────── */
@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(24px); }
}

/* ── Skeleton loading ────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface) 25%,
    var(--color-surface-alt) 50%,
    var(--color-surface) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text-lg {
  height: 24px;
  width: 60%;
  border-radius: 4px;
}

.skeleton-avatar {
  border-radius: 50%;
}

/* ── Micro-interactions ──────────────────────────────────── */

/* Cards lift on hover */
.card {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
}

/* Buttons scale on press */
.btn:active {
  transform: scale(0.97);
}

/* Smooth tab transitions */
.tab-btn {
  transition: all 0.25s ease;
}

/* Input focus ring */
.input-field {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Avatar hover */
.avatar {
  transition: transform 0.2s ease;
}

.avatar:hover {
  transform: scale(1.05);
}

/* ── Participant tile transitions ────────────────────────── */
.participant-tile {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.participant-tile.speaking {
  box-shadow: 0 0 0 0 rgba(59, 75, 219, 0);
  animation: tile-speak-pulse 2s ease-in-out infinite;
}

@keyframes tile-speak-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 75, 219, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(59, 75, 219, 0.1); }
}

/* ── Hand raise bounce ───────────────────────────────────── */
@keyframes hand-raise {
  0%   { transform: translateY(0); }
  20%  { transform: translateY(-8px); }
  40%  { transform: translateY(-4px); }
  60%  { transform: translateY(-6px); }
  100% { transform: translateY(-4px); }
}

.hand-raised {
  animation: hand-raise 0.5s ease forwards;
}

/* ── Joining animation ───────────────────────────────────── */
@keyframes join-pop {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.join-animation {
  animation: join-pop 0.4s ease both;
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
