/**
 * تحسينات الأداء للتنقل السريع بين الصفحات
 */

/* تحسين سلاسة الانتقالات بين الصفحات */
.page-transition {
    animation: page-in 0.3s ease-out;
}

/* تأثير دخول الصفحة */
@keyframes page-in {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* مؤشر تحميل الصفحة */
.page-transition-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 9999;
    pointer-events: none;
}

.page-transition-loader::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(to right, #8e24aa, #1976D2);
    animation: loading-animation 0.8s ease-in-out infinite;
}

@keyframes loading-animation {
    0% { width: 0; left: 0; }
    50% { width: 30%; left: 30%; }
    100% { width: 0; left: 100%; }
}

.spinner-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.loader-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.5);
}

.loader-overlay.dark {
    background-color: rgba(0, 0, 0, 0.5);
}

/* تسريع عرض العناصر */
.nav-link, .sidebar-link {
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* تحسين تأثيرات الحركة لزيادة الاستجابة */
.dashboard-widget, .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

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

/* تحسين أداء القوائم المنسدلة */
.dropdown-menu {
    transition: transform 0.15s ease, opacity 0.15s ease;
    transform-origin: top;
}

/* تحسين أداء الجداول الكبيرة */
.table-responsive {
    will-change: transform;
    transform: translateZ(0);
}

/* تنعيم الانتقالات بين الصفحات */
body {
    animation-duration: 0.2s;
    animation-name: smooth-entry;
}

@keyframes smooth-entry {
    from {
        opacity: 0.8;
    }
    to {
        opacity: 1;
    }
}

/* تحسين التعامل مع الصور لتسريع التحميل */
img:not(.no-optimize) {
    content-visibility: auto;
}

/* تحسين أداء العناصر الثابتة */
.sticky-top, .fixed-top {
    will-change: transform;
}