/* =======================================
   تحسينات وتعديلات إضافية للتجاوب
   Responsive Overrides & Enhancements
   ======================================= */

/* ========== إصلاحات عامة ========== */
* {
    -webkit-tap-highlight-color: transparent;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========== تحسينات القوائم ========== */
.navbar-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.navbar-hidden {
    transform: translateY(-100%);
}

/* قائمة الموبايل */
@media (max-width: 1023px) {
    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        position: relative;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu-toggle span {
        display: block;
        width: 25px;
        height: 2px;
        background-color: var(--heading-color);
        position: relative;
        transition: all 0.3s ease;
    }

    .mobile-menu-toggle span::before,
    .mobile-menu-toggle span::after {
        content: '';
        position: absolute;
        width: 100%;
        height: 100%;
        background-color: var(--heading-color);
        transition: all 0.3s ease;
    }

    .mobile-menu-toggle span::before {
        top: -8px;
    }

    .mobile-menu-toggle span::after {
        bottom: -8px;
    }

    .mobile-menu {
        padding: 20px;
    }

    .mobile-menu-close {
        position: absolute;
        top: 20px;
        left: 20px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        cursor: pointer;
        font-size: 24px;
    }

    .mobile-menu-nav {
        margin-top: 60px;
    }

    .mobile-menu-nav ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .mobile-menu-nav li {
        margin-bottom: 10px;
    }

    .mobile-menu-nav a {
        display: block;
        padding: 12px 0;
        color: var(--heading-color);
        text-decoration: none;
        font-size: 16px;
        font-weight: 500;
        transition: color 0.3s ease;
    }

    .mobile-menu-nav a:hover {
        color: var(--primary-color);
    }
}

/* ========== تحسينات البطاقات ========== */
.card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-body {
    flex: 1;
}

/* ========== تحسينات الشبكة ========== */
@media (max-width: 639px) {
    .grid {
        gap: var(--spacing-sm);
    }

    [class*="grid-cols-"] {
        grid-template-columns: 1fr;
    }
}

/* ========== تحسينات النصوص ========== */
@media (max-width: 767px) {
    .h1, h1 { font-size: calc(var(--font-3xl) * 0.8); }
    .h2, h2 { font-size: calc(var(--font-2xl) * 0.8); }
    .h3, h3 { font-size: calc(var(--font-xl) * 0.9); }
    .h4, h4 { font-size: var(--font-lg); }
    .h5, h5 { font-size: var(--font-base); }
    .h6, h6 { font-size: var(--font-sm); }

    .section {
        padding: var(--spacing-2xl) 0;
    }
}

/* ========== تحسينات الأزرار ========== */
@media (max-width: 639px) {
    .btn {
        font-size: var(--font-sm);
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .btn-lg {
        font-size: var(--font-base);
        padding: var(--spacing-sm) var(--spacing-lg);
    }
}

/* ========== تحسينات الصور ========== */
.img-responsive-height {
    height: 200px;
    object-fit: cover;
}

@media (min-width: 640px) {
    .img-responsive-height {
        height: 250px;
    }
}

@media (min-width: 1024px) {
    .img-responsive-height {
        height: 300px;
    }
}

/* ========== تحسينات الجداول ========== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--spacing-md);
}

.table-responsive table {
    min-width: 600px;
}

/* ========== تحسينات النماذج ========== */
input, textarea, select {
    width: 100%;
    max-width: 100%;
}

/* ========== تحسينات التمرير ========== */
.scroll-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.scroll-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}



/* ========== تحسينات الحركات ========== */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.tooltip {
    position: absolute;
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tooltip.show {
    opacity: 1;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--secondary-color);
}

/* ========== أجهزة اللمس ========== */
.touch-device .hover\:opacity-100 {
    opacity: 1 !important;
}

/* ========== إصلاح ارتفاع الشاشة للموبايل ========== */
.min-vh-100 {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
}

/* ========== تحسينات الطباعة ========== */
@media print {
    .navbar,
    .footer,
    .scroll-top,
    .mobile-menu,
    .mobile-menu-overlay,
    .no-print {
        display: none !important;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .section {
        page-break-inside: avoid;
    }
}

/* ========== دعم الوضع الداكن (اختياري) ========== */
@media (prefers-color-scheme: dark) {
    /* يمكن إضافة أنماط الوضع الداكن هنا إذا لزم الأمر */
}

/* ========== إصلاحات خاصة بالمتصفحات ========== */
/* Safari */
@supports (-webkit-appearance: none) {
    .navbar-sticky {
        -webkit-backdrop-filter: blur(10px);
    }
}

/* Firefox */
@-moz-document url-prefix() {
    /* إصلاحات خاصة بـ Firefox */
}

/* Edge */
@supports (-ms-ime-align: auto) {
    /* إصلاحات خاصة بـ Edge */
}
