/**
 * ملف الحركات والأنيميشن
 * حركات سلسة وجميلة للموقع
 */

/* حركة الظهور التدريجي */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* حركة الظهور من اليمين */
.slide-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* حركة الظهور من اليسار */
.slide-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* حركة التكبير */
.zoom-in {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.zoom-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* تأخير الحركات للعناصر المتتالية */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
.delay-6 { transition-delay: 0.6s; }

/* حركة العداد */
@keyframes countUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.counter-animated {
    animation: countUp 0.8s ease-out forwards;
}

/* حركة النبض للأزرار */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(30, 58, 138, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(30, 58, 138, 0); }
    100% { box-shadow: 0 0 0 0 rgba(30, 58, 138, 0); }
}

.btn-pulse {
    animation: pulse 2s infinite;
}

/* حركة التحويم للبطاقات */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* حركة الخط تحت الروابط */
.link-underline {
    position: relative;
    text-decoration: none;
}

.link-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color, #1e3a8a);
    transition: width 0.3s ease;
}

.link-underline:hover::after {
    width: 100%;
}

/* حركة الأيقونات */
.icon-bounce {
    transition: transform 0.3s ease;
}

.icon-bounce:hover {
    transform: scale(1.2);
}

/* حركة التدوير */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.rotate-on-hover:hover {
    animation: rotate 0.5s ease-in-out;
}

/* حركة الظهور للقوائم */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-item.visible {
    animation: staggerIn 0.5s ease-out forwards;
}

@keyframes staggerIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* حركة الشريط العلوي */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.header-animate {
    animation: slideDown 0.5s ease-out;
}

/* حركة الصورة */
.image-reveal {
    overflow: hidden;
}

.image-reveal img {
    transform: scale(1.1);
    transition: transform 0.6s ease-out;
}

.image-reveal.visible img {
    transform: scale(1);
}

/* حركة النص */
.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    transition: transform 0.5s ease-out;
}

.text-reveal.visible span {
    transform: translateY(0);
}

/* حركة الخلفية المتدرجة */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.gradient-animate {
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}

/* حركة الظل */
.shadow-animate {
    transition: box-shadow 0.3s ease;
}

.shadow-animate:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* حركة التمدد للخطوط */
.line-expand {
    width: 0;
    transition: width 0.6s ease-out;
}

.line-expand.visible {
    width: 100%;
}

/* حركة الظهور للأرقام */
@keyframes numberPop {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.number-pop {
    animation: numberPop 0.6s ease-out forwards;
}

/* حركة التحميل */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* حركة الإشعارات */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-animate {
    animation: slideInRight 0.3s ease-out;
}

/* حركة زر الواتساب */
@keyframes whatsappBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.whatsapp-float {
    animation: whatsappBounce 2s ease-in-out infinite;
}

/* حركة التحويم للصور */
.image-zoom {
    overflow: hidden;
}

.image-zoom img {
    transition: transform 0.5s ease;
}

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

/* حركة القائمة المنسدلة */
@keyframes dropDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-animate {
    animation: dropDown 0.2s ease-out;
}

/* تأثير التلاشي عند التمرير */
.scroll-fade {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.scroll-fade.faded {
    opacity: 0.5;
}

/* حركة الحدود */
.border-animate {
    position: relative;
}

.border-animate::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 3px;
    background: var(--primary-color, #1e3a8a);
    transition: width 0.4s ease;
}

.border-animate:hover::before,
.border-animate.active::before {
    width: 100%;
}

/* حركة الظهور من الأسفل مع تأثير مرن */
.bounce-in {
    opacity: 0;
    transform: translateY(50px) scale(0.95);
    transition: opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), 
                transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bounce-in.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* حركة الظهور مع الدوران الخفيف */
.rotate-in {
    opacity: 0;
    transform: translateY(30px) rotate(-3deg);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.rotate-in.visible {
    opacity: 1;
    transform: translateY(0) rotate(0);
}

/* حركة التلاشي مع التكبير */
.scale-fade {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.scale-fade.visible {
    opacity: 1;
    transform: scale(1);
}

/* حركة الانزلاق من أعلى */
.slide-down {
    opacity: 0;
    transform: translateY(-40px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-down.visible {
    opacity: 1;
    transform: translateY(0);
}

/* حركة التموج للخلفيات */
@keyframes wave {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-5px); }
    75% { transform: translateY(5px); }
}

.wave-animate {
    animation: wave 3s ease-in-out infinite;
}

/* حركة التوهج للأزرار */
@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(64, 224, 208, 0.5); }
    50% { box-shadow: 0 0 20px rgba(64, 224, 208, 0.8), 0 0 30px rgba(64, 224, 208, 0.4); }
}

.glow-animate {
    animation: glow 2s ease-in-out infinite;
}

/* حركة الخط المتحرك */
@keyframes lineMove {
    0% { width: 0; right: 100%; }
    50% { width: 100%; right: 0; }
    100% { width: 0; right: 0; }
}

.line-animate::after {
    content: '';
    position: absolute;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent, #40e0d0), var(--primary, #1e3a8a));
    animation: lineMove 3s ease-in-out infinite;
}

/* حركة البطاقات عند التحويم */
.card-3d {
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    transform-style: preserve-3d;
}

.card-3d:hover {
    transform: translateY(-10px) rotateX(5deg);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

/* حركة الأيقونات المتدحرجة */
@keyframes iconFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-5px) rotate(5deg); }
    75% { transform: translateY(5px) rotate(-5deg); }
}

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

/* حركة النص المتلألئ */
@keyframes textShine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.text-shine {
    background: linear-gradient(90deg, 
        var(--primary-dark, #1e3a5f) 0%, 
        var(--accent, #40e0d0) 50%, 
        var(--primary-dark, #1e3a5f) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShine 3s linear infinite;
}

/* حركة الحدود المتوهجة */
@keyframes borderGlow {
    0%, 100% { border-color: rgba(64, 224, 208, 0.3); }
    50% { border-color: rgba(64, 224, 208, 0.8); }
}

.border-glow {
    border: 2px solid rgba(64, 224, 208, 0.3);
    animation: borderGlow 2s ease-in-out infinite;
}

/* حركة الظهور المتتابع للقوائم */
.list-stagger > * {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.list-stagger.visible > *:nth-child(1) { transition-delay: 0.1s; }
.list-stagger.visible > *:nth-child(2) { transition-delay: 0.2s; }
.list-stagger.visible > *:nth-child(3) { transition-delay: 0.3s; }
.list-stagger.visible > *:nth-child(4) { transition-delay: 0.4s; }
.list-stagger.visible > *:nth-child(5) { transition-delay: 0.5s; }
.list-stagger.visible > *:nth-child(6) { transition-delay: 0.6s; }

.list-stagger.visible > * {
    opacity: 1;
    transform: translateX(0);
}

/* حركة زر الواتساب المحسنة */
.whatsapp-btn-animate {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 999;
    animation: whatsappPulse 2s ease-in-out infinite;
}

@keyframes whatsappPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
    }
}

/* حركة التمرير السلس */
html {
    scroll-behavior: smooth;
}

/* تأثير الضبابية عند التمرير */
.blur-on-scroll {
    transition: filter 0.3s ease;
}

.blur-on-scroll.blurred {
    filter: blur(3px);
}

/* تعطيل الحركات لمن يفضلون ذلك */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}
