/* ============================================================
   NoorAlFajr — Animations
   Page transitions, hover effects, Islamic special animations
   ============================================================ */

/* ─── Page Load Animation ─── */
@keyframes fadeUpIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Stagger children animation */
.stagger > * {
  animation: fadeUpIn 0.5s ease both;
}
.stagger > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger > *:nth-child(2)  { animation-delay: 0.10s; }
.stagger > *:nth-child(3)  { animation-delay: 0.15s; }
.stagger > *:nth-child(4)  { animation-delay: 0.20s; }
.stagger > *:nth-child(5)  { animation-delay: 0.25s; }
.stagger > *:nth-child(6)  { animation-delay: 0.30s; }
.stagger > *:nth-child(7)  { animation-delay: 0.35s; }
.stagger > *:nth-child(8)  { animation-delay: 0.40s; }
.stagger > *:nth-child(9)  { animation-delay: 0.45s; }
.stagger > *:nth-child(10) { animation-delay: 0.50s; }
.stagger > *:nth-child(n+11){ animation-delay: 0.55s; }

.animate-fade-up   { animation: fadeUpIn 0.5s ease both; }
.animate-fade-in   { animation: fadeIn 0.4s ease both; }
.animate-scale-in  { animation: scaleIn 0.4s ease both; }
.animate-slide-left{ animation: slideInLeft 0.4s ease both; }

/* ─── Gradient Morph (Prayer hero) ─── */
@keyframes gradientMorph {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.gradient-morph {
  background-size: 200% 200%;
  animation: gradientMorph 6s ease infinite;
}

/* ─── Floating Animation ─── */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}
.float { animation: float 4s ease-in-out infinite; }
.float-delay-1 { animation-delay: 0.5s; }
.float-delay-2 { animation-delay: 1s; }

/* ─── Pulse (active prayer / notifications) ─── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}
@keyframes pulseRing {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  70%  { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(16,185,129,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.pulse        { animation: pulse 2s ease-in-out infinite; }
.pulse-ring   { animation: pulseRing 2s ease-in-out infinite; }

/* ─── Gold Burst (Qibla aligned) ─── */
@keyframes goldBurst {
  0%   { opacity: 0; transform: scale(0.5); }
  40%  { opacity: 1; }
  100% { opacity: 0; transform: scale(2.5); }
}
.gold-burst {
  position: absolute; inset: 0;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, var(--gold-400) 0%, transparent 70%);
  animation: goldBurst 0.8s ease-out forwards;
  pointer-events: none;
}

/* ─── Confetti Particles ─── */
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(60px) rotate(360deg); opacity: 0; }
}
.confetti {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 2px;
  animation: confettiFall 0.8s ease-out forwards;
}

/* ─── Moon Phase Animation ─── */
@keyframes moonGlow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(245,158,11,0.5)); }
  50%       { filter: drop-shadow(0 0 16px rgba(245,158,11,0.9)); }
}
.moon-glow { animation: moonGlow 3s ease-in-out infinite; }

/* ─── Star Twinkle ─── */
@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%       { opacity: 1;   transform: scale(1.2); }
}
.star { animation: twinkle 2s ease-in-out infinite; }
.star:nth-child(2n)   { animation-delay: 0.4s; }
.star:nth-child(3n)   { animation-delay: 0.8s; }
.star:nth-child(4n)   { animation-delay: 1.2s; }

/* ─── Audio Waveform ─── */
@keyframes waveHeight {
  0%, 100% { height: 6px;  }
  50%       { height: 20px; }
}
.audio-bars { display: flex; align-items: center; gap: 3px; height: 24px; }
.audio-bar {
  width: 3px;
  border-radius: var(--radius-full);
  background: var(--primary-500);
  animation: waveHeight 0.8s ease-in-out infinite;
}
.audio-bar:nth-child(2) { animation-delay: 0.1s; }
.audio-bar:nth-child(3) { animation-delay: 0.2s; }
.audio-bar:nth-child(4) { animation-delay: 0.3s; }
.audio-bar:nth-child(5) { animation-delay: 0.2s; }
.audio-bar:nth-child(6) { animation-delay: 0.1s; }
.audio-bars.playing .audio-bar { animation-play-state: running; }
.audio-bars:not(.playing) .audio-bar { animation-play-state: paused; height: 4px; }

/* ─── Countdown Flip ─── */
@keyframes flipDown {
  from { transform: rotateX(0deg); }
  to   { transform: rotateX(-90deg); }
}
@keyframes flipUp {
  from { transform: rotateX(90deg); }
  to   { transform: rotateX(0deg); }
}

/* ─── Hero Particles ─── */
@keyframes particleDrift {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.6; }
  100% { transform: translateY(-100px) translateX(30px) rotate(180deg); opacity: 0; }
}
.hero-particle {
  position: absolute;
  border-radius: var(--radius-full);
  animation: particleDrift 5s ease-in-out infinite;
}

/* ─── Page Transition ─── */
.page-enter {
  animation: fadeUpIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.page-exit {
  animation: fadeIn 0.2s ease reverse both;
}

/* ─── Ripple Effect (button click) ─── */
.ripple-container { position: relative; overflow: hidden; }
@keyframes rippleAnim {
  0%   { transform: scale(0); opacity: 0.5; }
  100% { transform: scale(4); opacity: 0; }
}
.ripple-effect {
  position: absolute;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.4);
  pointer-events: none;
  animation: rippleAnim 0.6s linear;
}

/* ─── Worship Counter Celebration ─── */
@keyframes celebration {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.15); }
  50%  { transform: scale(0.95); }
  75%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.celebrate { animation: celebration 0.5s ease; }

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