/* =========================================================
   Sport IQ — Animations & Motion
   كل الانتقالات والتأثيرات الحركية
   ========================================================= */

/* -------------------------------------------------------
   Keyframes
   ------------------------------------------------------- */

/* دوران (Spinner) */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* وميض متكرر */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* توهج نابض — للأزرار الرئيسية */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(155,63,255,0.4), 0 0 30px rgba(155,63,255,0.2);
  }
  50% {
    box-shadow: 0 0 25px rgba(155,63,255,0.7), 0 0 50px rgba(155,63,255,0.35);
  }
}

/* توهج ذهبي */
@keyframes pulse-glow-gold {
  0%, 100% {
    box-shadow: 0 0 15px rgba(255,191,0,0.4), 0 0 30px rgba(255,191,0,0.2);
  }
  50% {
    box-shadow: 0 0 25px rgba(255,191,0,0.7), 0 0 50px rgba(255,191,0,0.35);
  }
}

/* شارة LIVE */
@keyframes pulse-badge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.8; transform: scale(0.95); }
}

/* Shimmer للـ Skeleton */
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ظهور Modal من الأسفل */
@keyframes modal-slide-up {
  from {
    opacity: 0;
    transform: translateY(60px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* تلاشي Modal الخلفية */
@keyframes modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ظهور من الأعلى */
@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ظهور بشكل عام */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ظهور مع حركة صغيرة */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* اختفاء مع حركة */
@keyframes fade-out-up {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-16px);
  }
}

/* ظهور Toast من اليمين (RTL) */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* ارتجاج (Shake) عند الإجابة الخاطئة */
@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); }
}

/* قفزة صغيرة (Success bounce) */
@keyframes bounce-in {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  80%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* Confetti من الأعلى */
@keyframes confetti-fall {
  0% {
    transform: translateY(-100vh) rotateZ(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotateZ(720deg);
    opacity: 0;
  }
}

/* نبض عداد الوقت */
@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.05); }
}

/* تلاشي خطي متدرج للـ Streak */
@keyframes streak-glow {
  0%   { text-shadow: 0 0 10px var(--color-gold-glow); }
  50%  { text-shadow: 0 0 20px var(--color-gold-glow), 0 0 40px rgba(255,191,0,0.3); }
  100% { text-shadow: 0 0 10px var(--color-gold-glow); }
}

/* دوران نجمة */
@keyframes star-spin {
  from { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.3); }
  to   { transform: rotate(360deg) scale(1); }
}

/* رادار الفريق */
@keyframes radar-draw {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0; }
}

/* -------------------------------------------------------
   Animation Utility Classes
   ------------------------------------------------------- */

/* تطبيق التوهج الأساسي على أزرار CTA */
.animate-pulse-glow {
  animation: pulse-glow 2.5s ease-in-out infinite;
}

.animate-pulse-glow-gold {
  animation: pulse-glow-gold 2.5s ease-in-out infinite;
}

/* Fade in عام */
.animate-fade-in {
  animation: fade-in var(--transition-base) ease both;
}

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

/* بتأخير للعناصر المتتالية */
.animate-delay-1 { animation-delay: 50ms; }
.animate-delay-2 { animation-delay: 100ms; }
.animate-delay-3 { animation-delay: 150ms; }
.animate-delay-4 { animation-delay: 200ms; }
.animate-delay-5 { animation-delay: 250ms; }

/* Shake عند الخطأ */
.animate-shake {
  animation: shake 0.5s ease both;
}

/* Bounce عند النجاح */
.animate-bounce-in {
  animation: bounce-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Spin للـ Loader */
.animate-spin {
  animation: spin 0.8s linear infinite;
}

/* Pulse للـ LIVE */
.animate-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

/* -------------------------------------------------------
   عداد الوقت الدائري (Circular Timer)
   ------------------------------------------------------- */
.circular-timer {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.circular-timer__svg {
  transform: rotate(-90deg);
}

.circular-timer__track {
  fill: none;
  stroke: rgba(255,255,255,0.1);
}

.circular-timer__fill {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--transition-base) linear;
}

.circular-timer__fill--normal {
  stroke: url(#timer-gradient-normal);
}

.circular-timer__fill--warning {
  stroke: var(--color-warning);
}

.circular-timer__fill--danger {
  stroke: var(--color-danger);
  animation: timer-pulse 0.5s ease-in-out infinite;
}

.circular-timer__label {
  position: absolute;
  font-size: var(--text-xl);
  font-weight: var(--font-black);
  color: var(--color-text-primary);
  line-height: 1;
}

.circular-timer__label--warning {
  color: var(--color-warning);
}

.circular-timer__label--danger {
  color: var(--color-danger);
}

/* -------------------------------------------------------
   شريط Combo
   ------------------------------------------------------- */
.combo-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.combo-bar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
}

.combo-bar__multiplier {
  font-size: var(--text-xl);
  font-weight: var(--font-black);
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: streak-glow 2s ease-in-out infinite;
}

.combo-bar__track {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.combo-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.combo-bar__fill--1x { background: var(--color-text-muted); }
.combo-bar__fill--2x { background: var(--color-info); }
.combo-bar__fill--5x { background: var(--gradient-primary); }
.combo-bar__fill--10x { background: var(--gradient-gold); box-shadow: 0 0 10px var(--color-gold-glow); }

/* -------------------------------------------------------
   Confetti تأثير الاحتفال
   ------------------------------------------------------- */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-toast);
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall linear both;
}

/* -------------------------------------------------------
   انتقال التبويبات (Tab Content Transition)
   ------------------------------------------------------- */
.tab-content {
  animation: fade-in-up 0.3s ease both;
}

/* -------------------------------------------------------
   تأثيرات البطاقات
   ------------------------------------------------------- */
.card-hover-effect {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card-hover-effect:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-card-hover);
}

/* -------------------------------------------------------
   تأثير اختيار الإجابة (Trivia)
   ------------------------------------------------------- */
.answer-option {
  transition: all var(--transition-base);
}

.answer-option:hover {
  transform: translateX(-4px); /* RTL: يتحرك يسارًا */
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.answer-option--correct {
  background: var(--color-success-light) !important;
  border-color: var(--color-success) !important;
  animation: bounce-in 0.4s ease;
}

.answer-option--wrong {
  background: var(--color-danger-light) !important;
  border-color: var(--color-danger) !important;
  animation: shake 0.4s ease;
}

.answer-option--selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

/* -------------------------------------------------------
   تفضيلات حركة مخفضة — Accessibility
   ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
