/* التجاوبية (Responsive design) وتجربة الموبايل (Mobile UX) */

/* الأجهزة اللوحية والموبايل */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 90;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-normal);
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
}

/* الموبايل */
@media (max-width: 768px) {
    .app-content {
        padding: 16px;
        padding-bottom: 90px; /* لترك مساحة للشريط السفلي */
    }
    
    .header {
        padding: 0 16px;
    }
    
    .header-search {
        display: none; /* إخفاء البحث في الهيدر واستبداله بزر */
    }
    
    /* شريط الملاحة السفلي للهواتف الذكية */
    .mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background-color: var(--bg-secondary);
        border-top: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: space-around;
        z-index: 100;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .mobile-nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: var(--text-secondary);
        font-size: 0.75rem;
        font-weight: 600;
        transition: var(--transition-fast);
    }
    
    .mobile-nav-link.active, .mobile-nav-link:hover {
        color: var(--accent-primary);
    }
    
    .mobile-nav-link i {
        font-size: 1.3rem;
    }
    
    /* تعديل عناصر النوافذ لتناسب الموبايل */
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .btn {
        width: 100%; /* أزرار كاملة العرض في الموبايل عند الحاجة */
    }
    
    .btn-auto {
        width: auto;
    }
    
    /* تنسيق الكروت بدلاً من الجداول الكبيرة */
    .table-responsive-cards .table-modern thead {
        display: none; /* إخفاء الهيدر في الموبايل */
    }
    
    .table-responsive-cards .table-modern tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        margin-bottom: 12px;
        padding: 12px;
    }
    
    .table-responsive-cards .table-modern td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding: 8px 0;
        text-align: left;
    }
    
    .table-responsive-cards .table-modern td:last-child {
        border-bottom: none;
    }
    
    .table-responsive-cards .table-modern td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-secondary);
        margin-left: 10px;
        text-align: right;
    }
}

/* إخفاء شريط الملاحة السفلي في الشاشات الكبيرة */
@media (min-width: 769px) {
    .mobile-nav {
        display: none;
    }
}
