:root {
    --irtiqaa-purple: #6f42c1;
    --irtiqaa-purple-light: #8e67d5;
    --irtiqaa-gold: #d4a017;
    --irtiqaa-gold-dark: #b88a12;
    --sidebar-bg: #2c3e50;
    --content-bg: #f0f2f5;
    --sidebar-width: 250px;
    --white: #ffffff;
    --success-green: #28a745;
    --danger-red: #dc3545;
    --shadow: 0 4px 15px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; }

body { 
    margin: 0; 
    font-family: 'Segoe UI', Tahoma, sans-serif; 
    background: var(--content-bg); 
    direction: rtl; 
}

.app-layout { display: flex; width: 100%; min-height: 100vh; }

/* --- القائمة الجانبية (Sidebar) المحسنة --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--white);
    position: fixed;
    height: 100vh;
    right: 0;
    z-index: 100;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
}

/* ضبط حجم الشعار */
.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    width: 120px; /* حجم متناسق للشعار */
    height: auto;
    border-radius: 8px;
}

/* تنسيق الروابط داخل القائمة */
.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    border-right: 4px solid transparent;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.sidebar-nav a i {
    margin-left: 12px;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* حالة الرابط النشط */
.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    border-right-color: var(--irtiqaa-gold);
    color: var(--irtiqaa-gold);
}

/* عند تمرير الماوس */
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.05);
    color: var(--irtiqaa-gold);
    padding-right: 25px; /* تأثير حركة بسيط */
}

/* --- المحتوى الرئيسي --- */
.main-content { 
    margin-right: var(--sidebar-width); 
    flex: 1; 
    padding: 25px; 
    min-width: 0; /* لمنع تمدد العناصر خارج الصفحة */
}

.top-bar {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    background: var(--white);
    padding: 15px 25px; 
    border-radius: 12px; 
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

/* --- البطاقات والجداول --- */
.card { 
    background: var(--white); 
    border-radius: 12px; 
    box-shadow: var(--shadow); 
    padding: 20px; 
    margin-bottom: 25px; 
}

.probe-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    background: var(--irtiqaa-purple); 
    color: white;
    padding: 15px 20px; 
    border-radius: 12px 12px 0 0; 
    margin: -20px -20px 20px -20px;
}

.irtiqaa-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.irtiqaa-table th { background: #f8f9fa; color: var(--irtiqaa-purple); padding: 12px; border: 1px solid #dee2e6; }
.irtiqaa-table td { padding: 10px; border: 1px solid #dee2e6; text-align: center; }

/* إضافات جمالية للمدخلات */
.styled-select {
    width: 100%; padding: 10px; border-radius: 8px; border: 2px solid #e0e4e8;
    background: white; cursor: pointer; transition: 0.3s;
}

.btn-save-gold {
    background: var(--irtiqaa-gold); color: white; border: none;
    padding: 10px 25px; border-radius: 30px; cursor: pointer; font-weight: bold;
    transition: 0.3s;
}

.btn-save-gold:hover { background: var(--irtiqaa-gold-dark); transform: translateY(-2px); }
/* --- تحديثات لتقليل الارتفاع والمساحات --- */

/* تأمين ابتعاد المحتوى عن القائمة الجانبية الثابتة */
.main-content { 
    margin-right: var(--sidebar-width); /* يضمن ابتعاد المحتوى مسافة 250px عن اليمين */
    flex: 1; 
    padding: 20px; 
    min-width: 0; 
    overflow-x: auto; /* يسمح بالتمرير الأفقي للجداول الطويلة دون التأثير على القائمة الجانبية */
}

/* تنسيق الفلاتر في سطر واحد */
.condensed-filter {
    padding: 10px 15px !important; /* تقليل الحشوة الداخلية */
    margin-bottom: 15px !important;
}

.filter-grid-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* توزيع متساوي للأعمدة الأربعة */
    gap: 15px;
    align-items: center;
}

.input-group-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group-inline label {
    white-space: nowrap; /* منع انكسار النص */
    font-size: 0.85rem;
    color: var(--irtiqaa-purple);
    font-weight: bold;
    min-width: fit-content;
}

/* تصغير حجم حقول الاختيار لتناسب السطر الواحد */
.styled-select-sm {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.85rem;
    border-radius: 6px;
    border: 1px solid #e0e4e8;
    background: white;
    cursor: pointer;
}

/* تحسين الجدول ليتناسب مع الأسماء الكبيرة والعلامات */
.probe-table th, .probe-table td {
    padding: 8px 4px !important;
    font-size: 0.85rem !important;
}

.table-responsive {
    overflow-x: auto;
    max-width: 100%;
    border-radius: 8px;
}

/* إخفاء الهيدر القديم إذا كنت تستخدم الـ top-bar الجديد */
header:not(.top-bar) {
    display: none; 
}
/* --- تنسيق نافذة النقل المحسن --- */

/* تأمين ابتعاد النافذة عن القائمة الجانبية (250px) وتوسيطها في المساحة المتبقية */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    /* ضمان أن المحتوى الداخلي يحترم الهامش الأيمن للقائمة الجانبية */
    padding-right: var(--sidebar-width); 
}

/* محتوى النافذة - عرض واسع للحقول الأفقية */
.modal-content-wide {
    background: white;
    margin: 10% auto;
    padding: 20px 25px;
    width: 90%; /* عرض مرن */
    max-width: 900px; /* حد أقصى لضمان الشكل الجمالي */
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    position: relative;
}

/* تنظيم الحقول في سطر واحد داخل النافذة */
.modal-grid-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* توزيع الحقول الأربعة بالتساوي */
    gap: 15px;
    margin-top: 15px;
}

.form-group-inline {
    display: flex;
    flex-direction: column; /* Label فوق الحقل ولكن الحقول بجانب بعضها */
    gap: 5px;
}

.form-group-inline label {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--irtiqaa-purple);
}

/* تنسيق أزرار النافذة بشكل مضغوط */
.btn-save-gold-sm, .btn-outline-sm {
    padding: 10px 25px;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: bold;
}

.btn-save-gold-sm {
    background: var(--irtiqaa-gold);
    color: white;
    border: none;
}

.btn-outline-sm {
    background: white;
    border: 1px solid #ddd;
    color: #666;
    margin-right: 10px;
}

.modal-footer {
    display: flex;
    justify-content: center; /* توسيط أزرار الإجراء */
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
/* تنسيق قسم اختيار المواد */
.subjects-selector-card {
    padding: 15px;
    margin-bottom: 15px !important;
    background-color: #f9f9fc;
}

.selector-header {
    margin-bottom: 12px;
    border-bottom: 1px solid #e0e4e8;
    padding-bottom: 8px;
}

.selector-header label {
    font-weight: bold;
    color: var(--irtiqaa-purple);
    font-size: 0.95rem;
}

.subjects-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); /* توزيع المواد أفقياً */
    gap: 12px;
}

.subject-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s ease;
}

.subject-item:hover {
    background: #fff;
    border-radius: 5px;
}

.subject-item label {
    cursor: pointer;
    font-size: 0.9rem;
    color: #444;
}

.subject-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--irtiqaa-gold); /* تلوين المربع بذهب ارتقاء */
}
.btn-danger-sm {
    background: var(--danger-red);
    color: white;
    border: none;
    padding: 6px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
    transition: 0.3s;
    margin-right: 5px;
}

.btn-danger-sm:hover {
    background: #bd2130;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}
.btn-excel-sm {
    background: #217346; /* لون برنامج Excel الرسمي */
    color: white;
    border: none;
    padding: 6px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
    transition: 0.3s;
    margin-right: 5px;
}

.btn-excel-sm:hover {
    background: #1a5a37;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 115, 70, 0.3);
}

.btn-excel-sm i {
    margin-left: 5px;
}

#userInfo {
    display: flex;
    align-items: center;
    gap: 15px;
}

#dashboardBtn {
    background-color: var(--irtiqaa-gold);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

#dashboardBtn:hover {
    background-color: var(--irtiqaa-purple);
    transform: translateY(-2px);
}