/* إعادة تعيين وإعدادات أساسية */
/* هذه القاعدة تطبق على جميع العناصر وتقوم بإزالة الهوامش والحشو الداخلي */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* إعدادات أساسية للصفحة */
/* تحديد حجم الخط الأساسي وسلوك التمرير السلس */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

/* إعدادات الجسم الرئيسي للصفحة */
/* تحديد نوع الخط، لون الخلفية، لون النص، ارتفاع السطر وإخفاء التمرير الأفقي */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* الصور والوسائط المتجاوبة */
/* جعل الصور والفيديوهات تتكيف مع حجم الشاشة */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* الجداول المتجاوبة */
/* جعل الجداول تأخذ العرض الكامل ودمج حدود الخلايا */
table {
    width: 100%;
    border-collapse: collapse;
}

/* عناصر تفاعلية ملائمة للشاشات التي تعمل باللمس */
/* تعديلات للشاشات الصغيرة التي تعمل باللمس */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-link, button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.8rem 0.5rem;
    }
    
    .modal-content {
        touch-action: manipulation;
    }
    
    .table-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* شريط التنقل */
/* تصميم شريط التنقل العلوي مع تدرج لوني وظل */
.navbar {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* حاوية شريط التنقل */
/* تحديد أقصى عرض وتوزيع العناصر داخلها */
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* العلامة التجارية في شريط التنقل */
/* تصميم وتنسيق العلامة التجارية */
.nav-brand {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
}

/* أيقونة العلامة التجارية */
/* تحديد حجم وهامش الأيقونة في شريط التنقل */
.nav-brand i {
    margin-right: 0.3rem;
    font-size: 1.8rem;
}

/* نص العلامة التجارية */
/* تصميم نص الشعار في شريط التنقل */
.nav-brand span {
    font-size: 18px;
    font-weight: bold;
    margin-right: 0.1rem;
    color: var(--primary-color);
}
/* اسم المستشفى */
/* تصميم نص اسم المستشفى أسفل الشعار */
.hospital-name {
    font-size: 12px;
    margin-top: 0.3px;
    margin-right: 0.1rem;
    color: #fff;
    display: block;
}
/* قائمة التنقل */
/* تصميم القائمة الأفقية مع إمكانية التفاف العناصر */
.nav-menu {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

/* روابط التنقل */
/* تصميم روابط القائمة مع تأثيرات الحركة */
.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* تأثيرات روابط التنقل عند التمرير */
/* تغيير الخلفية وحركة العنصر عند التمرير أو التحديد */
.nav-link:hover,
.nav-link.active {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

/* قسم المستخدم */
/* تصميم منطقة معلومات المستخدم في شريط التنقل */
.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* الأزرار */
/* تصميم أساسي لجميع الأزرار في التطبيق */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

/* زر أساسي */
/* تصميم الزر الأساسي مع تدرج لوني */
.btn-primary {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
}

/* تأثيرات الزر الأساسي عند التمرير */
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.4);
}

/* زر ثانوي */
/* تصميم الزر الثانوي */
.btn-secondary {
    background: #6c757d;
    color: white;
}

/* زر ذو حدود */
/* تصميم زر ذو حدود بدون تعبئة */
.btn-outline {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
}

/* تأثيرات زر الحدود عند التمرير */
.btn-outline:hover {
    background: rgba(255,255,255,0.1);
}

/* زر أزرق */
/* تصميم زر أزرق */
.btn-blue {
    background: #007bff;
    border: 2px solid #007bff;
    color: white;
}

/* تأثيرات الزر الأزرق عند التمرير */
.btn-blue:hover {
    background: #0056b3;
    border-color: #0056b3;
}

/* زر تحذير */
/* تصميم زر للإجراءات الخطرة */
.btn-danger {
    background: #dc3545;
    color: white;
}

/* زر صغير */
/* تصميم زر بحجم أصغر */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* المحتوى الرئيسي */
/* تصميم منطقة المحتوى الرئيسي في الصفحة */
.main-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* أقسام المحتوى */
/* إظهار وإخفاء أقسام المحتوى مع تأثيرات الحركة */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* تأثير الظهور التدريجي */
/* حركة ظهور العنصر من الأسفل إلى الأعلى */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* رأس القسم */
/* تصميم رأس كل قسم مع توزيع العناصر داخله */
.section-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* عنوان القسم */
/* تصميم العنوان الرئيسي لكل قسم */
.section-header h1 {
    font-size: 2rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* نص وصف القسم */
/* تصميم النص الوصفي تحت عنوان القسم */
.section-header p {
    color: #666;
    margin-top: 0.5rem;
}

/* لوحة التحكم المحسنة */
/* عناصر التحكم في لوحة المعلومات */
.dashboard-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

/* منتقي نطاق الوقت */
/* تصميم عنصر اختيار الفترة الزمنية */
.time-range-selector {
    padding: 8px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* تأثيرات منتقي الوقت عند التركيز */
.time-range-selector:focus {
    outline: none;
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

/* شبكة لوحة المعلومات المحسنة */
/* تصميم شبكة العناصر في لوحة المعلومات */
.enhanced-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}



.success-rate {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
}

.success-rate.high {
    background: #d4edda;
    color: #155724;
}

.success-rate.medium {
    background: #fff3cd;
    color: #856404;
}

.success-rate.low {
    background: #f8d7da;
    color: #721c24;
}

.usage-count {
    background: #e3f2fd;
    color: #1565c0;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

.error-message {
    text-align: center;
    padding: 2rem;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

.loading-spinner {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
}

.loading-spinner::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* تحسينات للشاشات الكبيرة (أعرض من 1400 بكسل) */
@media (min-width: 1400px) {
    .enhanced-stats-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1400px;
        margin: 0 auto 2rem auto;
    }
    
    .main-content {
        max-width: 1400px;
    }
    
    .nav-container {
        max-width: 1400px;
    }
}

/* بطاقة الإحصائيات المُحسنة - تصميم أساسي مع حدود ظلال وتأثيرات حركية */
.enhanced-stat-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border-left: 4px solid #2a5298;
    position: relative;
    overflow: hidden;
}

/* الخط التدرجي العلوي للبطاقة */
.enhanced-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

/* النمط الأساسي للخط العلوي (أزرق داكن) */
.enhanced-stat-card.primary::before {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

/* النمط الثانوي للخط العلوي (رمادي) */
.enhanced-stat-card.secondary::before {
    background: linear-gradient(90deg, #6c757d, #5a6268);
}

.enhanced-stat-card.success::before {
    background: linear-gradient(90deg, #28a745, #1e7e34);
}

.enhanced-stat-card.warning::before {
    background: linear-gradient(90deg, #ffc107, #e0a800);
}

.enhanced-stat-card.info::before {
    background: linear-gradient(90deg, #17a2b8, #138496);
}

.enhanced-stat-card.danger::before {
    background: linear-gradient(90deg, #dc3545, #c82333);
}

/* تأثيرات التحويم - رفع البطاقة وزيادة الظل */
.enhanced-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* تنسيق رأس البطاقة (العنوان والرمز) */
.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* تصميم الرمز الدائري مع ظل متدرج */
.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.3);
}

.enhanced-stat-card.primary .stat-icon {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.3);
}

.enhanced-stat-card.secondary .stat-icon {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.enhanced-stat-card.success .stat-icon {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.enhanced-stat-card.warning .stat-icon {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.enhanced-stat-card.info .stat-icon {
    background: linear-gradient(135deg, #17a2b8, #138496);
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
}

.enhanced-stat-card.danger .stat-icon {
    background: linear-gradient(135deg, #dc3545, #c82333);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 20px;
}

/* مؤشر الاتجاه الإيجابي (أخضر) */
.stat-trend.positive {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.stat-trend.negative {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.stat-trend.neutral {
    color: #666;
    background: rgba(102, 102, 102, 0.1);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.25rem;
    line-height: 1;
}

.stat-content p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.stat-progress {
    margin-top: 1rem;
}

/* شريط التقدم العام (الخلفية الرمادية) */
.progress-bar {
    width: 100%;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 3px;
    transition: width 0.8s ease;
}

.enhanced-stat-card.primary .progress-fill {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.enhanced-stat-card.secondary .progress-fill {
    background: linear-gradient(90deg, #6c757d, #5a6268);
}

.enhanced-stat-card.success .progress-fill {
    background: linear-gradient(90deg, #28a745, #1e7e34);
}

.enhanced-stat-card.warning .progress-fill {
    background: linear-gradient(90deg, #ffc107, #e0a800);
}

.enhanced-stat-card.info .progress-fill {
    background: linear-gradient(90deg, #17a2b8, #138496);
}

.enhanced-stat-card.danger .progress-fill {
    background: linear-gradient(90deg, #dc3545, #c82333);
}

.progress-text {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* شبكة الإحصائيات */
/* تصميم شبكة بطاقات الإحصائيات */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* بطاقة الإحصائية */
/* تصميم بطاقة عرض الإحصائيات */
.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease;
}

/* تأثيرات بطاقة الإحصائية عند التمرير */
.stat-card:hover {
    transform: translateY(-5px);
}

/* شبكة لوحة التحكم المحسنة */
/* تصميم شبكة متقدمة لعناصر لوحة التحكم */
.enhanced-dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* بطاقة الرسوم البيانية */
/* تحديد موقع بطاقة الرسوم في الشبكة */
.chart-card {
    grid-column: 1;
    grid-row: 1;
}

/* بطاقة النشاط */
/* تحديد موقع بطاقة النشاط في الشبكة */
.activity-card {
    grid-column: 2;
    grid-row: 1;
}

/* بطاقة الأقسام */
/* تحديد موقع بطاقة الأقسام في الشبكة */
.department-card {
    grid-column: 1;
    grid-row: 2;
}

/* بطاقة الآلات */
/* تحديد موقع بطاقة الآلات في الشبكة */
.machine-card {
    grid-column: 2;
    grid-row: 2;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.dashboard-card h3 {
    margin-bottom: 1rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f8f9fa;
}

.card-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-controls {
    display: flex;
    gap: 5px;
}

.chart-btn {
    padding: 6px 12px;
    border: 1px solid #e1e8ed;
    background: white;
    color: #666;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chart-btn.active,
.chart-btn:hover {
    background: #2a5298;
    color: white;
    border-color: #2a5298;
}

.chart-container {
    position: relative;
    height: 250px;
    margin-top: 15px;
}

.metric-selector {
    padding: 6px 10px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 12px;
    cursor: pointer;
}

/* Recent List */
.recent-list {
    max-height: 300px;
    overflow-y: auto;
}

.enhanced-recent-list {
    max-height: 300px;
    overflow-y: auto;
}

.recent-item {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.recent-item:hover {
    background: #f8f9fa;
    margin: 0 -1rem;
    padding: 1rem;
    border-radius: 8px;
}

.recent-item:last-child {
    border-bottom: none;
}

/* Usage Chart */
.usage-chart {
    max-height: 300px;
    overflow-y: auto;
}

.enhanced-usage-chart {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.usage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.usage-item:last-child {
    border-bottom: none;
}

.usage-bar {
    flex: 1;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    margin: 0 1rem;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.status-legend {
    display: flex;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
}

.legend-item::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-item.operational::before {
    background: #28a745;
}

.legend-item.maintenance::before {
    background: #ffc107;
}

.legend-item.offline::before {
    background: #dc3545;
}

.machine-status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.machine-status-item {
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
    text-align: center;
    transition: all 0.3s ease;
}

.machine-status-item.operational {
    border-left: 4px solid #28a745;
}

.machine-status-item.maintenance {
    border-left: 4px solid #ffc107;
}

.machine-status-item.offline {
    border-left: 4px solid #dc3545;
}

/* Enhanced Alerts Section */
.enhanced-alerts-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f8f9fa;
}

.alerts-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-filters {
    display: flex;
    gap: 5px;
}

.alert-filter {
    padding: 6px 12px;
    border: 1px solid #e1e8ed;
    background: white;
    color: #666;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.alert-filter.active,
.alert-filter:hover {
    background: #2a5298;
    color: white;
    border-color: #2a5298;
}

.enhanced-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Alerts */
.alerts-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.alerts-section h3 {
    margin-bottom: 1rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alerts-list {
    max-height: 300px;
    overflow-y: auto;
}

.alert-item {
    padding: 1rem;
    border-left: 4px solid #2a5298;
    background: #f8f9fa;
    margin-bottom: 1rem;
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
}

.alert-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.alert-item.warning {
    border-left-color: #ffc107;
}

.alert-item.error {
    border-left-color: #dc3545;
}

.alert-item.critical {
    border-left-color: #dc3545;
    background: #fdf2f2;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.alert-title {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.alert-message {
    color: #666;
    font-size: 0.9rem;
}

/* لوحة الإجراءات السريعة */
/* تصميم لوحة الإجراءات السريعة للوصول السريع للوظائف الشائعة */
.quick-actions-panel {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.quick-actions-panel h3 {
    margin: 0 0 1.5rem 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    border: 2px solid #e1e8ed;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #333;
}

.quick-action-btn:hover {
    border-color: #2a5298;
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(42, 82, 152, 0.2);
}

.quick-action-btn i {
    font-size: 1.5rem;
    color: #2a5298;
}

.quick-action-btn span {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

/* شريط الفلاتر */
/* تصميم شريط الفلاتر للبحث والتصفية المتقدمة */
.filters-bar {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}





.filters-bar select,
.filters-bar input[type="date"] {
    padding: 0.75rem;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    min-width: 150px;
}

/* الجداول */
/* تصميم الجداول لعرض البيانات بشكل منظم وجذاب */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8f9fa;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #eee;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-in_progress {
    background: #fff3cd;
    color: #856404;
}

.status-in-progress {
    background: #fff3cd;
    color: #856404;
}

.status-pending {
    background: #e2e3e5;
    color: #383d41;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

/* تحديد الحالة القابلة للتعديل */
/* تصميم قائمة اختيار الحالة للتعديل السريع للحالات */
#editCycleStatus {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    background-color: white;
    min-width: 120px;
}

/* شبكة الأجهزة */
/* تصميم شبكة عرض الأجهزة بشكل منظم ومتجاوب */
.instruments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.instrument-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.instrument-card:hover {
    transform: translateY(-5px);
}

.instrument-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.instrument-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
}

.instrument-department {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.instrument-details {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.instrument-actions {
    display: flex;
    gap: 0.5rem;
}



/* النوافذ المنبثقة */
/* تصميم النوافذ المنبثقة لعرض التفاصيل والنماذج */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-width: 900px;
    width: 95%;
    max-height: 95vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

/* تكبير النافذة المنبثقة على الكمبيوتر */
@media (min-width: 1024px) {
    .modal-content {
        max-width: 1200px;
        width: 90%;
        max-height: 90vh;
    }
    
    /* تحسين تخطيط النموذج للشاشات الكبيرة */
    .form-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1.5rem;
    }
    
    .item-fields {
        grid-template-columns: 2fr 2fr 2fr 120px 2fr;
        gap: 1rem;
        padding: 15px 0;
    }
    
    .items-section {
        padding: 1.5rem;
    }
    
    /* تحسين حجم الخطوط والحقول */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .form-group label {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    /* تحسين تخطيط رأس النافذة */
    .modal-header {
        padding: 1.5rem 2.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    /* تحسين تخطيط النموذج */
    form {
        padding: 2rem 2.5rem;
    }
    
    /* تحسين عرض العناصر */
    .cycle-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .item-fields select,
    .item-fields input {
        height: 45px;
        padding: 10px 15px;
        font-size: 1rem;
    }
}

/* تحسينات للشاشات الكبيرة جداً */
@media (min-width: 1440px) {
    .modal-content {
        max-width: 1400px;
        width: 85%;
    }
    
    .form-grid {
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 2rem;
    }
    
    .item-fields {
        grid-template-columns: 2.5fr 2.5fr 2.5fr 140px 2.5fr;
        gap: 1.5rem;
        padding: 20px 0;
    }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close {
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

/* النماذج */
/* تصميم النماذج لإدخال البيانات بطريقة منظمة وسهلة */
form {
    padding: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
}

.form-group {
    margin-bottom: 0.3rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.15rem;
    font-weight: 500;
    color: #333;
    font-size: 0.8rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.4rem;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 0.75rem;
    transition: border-color 0.3s ease;
    /* إصلاح مشكلة عدم ظهور النص بالكامل */
    text-align: left;
    direction: ltr;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    box-sizing: border-box;
}

/* إصلاحات خاصة للقوائم المنسدلة في النماذج */
.form-group select {
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
    padding-left: 8px;
    padding-right: 25px;
    cursor: pointer;
    text-indent: 0;
    min-width: 0;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2a5298;
}

/* قسم العناصر */
/* تصميم قسم عرض العناصر والأدوات المستخدمة */
.items-section {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.items-header h3 {
    color: #495057;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.items-help-text {
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: #e3f2fd;
    border-radius: 8px;
    border-left: 4px solid #2a5298;
}

.items-help-text p {
    margin: 0;
    color: #1e3c72;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Cycle Items */
.cycle-item {
    margin-bottom: 0.1rem;
    padding: 0.3rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.item-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.1rem;
    padding-bottom: 0.1rem;
    border-bottom: 1px solid #e9ecef;
}

.remove-item {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 2px;
    padding: 0.02rem 0.08rem;
    cursor: pointer;
    font-size: 0.5rem;
    min-width: 12px;
    height: 14px;
}

.item-number {
    font-weight: 600;
    color: #495057;
    font-size: 0.65rem;
}

.item-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 100px 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 10px 0;
}

.item-fields select,
.item-fields input {
    height: 38px;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    width: 100%;
    /* إصلاح مشكلة عدم ظهور النص بالكامل في القوائم المنسدلة */
    text-align: left;
    direction: ltr;
    padding-left: 12px;
    padding-right: 12px;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    line-height: normal;
    vertical-align: middle;
}

/* إصلاحات خاصة للقوائم المنسدلة */
.item-fields select {
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
    background-image: none;
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 12px;
    cursor: pointer;
    text-indent: 0;
    min-width: 0;
    /* ضمان ظهور النص بالكامل */
    padding-left: 8px;
    padding-right: 30px; /* مساحة إضافية للسهم */
}

/* إصلاحات للقوائم المنسدلة في Safari */
@supports (-webkit-appearance: menulist) {
    .item-fields select {
        -webkit-appearance: menulist;
        padding-left: 8px;
        padding-right: 25px;
        text-align: left;
        direction: ltr;
    }
}

/* إصلاحات للقوائم المنسدلة في Firefox */
@-moz-document url-prefix() {
    .item-fields select {
        padding-left: 8px;
        padding-right: 25px;
        text-indent: 0;
    }
}

/* تنسيقات خاصة لحقل الأدوات */
.item-instrument {
    text-align: right !important;
    direction: rtl !important;
    padding-right: 12px !important;
    padding-left: 12px !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-clip: padding-box !important;
    text-indent: 0 !important;
    min-width: 0 !important;
    width: 100% !important;
    /* إصلاحات للمتصفحات المختلفة */
    -webkit-text-align-last: right !important;
    -moz-text-align-last: right !important;
    text-align-last: right !important;
    unicode-bidi: bidi-override !important;
    font-variant-numeric: normal !important;
    letter-spacing: normal !important;
}

/* تنسيقات خاصة لمتصفح Safari */
@supports (-webkit-appearance: none) {
    .item-instrument {
        -webkit-text-fill-color: initial !important;
        -webkit-opacity: 1 !important;
        text-rendering: optimizeLegibility !important;
        -webkit-font-smoothing: antialiased !important;
        padding: 8px 12px !important;
        margin: 0 !important;
        border-radius: 4px !important;
        line-height: normal !important;
        -webkit-rtl-ordering: logical !important;
        unicode-bidi: embed !important;
        text-align-last: right !important;
    }
}

/* تنسيقات إضافية لمتصفح Safari على macOS */
@media screen and (-webkit-min-device-pixel-ratio: 1) {
    .item-instrument {
        -webkit-locale: "ar" !important;
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
        font-feature-settings: normal !important;
        font-variant-ligatures: normal !important;
        text-combine-upright: none !important;
        text-decoration-skip-ink: auto !important;
    }
}

.item-fields select:focus,
.item-fields input:focus {
    outline: none;
    border-color: #2a5298;
    box-shadow: 0 0 0 2px rgba(42, 82, 152, 0.1);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 2px solid #eee;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination button:hover,
.pagination button.active {
    background: #2a5298;
    color: white;
    border-color: #2a5298;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #eee;
    border-top: 4px solid #2a5298;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* إشعارات الصفحة */
.toast-container {
    position: fixed;
    top: 100px;
    right: 2rem;
    z-index: 4000;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-bottom: 1rem;
    border-left: 4px solid #2a5298;
    animation: slideInRight 0.3s ease;
    max-width: 350px;
}

.toast.success {
    border-left-color: #28a745;
}

.toast.error {
    border-left-color: #dc3545;
}

.toast.warning {
    border-left-color: #ffc107;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* تفاصيل الدورة في النافذة المنبثقة */
.modal-large {
    max-width: 90%;
    width: 1200px;
}

.cycle-details-container {
    padding: 20px;
}

.cycle-info-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.cycle-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.info-item span {
    padding: 8px 12px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    min-height: 20px;
}

.cycle-items-section {
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.cycle-items-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.cycle-items-section .section-header h3 {
    margin: 0;
    color: #495057;
}

.cycle-items-section .section-actions {
    display: flex;
    gap: 10px;
}

.cycle-items-section .table-container {
    padding: 0;
    border-radius: 0 0 8px 8px;
}

.editable-item {
    background-color: #fff3cd !important;
}

.editable-item input,
.editable-item select,
.editable-item textarea {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
}

.editable-item textarea {
    resize: vertical;
    min-height: 60px;
}

.item-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.btn-xs {
    padding: 2px 6px;
    font-size: 0.75rem;
    line-height: 1.2;
}

/* أنماط إدارة الموظفين - تنسيقات شريط التنقل */
.container header {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.container header h1 {
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.container header nav {
    display: flex;
    gap: 1rem;
}

.container header .nav-link {
    color: #007bff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.container header .nav-link:hover {
    background: rgba(0, 123, 255, 0.1);
    color: #0056b3;
}

.container header .nav-link.active {
    background: #007bff;
    color: white;
}

.container header .nav-link.active:hover {
    background: #0056b3;
}

.role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.role-admin {
    background: #dc3545;
    color: white;
}

.role-operator {
    background: #28a745;
    color: white;
}

.role-supervisor {
    background: #ffc107;
    color: #333;
}

.text-center {
    text-align: center;
}

.text-danger {
    color: #dc3545;
    font-weight: bold;
}

/* دعم اللغة العربية والاتجاه من اليمين */
[dir="rtl"] .toast-container {
    right: auto;
    left: 20px;
}

[dir="rtl"] .toast {
    text-align: right;
}

[dir="rtl"] .modal-content {
    text-align: right;
}

[dir="rtl"] .form-group label {
    text-align: right;
}

[dir="rtl"] .data-table {
    text-align: right;
}

[dir="rtl"] .data-table th,
[dir="rtl"] .data-table td {
    text-align: right;
}

[dir="rtl"] .btn {
    margin-left: 5px;
    margin-right: 0;
}

[dir="rtl"] .section-header {
    text-align: right;
}

[dir="rtl"] .filters {
    text-align: right;
}



/* التصميم المتجاوب - أجهزة لوحية كبيرة وشاشات صغيرة */
@media (max-width: 1024px) {
    .nav-container {
        padding: 0 1.5rem;
    }
    
    .main-content {
        padding: 0 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .enhanced-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.2rem;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
    }
    
    .modal-content {
        width: 90%;
        max-width: 600px;
        margin: 2rem auto;
    }
    
    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }
}

/* الأجهزة اللوحية */
@media (max-width: 768px) {
    /* Prevent horizontal overflow */
    body {
        overflow-x: hidden;
    }
    
    .main-content {
        padding: 0 1rem;
        max-width: 100vw;
        box-sizing: border-box;
    }
    


    
    /* توحيد عرض البطاقات مع شريط التنقل */
.dashboard-card,
    .enhanced-stat-card,
    .stat-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin-left: 0;
        margin-right: 0;
    }
    .nav-container {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        justify-content: center;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        align-items: center;
    }
    
    .navbar {
        padding: 0.5rem 0;
        min-height: auto;
    }
    
    .nav-brand {
        order: 1;
        display: flex;
        flex-direction: row;
        align-items: center;
        text-align: center;
        margin-bottom: 0.3rem;
        gap: 0.5rem;
    }
    
    .nav-brand span {
        font-size: 16px;
        font-weight: bold;
        color: white;
    }
    
    .hospital-name {
        font-size: 11px;
        color: rgba(255, 255, 255, 0.9);
    }
    
    .nav-menu {
        order: 2;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.3rem;
        width: 100%;
        max-width: 100%;
        justify-content: center;
        padding: 0.3rem 0;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .nav-link {
        padding: 0.5rem 0.7rem;
        font-size: 0.75rem;
        white-space: nowrap;
        text-align: center;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 6px;
        transition: all 0.3s ease;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.3rem;
        flex: 1;
        min-width: 0;
        box-sizing: border-box;
        justify-content: center;
    }
    
    .nav-link i {
        font-size: 0.9rem;
        margin-bottom: 0;
    }
    
    .nav-link:hover,
    .nav-link.active {
        background: rgba(255, 255, 255, 0.25);
        transform: translateY(-1px);
    }
    
    .nav-user {
        order: 3;
        gap: 0.5rem;
        flex-shrink: 0;
        width: 100%;
        justify-content: center;
        margin-top: 0.3rem;
        padding-top: 0.3rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        flex-direction: row;
        align-items: center;
    }
    
    .nav-user span {
        font-size: 0.8rem;
        text-align: center;
        margin-right: 0.5rem;
    }
    
    .nav-user .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
    
    .main-content {
        padding: 0 1rem;
        margin: 1rem auto;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1rem;
    }
    
    .enhanced-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .enhanced-stat-card {
        padding: 1.5rem;
    }
    
    .stat-content h3 {
        font-size: 1.8rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .section-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }
    
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    

    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .item-fields {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        padding: 12px 0;
    }
    
    .item-fields select,
    .item-fields input {
        height: 42px;
        padding: 10px 14px;
        font-size: 16px;
    }
    
    /* تنسيقات خاصة لحقل الأدوات في الشاشات المتوسطة */
    .item-instrument {
        text-align: right !important;
        direction: rtl !important;
        padding-right: 14px !important;
        padding-left: 14px !important;
    }
    
    .items-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .instruments-grid {
        grid-template-columns: 1fr;
    }
    

    
    .data-table {
        font-size: 0.9rem;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .dashboard-card {
        padding: 1.2rem;
        margin-bottom: 1rem;
    }
    
    /* Enhanced Dashboard Grid for tablets */
    .enhanced-dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 1rem;
    }
    
    .chart-card,
    .activity-card,
    .department-card,
    .machine-card {
        grid-column: 1;
        grid-row: auto;
    }
}

/* الهواتف المحمولة */
@media (max-width: 480px) {
    /* Prevent horizontal overflow */
    body {
        overflow-x: hidden;
    }
    
    .main-content {
        padding: 0 0.5rem;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    /* Make navbar full width */
    .navbar {
        width: 100%;
        box-sizing: border-box;
    }
    
    .nav-container {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        padding: 0 0.5rem;
    }
    
    /* Ensure all cards match navbar width */
    .dashboard-card,
    .enhanced-stat-card,
    .stat-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin-left: 0;
        margin-right: 0;
        padding: 1rem;
    }
    
    /* إصلاح تجاوز الشبكة وجعل البطاقات بنفس العرض */
.stats-grid,
    .enhanced-stats-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        width: 100%;
        box-sizing: border-box;
        padding: 0;
        margin: 0;
    }
    
    /* Fix dashboard grid overflow and make cards same width */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        width: 100%;
        box-sizing: border-box;
        padding: 0;
        margin: 0;
    }
    .nav-brand {
        font-size: 1.1rem;
        order: 1;
    }
    
    .nav-container {
        padding: 0 0.3rem;
    }
    
    .nav-menu {
        gap: 0.3rem;
        justify-content: center;
    }
    
    .nav-link {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .nav-user {
        gap: 0.2rem;
    }
    
    .nav-user span {
        font-size: 0.8rem;
    }
    
    .section-header h1 {
        font-size: 1.5rem;
    }
    
    .stat-card {
        padding: 1.5rem;
        flex-direction: column;
        text-align: center;
    }
    
    .enhanced-stats-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .enhanced-stat-card {
        padding: 1.2rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .stat-content h3 {
        font-size: 1.5rem;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .dashboard-card {
        padding: 1.5rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.25rem;
    }
    
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
    }
    
    .modal-content {
        width: 98%;
        margin: 0.5rem;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.8rem;
    }
    
    .item-fields {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 15px 0;
    }
    
    .item-fields select,
    .item-fields input {
        height: 48px;
        padding: 12px 16px;
        font-size: 16px;
        border: 2px solid #ddd;
        border-radius: 6px;
    }
    
    /* تنسيقات خاصة لحقل الأدوات في الشاشات الصغيرة */
    .item-instrument {
        text-align: right !important;
        direction: rtl !important;
        padding-right: 16px !important;
        padding-left: 16px !important;
    }

    .item-fields select:focus,
    .item-fields input:focus {
        border-color: #2a5298;
        box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.15);
    }
    
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
    
    .dashboard-card {
        padding: 1rem;
        margin-bottom: 0.8rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .section-header h1 {
        font-size: 1.3rem;
    }
    
    /* شبكة لوحة التحكم المُحسنة للأجهزة المحمولة */
.enhanced-dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 0.8rem;
        width: 100%;
        box-sizing: border-box;
        padding: 0;
        margin: 0;
    }
    
    .chart-card,
    .activity-card,
    .department-card,
    .machine-card {
        grid-column: 1;
        grid-row: auto;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Extra small devices */
@media (max-width: 320px) {
    /* Prevent horizontal overflow */
    body {
        overflow-x: hidden;
    }
    
    .main-content {
        padding: 0 0.3rem;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    /* Make navbar full width */
    .navbar {
        width: 100%;
        box-sizing: border-box;
    }
    
    .nav-container {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        padding: 0 0.3rem;
    }
    
    /* Ensure all cards match navbar width */
    .dashboard-card,
    .enhanced-stat-card,
    .stat-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin-left: 0;
        margin-right: 0;
        padding: 0.8rem;
    }
    
    /* Fix grids overflow and make cards same width */
    .stats-grid,
    .enhanced-stats-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        width: 100%;
        box-sizing: border-box;
        padding: 0;
        margin: 0;
    }
    .nav-container {
        padding: 0 0.2rem;
        gap: 0.3rem;
    }
    
    .main-content {
        padding: 0 0.5rem;
    }
    
    .nav-brand {
        font-size: 0.9rem;
    }
    
    .nav-menu {
        gap: 0.2rem;
    }
    
    .nav-link {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }
    
    .nav-user {
        gap: 0.1rem;
    }
    
    .nav-user span {
        font-size: 0.7rem;
    }
    
    .btn-outline {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .section-header h1 {
        font-size: 1.3rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .enhanced-stats-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .enhanced-stat-card {
        padding: 1rem;
    }
    
    .stat-content h3 {
        font-size: 1.3rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
        min-height: 44px; /* Touch-friendly */
        min-width: 44px;
    }
    
    .modal-content {
        width: 100%;
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 1rem;
        min-height: 44px;
    }
    
    .dashboard-card {
        padding: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .section-header h1 {
        font-size: 1.1rem;
    }
    
    /* Enhanced Dashboard Grid for extra small devices */
    .enhanced-dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 0.5rem;
    }
    
    .chart-card,
    .activity-card,
    .department-card,
    .machine-card {
        grid-column: 1;
        grid-row: auto;
        padding: 0.8rem;
    }
}

/* Enhanced RECALL Section Styles */
.recall-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    border-radius: 15px;
    color: white;
}

.recall-title h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
}

.recall-subtitle {
    margin: 5px 0 0 0;
    opacity: 0.9;
    font-size: 1rem;
}

.recall-actions {
    display: flex;
    gap: 10px;
}











.enhanced-select {
    padding: 12px 15px;
    border: 2px solid #eee;
    border-radius: 10px;
    background: white;
    color: #333;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    /* إصلاح مشكلة عدم ظهور النص بالكامل */
    text-align: left;
    direction: ltr;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    box-sizing: border-box;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
    padding-left: 12px;
    padding-right: 30px;
    cursor: pointer;
    text-indent: 0;
    min-width: 0;
}

.enhanced-select:focus {
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

.date-range-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #eee;
    border-radius: 10px;
    background: white;
    color: #333;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.date-input:focus {
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

.date-separator {
    color: #666;
    font-weight: 500;
}



.loading-content {
    text-align: center;
    max-width: 400px;
}

.loading-spinner {
    font-size: 3rem;
    color: #2a5298;
    margin-bottom: 20px;
}

.loading-content h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.5rem;
}

.loading-content p {
    margin: 0;
    color: #666;
}

.empty-state, .error-state {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.empty-content, .error-content {
    text-align: center;
    max-width: 400px;
}

.empty-icon, .error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-icon {
    color: #666;
}

.error-icon {
    color: #dc3545;
}

.empty-content h3, .error-content h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.5rem;
}

.empty-content p, .error-content p {
    margin: 0 0 20px 0;
    color: #666;
}

/* تنسيق أفقي للأجهزة المحمولة (ارتفاع شاشة حتى 500 بكسل) */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .navbar {
        padding: 0.5rem 0;
        position: fixed;
        width: 100%;
        top: 0;
        z-index: 1001;
    }
    
    .nav-container {
        padding: 0 1rem;
        min-height: auto;
    }
    
    .nav-brand {
        font-size: 1rem;
    }
    
    .nav-menu {
        gap: 0.5rem;
    }
    
    .nav-link {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .main-content {
        margin-top: 80px; /* Account for fixed navbar */
        padding: 0.5rem 1rem;
    }
    
    .section-header {
        margin-bottom: 1rem;
    }
    
    .section-header h1 {
        font-size: 1.3rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.8rem;
        margin-bottom: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .dashboard-grid {
        gap: 0.8rem;
    }
    
    .dashboard-card {
        padding: 1rem;
    }
    
    .modal-content {
        max-height: 85vh;
        margin: 0.5rem;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.4rem 0.3rem;
    }
}

/* إصلاحات عامة لجميع القوائم المنسدلة في النظام */
select {
    /* إصلاح مشكلة عدم ظهور النص بالكامل في جميع القوائم المنسدلة */
    text-align: left !important;
    direction: ltr !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    padding-left: 8px !important;
    padding-right: 25px !important;
    text-indent: 0 !important;
    min-width: 0 !important;
    line-height: normal !important;
    vertical-align: middle !important;
    -webkit-appearance: menulist !important;
    -moz-appearance: menulist !important;
    appearance: menulist !important;
    cursor: pointer !important;
}

/* إصلاحات خاصة لمتصفح Safari */
@supports (-webkit-appearance: menulist) {
    select {
        -webkit-appearance: menulist !important;
        -webkit-text-fill-color: initial !important;
        -webkit-opacity: 1 !important;
    }
}

/* إصلاحات خاصة لمتصفح Firefox */
@-moz-document url-prefix() {
    select {
        -moz-appearance: menulist !important;
        text-indent: 0 !important;
    }
}

/* الشاشات الصغيرة جداً (أقل من 480px) */
@media (max-width: 480px) {
    .nav-menu {
        flex-wrap: wrap;
        gap: 0.2rem;
        padding: 0.3rem 0;
    }
    
    .nav-link {
        padding: 0.4rem 0.5rem;
        font-size: 0.65rem;
        gap: 0.2rem;
        flex: 1;
        min-width: 80px;
    }
    
    .nav-link i {
        font-size: 0.8rem;
    }
    
    .nav-brand span {
        font-size: 14px;
    }
    
    .hospital-name {
        font-size: 10px;
    }
}

/* الشاشات الصغيرة جداً (أقل من 400px) */
@media (max-width: 400px) {
    .nav-container {
        padding: 0.4rem 0.3rem;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        gap: 0.15rem;
        padding: 0.2rem 0;
    }
    
    .nav-link {
        padding: 0.3rem 0.4rem;
        font-size: 0.6rem;
        gap: 0.15rem;
        flex: 1;
        min-width: 70px;
    }
    
    .nav-link i {
        font-size: 0.7rem;
        margin-bottom: 0;
    }
    
    .nav-brand span {
        font-size: 13px;
    }
    
    .hospital-name {
        font-size: 9px;
    }
    
    .nav-user span {
        font-size: 0.75rem;
    }
    
    .nav-user .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
}

/* الشاشات الصغيرة جداً جداً (أقل من 320px) */
@media (max-width: 320px) {
    .nav-container {
        padding: 0.3rem 0.2rem;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        gap: 0.1rem;
        padding: 0.15rem 0;
    }
    
    .nav-link {
        padding: 0.25rem 0.3rem;
        font-size: 0.55rem;
        gap: 0.1rem;
        flex: 1;
        min-width: 60px;
    }
    
    .nav-link i {
        font-size: 0.65rem;
        margin-bottom: 0;
    }
    
    .nav-brand span {
        font-size: 12px;
    }
    
    .hospital-name {
        font-size: 8px;
    }
    
    .nav-user span {
        font-size: 0.7rem;
    }
    
    .nav-user .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }
}

/* شاشات أفقية صغيرة جدًا (هواتف في وضع أفقي) */
@media screen and (orientation: landscape) and (max-height: 400px) {
    .navbar {
        padding: 0.3rem 0;
    }
    
    .nav-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.3rem 1rem;
        gap: 0.5rem;
    }
    
    .nav-brand {
        order: 1;
        margin-bottom: 0;
        flex-direction: row;
        gap: 0.3rem;
    }
    
    .nav-brand span {
        font-size: 12px;
    }
    
    .hospital-name {
        font-size: 8px;
    }
    
    .nav-menu {
        order: 2;
        display: flex;
        flex-direction: row;
        gap: 0.3rem;
        border: none;
        padding: 0;
        width: auto;
        flex-wrap: wrap;
        justify-content: center;
        flex: 1;
    }
    
    .nav-link {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        min-width: auto;
        flex-direction: row;
        gap: 0.2rem;
        width: auto;
        background: rgba(255, 255, 255, 0.15);
    }
    
    .nav-link i {
        font-size: 0.8rem;
        margin-bottom: 0;
    }
    
    .nav-user {
        order: 3;
        flex-direction: row;
        width: auto;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }
    
    .nav-user span {
        font-size: 0.7rem;
        margin-bottom: 0;
        margin-right: 0.3rem;
    }
    
    .nav-user .btn {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }
}

/* أنماط العرض الأسبوعي */
.week-navigation {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.week-navigation button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.week-navigation button:hover {
    background: #f8f9fa;
    border-color: #2a5298;
    color: #2a5298;
}

.week-navigation span {
    color: #333;
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

/* أزرار العرض الأسبوعي في شريط الفلاتر */
.filters-bar button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid #2a5298;
    background: white;
    color: #2a5298;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 150px;
}

.filters-bar button:hover {
    background: #2a5298;
    color: white;
}

.filters-bar button.active {
    background: #2a5298;
    color: white;
}

/* تعديلات الاستجابة للعرض الأسبوعي على الشاشات الصغيرة */
@media (max-width: 768px) {
    .week-navigation {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.8rem;
    }
    
    .week-navigation button {
        width: 100%;
        justify-content: center;
    }
    
    .filters-bar {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .filters-bar button {
        width: 100%;
        justify-content: center;
    }
}
