/**
 * نظام الحضور - الأنماط الرئيسية الموحدة
 * تاريخ التحديث: 2025-04-18
 */

/******************************
 * 1. المتغيرات والقيم الأساسية
 ******************************/
:root {
    /* الألوان الأساسية */
    --primary: #3490dc;
    --primary-dark: #2779bd;
    --primary-light: rgba(13, 110, 253, 0.1);
    --secondary: #6cb2eb;
    --success: #38c172;
    --success-light: rgba(25, 135, 84, 0.1);
    --info: #6cb2eb;
    --info-light: rgba(13, 202, 240, 0.1);
    --warning: #ffed4a;
    --warning-light: rgba(255, 193, 7, 0.1);
    --danger: #e3342f;
    --light: #f8f9fa;
    --dark: #343a40;
    --dark-light: #6c757d;
    
    /* خصائص عامة */
    --border-radius: 8px;
    --border-radius-lg: 15px;
    --border-radius-sm: 4px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    
    /* تباعدات */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* خصائص النص */
    --font-family: 'Tajawal', 'Segoe UI', Tahoma, 'Helvetica Neue', Arial, sans-serif;
    --font-size-sm: 0.85rem;
    --font-size: 1rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    
    /* أبعاد عناصر الواجهة */
    --sidebar-width: 280px;
    --sidebar-width-sm: 240px;
}

/******************************
 * 2. إعدادات أساسية
 ******************************/
html, body {
    direction: rtl;
    font-family: var(--font-family);
    text-align: right;
}

body {
    background-color: var(--light);
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    position: relative;
}

h1, h2, h3, h4, h5, h6 {
    color: #2d3748;
    font-weight: 600;
}

.page-title {
    font-weight: bold;
    color: #3b5998;
    margin-bottom: var(--spacing-lg);
}

/* معالجة القوائم والأزرار للدعم الكامل للغة العربية */
.dropdown-menu {
    text-align: right;
}

.btn-group > .btn:first-child {
    margin-right: 0;
}

/******************************
 * 3. القائمة الجانبية
 ******************************/

/* التنسيق العام للقائمة الجانبية */
.main-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

.sidebar-container {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background-color: var(--dark);
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1030;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-container {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.logo-icon {
    font-size: 30px;
    color: var(--primary);
    filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.1));
}

.app-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: white;
}

.user-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    padding: 8px;
}

/* عناصر القائمة */
.sidebar-item {
    padding: 12px 16px;
    color: #ced4da;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding-right: 22px;
}

.sidebar-item.active {
    background-color: var(--primary);
    color: #fff;
    border-right: 4px solid #fff;
}

.sidebar-group {
    margin-bottom: 10px;
}

.sidebar-group-title {
    padding: 12px 16px;
    font-size: 0.8rem;
    color: #adb5bd;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* محتوى الموقع */
.content-container, #main-content {
    width: calc(100% - var(--sidebar-width));
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    transition: all 0.3s ease;
    float: left;
}

.content-area {
    padding: 20px;
    width: 100%;
}

/* زر القائمة */
.toggle-sidebar {
    display: none;
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1031;
    background: var(--dark);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

/******************************
 * 4. نقاط الكسر للشاشات المختلفة
 ******************************/

/* تنسيقات الشاشات المتوسطة والكبيرة */
@media (min-width: 768px) {
    #sidebar {
        width: 250px;
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        z-index: 999;
        transition: all 0.3s;
    }

    #content {
        width: calc(100% - 250px);
        margin-right: 250px;
        transition: all 0.3s;
    }

    #content.active {
        width: 100%;
        margin-right: 0;
    }

    #sidebar.active {
        margin-right: -250px;
    }
}

/* تنسيقات الشاشات الصغيرة */
@media (max-width: 767.98px) {
    #sidebar {
        width: 250px;
        position: fixed;
        top: 0;
        right: -250px;
        height: 100vh;
        z-index: 999;
        transition: all 0.3s;
    }

    #sidebar.active {
        right: 0;
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    }

    #content {
        width: 100%;
        margin-right: 0;
        transition: all 0.3s;
    }

    #sidebarCollapse {
        display: block;
    }
}

@media (max-width: 767.98px) {
    .tag-color-display {
        width: 25px;
        height: 25px;
    }
    
    .tag-name {
        font-size: 14px;
        padding: 0;
    }
    
    .btn-group-sm > .btn {
        font-size: 12px;
        padding: 0.25rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .table-tags .mobile-hide {
        display: none;
    }
    
    .tag-actions .btn-text {
        display: none;
    }
}

/******************************
 * 5. البطاقات والحاويات
 ******************************/

.card {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: none;
    margin-bottom: 25px;
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background-color: #fff;
    padding: 1rem 1.25rem;
}

.card-header.bg-primary {
    background-color: var(--primary) !important;
    color: white;
}

.card-body {
    padding: 1.25rem;
}

.content-area .container,
.content-area .container-fluid {
    padding-right: 15px;
    padding-left: 15px;
    width: 100%;
}

/******************************
 * 6. الجداول
 ******************************/

.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    background-color: var(--light);
    border-bottom: 1px solid #e9ecef;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

.table th, .table td {
    text-align: right;
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

/******************************
 * 7. النماذج والإدخالات
 ******************************/

.form-control {
    border-radius: var(--border-radius-sm);
}

.form-control:focus {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.input-group {
    direction: ltr;
}

.input-group > * {
    direction: rtl;
}

.input-group-text {
    background-color: var(--light);
}

/* إصلاحات للـ RTL */
.input-group .form-control:first-child,
.input-group-addon:first-child,
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .dropdown-toggle,
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle) {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group .form-control:last-child,
.input-group-addon:last-child,
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .dropdown-toggle,
.input-group-btn:first-child > .btn:not(:first-child) {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/******************************
 * 8. تصنيفات (Tags)
 ******************************/

/* تصميم عرض التصنيفات */
.tag-color-display {
    display: inline-block;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    margin-left: 5px;
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tag-name {
    font-weight: 500;
    color: var(--dark);
    padding: 5px 8px;
    border-radius: var(--border-radius-sm);
    background-color: rgba(0, 0, 0, 0.03);
    display: inline-block;
}

.tag-stats-card .card-body {
    padding: 1rem;
}

.tag-label {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 20px;
    margin-right: 5px;
    margin-bottom: 5px;
    font-size: 0.85rem;
    white-space: nowrap;
    border: 1px solid transparent;
}

.tag-label .tag-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 5px;
}

/* تحسين عرض الجداول لصفحات التصنيفات */
.table-tags td {
    vertical-align: middle;
}

/* توزيع المساحة في صفحات التصنيفات */
@media (max-width: 767.98px) {
    .tag-color-display {
        width: 20px;
        height: 20px;
    }
    
    .tag-name {
        font-size: 0.9rem;
        padding: 3px 6px;
    }
    
    /* تحسين أزرار الإجراءات في الجداول على الأجهزة المحمولة */
    .btn-group-sm > .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* إخفاء بعض أعمدة الجدول في الشاشات الصغيرة جدًا */
    @media (max-width: 480px) {
        .table-tags .mobile-hide {
            display: none;
        }
        
        .tag-actions .btn-text {
            display: none;
        }
    }
}

/******************************
 * 9. النوافذ المنبثقة
 ******************************/

.modal-backdrop {
    z-index: 1040 !important;
}

.modal {
    z-index: 1050 !important;
}

.modal-dialog {
    margin-top: 100px;
}

.modal-content {
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-radius: 10px 10px 0 0;
}

.btn-close {
    opacity: 1;
    padding: 0.5rem;
}

/******************************
 * 10. أزرار التنقل بين الصفحات
 ******************************/

.pagination {
    margin-bottom: 0;
}

.pagination svg {
    width: 12px !important;
    height: 12px !important;
}

.pagination .page-link {
    padding: 0.2rem 0.5rem;
    font-size: 14px;
}

.pagination .page-link svg {
    max-width: 12px;
    max-height: 12px;
}

.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    padding: 0.1rem 0.4rem;
}

.pagination .page-item.disabled .page-link {
    padding: 0.1rem 0.4rem;
}

.w-5.h-5 {
    width: 16px !important;
    height: 16px !important;
}

.pagination nav > div:first-child > span,
.pagination nav > div:first-child > a {
    display: flex;
    align-items: center;
    justify-content: center;
}

/******************************
 * 11. تنسيقات شريط التقدم
 ******************************/

.progress {
    height: 10px;
    background-color: #f0f0f0;
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

.progress-bar {
    border-radius: 10px;
}

/******************************
 * 12. تنسيقات التصنيفات (Tags)
 ******************************/

.badge {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 50px;
}

.btn-group .btn {
    padding: 0.25rem 0.5rem;
    margin: 0 1px;
}

/* البطاقات الإحصائية */
.stats-card {
    display: flex;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

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

.stats-icon {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.8rem;
}

.stats-details {
    display: flex;
    flex-direction: column;
}

.stats-number {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 5px;
    line-height: 1.2;
}

.stats-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Background colors for different statuses */
.bg-primary {
    background-color: #4e73df;
}

.bg-success {
    background-color: #1cc88a;
}

.bg-warning {
    background-color: #f6c23e;
}

.bg-danger {
    background-color: #e74a3b;
}

/* Page headers and titles */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0;
}

.add-task-btn {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
}

.add-task-btn i {
    margin-right: 0.5rem;
}

/* Chart containers */
.chart-container {
    position: relative;
    margin: auto;
    height: 300px;
}

/******************************
 * 13. تنسيقات خاصة بـselect2
 ******************************/

.select2-selection__choice {
    background-color: #f0f0f0 !important;
    color: #000 !important;
    border: 1px solid #aaa !important;
}

.select2-selection__choice span,
.select2-selection__choice__display,
.select2-selection__choice * {
    color: #000 !important;
}

.select2-selection__choice__remove {
    color: #333 !important;
    background-color: rgba(255,255,255,0.5) !important;
}

.select2-dropdown {
    border-radius: 6px !important;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid #d6e0f5 !important;
    overflow: hidden;
}

/******************************
 * 14. تنسيقات صفحة لوحة المعلومات
 ******************************/

/* تنسيقات شارات الحضور */
.attendance-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    margin-top: 0.5rem;
}

.badge-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.badge-danger {
    background-color: #f8d7da;
    color: #842029;
}

.badge-warning {
    background-color: #fff3cd;
    color: #664d03;
}

.badge-info {
    background-color: #cff4fc;
    color: #055160;
}

/* تحسين مظهر الجداول في لوحة المعلومات */
.dashboard-table th {
    font-weight: 600;
    background-color: #f8f9fa;
    padding: 0.6rem;
    font-size: 0.9rem;
}

.dashboard-table td {
    padding: 0.7rem 0.6rem;
    font-size: 0.9rem;
}

/* تنسيقات بطاقات المهام والفعاليات */
.task-item, .event-item, .leave-item {
    transition: background-color 0.3s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.task-item:hover, .event-item:hover, .leave-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.task-description, .leave-reason {
    font-size: 0.85rem;
    line-height: 1.4;
}

/* تنسيقات الأيقونات في البطاقات */
.task-icon, .event-icon, .leave-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.03);
    color: #6c757d;
}

/* تنسيقات خاصة لجدول الحضور */
.attendance-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-card {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.075);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 1rem;
}

/* تحسين شكل العنوان الرئيسي */
.dashboard-welcome {
    background: linear-gradient(45deg, #2d3748, #4a5568);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.dashboard-welcome h2 {
    margin-bottom: 0.5rem;
    color: white;
    font-weight: 700;
}

.dashboard-welcome p {
    margin-bottom: 0;
    opacity: 0.9;
}

.dashboard-welcome::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(50%, -50%);
}

/* تنسيقات عربية إضافية */
.me-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

.me-1 {
    margin-left: 0.25rem !important;
    margin-right: 0 !important;
}

/* تنسيقات الإحصائيات على لوحة المعلومات */
.stats-card {
    padding: 1.5rem;
    border-radius: 10px;
    background-color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-right: 4px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.stats-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.stats-title {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.stats-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.attendance-status-container {
    background-color: #f8f9fa;
}

/******************************
 * 15. تنسيقات صفحات تسجيل الدخول والمصادقة
 ******************************/

.login-body {
    background-color: #f8f9fa;
    font-family: 'Tajawal', sans-serif;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 35px;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.1);
}

.login-title {
    text-align: center;
    margin-bottom: 30px;
    color: #3490dc;
    font-weight: 700;
    font-size: 2rem;
}

.login-btn {
    background-color: #3490dc;
    border-color: #3490dc;
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background-color: #2779bd;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 144, 220, 0.3);
}

.login-input {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.login-input:focus {
    border-color: #3490dc;
    box-shadow: 0 0 0 3px rgba(52, 144, 220, 0.25);
}

.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo i {
    font-size: 50px;
    color: #3490dc;
    background: rgba(52, 144, 220, 0.1);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

/* تنسيقات صفحة التسجيل */
.register-body {
    background-color: #f8f9fa;
}

.register-container {
    max-width: 500px;
    margin: 50px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.register-title {
    text-align: center;
    margin-bottom: 30px;
    color: #3490dc;
}

.register-btn {
    background-color: #3490dc;
    border-color: #3490dc;
    width: 100%;
    margin-top: 20px;
}

.login-link {
    text-align: center;
    margin-top: 20px;
}

.login-link a {
    color: #3490dc;
    text-decoration: none;
    font-weight: 500;
}

.login-link a:hover {
    text-decoration: underline;
}

/******************************
 * 16. تنسيقات القائمة الجانبية
 ******************************/

.sidebar {
    height: 100vh;
    overflow-y: auto;
    background: linear-gradient(to left, #343a40, #212529);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    color: #f8f9fa;
    padding-top: 0;
    transition: all 0.3s ease;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    position: fixed;
    top: 0;
    right: 0;
    width: 16.666667%;
    z-index: 1000;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-header {
    padding: 25px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-container {
    margin: 0 auto;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #3490dc 0%, #6574cd 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.logo-icon {
    font-size: 28px;
    color: white;
}

.app-title {
    color: white;
    font-weight: 700;
    margin: 10px 0;
    font-size: 1.4rem;
}

.user-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 8px;
    margin-top: 10px;
}

.user-name {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
}

.user-role {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-content {
    padding: 15px 0;
}

.sidebar-group {
    margin-bottom: 15px;
    overflow: hidden;
}

.sidebar-group-title {
    padding: 10px 15px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #3490dc;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.sidebar-group-title:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-item {
    padding: 10px 15px 10px 30px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    display: block;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 0;
    position: relative;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(-5px);
}

.sidebar-item:hover i {
    transform: scale(1.1);
}

.sidebar-item.active {
    background: linear-gradient(90deg, #3490dc 0%, rgba(52, 144, 220, 0.5) 100%);
    color: white;
    border-right: 4px solid #fff;
}

.sidebar-item.active i {
    color: white;
}

.sidebar-item i {
    width: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 1030;
        right: -100%;
        width: 80%;
        transition: right 0.3s ease;
    }
    
    .sidebar.show {
        right: 0;
    }
    
    .toggle-sidebar {
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 1031;
        background: #343a40;
        color: white;
        border: none;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    }
}

/******************************
 * 17. تحسين تنسيق حقل اختيار اللون في نموذج التصنيفات
 ******************************/

.form-control-color {
    height: 42px;
    min-width: 60px;
    padding: 5px;
    cursor: pointer;
}

.preview-container {
    margin-top: 15px;
    padding: 20px !important;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    box-shadow: inset 0 0 5px rgba(0,0,0,0.05);
}

.preview-tag {
    padding: 8px 15px;
    border-radius: 20px;
    display: inline-block;
    font-size: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

@media (max-width: 767.98px) {
    .input-group-lg {
        flex-wrap: nowrap;
    }
    
    .form-control-color {
        min-width: 50px;
        height: 38px;
    }
    
    .preview-container {
        padding: 15px !important;
    }
    
    .preview-tag {
        padding: 6px 12px;
        font-size: 14px;
    }
}

/* Sidebar Styling */
#sidebar {
    width: 250px;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 999;
    background: #343a40;
    color: #fff;
    transition: all 0.3s;
}

#sidebar .sidebar-header {
    padding: 20px;
    background: #272c30;
    text-align: center;
}

#sidebar ul.components {
    padding: 20px 0;
    border-bottom: 1px solid #4a5056;
}

#sidebar ul p {
    color: #fff;
    padding: 10px;
}

#sidebar ul li a {
    padding: 10px 15px;
    display: block;
    color: #c8c9ca;
    text-decoration: none;
    transition: all 0.3s ease;
}

#sidebar ul li a:hover {
    color: #fff;
    background: #272c30;
}

#sidebar ul li.active > a {
    color: #fff;
    background: #4e73df;
}

#sidebar ul li a i {
    margin-left: 10px;
}

#sidebar ul li a[aria-expanded="true"] {
    color: #fff;
    background: #272c30;
}

ul ul a {
    font-size: 0.9em !important;
    padding-right: 30px !important;
    background: #272c30;
}

/* Content Area */
#content {
    width: calc(100% - 250px);
    margin-right: 250px;
    transition: all 0.3s;
    min-height: 100vh;
}

/* Toggled Sidebar */
#sidebar.active {
    margin-right: -250px;
}

#content.active {
    width: 100%;
    margin-right: 0;
}

/* Dropdown Styling */
.dropdown-menu {
    border-radius: 0.25rem;
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item {
    padding: 0.5rem 1rem;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

/* تحسينات الشريط الجانبي */
#sidebar {
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    background: linear-gradient(to left, #343a40, #212529);
}

#sidebar .sidebar-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 25px 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#sidebar ul.components li {
    position: relative;
}

#sidebar ul li a {
    border-right: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#sidebar ul li a:before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: rgba(78, 115, 223, 0.3);
    transition: all 0.3s ease;
    z-index: -1;
}

#sidebar ul li a:hover {
    border-right-color: #4e73df;
}

#sidebar ul li a:hover:before {
    width: 100%;
}

#sidebar ul li a i {
    transition: transform 0.3s ease;
}

#sidebar ul li a:hover i {
    transform: translateX(-5px);
}

#sidebar ul li.active > a {
    background: #4e73df;
    color: #fff;
    border-right-color: #fff;
}

/* تحسين زر التوسيع والطي */
#sidebarCollapse {
    background: #4e73df;
    color: white;
    border: none;
    transition: all 0.3s;
}

#sidebarCollapse:hover {
    background: #375abd;
    transform: scale(1.05);
}

/* تحسين التجاوب مع الشاشات الصغيرة */
@media (max-width: 767.98px) {
    #sidebarCollapse {
        margin-right: 15px;
    }
    
    #sidebar {
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    }
}

/******************************
 * تعديلات إضافية لإصلاح مشكلة القائمة الجانبية والتداخل
 ******************************/

/* تحسينات القائمة الجانبية لمنع التداخل */
.main-sidebar {
    position: fixed !important;
    right: 0 !important;
    left: auto !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    width: 250px !important;
    max-width: 250px !important;
    min-width: 250px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    z-index: 2500 !important;
    transition: transform 0.3s ease-in-out !important;
    transform: translateX(0) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
}

/* ضبط محتوى القائمة لمنع تجاوز العرض */
.main-sidebar .sidebar {
    width: 100% !important;
    height: calc(100% - 57px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 0 !important;
}

/* إصلاح عناصر القائمة */
.main-sidebar .nav-link {
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    padding: 0.6rem 1rem !important;
}

/* تحسين هوامش المحتوى الرئيسي */
.content-wrapper {
    min-height: 100vh !important;
    width: calc(100% - 250px) !important;
    margin-right: 250px !important;
    margin-left: 0 !important;
    transition: margin-right 0.3s ease-in-out, width 0.3s ease-in-out !important;
}

/* تحسين شريط التنقل العلوي */
.main-header {
    position: relative !important;
    width: calc(100% - 250px) !important;
    margin-right: 250px !important;
    margin-left: 0 !important;
    transition: margin-right 0.3s ease-in-out, width 0.3s ease-in-out !important;
}

/* إصلاحات الشاشات الصغيرة */
@media (max-width: 991.98px) {
    .main-sidebar {
        transform: translate3d(250px, 0, 0) !important;
        transition: transform 0.3s ease-in-out, width 0.3s ease-in-out !important;
    }
    
    body.sidebar-open .main-sidebar {
        transform: translate3d(0, 0, 0) !important;
    }
    
    /* تأكيد أن نموذج القائمة يظهر بشكل صحيح */
    .nav-sidebar .nav-item {
        width: 100% !important;
    }
    
    .nav-sidebar .nav-link {
        display: flex !important;
        align-items: center !important;
    }
    
    /* إصلاح القوائم الفرعية في وضع الموبايل */
    .nav-treeview {
        display: none;
    }
    
    .nav-item.menu-open > .nav-treeview {
        display: block !important;
    }
    
    /* تأكيد ظهور الأيقونات بشكل صحيح */
    .nav-sidebar .nav-link i {
        display: inline-block !important;
        width: 20px !important;
        margin-left: 10px !important;
    }
    
    /* إصلاح زر فتح القائمة */
    .main-header .navbar-toggler {
        display: inline-block !important;
        cursor: pointer !important;
    }
    
    /* تحسين مظهر القائمة في الشاشات الصغيرة */
    .sidebar-open .main-sidebar {
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2) !important;
    }
}

/* إلغاء القواعد التي قد تمنع ظهور القائمة */
.main-sidebar, 
.nav-sidebar, 
.nav-treeview,
.sidebar-dark-primary {
    visibility: visible !important;
    opacity: 1 !important;
}

/* تأكيد عرض محتوى القائمة */
.main-sidebar .sidebar {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* إصلاح الأزرار في القائمة */
.nav-sidebar .nav-link {
    cursor: pointer !important;
}

.nav-sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.nav-sidebar .nav-link.active {
    background-color: #3490dc !important;
    color: #fff !important;
}

/* تعديل زر فتح/إغلاق القائمة الجانبية */
[data-widget="pushmenu"] {
    cursor: pointer !important;
    z-index: 5001 !important;
    position: relative !important;
    display: inline-block !important;
    padding: 8px 10px !important;
    font-size: 20px !important;
    background-color: transparent !important;
    border: none !important;
    color: #333 !important;
    border-radius: 3px !important;
    transition: background-color 0.3s ease !important;
}

[data-widget="pushmenu"]:hover {
    background-color: rgba(0, 0, 0, 0.1) !important;
}

/* إزالة أي تنسيقات قد تمنع عمل الزر */
[data-widget="pushmenu"],
[data-widget="pushmenu"] * {
    pointer-events: auto !important;
}

/* تحسين عرض أيقونة الزر */
[data-widget="pushmenu"] i {
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
    text-align: center !important;
}

/* تحسين العرض في الأجهزة الصغيرة جدًا */
@media (max-width: 576px) {
    .nav-sidebar .nav-link {
        font-size: 14px !important;
        padding: 8px 12px !important;
    }
    
    .main-sidebar {
        width: 240px !important;
    }
}

/******************************
 * 21. إصلاح نهائي لمشاكل العرض على الموبايل
 ******************************/

/* قواعد عامة للشاشات الصغيرة */
@media (max-width: 767.98px) {
    /* حل مشكلة تداخل القائمة مع المحتوى */
    .main-sidebar {
        width: 260px !important;
        right: -260px !important;
        left: auto !important;
        transform: none !important;
        transition: right 0.3s ease-in-out !important;
        position: fixed !important;
        z-index: 5000 !important;
        height: 100% !important;
    }
    
    body.sidebar-open .main-sidebar {
        right: 0 !important;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* إصلاح المحتوى الرئيسي */
    .content-wrapper {
        margin-right: 0 !important;
        width: 100% !important;
        transition: margin-right 0.3s ease-in-out !important;
        min-height: 100vh !important;
    }
    
    /* إصلاح الشريط العلوي */
    .main-header {
        width: 100% !important;
        margin-right: 0 !important;
        padding: 0 !important;
        z-index: 4000 !important;
    }
    
    /* إضافة طبقة شفافة عند فتح القائمة */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 4500;
        transition: opacity 0.3s;
    }
    
    body.sidebar-open .sidebar-overlay {
        display: block;
    }
    
    /* تحسين أحجام الخطوط والعناصر */
    .nav-sidebar .nav-link {
        padding: 10px 15px !important;
        font-size: 14px !important;
    }
    
    .brand-link {
        font-size: 16px !important;
        padding: 10px !important;
    }
    
    /* إصلاح شكل الأزرار في الشريط العلوي */
    .navbar-toggler {
        padding: 6px 10px !important;
        font-size: 18px !important;
    }
    
    /* تحسين عرض المحتوى الرئيسي */
    .content-wrapper .content {
        padding: 10px !important;
    }
    
    /* تنظيف أي تأثيرات جانبية */
    .main-sidebar * {
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* إضافة طبقة تغطية لإغلاق القائمة عند النقر خارجها */
.sidebar-overlay {
    display: none;
}

@media (max-width: 767.98px) {
    body::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }
    
    body.sidebar-open::after {
        opacity: 1;
        visibility: visible;
    }
    
    /* تصحيح عرض القائمة المنسدلة في الشريط العلوي */
    .dropdown-menu {
        position: absolute !important;
        float: left !important;
        margin-top: 5px !important;
    }
}

/* إصلاح مشكلة التمرير */
body.sidebar-open {
    overflow: hidden !important;
}

/* تأكيد أن زر فتح القائمة يعمل بشكل صحيح */
[data-widget="pushmenu"] {
    cursor: pointer !important;
    z-index: 5001 !important;
    position: relative !important;
}

/* إصلاح عرض القوائم الفرعية */
.nav-treeview {
    padding-right: 15px !important;
}

@media (max-width: 575.98px) {
    /* تحسينات إضافية للشاشات الصغيرة جدًا */
    .container-fluid {
        padding-right: 10px !important;
        padding-left: 10px !important;
    }
    
    .nav-sidebar .nav-link {
        padding: 8px 10px !important;
        font-size: 13px !important;
    }
    
    .content {
        padding: 5px !important;
    }
}

/******************************
 * 22. إصلاح مشكلة ظهور القائمة الجانبية فارغة على الموبايل
 ******************************/

/* ضمان ظهور محتوى القائمة الجانبية على الموبايل */
.main-sidebar .sidebar .nav-sidebar,
.main-sidebar .sidebar .nav-sidebar .nav-item,
.main-sidebar .sidebar .nav-sidebar .nav-link,
.main-sidebar .sidebar .nav-sidebar .nav-treeview {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #c2c7d0 !important;
}

/* تحسين ظهور نص القائمة على خلفية داكنة */
.main-sidebar .nav-link p {
    color: #c2c7d0 !important;
    display: inline-block !important;
    margin-right: 5px !important;
}

/* تأكيد ظهور الأيقونات */
.main-sidebar .nav-link i {
    color: #c2c7d0 !important;
    display: inline-block !important;
    width: 20px !important;
    text-align: center !important;
}

/* إظهار الأيقونة للمزيد من الخيارات */
.main-sidebar .nav-link .right {
    color: #c2c7d0 !important;
    display: block !important;
    position: absolute !important;
    left: 1rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

/* تحسين شكل القائمة المفتوحة */
.main-sidebar .nav-item.menu-open > .nav-link {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

.main-sidebar .nav-item.menu-open > .nav-link p,
.main-sidebar .nav-item.menu-open > .nav-link i {
    color: #ffffff !important;
}

/* تحسين ظهور القوائم الفرعية */
.main-sidebar .nav-treeview {
    padding-right: 15px !important;
    display: none !important; /* مخفية بشكل افتراضي */
    background-color: rgba(0, 0, 0, 0.2) !important;
    margin-right: 10px !important;
    margin-left: 10px !important;
    border-radius: 5px !important;
}

.main-sidebar .nav-item.menu-open > .nav-treeview {
    display: block !important; /* تظهر عند فتح القائمة */
}

/* تأكيد ظهور البحث في القائمة */
.main-sidebar .sidebar-search {
    display: block !important;
    visibility: visible !important;
    margin: 10px !important;
}

.main-sidebar .form-control-sidebar {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    border: none !important;
}

.main-sidebar .btn-sidebar {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #c2c7d0 !important;
    border: none !important;
}

/* تأكيد ظهور شعار التطبيق */
.main-sidebar .brand-link {
    display: flex !important;
    align-items: center !important;
    padding: 10px 15px !important;
    background-color: rgba(0, 0, 0, 0.2) !important;
    color: #ffffff !important;
}

.main-sidebar .brand-image {
    margin-left: 10px !important;
    max-height: 30px !important;
    display: inline-block !important;
}

.main-sidebar .brand-text {
    display: inline-block !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

@media (max-width: 767.98px) {
    .main-sidebar,
    .main-sidebar * {
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* تأكيد أن القائمة تملأ المساحة كاملة */
    body.sidebar-open .main-sidebar {
        width: 260px !important;
        min-width: 260px !important;
        max-width: 85% !important;
        overflow-y: auto !important;
    }
    
    /* تحسين شكل العناصر على الموبايل */
    .main-sidebar .nav-link {
        padding: 12px 15px !important;
        font-size: 14px !important;
        line-height: 1.5 !important;
    }
    
    /* إظهار محتوى القائمة بشكل كامل */
    .main-sidebar .sidebar .nav-sidebar {
        margin-bottom: 20px !important;
    }
    
    /* تحسين ظهور البحث على الموبايل */
    .main-sidebar .sidebar-search {
        margin: 15px 10px !important;
    }
}

/* إصلاحات إضافية للقائمة الجانبية - يونيو 2023 */
.main-sidebar {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
    overflow-y: auto !important;
}

.main-sidebar .nav-sidebar {
    margin-top: 0 !important;
    padding-top: 10px !important;
    padding-bottom: 20px !important;
}

.main-sidebar .nav-link {
    display: flex !important;
    align-items: center !important;
    padding: 0.6rem 1rem !important;
    white-space: nowrap !important;
}

.main-sidebar .nav-link p {
    margin-right: 10px !important;
    margin-bottom: 0 !important;
    display: inline-block !important;
    white-space: nowrap !important;
    width: auto !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.main-sidebar .nav-link .nav-icon {
    font-size: 1.1rem !important;
    width: 20px !important;
    text-align: center !important;
    margin-left: 10px !important;
}

.main-sidebar .brand-link {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 0.8rem 1rem !important;
}

.main-sidebar .brand-image {
    float: right !important;
    margin-left: 0.8rem !important;
    margin-right: 0 !important;
    margin-top: -3px !important;
}

.main-sidebar .brand-text {
    display: inline-block !important;
    font-weight: 500 !important;
}

/* تحسين عرض القوائم الفرعية */
.nav-treeview {
    padding-right: 1rem !important;
    display: none;
}

.nav-item.menu-open > .nav-treeview {
    display: block !important;
}

.nav-item.menu-open > .nav-link .fa-angle-left {
    transform: rotate(-90deg) !important;
}

.nav-sidebar .nav-link .right {
    position: absolute !important;
    left: 1rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    transition: transform 0.3s ease !important;
}

/* Fix for search bar in sidebar */
.sidebar-search {
    margin: 1rem !important;
}

.form-control-sidebar {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    border: none !important;
}

.btn-sidebar {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    border: none !important;
}
