-table/* --- الدستور التقني: معايير الـ UI/UX الأساسية --- */

/* 1. القاعدة الذهبية لمنع التمرير الأفقي وضمان التجاوب */

* { 
    box-sizing: border-box; 
    max-width: 100%; 
}

body { 
    margin: 0; 
    padding: 0; 
    overflow-x: hidden; 
    width: 100%; 
    font-family: 'Almarai', sans-serif; /* تأكد من تعريف الخط */
}

        
/* 1. الشاشات الكبيرة جداً (Extra Large) - أقل من 1400px */
@media (max-width: 1399px) {
    /* التعديلات هنا ستؤثر على كل ما هو أصغر من 1400px */
}

/* 2. الحواسيب المحمولة (Large) - أقل من 992px */
@media (max-width: 991px) {
    .login-visual { display: none !important; } 
}

/* 3. الأجهزة اللوحية (Medium) - أقل من 768px */
@media (max-width: 767px) {
    .royal-banner-header { font-size: 1.2rem !important; }
    .card-body { padding: 15px !important; }
}

/* الحل الجذري لاحتواء كامل الصفحة على الموبايل */
@media (max-width: 676px) {
    /* 1. إجبار كافة العناصر على عدم تجاوز عرض الشاشة */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative !important;
        
    }


    /* 2. إلغاء أي عرض ثابت (Fixed Width) للمكونات الرئيسية */
    .container, .container-fluid, .content-wrapper, .row, section, div {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        box-sizing: border-box !important;
    }

    /* 3. التعامل مع عناصر الرسوم البيانية والصور التي تسبب التمدد */
    img, svg, canvas, .chart-container {
        max-width: 100% !important;
        height: auto !important;
    }

    /* 4. معالجة التذييل (Footer) الذي يظهر في الصورة الثانية */
    footer, .footer-wrapper {
        width: 100% !important;
        display: block !important;
    }
    img, .img-fluid {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        display: block !important;
    }

    /* 2. الأزرار والحاويات: إجبارها على التوسط وعدم تجاوز الحواف */
    .btn, .button-container {
        width: 90% !important;        /* تقليص العرض قليلاً لإعطاء هامش أمان */
        margin: 10px auto !important; /* توسيط الزر */
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* 3. إزالة أي Padding أو Margin جانبي زائد في العناصر الأم */
    .row, .col, .card {
        padding-right: 5px !important;
        padding-left: 5px !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    .header-actions { display: table; padding: 15px; }

}
/* =========================================
   1. المتغيرات (Root)
   ========================================= */
:root {
    --royal-olive: #2c5f2d;
    --olive-dark: #1a3320;
    --gold-accent: #c5a059;
    --white: #ffffff;
    --border-color: #eee;
    --side-nav-width: 280px;
    --soft-green-bg: #f4f7f4;
}

body {
    font-family: 'Almarai', sans-serif;
    direction: rtl;
    background-color: #f8fafb;
    margin: 0;
    padding: 0;
}

/* =========================================
   2. الهيكل (Layout) - الضبط الذهبي للمساحات
   ========================================= */
.center-wrapper {
    display: flex;
    justify-content: flex-start; /* تبدأ من اليمين */
    gap: 0; /* سنعتمد على الـ margins لضبط دقيق */
    padding: 0 0 50px 0; /* مسافة علوية كافية للهيدر */
    min-height: 100vh;
    width: 100%;
}

/* القائمة الجانبية (الشريط الأيمن) */
.center-navbar {
    height: calc(100vh - 70px); /* 70px هي طول الهيدر الأساسي */
    position: sticky;
    top: 70px;

     
    width: 340px;
    min-width: var(--side-nav-width);
    background: var(--white);
    border-radius: 15px; /* ملتصقة تماماً باليمين */
    border: 3px solid var(--border-color);
    border-right: none; 
     
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 15px rgba(0,0,0,0.02);
    margin-right: 2px; /* الالتصاق التام بحافة الشاشة اليمنى */
    margin-bottom: auto;
    line-height: 1.2rem;
}

/* المحتوى الرئيسي (المنطقة البيضاء) */
.center-content {
    flex: 1;
    background: var(--white);
    padding: 10px; /* زيادة التباعد الداخلي لراحة العين */
    border-radius: 30px;
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    min-width: 0; /* تمنع الجدول من كسر التصميم */
}

/* =========================================
   3. الروابط (Navigation) - حركة سوية ومستقرة
   ========================================= */
.nav-menu {
    list-style: none;
    padding: 15px;
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    color: #555;
    text-decoration: none !important;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    gap: 10px;
    margin-bottom: 9px;
}

.nav-link:hover {
    background: var(--soft-green-bg);
    color: var(--royal-gold);
    font-size: 1.1rem;
}

/* =========================================
   4. الجداول الملكية (Royal Tables)
   ========================================= */
.table-container-royal {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead tr {
    background-color: var(--royal-olive);
    color: white;
}

table th {
    color:  #c5a059;

    padding: 13px 15px;
    font-weight: 700;
    font-size: 1.1rem;
}

table td {
    padding: 15px;
    text-align: center;
    color: #444;
}

table tbody tr:hover {
    background-color: #fcfdfc;
}

/* =========================================
   5. كروت الإحصائيات (Stat Cards) - توزيع شبكي صحيح
   ========================================= */
.stat-cards-modern-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 أعمدة كما في الصور */
    gap: 20px;
    margin-bottom: 35px;
}

.stat-card-glass {
    padding: 25px;
    border-radius: 18px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 120px;
    transition: transform 0.2s ease;
}

.stat-card-glass.total { background: linear-gradient(135deg, var(--royal-olive), var(--olive-dark)); }
.stat-card-glass.new { background: linear-gradient(135deg, #c5a059, #a38345); }
.stat-card-glass.review { background: linear-gradient(135deg, #4a6fa5, #354f76); }
.stat-card-glass.ready { background: linear-gradient(135deg, #28a745, #1e7e34); }

.stat-content h4 { margin: 0; font-size: 1.2rem; opacity: 0.85; font-weight: 400; }
.stat-content p { margin: 10px 0 0; font-size: 2.2rem; font-weight: 900; line-height: 1; }
/* --- تصميم الترقيم الملكي (Royal Pagination) --- */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding: 20px 0;
}

.royal-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    padding: 10px 20px;
    border-radius: 50px; /* شكل بيضاوي أنيق */
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border: 1px solid rgba(197, 160, 89, 0.2); /* إطار ذهبي خفيف جداً */
}

.royal-pagination .page-link {
    text-decoration: none;
    color: var(--royal-olive);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 30px;
    transition: var(--transition);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* تأثير التمرير على الأزرار */
.royal-pagination .page-link:hover {
    background: var(--soft-green-bg);
    color: var(--gold-accent);
    border-color: var(--gold-accent);
    transform: translateY(-2px);
}

/* تمييز النص الحالي */
.royal-pagination .page-current {
    font-family: 'Almarai', sans-serif;

    font-size: 1.2rem;
    font-weight: 800;
    color: var(--olive-dark);
    padding: 0 15px;
    border-left: 2px solid #eee;
    border-right: 2px solid #eee;
    margin: 0 10px;
}

/* أيقونات الأسهم */
.royal-pagination .page-link i {
    font-size: 0.7rem;
}
/* دفع الفوتر لأسفل القائمة */
.sidebar-footer {
    margin-top: -34px; /* هذا هو السر الذي يدفعه للأسفل */
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fcfcfc;
    border-radius: 0 0 20px 0;
}

.user-avatar {
    width: 40px;
    height: 25px;
    background: var(--royal-olive);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.user-details p {
    font-size: 1.2rem;
    margin: 0;
    color: #333;
    line-height: 1;
}

.user-details small {
    font-size: 1.1rem;
    color: #888;
}
/* رأس الصفحة الملكي */
    .dashboard-header {
        background: linear-gradient(135deg, var(--royal-black) 0%, var(--royal-olive) 100%);
        padding: 45px;
        border-radius: 25px;
        color: white;
        margin-bottom: 40px;
        box-shadow: var(--card-shadow);
        border-bottom: 5px solid var(--royal-gold);
        position: relative;
    }

    .dashboard-header h1 { font-weight: 800; color: var(--royal-gold); }

    
    /* تحسينات عامة */  
    /* --- المتغيرات الملكية --- */
:root {
    --royal-olive: #1b3022;
    --royal-gold: #c5a059;
    --royal-black: #121212;
    --soft-gold: rgba(197, 160, 89, 0.15);
    --card-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

/* --- صندوق البحث الملكي --- */
.royal-search-wrapper { flex-grow: 1; max-width: 450px; }
.search-box {
    position: relative;
    background: rgba(255,255,255,0.08);
    border-radius: 50px;
    border: 1px solid var(--royal-gold);
    padding: 2px 20px;
    display: flex;
    align-items: center;
    backdrop-filter: blur(10px);
}
.search-icon { color: var(--royal-gold); margin-left: 10px; }
.search-input {
    border: none !important;
    outline: none !important;
    width: 100%;
    padding: 10px;
    background: transparent !important;
    color: white !important;
    font-size: 1rem;
}

/* --- تنسيق الجداول --- */
.table-container {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(197, 160, 89, 0.1);
}

.royal-table-compact { width: 100%; border-collapse: collapse; }
.royal-table-compact thead th {
    background: var(--royal-black);
    color: var(--royal-gold);
    padding: 18px;
    text-align: center;
    font-weight: 800;
    font-size: 0.9rem;
    border-bottom: 3px solid var(--royal-gold);
}

.royal-table-compact tbody td {
    padding: 15px;
    vertical-align: middle;
    text-align: center;
    border-bottom: 1px solid #f2f2f2;
}

.avatar-circle {
    width: 40px; height: 40px;
    background: #f8f9fa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    border: 2px solid var(--soft-gold);
}

.user-name { font-weight: 700; color: var(--royal-olive); }

/* --- الأزرار والأوسمة --- */
.role-badge-royal {
    background: var(--soft-gold);
    color: var(--royal-olive);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid rgba(197, 160, 89, 0.3);
}

.action-btn-circle {
    width: 35px; height: 35px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 3px;
    transition: 0.3s ease;
    text-decoration: none !important;
}

.btn-view-gold { background: #fdf8ef; color: #b8860b; border: 1px solid #f1e0b9; }
.btn-edit-olive { background: #eff3f0; color: var(--royal-olive); border: 1px solid #d1dbd3; }
.btn-delete-red { background: #fff5f5; color: #d93025; border: 1px solid #fad2d2; }

.action-btn-circle:hover { transform: translateY(-2px); filter: brightness(0.9); }

/* --- الترقيم --- */
.royal-pagination { display: flex; justify-content: center; gap: 8px; margin-top: 25px; }
.page-link-royal {
    padding: 8px 16px; background: white; border-radius: 8px;
    color: var(--royal-olive); font-weight: 700; border: 1px solid #ddd; text-decoration: none;
}
.page-current-royal {
    padding: 8px 16px; background: var(--royal-gold); color: var(--royal-black);
    border-radius: 8px; font-weight: 800;
}

/* --- إضافات خاصة بصفحة الممثلين --- */

.avatar-ring {
    border: 2px solid var(--royal-gold);
    padding: 2px;
    border-radius: 50%;
    display: inline-block;
}

.avatar-circle-inner {
    width: 40px;
    height: 40px;
    background: #f8f9fa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inst-name-tag {
    font-weight: 700;
    color: #2c5f2d;
    font-size: 0.9rem;
}

.sector-badge {
    font-size: 0.65rem !important;
    vertical-align: middle;
}

.inst-info-box {
    background: #fdfcf9;
    border-right: 4px solid var(--royal-gold);
    padding: 6px 12px;
    border-radius: 8px;
    margin-bottom: 5px;
    text-align: right;
    font-size: 0.85rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--soft-gold);
}

.empty-state i {
    opacity: 0.5;
}

.empty-state h4 {
    color: #888;
    font-weight: 600;
}

/* زر الإجراء الملكي الموحد */
.btn-royal-action {
    background: var(--royal-gold);
    color: var(--royal-black) !important;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 800;
    text-decoration: none !important;
    transition: 0.3s;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-royal-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(197, 160, 89, 0.4);
    filter: brightness(1.1);
}

/* --- زر العودة الملكي --- */
.btn-royal-back {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: white;
    color: var(--royal-olive);
    border: 1.5px solid var(--soft-gold);
    border-radius: 12px;
    text-decoration: none !important;
    font-weight: 700;
    transition: 0.3s;
}
.btn-royal-back:hover {
    background: var(--royal-gold);
    color: var(--royal-black);
    transform: translateX(-5px);
}

/* --- حاوية الإشعارات --- */
.notifications-container {
    max-width: 900px;
    margin: 0 auto;
}

.notifications-card-wrapper {
    background: white;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    border: 1px solid rgba(197, 160, 89, 0.1);
}

.notification-item {
    display: flex;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #f0f0f0;
    transition: 0.2s;
    position: relative;
}

.notification-item:last-child { border-bottom: none; }

.notification-item:hover {
    background: #fdfcf9;
}

.unread-item {
    background: rgba(197, 160, 89, 0.04);
    border-right: 4px solid var(--royal-gold);
}

.notif-icon {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 12px;
    margin-left: 20px;
    font-size: 1.2rem;
}

.notif-body { flex-grow: 1; text-align: right; }

.actor-name {
    color: var(--royal-olive);
    font-weight: 800;
}

.notif-text {
    margin-bottom: 5px;
    color: #444;
    font-size: 1rem;
}

.notif-time {
    font-size: 0.8rem;
    color: #999;
}

/* لون ذهبي مخصص للأيقونات */
.text-gold { color: var(--royal-gold); }

/* --- لمسات ملكية إضافية لسجل التدريب --- */

.text-olive { color: var(--royal-olive) !important; }

.date-badge {
    background: #f8f9fa;
    color: var(--royal-black);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
    border: 1px solid #eee;
}

.duration-tag {
    background: white;
    border: 1px solid var(--soft-gold);
    padding: 3px 12px;
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--royal-olive);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* كبسولات الحالة */
.status-badge-royal {
    padding: 6px 15px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-attended { 
    background: #e6fffa; 
    color: #1b4d3e; 
    border: 1px solid #b2f5ea; 
}

.status-missed { 
    background: #fff5f5; 
    color: #a02626; 
    border: 1px solid #feb2b2; 
}

/* تعديل هيدر الجدول ليكون أكثر فخامة */
.royal-table-compact thead th {
    background: linear-gradient(90deg, #0a0f0b 0%, #1b3022 100%) !important;
    color: var(--royal-gold) !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.royal-welcome-banner {
    background: linear-gradient(135deg, var(--royal-black) 0%, var(--royal-olive) 100%);
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    padding: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-right: 8px solid var(--royal-gold);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    margin-bottom: 35px;
}
.royal-welcome-banner .welcome-text {
    color: white;       
    max-width: 60%;
}
    .banner-title { font-size: 1.8rem; font-weight: 800; color: var(--gold-accent); }
  /* --- الأزرار الملكية للأكشن --- */
.action-btn-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.1);
}

.action-btn-circle:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

/* 1. زر العرض الذهبي (الملكي) */
.btn-view-gold {
    background: #fff;
    color: #c5a059;
    border-color: #c5a059;
}
.btn-view-gold:hover {
    background: #c5a059;
    color: #fff;
}

/* 2. زر التعديل الزيتوني */
.btn-edit-olive {
    background: #fff;
    color: #1b3022;
    border-color: #1b3022;
}
.btn-edit-olive:hover {
    background: #1b3022;
    color: #c5a059; /* لمسة ذهبية عند المرور */
}

/* 3. زر الحذف (الأحمر) بلمسة احترافية */
.btn-delete-red {
    background: #fff;
    color: #a33;
    border-color: #a33;
}
.btn-delete-red:hover {
    background: #a33;
    color: #fff;
}  

    /* كارت النموذج */
    .staff-card-royal {
        font-size: 1.3rem;
        background: #ffffff !important;
        padding: 50px !important;
        border-radius: 30px !important;
        box-shadow: 0 20px 40px rgba(0,0,0,0.08) !important;
        border: 1px solid rgba(197, 160, 89, 0.2) !important;
    }








    :root {
        --royal-olive: #1b3022;
        --royal-gold: #c5a059;
        --royal-black: #121212;
        --soft-gold: rgba(197, 160, 89, 0.15);
        --card-shadow: 0 15px 35px rgba(0,0,0,0.1);
    }
/* إصلاح جذري للتنبيهات (تم تحريك التنسيق ليصبح عاماً) */
    .notifications-dropdown {
        display: none;
        position: fixed !important;
        z-index: 99999 !important;
        background: white;
        border: 1px solid var(--royal-gold);
        border-radius: 20px;
        box-shadow: 0 20px 40px rgba(0,0,0,0.2);
        width: 320px;
        max-height: 400px;
        overflow-y: auto;
        padding: 15px;
    }
    .notifications-dropdown.show { display: block !important; }
    /* قاعدة الدستور التقني لمنع تجاوز العرض */
    * { box-sizing: border-box; max-width: 100%; }
    
    body { 
        direction: rtl; 
        text-align: right; 
        background-color: #f4f6f5; 
        margin: 0; 
        padding: 0;
        overflow-x: hidden; 
    }

    .dashboard-wrapper { 
        animation: fadeIn 0.8s ease; 
        font-family: 'Almarai', sans-serif; 
        padding: 20px; 
        width: 100%;
    }

    /* رأس الصفحة */
    .dashboard-header {
        background: linear-gradient(135deg, var(--royal-black) 0%, var(--royal-olive) 100%);
        padding: 40px;
        border-radius: 25px;
        color: white;
        margin-bottom: 30px;
        box-shadow: var(--card-shadow);
        border-bottom: 5px solid var(--royal-gold);
    }

    /* كروت KPI المتجاوبة */
   /* الحاويات */
    .dashboard-wrapper { width: 100%; padding: 20px; animation: fadeIn 0.8s ease; }
    .kpi-grid { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 30px; }
    .kpi-card { background: white; padding: 25px; border-radius: 20px; box-shadow: var(--card-shadow); flex: 1 1 200px; border-top: 4px solid var(--royal-olive); text-align: center; }
    .charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 20px; }
    .chart-card {font-size: 0.45rem; background: white; padding: 10px; border-radius: 25px; box-shadow: var(--card-shadow); min-height: 400px; }

    .kpi-card:hover { transform: translateY(-5px); }

   
  

    /* تحسين الخطوط */
    .kpi-value { font-size: 2rem; font-weight: 800; color: var(--royal-olive); display: block; }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }

    /* ضبط خاص للهواتف */
    @media (max-width: 767px) {
        .dashboard-header { padding: 20px; }
        .kpi-value { font-size: 1.5rem; }
    }
