/* 
   منصة إدارة سلامة المرضى - تجمع الرياض الصحي الثالث
   تصميم عصري متجاوب يدعم اللغة العربية بالكامل RTL-first
*/

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

:root {
    /* نظام الألوان - الهوية الصحية للتجمع */
    --primary: #006c7f;
    --primary-light: #00889f;
    --primary-dark: #004e5c;
    --primary-rgb: 0, 108, 127;
    
    --secondary: #10b981;
    --secondary-rgb: 16, 185, 129;
    
    --danger: #ef4444;
    --danger-rgb: 239, 68, 68;
    
    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;
    
    --info: #3b82f6;
    
    /* درجات الرمادي والأساسيات - الوضع الفاتح (افتراضي) */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0e1e25;
    --sidebar-text: #e2e8f0;
    --sidebar-text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05), 0 0 0 1px rgb(0 0 0 / 0.02);
    --card-shadow-hover: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08), 0 0 0 1px rgb(0 0 0 / 0.03);
    
    --font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 12px;
}

/* الوضع الداكن */
body.dark-theme {
    --bg-main: #0b1319;
    --bg-card: #15222b;
    --border-color: #243542;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --card-shadow: 0 4px 20px 0 rgb(0 0 0 / 0.3);
    --card-shadow-hover: 0 10px 25px 0 rgb(0 0 0 / 0.4);
}

/* التنسيق العام وعناصر الصفحة */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background-color: var(--primary-light);
    border-radius: 20px;
}

body {
    direction: rtl;
    text-align: right;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background-color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

/* تخطيط الصفحة الرئيسي */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

/* القائمة الجانبية (Sidebar) */
.sidebar {
    width: 270px;
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 25px rgb(0 0 0 / 0.15);
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background-color: rgba(var(--secondary-rgb), 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(var(--secondary-rgb), 0.3);
}

.sidebar-logo svg {
    width: 24px;
    height: 24px;
    fill: var(--secondary);
}

.sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.4;
}

.sidebar-subtitle {
    font-size: 10px;
    color: var(--sidebar-text-muted);
    font-weight: 400;
}

.sidebar-menu {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.menu-item svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: var(--transition);
}

.menu-item:hover, .menu-item.active {
    color: #ffffff;
    background-color: rgba(var(--primary-rgb), 0.15);
}

.menu-item.active {
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25);
    font-weight: 600;
}

.menu-item.active svg {
    stroke: #ffffff;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    color: var(--sidebar-text-muted);
    text-align: center;
}

/* المحتوى الرئيسي (Main Content) */
.main-wrapper {
    flex: 1;
    margin-right: 270px; /* نفس عرض السايدبار */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px 32px;
    transition: var(--transition);
}

/* الهيدر العلوي */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.header-title-section h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
}

.header-title-section p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* الأزرار المتميزة */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
}

.btn-secondary:hover {
    background-color: rgba(var(--primary-rgb), 0.15);
}

.btn-success {
    background-color: var(--secondary);
    color: #ffffff;
}

.btn-success:hover {
    background-color: #0d9488;
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

body.dark-theme .btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.btn-icon {
    padding: 8px;
    border-radius: 8px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background-color: var(--border-color);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* البطاقات والشبكات (Cards & Grids) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    opacity: 0.7;
}

.stat-card.success::after { background: var(--secondary); }
.stat-card.danger::after { background: var(--danger); }
.stat-card.warning::after { background: var(--warning); }

.stat-info h3 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.stat-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-card.primary .stat-icon { background-color: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.stat-card.success .stat-icon { background-color: rgba(var(--secondary-rgb), 0.1); color: var(--secondary); }
.stat-card.danger .stat-icon { background-color: rgba(var(--danger-rgb), 0.1); color: var(--danger); }
.stat-card.warning .stat-icon { background-color: rgba(var(--warning-rgb), 0.1); color: var(--warning); }

/* الأقسام والصفحات (Sections) */
.app-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.app-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* شبكة محتويات الداشبورد والصفحات الكبيرة */
.layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    position: relative;
    transition: var(--transition);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title svg {
    width: 20px;
    height: 20px;
    stroke: var(--primary);
    fill: none;
    stroke-width: 2;
}

/* الرسوم البيانية SVG */
.chart-container {
    height: 260px;
    position: relative;
    width: 100%;
}

.chart-svg {
    width: 100%;
    height: 100%;
}

.chart-bar {
    fill: var(--primary);
    rx: 4;
    transition: var(--transition);
    cursor: pointer;
}

.chart-bar:hover {
    fill: var(--primary-light);
    filter: drop-shadow(0 4px 6px rgba(var(--primary-rgb), 0.2));
}

.chart-grid-line {
    stroke: var(--border-color);
    stroke-width: 1;
    stroke-dasharray: 4,4;
}

.chart-label {
    fill: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    text-anchor: middle;
}

.chart-axis-line {
    stroke: var(--border-color);
    stroke-width: 1.5;
}

/* قائمة المستشفيات (Hospitals Grid) */
.hospitals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.hospital-card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 180px;
}

.hospital-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--primary-light);
}

.hospital-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.hospital-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background-color: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hospital-icon svg {
    width: 22px;
    height: 22px;
}

.hospital-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
}

.hospital-card-stats {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: 16px;
}

.hospital-stat-item {
    text-align: center;
}

.hospital-stat-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.hospital-stat-label {
    font-size: 10px;
    color: var(--text-muted);
}

/* واجهة المستشفى الفردية */
.hospital-detail-header {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.hospital-detail-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hospital-detail-title h2 {
    font-size: 20px;
    font-weight: 700;
}

.hospital-detail-title p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.hospital-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    gap: 16px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* الجداول المتطورة */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    font-size: 13px;
}

th {
    background-color: rgba(var(--primary-rgb), 0.04);
    color: var(--text-main);
    font-weight: 700;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

body.dark-theme tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

/* الشارات (Badges) */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.badge-success { background-color: rgba(16, 185, 129, 0.12); color: #059669; }
.badge-warning { background-color: rgba(245, 158, 11, 0.12); color: #d97706; }
.badge-danger { background-color: rgba(239, 68, 68, 0.12); color: #dc2626; }
.badge-info { background-color: rgba(59, 130, 246, 0.12); color: #2563eb; }
.badge-neutral { background-color: rgba(100, 116, 139, 0.12); color: #475569; }

/* عناصر الإدخال والاستمارات */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.form-control, .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* النوافذ المنبثقة (Modals) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeInModal 0.25s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
    position: relative;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.2), 0 8px 10px -6px rgb(0 0 0 / 0.2);
    animation: slideUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUpModal {
    from { transform: translateY(40px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* التقويم (Calendar View) */
.calendar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-card);
    padding: 16px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.calendar-month-title {
    font-size: 16px;
    font-weight: 700;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day-header {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 8px 0;
}

.calendar-day {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 95px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
}

.calendar-day:hover {
    border-color: var(--primary-light);
}

.calendar-day.other-month {
    opacity: 0.4;
    background-color: rgba(0, 0, 0, 0.01);
}

.calendar-day-num {
    font-size: 12px;
    font-weight: 600;
    align-self: flex-end;
}

.calendar-day-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
    overflow-y: auto;
    max-height: 60px;
}

.calendar-event-indicator {
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 3px;
    color: #ffffff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* منطقة استيراد الملفات وجلب OVR */
.import-box {
    border: 2px dashed var(--border-color);
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.005);
    transition: var(--transition);
    margin-bottom: 20px;
}

.import-box:hover {
    border-color: var(--primary);
    background-color: rgba(var(--primary-rgb), 0.02);
}

.import-box svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-muted);
    margin-bottom: 12px;
    fill: none;
    stroke-width: 1.5;
}

.import-box h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
}

.import-box p {
    font-size: 11px;
    color: var(--text-muted);
}

/* شاشة البحث والأرشيف */
.search-bar-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-input-container {
    position: relative;
    flex: 1;
}

.search-input-container svg {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 2;
}

.search-input-container .form-control {
    padding-right: 42px;
}

/* رفع الملفات وسجل الملفات */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: rgba(var(--primary-rgb), 0.03);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-item-info svg {
    width: 18px;
    height: 18px;
    stroke: var(--primary);
    fill: none;
    stroke-width: 2;
}

.file-delete-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
}

/* تتبع الجدول الزمني للـ RCA والتوصيات */
.timeline-tracker {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.timeline-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
}

.timeline-step::before {
    content: '';
    position: absolute;
    right: 9px;
    top: 20px;
    bottom: -20px;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-step:last-child::before {
    display: none;
}

.timeline-bullet {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.timeline-step.completed .timeline-bullet {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.timeline-step.completed .timeline-bullet svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: #ffffff;
    stroke-width: 3;
}

.timeline-step.in-progress .timeline-bullet {
    border-color: var(--warning);
    background-color: var(--warning);
}

.timeline-content {
    flex: 1;
    min-width: 0;
    background-color: rgba(0, 0, 0, 0.005);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    word-wrap: break-word;
}

body.dark-theme .timeline-content {
    background-color: rgba(255, 255, 255, 0.005);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.timeline-title {
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.4;
    word-break: break-word;
    flex: 1;
}

.timeline-date {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.timeline-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* تنسيقات الطباعة المخصصة */
@media print {
    body {
        background-color: #ffffff;
        color: #000000;
        font-size: 12pt;
    }
    
    .sidebar, .top-header .header-actions, .btn, .modal, .modal-overlay, .import-box, .search-bar-wrapper {
        display: none !important;
    }
    
    .main-wrapper {
        margin-right: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
        page-break-inside: avoid;
    }
    
    table {
        border: 1px solid #000000 !important;
    }
    
    th, td {
        border-bottom: 1px solid #000000 !important;
        padding: 8px !important;
        color: #000000 !important;
    }
    
    th {
        background-color: #eaeaea !important;
    }
    
    .badge {
        border: 1px solid #000000 !important;
        background: transparent !important;
        color: #000000 !important;
        padding: 2px 4px !important;
    }
}

/* مؤشر التحميل */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background-color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

body.dark-theme .loader-overlay {
    background-color: rgba(11, 19, 25, 0.85);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(var(--primary-rgb), 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

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

/* تنسيق خاص بقائمة جهات الاتصال */
.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.contact-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.contact-details h4 {
    font-size: 13.5px;
    font-weight: 700;
    margin-bottom: 2px;
}

.contact-details p {
    font-size: 11px;
    color: var(--text-muted);
}

.contact-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.text-danger {
    color: var(--danger) !important;
}

.text-success {
    color: var(--secondary) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: var(--bg-sidebar);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInToast 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.toast.success {
    border-right: 4px solid var(--secondary);
}

.toast.error {
    border-right: 4px solid var(--danger);
}

/* تنسيقات شاشة القفل وتأمين الدخول (Lock Screen Styles) */
.lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.4s ease, visibility 0.4s;
}

body.dark-theme .lock-screen {
    background-color: rgba(10, 15, 20, 0.85);
}

.lock-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 40px 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    animation: lockScaleUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lockScaleUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lock-logo {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.lock-logo svg {
    width: 38px;
    height: 38px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.lock-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.lock-subtitle {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 24px;
    font-weight: 500;
}

.lock-info-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}

.lock-screen .form-control {
    font-size: 14px;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.01);
}

body.dark-theme .lock-screen .form-control {
    background-color: rgba(255, 255, 255, 0.02);
}

.lock-screen .btn-primary {
    padding: 12px;
    font-size: 13.5px;
    border-radius: 8px;
    font-weight: 700;
}
