/**
 * animations.css — All animations and transitions
 * Includes glow effects, shake, fade, pulse, and counter animations
 */

/* ───────────── GLOW PULSE (on hasanat number) ───────────── */
@keyframes glowPulse {
  0%   { text-shadow: 0 0 10px rgba(201, 168, 76, 0.4); }
  50%  { text-shadow: 0 0 30px rgba(201, 168, 76, 0.9), 0 0 60px rgba(201, 168, 76, 0.4); }
  100% { text-shadow: 0 0 10px rgba(201, 168, 76, 0.4); }
}

.glow-pulse {
  animation: glowPulse 1.5s ease-in-out infinite;
}

/* ───────────── FADE IN UP ───────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

/* ───────────── FADE OUT (hadith carousel) ───────────── */
.fade-out {
  opacity: 0;
  transition: opacity 0.4s ease;
}

#hadith-container {
  opacity: 1;
  transition: opacity 0.4s ease;
}

/* ───────────── SHAKE (error message) ───────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-8px); }
  30%      { transform: translateX(8px); }
  45%      { transform: translateX(-6px); }
  60%      { transform: translateX(6px); }
  75%      { transform: translateX(-3px); }
  90%      { transform: translateX(3px); }
}

.shake {
  animation: shake 0.6s ease-in-out;
}

/* ───────────── PULSE RING ───────────── */
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0.5); }
  70%  { box-shadow: 0 0 0 15px rgba(201, 168, 76, 0); }
  100% { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0); }
}

.pulse-ring {
  animation: pulseRing 2s ease-out infinite;
}

/* ───────────── SPIN (loading) ───────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.spin {
  animation: spin 1.5s linear infinite;
}

/* ───────────── FLOAT (decorative elements) ───────────── */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-8px); }
}

.float {
  animation: float 4s ease-in-out infinite;
}

/* ───────────── SCALE IN (result cards) ───────────── */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-in {
  animation: scaleIn 0.5s ease-out forwards;
}

/* ───────────── SHIMMER (gold accent lines) ───────────── */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.shimmer {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(201, 168, 76, 0.3) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}

/* ───────────── TOAST NOTIFICATION ───────────── */
#share-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(26, 122, 74, 0.95);
  color: #f0ede6;
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9999;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#share-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ───────────── PROGRESS RING ANIMATION ───────────── */
#progress-ring-circle {
  transition: stroke-dashoffset 1.5s ease-out;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* ───────────── BUTTON PRESS EFFECT ───────────── */
.btn:active {
  transform: scale(0.96);
}

.btn {
  transition: transform 0.1s ease, box-shadow 0.2s ease, background 0.2s ease;
}

/* ───────────── CARD HOVER ───────────── */
.glass-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (hover: hover) {
  .glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(201, 168, 76, 0.15);
  }
}

/* ───────────── TAB PILL TRANSITION ───────────── */
.mode-tab {
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* ───────────── SURAH ITEM TRANSITION ───────────── */
.surah-item {
  transition: background 0.2s ease;
}

/* ───────────── NAV BUTTON TRANSITION ───────────── */
.nav-btn {
  transition: color 0.2s ease, background 0.2s ease;
}

/* ───────────── INPUT FOCUS GLOW ───────────── */
.calc-input:focus,
.surah-search-input:focus {
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.4);
  transition: box-shadow 0.2s ease;
}

/* ───────────── REDUCED MOTION ───────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #progress-ring-circle {
    transition: none !important;
  }
}
