/* ============================================================
   MGames - الحركات والتأثيرات
   المسار: /assets/css/animations.css
   ============================================================ */

/* ============================================================
   1) Keyframes
   ============================================================ */

@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(40px, -40px) scale(1.1); }
    66%      { transform: translate(-30px, 30px) scale(0.9); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.15); opacity: 0.85; }
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

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

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

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-15px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.4); }
    50%      { box-shadow: 0 0 40px rgba(99, 102, 241, 0.8); }
}

@keyframes shimmer {
    0%   { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

@keyframes ripple {
    0%   { transform: scale(0); opacity: 0.6; }
    100% { transform: scale(4); opacity: 0; }
}

/* ============================================================
   2) Reveal on Scroll (يُدار بواسطة animations.js)
   ============================================================ */

.reveal,
.reveal-up,
.reveal-down,
.reveal-left,
.reveal-right,
.reveal-zoom,
.reveal-rotate {
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: opacity, transform;
}

.reveal-up     { transform: translateY(40px); }
.reveal-down   { transform: translateY(-40px); }
.reveal-left   { transform: translateX(-40px); }
.reveal-right  { transform: translateX(40px); }
.reveal-zoom   { transform: scale(0.85); }
.reveal-rotate { transform: rotate(-8deg) scale(0.9); }

.reveal.is-visible,
.reveal-up.is-visible,
.reveal-down.is-visible,
.reveal-left.is-visible,
.reveal-right.is-visible,
.reveal-zoom.is-visible,
.reveal-rotate.is-visible {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0);
}

/* تأخيرات متتالية */
.delay-100 { transition-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; }
.delay-400 { transition-delay: 0.4s; }
.delay-500 { transition-delay: 0.5s; }
.delay-700 { transition-delay: 0.7s; }
.delay-1000 { transition-delay: 1s; }

/* ============================================================
   3) تأثيرات Hover والتحويم
   ============================================================ */

.hover-lift {
    transition: transform var(--trans-spring), box-shadow var(--trans-base);
}

.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.hover-glow {
    transition: box-shadow var(--trans-base), border-color var(--trans-base);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow);
    border-color: var(--theme-primary);
}

.hover-zoom {
    overflow: hidden;
}

.hover-zoom img {
    transition: transform var(--trans-slow);
}

.hover-zoom:hover img {
    transform: scale(1.12);
}

.hover-tilt {
    transition: transform var(--trans-spring);
    transform-style: preserve-3d;
}

.hover-tilt:hover {
    transform: perspective(1000px) rotateX(-5deg) rotateY(5deg);
}

/* ============================================================
   4) تأثيرات الأزرار
   ============================================================ */

.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.35),
        transparent
    );
    transition: left 0.6s ease;
}

.btn-shine:hover::before {
    left: 100%;
}

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple .ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

/* ============================================================
   5) تأثيرات التحميل (Skeleton)
   ============================================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.05) 25%,
        rgba(255,255,255,0.12) 50%,
        rgba(255,255,255,0.05) 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 1.8s infinite;
    border-radius: var(--radius-md);
}

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

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-thumb {
    aspect-ratio: 16 / 10;
    width: 100%;
}

/* ============================================================
   6) تأثيرات إضافية على الصفحة الرئيسية
   ============================================================ */

/* شعار متحرك (float) */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* نبض مستمر */
.animate-pulse {
    animation: pulse 2s infinite;
}

/* دوران مستمر */
.animate-spin {
    animation: spin 1.5s linear infinite;
}

/* ارتداد */
.animate-bounce {
    animation: bounce 2s infinite;
}

/* توهج */
.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* اهتزاز (للأخطاء) */
.animate-shake {
    animation: shake 0.5s ease;
}

/* ============================================================
   7) فئات الظهور الفوري (بدون scroll)
   ============================================================ */

.fade-in       { animation: fadeIn 0.8s ease both; }
.fade-in-up    { animation: fadeInUp 0.8s ease both; }
.fade-in-down  { animation: fadeInDown 0.8s ease both; }
.zoom-in       { animation: zoomIn 0.6s var(--trans-spring) both; }

/* ============================================================
   8) Parallax و Glow Decorations
   ============================================================ */

.parallax-bg {
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
}

@media (max-width: 900px) {
    .parallax-bg { background-attachment: scroll; }
}

/* حبيبات توهج عشوائية */
.glow-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--theme-accent);
    box-shadow: 0 0 20px var(--theme-accent);
    animation: float 4s ease-in-out infinite;
    opacity: 0.6;
}

/* ============================================================
   9) احترام تفضيلات المستخدم (a11y)
   ============================================================ */

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