/* ============================================
   MOBILE SIDEBAR MENU - قائمة جانبية للهاتف
   نظام منفصل تماماً عن الهيدر
   ============================================ */

/* إلغاء الحدود الزرقاء لجميع العناصر */
#mobileSidebarMenu *,
#mobileSidebarMenu *:focus,
#mobileSidebarMenu *:active {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Hide on Desktop */
@media (min-width: 769px) {
    #mobileSidebarMenu {
        display: none !important;
    }
}

/* Mobile Only */
@media (max-width: 768px) {
    /* ===== SIDEBAR CONTAINER ===== */
    #mobileSidebarMenu {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        /* Fallback للمتصفحات القديمة */
        height: 100vh !important;
        max-height: 100vh !important;
        /* استخدام dvh للتعامل مع شريط العناوين - يعمل في المتصفحات الحديثة */
        height: 100dvh !important;
        max-height: 100dvh !important;
        background: #ffffff !important;
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3) !important;
        z-index: 100000 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        
        /* Hidden by default */
        transform: translateX(100%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), 
                    opacity 0.35s ease, 
                    visibility 0.35s ease !important;
    }
    
    /* LTR - من اليمين */
    [dir="ltr"] #mobileSidebarMenu {
        right: 0 !important;
        left: auto !important;
    }
    
    /* RTL - من اليسار */
    [dir="rtl"] #mobileSidebarMenu {
        left: 0 !important;
        right: auto !important;
        transform: translateX(-100%) !important;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* Active State - Show Menu */
    #mobileSidebarMenu.active {
        transform: translateX(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* ===== MENU HEADER ===== */
    .mobile-sidebar-header {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 60px !important;
        height: 60px !important;
        background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%) !important;
        color: #ffffff !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 1.2px !important;
        box-shadow: 0 2px 10px rgba(59, 130, 246, 0.2) !important;
        flex-shrink: 0 !important;
        gap: 10px !important;
    }
    
    .mobile-sidebar-header i {
        font-size: 20px !important;
    }
    
    /* ===== MENU ITEMS ===== */
    .mobile-sidebar-nav {
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        flex: 1 !important;
        overflow-y: auto !important;
    }
    
    .mobile-sidebar-item {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* ===== MENU LINKS ===== */
    .mobile-sidebar-link {
        width: 100% !important;
        display: grid !important;
        align-items: center !important;
        padding: 16px 20px !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
        color: #2c3e50 !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        transition: all 0.25s ease !important;
        position: relative !important;
        cursor: pointer !important;
        outline: none !important;
        gap: 12px !important;
    }
    
    /* إلغاء الحدود الزرقاء عند التركيز */
    .mobile-sidebar-link:focus {
        outline: none !important;
        box-shadow: none !important;
    }
    
    /* LTR - الإنجليزي: الأيقونة ثم النص (الترتيب الطبيعي في DOM) */
    [dir="ltr"] .mobile-sidebar-link {
        grid-template-columns: 40px 1fr !important;
    }
    
    [dir="ltr"] .mobile-sidebar-link span {
        text-align: left !important;
    }
    
    /* RTL - العربي: الأيقونة على اليسار، النص على اليمين */
    [dir="rtl"] .mobile-sidebar-link {
        grid-template-columns: 40px 1fr !important;
        direction: rtl !important;
    }
    
    [dir="rtl"] .mobile-sidebar-link span {
        text-align: right !important;
    }
    
    /* Icon Container - تخطيط منفصل */
    .mobile-sidebar-link i {
        font-size: 20px !important;
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: #3b82f6 !important;
        transition: all 0.3s ease !important;
        flex-shrink: 0 !important;
        background: rgba(59, 130, 246, 0.08) !important;
        border-radius: 8px !important;
    }
    
    /* Text Container - تخطيط منفصل */
    .mobile-sidebar-link span {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* Hover Effect */
    .mobile-sidebar-link:hover {
        background: rgba(59, 130, 246, 0.05) !important;
        color: #3b82f6 !important;
    }
    
    .mobile-sidebar-link:hover i {
        background: rgba(59, 130, 246, 0.15) !important;
        color: #ffffff !important;
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
        transform: scale(1.05) !important;
    }
    
    /* Active State */
    .mobile-sidebar-link.active {
        background: rgba(59, 130, 246, 0.1) !important;
        color: #3b82f6 !important;
        font-weight: 700 !important;
    }
    
    [dir="ltr"] .mobile-sidebar-link.active {
        border-left: 4px solid #3b82f6 !important;
        padding-left: 16px !important;
    }
    
    [dir="rtl"] .mobile-sidebar-link.active {
        border-right: 4px solid #3b82f6 !important;
        padding-right: 16px !important;
    }
    
    .mobile-sidebar-link.active i {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
        color: #ffffff !important;
        transform: scale(1.05) !important;
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3) !important;
    }
    
    /* Touch Feedback */
    .mobile-sidebar-link:active {
        background: rgba(59, 130, 246, 0.15) !important;
        transform: scale(0.98) !important;
    }
    
    .mobile-sidebar-link:active i {
        transform: scale(0.95) !important;
    }
    
    /* ===== BACKDROP OVERLAY ===== */
    #mobileSidebarBackdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0, 0, 0, 0.6) !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        z-index: 99999 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: opacity 0.3s ease, visibility 0.3s ease !important;
        cursor: pointer !important;
    }
    
    #mobileSidebarBackdrop.active {
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* Prevent body scroll when menu is open */
    body.mobile-menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }
    
    /* ===== SCROLLBAR STYLING ===== */
    #mobileSidebarMenu::-webkit-scrollbar {
        width: 6px !important;
    }
    
    #mobileSidebarMenu::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05) !important;
    }
    
    #mobileSidebarMenu::-webkit-scrollbar-thumb {
        background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%) !important;
        border-radius: 10px !important;
    }
    
    #mobileSidebarMenu::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%) !important;
    }
    
    /* ===== MENU FOOTER ===== */
    .mobile-sidebar-footer {
        min-height: 70px !important;
        padding: 15px 20px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
        background: rgba(59, 130, 246, 0.02) !important;
        flex-shrink: 0 !important;
    }
    
    /* Social Media Container */
    .mobile-sidebar-social {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 12px !important;
        flex-wrap: wrap !important;
    }
    
    /* Social Media Links */
    .mobile-sidebar-social-link {
        width: 36px !important;
        height: 36px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
        color: #ffffff !important;
        border-radius: 50% !important;
        text-decoration: none !important;
        font-size: 16px !important;
        transition: all 0.3s ease !important;
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2) !important;
    }
    
    .mobile-sidebar-social-link:hover {
        transform: translateY(-3px) scale(1.1) !important;
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
    }
    
    .mobile-sidebar-social-link:active {
        transform: translateY(-1px) scale(1.05) !important;
    }
    
    .mobile-sidebar-social-link i {
        font-size: 16px !important;
        font-family: "Font Awesome 6 Brands" !important;
        font-weight: 400 !important;
    }
    
    .mobile-sidebar-social-link i.fab {
        font-family: "Font Awesome 6 Brands" !important;
    }
}

/* ===== SMALL DEVICES ===== */
@media (max-width: 480px) {
    #mobileSidebarMenu {
        width: 260px !important;
        max-width: 90vw !important;
    }
    
    .mobile-sidebar-header {
        min-height: 55px !important;
        height: 55px !important;
        font-size: 14px !important;
    }
    
    .mobile-sidebar-footer {
        min-height: 60px !important;
        padding: 12px 15px !important;
    }
    
    .mobile-sidebar-link {
        padding: 14px 16px !important;
        font-size: 14px !important;
    }
    
    [dir="ltr"] .mobile-sidebar-link {
        gap: 10px !important;
    }
    
    [dir="rtl"] .mobile-sidebar-link {
        gap: 10px !important;
    }
    
    .mobile-sidebar-link i {
        font-size: 18px !important;
        width: 36px !important;
        height: 36px !important;
    }
    
    .mobile-sidebar-link span {
        font-size: 14px !important;
    }
    
    .mobile-sidebar-social-link {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }
    
    .mobile-sidebar-social-link i {
        font-size: 14px !important;
    }
}

/* ===== EXTRA SMALL DEVICES ===== */
@media (max-width: 360px) {
    #mobileSidebarMenu {
        width: 240px !important;
        max-width: 95vw !important;
    }
    
    .mobile-sidebar-header {
        min-height: 50px !important;
        height: 50px !important;
        font-size: 13px !important;
    }
    
    .mobile-sidebar-footer {
        min-height: 55px !important;
        padding: 10px !important;
    }
    
    .mobile-sidebar-social-link {
        width: 30px !important;
        height: 30px !important;
        font-size: 13px !important;
    }
    
    .mobile-sidebar-social-link i {
        font-size: 13px !important;
    }
}

/* ===== LANDSCAPE MODE ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-sidebar-header {
        min-height: 50px !important;
        height: 50px !important;
        font-size: 14px !important;
    }
    
    .mobile-sidebar-footer {
        min-height: 55px !important;
        padding: 10px 15px !important;
    }
    
    .mobile-sidebar-link {
        padding: 12px 18px !important;
    }
}

/* ===== ANIMATIONS ===== */
@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;
    }
}
