/* ============================================================
   طبقة الأنيميشن — منصة د. أحمد رجب (v1.6)
   حركة ناعمة هادئة تليق بمنصة طبية + احترام تفضيل تقليل الحركة
   ============================================================ */

/* ---------- الكيفريمات ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(48px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  0%   { opacity: 0; transform: scale(.92); }
  70%  { transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes softPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.045); }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .35); }
  60%      { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-8deg); }
  75%      { transform: rotate(8deg); }
}

/* ---------- دخول الصفحات والكروت ---------- */
main section,
main article,
main .card {
  animation: fadeUp .45s cubic-bezier(.22, .8, .36, 1) both;
}
/* تتابع لطيف لأول العناصر */
main section:nth-child(1), main .card:nth-child(1) { animation-delay: .02s; }
main section:nth-child(2), main .card:nth-child(2) { animation-delay: .07s; }
main section:nth-child(3), main .card:nth-child(3) { animation-delay: .12s; }
main section:nth-child(4), main .card:nth-child(4) { animation-delay: .17s; }
main section:nth-child(5), main .card:nth-child(5) { animation-delay: .22s; }
main section:nth-child(6), main .card:nth-child(6) { animation-delay: .27s; }
main article:nth-child(odd)  { animation-delay: .06s; }
main article:nth-child(even) { animation-delay: .12s; }

/* ---------- الأزرار: ضغطة حية ---------- */
button, a[class*="rounded"] {
  transition: transform .16s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}
button:active { transform: scale(.96); }
button:disabled { transition: none; }

/* الزر الأساسي الأخضر: نبضة توهج هادئة */
button.bg-emerald-600 {
  animation: glowPulse 3.2s ease-in-out infinite;
}
button.bg-emerald-600:hover { transform: translateY(-1px); }

/* ---------- الكروت: رفعة عند اللمس/الهوفر ---------- */
main .card:hover,
main a[class*="rounded-3xl"]:hover,
main article:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -10px rgba(15, 23, 42, .18);
}
main .card, main a[class*="rounded-3xl"], main article {
  transition: transform .22s ease, box-shadow .25s ease;
}

/* ---------- أشرطة التقدم: امتلاء سلس + لمعة ---------- */
[class*="bg-emerald-500"][style*="width"],
[class*="bg-cyan-500"][style*="width"] {
  transition: width .8s cubic-bezier(.22, .8, .36, 1);
  background-image: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: shimmer 2.6s linear infinite;
}

/* ---------- الشيتات المنبثقة (بدائل/مكونات/دليل الأكل/شرح التمرين) ---------- */
.sheet-backdrop { animation: fadeIn .25s ease both; }
.sheet-panel    { animation: sheetUp .38s cubic-bezier(.22, .8, .36, 1) both; }
/* مودال شرح التمرين (كلاسات جاهزة في الصفحة) */
.fixed.inset-0.z-50 { animation: fadeIn .25s ease both; }
.fixed.inset-0.z-50 > div { animation: sheetUp .38s cubic-bezier(.22, .8, .36, 1) both; }

/* ---------- قايمة البدائل: ظهور متتابع ---------- */
.alt-list > * { animation: fadeUp .3s ease both; }
.alt-list > *:nth-child(1) { animation-delay: .03s; }
.alt-list > *:nth-child(2) { animation-delay: .07s; }
.alt-list > *:nth-child(3) { animation-delay: .11s; }
.alt-list > *:nth-child(4) { animation-delay: .15s; }
.alt-list > *:nth-child(5) { animation-delay: .19s; }
.alt-list > *:nth-child(6) { animation-delay: .23s; }
.alt-list > *:nth-child(n+7) { animation-delay: .27s; }

/* ---------- عناصر مميزة ---------- */
/* شعلة السلسلة والإيموجي في العناوين */
.streak-flame { display: inline-block; animation: softPulse 1.8s ease-in-out infinite; transform-origin: 50% 85%; }
/* شارات الإنجاز المحققة */
.milestone-on { animation: popIn .5s cubic-bezier(.22, .8, .36, 1) both; }
/* حلقات المياه */
.water-btn:active { animation: wiggle .3s ease; }
/* رسالة النجاح/الفلاش */
.flash-note { animation: popIn .45s cubic-bezier(.22, .8, .36, 1) both; }

/* ---------- اللوجو في الهيدر وصفحات الدخول ---------- */
img[src*="logo-mark"] { animation: floaty 4s ease-in-out infinite; }

/* ---------- صور التمارين: حياة خفيفة ---------- */
article img[src*="/images/exercises/"] { transition: transform .35s ease; }
article:hover img[src*="/images/exercises/"] { transform: scale(1.03); }

/* ---------- التبويبات النشطة ---------- */
button.bg-emerald-600.text-white { transition: transform .16s ease, box-shadow .2s ease; }

/* ---------- تقليل الحركة: احترام كامل ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}
