﻿/* =========================================================
   نظام تكامل أعمال الإدارة العامة للشؤون الإدارية
   ملف CSS الموحد المدمج - الإصدار 8.0 (النسخة النهائية الشاملة)
   وزارة النقل والخدمات اللوجستية
   ========================================================= */

/* Bootstrap + CoreUI override: replace primary with brand green (Pantone 329C) */
:root {
    --bs-primary: #00685E;
    --bs-primary-rgb: 0, 104, 94;
    --bs-link-color: #00685E;
    --bs-link-hover-color: #005049;
    /* CoreUI vendor overrides */
    --cui-primary: #00685E;
    --cui-primary-rgb: 0, 104, 94;
    --cui-primary-text-emphasis: #005049;
    --cui-primary-bg-subtle: #E7F3F2;
    --cui-primary-border-subtle: #B3D9D4;
    --cui-blue: #00685E;
    --cui-link-color: #00685E;
    --cui-link-color-rgb: 0, 104, 94;
    --cui-link-hover-color: #005049;
}

:root {
    /* ===== الألوان الأساسية ===== */
    /* وزارة النقل - الأخضر */
    --mot-primary: #00685E;
    --mot-secondary: #005249;
    --mot-dark: #003d38;
    --mot-light: #E7F3F2;
    --mot-accent: #F2C75C;
    --mot-gold: #C9A961;
    --mot-gold-light: #F2C75C;
    /* الأخضر الأساسي - وزارة النقل (Pantone 329C) */
    --primary-blue: #00685E;
    --secondary-blue: #0a8a7a;
    --light-blue: #4FB3A6;
    --dark-blue: #005049;
    --accent-blue: #00685E;
    /* الألوان المحايدة */
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    /* ألوان الحالة */
    --success: #10b981;
    --success-light: rgba(40, 167, 69, 0.12);
    --warning: #f59e0b;
    --warning-light: rgba(255, 193, 7, 0.12);
    --danger: #ef4444;
    --danger-light: rgba(220, 53, 69, 0.12);
    --info: #00685E;
    --info-light: rgba(0, 104, 94, 0.12);
    /* الظلال */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* زوايا الحدود */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    /* التحويلات */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition: all 0.3s ease;
    /* الأبعاد */
    --sidebar-width-expanded: 260px;
    --sidebar-width-collapsed: 70px;
    --sidebar-width: 280px;
    --sidebar-collapsed: 80px;
    --header-height: 60px;
}

/* =================== إعادة تعيين =================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--gray-400);
    }

/* =================== تخطيط التطبيق الرئيسي =================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: var(--sidebar-width-expanded);
    background: var(--white);
    border-left: 1px solid var(--gray-200);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal);
    overflow: hidden;
}

    .app-sidebar.collapsed {
        width: var(--sidebar-width-collapsed);
    }

.app-main {
    flex: 1;
    margin-right: var(--sidebar-width-expanded);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-right var(--transition-normal);
}

.app-sidebar.collapsed ~ .app-main,
.sidebar-collapsed .app-main {
    margin-right: var(--sidebar-width-collapsed);
}

/* ===== Header ===== */
.app-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    width: 38px;
    height: 38px;
    border: none;
    background: var(--gray-100);
    border-radius: var(--radius);
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}

    .sidebar-toggle:hover {
        background: var(--gray-200);
        color: var(--gray-800);
    }

.page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    position: relative;
    transition: all var(--transition-fast);
}

    .header-btn:hover {
        background: var(--gray-100);
        color: var(--gray-700);
    }

    .header-btn .badge {
        position: absolute;
        top: 4px;
        left: 4px;
        width: 18px;
        height: 18px;
        background: var(--danger);
        color: var(--white);
        border-radius: 50%;
        font-size: 0.65rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
    }

.header-search {
    position: relative;
    width: 280px;
}

    .header-search input {
        width: 100%;
        height: 38px;
        border: 1px solid var(--gray-200);
        border-radius: var(--radius);
        padding: 0 1rem 0 2.5rem;
        font-size: 0.9rem;
        background: var(--gray-50);
        color: var(--gray-700);
        transition: all var(--transition-fast);
    }

        .header-search input:focus {
            outline: none;
            border-color: var(--primary-blue);
            background: var(--white);
            box-shadow: 0 0 0 3px rgba(0, 104, 94, 0.1);
        }

        .header-search input::placeholder {
            color: var(--gray-400);
        }

    .header-search i {
        position: absolute;
        left: 1rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--gray-400);
        font-size: 0.9rem;
    }

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

    .user-menu:hover {
        background: var(--gray-100);
    }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-blue);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ===== Main Content ===== */
.app-content {
    flex: 1;
    padding: 1.5rem;
}

/* ===== Sidebar Components ===== */
.sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 60px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: var(--primary-blue);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .sidebar-logo img {
        width: 28px;
        height: 28px;
        object-fit: contain;
    }

    .sidebar-logo i {
        color: var(--white);
        font-size: 1.2rem;
    }

.sidebar-brand {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity var(--transition-normal);
}

.app-sidebar.collapsed .sidebar-brand {
    opacity: 0;
    width: 0;
}

.sidebar-brand-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.3;
}

.sidebar-brand-subtitle {
    font-size: 0.7rem;
    color: var(--gray-500);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0.75rem;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-normal);
}

.app-sidebar.collapsed .nav-section-title {
    opacity: 0;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
}

    .nav-link:hover {
        background: var(--gray-100);
        color: var(--gray-800);
    }

    .nav-link.active {
        background: var(--primary-blue);
        color: var(--white);
    }

        .nav-link.active:hover {
            background: var(--dark-blue);
        }

.nav-icon {
    width: 22px;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.nav-text {
    flex: 1;
    transition: opacity var(--transition-normal);
}

.app-sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
}

.nav-arrow {
    font-size: 0.65rem;
    color: var(--gray-400);
    transition: transform var(--transition-fast), opacity var(--transition-normal);
    margin-right: auto;
}

.app-sidebar.collapsed .nav-arrow {
    opacity: 0;
}

/* Submenu - التصحيح الرئيسي */
.nav-group.show > .nav-link .nav-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal) ease;
}

.nav-group.show > .nav-submenu {
    max-height: 500px;
    overflow: visible;
}

.app-sidebar.collapsed .nav-submenu {
    display: none;
}

.nav-submenu .nav-link {
    padding-right: 3rem;
    font-size: 0.825rem;
}

    .nav-submenu .nav-link::before {
        content: '';
        width: 6px;
        height: 6px;
        background: var(--gray-300);
        border-radius: 50%;
        margin-left: 0.5rem;
    }

    .nav-submenu .nav-link.active::before {
        background: rgba(255, 255, 255, 0.7);
    }

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-100);
}

.sidebar-footer-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.app-sidebar.collapsed .sidebar-footer-text {
    opacity: 0;
    width: 0;
}

.sidebar-footer-text {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
    transition: opacity var(--transition-normal);
}

/* ===== Overlay ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

/* ===== Dropdowns ===== */
.dropdown-menu {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    min-width: 200px;
}

.dropdown-item {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .dropdown-item:hover {
        background: var(--gray-100);
        color: var(--gray-800);
    }

    .dropdown-item i {
        width: 18px;
        color: var(--gray-500);
    }

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: var(--gray-200);
}

/* =================== رأس الصفحة =================== */
.mot-header {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
    border-right: 4px solid var(--mot-primary);
}

    .mot-header .row {
        align-items: center;
    }

.mot-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
    color: var(--mot-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

    .mot-title i {
        color: var(--mot-primary);
    }

.mot-subtitle {
    color: var(--gray-500);
    margin: 5px 0 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .mot-subtitle i {
        color: var(--mot-primary);
    }

.header-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* =================== الأزرار الموحدة =================== */
.mot-btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    padding: 10px 20px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

    .mot-btn:hover {
        transform: translateY(-2px);
    }

.mot-btn-primary {
    background: linear-gradient(135deg, var(--mot-primary) 0%, var(--mot-secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 104, 94, 0.25);
}

    .mot-btn-primary:hover {
        box-shadow: 0 6px 20px rgba(0, 104, 94, 0.35);
        color: white;
    }

.mot-btn-gold {
    background: linear-gradient(135deg, var(--mot-gold) 0%, #b8925a 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(201, 169, 97, 0.25);
}

    .mot-btn-gold:hover {
        box-shadow: 0 6px 20px rgba(201, 169, 97, 0.35);
        color: white;
    }

.mot-btn-outline {
    background: transparent;
    color: var(--mot-primary);
    border: 2px solid var(--mot-primary);
}

    .mot-btn-outline:hover {
        background: var(--mot-primary);
        color: white;
    }

.mot-btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

.mot-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* =================== بطاقات الإحصائيات =================== */
.mot-stats-card {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    overflow: hidden;
    color: white;
}

    .mot-stats-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-lg);
    }

    .mot-stats-card .card-body {
        padding: 20px;
    }

    .mot-stats-card h2 {
        font-size: 32px;
        font-weight: 700;
        margin-bottom: 5px;
    }

    .mot-stats-card p {
        margin: 0;
        opacity: 0.9;
        font-size: 14px;
    }

.stats-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.2);
}

.stats-primary {
    background: linear-gradient(135deg, var(--mot-primary) 0%, var(--mot-secondary) 100%);
}

.stats-success {
    background: linear-gradient(135deg, var(--success) 0%, #1e7e34 100%);
}

.stats-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d39e00 100%);
}

    .stats-warning h2,
    .stats-warning p {
        color: var(--gray-700);
    }

.stats-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #bd2130 100%);
}

.stats-info {
    background: linear-gradient(135deg, var(--info) 0%, #117a8b 100%);
}

.stats-accent {
    background: linear-gradient(135deg, var(--mot-accent) 0%, var(--mot-gold) 100%);
}

    .stats-accent h2,
    .stats-accent p {
        color: var(--mot-dark);
    }

    .stats-accent .stats-icon {
        background: rgba(0, 104, 94, 0.15);
        color: var(--mot-dark);
    }

/* =================== رسائل التنبيه =================== */
.mot-alert {
    border-radius: var(--radius-lg);
    border: none;
    padding: 15px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

    .mot-alert i {
        font-size: 1.25rem;
    }

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* =================== بطاقة الفلترة =================== */
.filter-card {
    background: white;
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.filter-card-header {
    background: var(--mot-light);
    padding: 15px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.filter-card-title {
    font-weight: 700;
    color: var(--mot-primary);
    font-size: 15px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .filter-card-title i {
        color: var(--mot-gold);
    }

.filter-card form {
    padding: 20px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

    .filter-group label {
        display: block;
        font-size: 13px;
        font-weight: 600;
        color: var(--gray-600);
        margin-bottom: 6px;
    }

        .filter-group label i {
            color: var(--mot-primary);
        }

    .filter-group .form-control,
    .filter-group .form-select {
        width: 100%;
        padding: 10px 15px;
        border: 2px solid var(--gray-200);
        border-radius: var(--radius-md);
        font-size: 14px;
        transition: var(--transition);
    }

        .filter-group .form-control:focus,
        .filter-group .form-select:focus {
            border-color: var(--mot-primary);
            outline: none;
            box-shadow: 0 0 0 3px rgba(0, 104, 94, 0.1);
        }

.number-range {
    display: flex;
    gap: 8px;
}

    .number-range input {
        flex: 1;
    }

.filter-actions {
    display: flex;
    gap: 8px;
}

.btn-filter {
    background: linear-gradient(135deg, var(--mot-primary) 0%, var(--mot-secondary) 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

    .btn-filter:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(0, 104, 94, 0.3);
    }

.btn-clear {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 2px solid var(--gray-200);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

    .btn-clear:hover {
        background: var(--gray-200);
        color: var(--gray-700);
    }

/* =================== بطاقة الجدول =================== */
.table-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 25px;
}

.table-card-header {
    background: linear-gradient(135deg, var(--mot-primary) 0%, var(--mot-secondary) 100%);
    padding: 18px 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    border-bottom: 3px solid var(--mot-gold);
}

.table-card-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-card-title {
    margin: 0;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-card-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.table-card-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.table-card-body {
    padding: 20px;
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

    .search-box i {
        position: absolute;
        right: 12px;
        color: rgba(255, 255, 255, 0.7);
    }

    .search-box .table-search {
        padding: 8px 35px 8px 15px;
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-radius: var(--radius-md);
        background: rgba(255, 255, 255, 0.2);
        color: white;
        width: 220px;
        font-size: 14px;
        transition: var(--transition);
    }

        .search-box .table-search::placeholder {
            color: rgba(255, 255, 255, 0.7);
        }

        .search-box .table-search:focus {
            outline: none;
            border-color: white;
            background: rgba(255, 255, 255, 0.3);
        }

/* =================== Length Menu Inline (نقل "عرض X عنصر" جنب البحث) =================== */
.table-card-tools .dataTables_length.dt-length-inline {
    margin: 0 !important;
    padding: 0;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: nowrap;
    color: white;
    font-size: 13px;
    font-weight: 600;
}

    .table-card-tools .dataTables_length.dt-length-inline label {
        margin: 0 !important;
        padding: 0;
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 8px;
        color: white;
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
        flex-shrink: 0;
        flex-wrap: nowrap;
        line-height: 1;
    }

    .table-card-tools .dataTables_length.dt-length-inline select {
        flex-shrink: 0;
        /* RTL: السهم على اليسار → padding-left كبير علشان السهم، padding-right صغير */
        /* !important علشان نتغلب على .dataTables_length select الـ generic */
        padding: 8px 12px 8px 28px !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        border-radius: var(--radius-md) !important;
        background-color: rgba(255, 255, 255, 0.2);
        color: white;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition);
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: left 10px center;
        background-size: 10px;
        min-width: 72px;
        text-align: center;
        text-align-last: center;
        line-height: 1;
    }

        .table-card-tools .dataTables_length.dt-length-inline select:focus {
            outline: none;
            border-color: white;
            background-color: rgba(255, 255, 255, 0.3);
        }

        .table-card-tools .dataTables_length.dt-length-inline select option {
            background: white;
            color: var(--mot-primary, #00685E);
        }

/* Override للـ theme-blue-simple (header أبيض): نقلب الألوان لـ dark */
.theme-blue-simple .table-card-tools .dataTables_length.dt-length-inline,
.theme-blue-simple .table-card-tools .dataTables_length.dt-length-inline label {
    color: var(--gray-700, #374151);
}

.theme-blue-simple .table-card-tools .dataTables_length.dt-length-inline select {
    color: var(--gray-700, #374151);
    background-color: var(--gray-50, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23374151'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
}

    .theme-blue-simple .table-card-tools .dataTables_length.dt-length-inline select:focus {
        border-color: var(--primary, #00685E);
        background-color: white;
        box-shadow: 0 0 0 3px rgba(0, 104, 94, 0.1);
    }

/* =================== إخفاء كود العميل (cust_code) من جميع الصفحات الداخلية =================== */
/* الـ Login مش بيـ load الـ Layout ده، فالـ rule مش هيتأثر هناك */
.crud-form-group:has(input[name="cust_code"]),
.crud-form-group:has(select[name="cust_code"]),
.crud-form-group:has(input[name="CustCode"]),
.crud-form-group:has(select[name="CustCode"]),
.form-group:has(input[name="cust_code"]):not(.cust-code-show),
.form-group:has(select[name="cust_code"]):not(.cust-code-show),
.crud-detail-item:has([data-field="cust_code"]),
.crud-detail-item:has([data-field="CustCode"]) {
    display: none !important;
}

/* =================== الجدول =================== */
.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

    .custom-table thead {
        background: var(--gray-50);
        border-bottom: 2px solid var(--mot-primary);
    }

    .custom-table th {
        padding: 12px 15px;
        color: var(--mot-primary);
        font-weight: 700;
        font-size: 13px;
        text-align: right;
    }

    .custom-table td {
        padding: 12px 15px;
        border-bottom: 1px solid var(--gray-100);
        vertical-align: middle;
    }

    .custom-table tbody tr {
        transition: var(--transition);
    }

        .custom-table tbody tr:hover {
            background: var(--gray-50);
        }

        .custom-table tbody tr:last-child td {
            border-bottom: none;
        }

/* =================== أزرار الإجراءات =================== */
.action-btn-group {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
    min-width: 65px;
    justify-content: center;
}

    .action-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-sm);
    }

    .action-btn.btn-sm {
        padding: 4px 8px;
        font-size: 11px;
        min-width: 50px;
    }

    .action-btn.btn-lg {
        padding: 8px 16px;
        font-size: 14px;
        min-width: 80px;
    }

.btn-view {
    background: #d1ecf1;
    color: #0c5460;
}

    .btn-view:hover {
        background: #bee5eb;
        color: #0c5460;
    }

.btn-edit {
    background: #fff3cd;
    color: #856404;
}

    .btn-edit:hover {
        background: #ffe69c;
        color: #856404;
    }

.btn-delete {
    background: #f8d7da;
    color: #721c24;
}

    .btn-delete:hover {
        background: #f5c6cb;
        color: #721c24;
    }

.btn-supply {
    background: #d4edda;
    color: #155724;
}

    .btn-supply:hover {
        background: #c3e6cb;
        color: #155724;
    }

/* =================== شارات الحالة =================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

    .status-badge i {
        font-size: 10px;
    }

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: var(--gray-100);
    color: var(--gray-500);
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-rejected {
    background: #f8d7da;
    color: #721c24;
}

.status-draft {
    background: var(--gray-100);
    color: var(--gray-600);
}

.status-warning {
    background: #fff3cd;
    color: #856404;
}

.status-info {
    background: #d1ecf1;
    color: #0c5460;
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-danger {
    background: #f8d7da;
    color: #721c24;
}

.status-default {
    background: var(--mot-light);
    color: var(--mot-primary);
}

/* =================== حالة عدم وجود بيانات =================== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-state-icon {
    font-size: 56px;
    color: var(--gray-300);
    margin-bottom: 15px;
    display: block;
}

.empty-state h4 {
    color: var(--gray-500);
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 600;
}

.empty-state p {
    color: var(--gray-400);
    margin-bottom: 20px;
    font-size: 14px;
}

/* =================== أزرار التصدير =================== */
.export-buttons {
    display: flex;
    gap: 0;
}

.export-btn {
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

    .export-btn:first-child {
        border-radius: 0 var(--radius-md) var(--radius-md) 0;
    }

    .export-btn:last-child {
        border-radius: var(--radius-md) 0 0 var(--radius-md);
    }

    .export-btn:not(:first-child):not(:last-child) {
        border-radius: 0;
    }

    .export-btn:only-child {
        border-radius: var(--radius-md);
    }

    .export-btn:hover {
        background: rgba(255, 255, 255, 0.25);
        border-color: white;
        color: white;
    }

/* =================== الترقيم =================== */
.pagination-container {
    padding: 20px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 600;
}

    .pagination-info strong {
        color: var(--mot-primary);
    }

.pagination {
    display: flex;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
}

    .pagination li a,
    .pagination li span {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        border: 1px solid var(--gray-200);
        border-radius: var(--radius-md);
        color: var(--mot-primary);
        text-decoration: none;
        font-size: 13px;
        font-weight: 600;
        transition: var(--transition);
        background: white;
    }

        .pagination li a:hover {
            background: var(--mot-light);
            border-color: var(--mot-primary);
        }

    .pagination li.active span {
        background: linear-gradient(135deg, var(--mot-primary) 0%, var(--mot-secondary) 100%);
        border-color: var(--mot-primary);
        color: white;
    }

    .pagination li.disabled span {
        background: var(--gray-50);
        color: var(--gray-300);
        cursor: not-allowed;
    }

/* =================== Form Controls RTL =================== */
.form-select {
    background-position: left 0.75rem center !important;
    padding-left: 2.5rem !important;
    padding-right: 1rem !important;
}

/* =================== Dashboard Cards =================== */
.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

    .stat-card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
        border-color: var(--primary-blue);
    }

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--dark-blue);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.chart-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-blue);
    margin: 0;
}

.chart-body {
    position: relative;
    height: 300px;
}

/* =================== Dashboard Container =================== */
.dashboard-container {
    max-width: 100%;
    margin: 0 auto;
}

.dashboard-header {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-blue);
    margin: 0;
}

.dashboard-subtitle {
    font-size: 1rem;
    color: var(--gray-600);
    margin: 0.5rem 0 0 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

    .stat-card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
        border-color: var(--primary-blue);
    }

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--dark-blue);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.stat-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--primary-blue);
    text-decoration: none;
    margin-top: 0.5rem;
    transition: var(--transition);
}

    .stat-link:hover {
        color: var(--dark-blue);
    }

    .stat-link i {
        font-size: 0.875rem;
    }

/* Performance Cards */
.performance-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.performance-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.performance-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.performance-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
}

.performance-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark-blue);
    margin: 0;
}

.performance-body {
    display: flex;
    gap: 1.5rem;
}

.performance-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.performance-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-blue);
    line-height: 1;
}

.performance-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-top: 0.5rem;
}

.performance-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.detail-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.detail-label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.detail-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-blue);
    min-width: 40px;
    text-align: left;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

    .metric-card:hover {
        box-shadow: var(--shadow-md);
        border-color: var(--primary-blue);
    }

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--white);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
}

.metric-content {
    text-align: center;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-blue);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.metric-unit {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Contractors Chart */
.contractors-chart {
    margin-bottom: 2rem;
}

.contractors-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contractor-bar-row {
    display: grid;
    grid-template-columns: 60px 1fr 200px;
    align-items: center;
    gap: 1rem;
}

.bar-score {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark-blue);
    text-align: center;
}

.bar-container {
    height: 28px;
    background: var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-blue), var(--secondary-blue));
    border-radius: var(--radius);
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ✅ ألوان حسب التصنيف — تـ apply على .bar-fill داخل الـ rating class */
.contractor-bar-link.rating-excellent .bar-fill {
    background: linear-gradient(90deg, #16a34a, #22c55e); /* أخضر */
}
.contractor-bar-link.rating-good .bar-fill {
    background: linear-gradient(90deg, #2563eb, #3b82f6); /* أزرق */
}
.contractor-bar-link.rating-acceptable .bar-fill {
    background: linear-gradient(90deg, #ea580c, #f97316); /* برتقالي */
}
.contractor-bar-link.rating-weak .bar-fill {
    background: linear-gradient(90deg, #dc2626, #ef4444); /* أحمر */
}

/* badge صغير جنب الـ score */
.bar-rating-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    margin-right: 4px;
    color: #fff;
    vertical-align: middle;
    white-space: nowrap;
}
.contractor-bar-link.rating-excellent .bar-rating-badge { background: #16a34a; }
.contractor-bar-link.rating-good .bar-rating-badge { background: #2563eb; }
.contractor-bar-link.rating-acceptable .bar-rating-badge { background: #ea580c; }
.contractor-bar-link.rating-weak .bar-rating-badge { background: #dc2626; }

.bar-name {
    font-size: 0.9375rem;
    color: var(--gray-700);
    font-weight: 500;
    text-align: right;
}

/* Doughnut Chart */
.doughnut-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 2rem;
}

.doughnut-chart-container {
    position: relative;
    width: 200px;
    height: 200px;
    flex-shrink: 0;
}

.doughnut-svg {
    width: 100%;
    height: 100%;
}

.segment-animate {
    animation: drawSegment 1.8s ease-out forwards;
}

@keyframes drawSegment {
    from {
        stroke-dasharray: 0 251;
    }

    to {
        stroke-dasharray: 251 251;
    }
}

.doughnut-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.center-percent {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-blue);
}

.doughnut-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

    .legend-dot.blue {
        background: var(--primary-blue);
    }

    .legend-dot.gray {
        background: var(--gray-400);
    }

    .legend-dot.dark {
        background: var(--gray-700);
    }

    /* ✅ ألوان legend جديدة matching الـ bar colors */
    .legend-dot.legend-excellent { background: #16a34a; }
    .legend-dot.legend-good { background: #2563eb; }
    .legend-dot.legend-acceptable { background: #ea580c; }
    .legend-dot.legend-weak { background: #dc2626; }

.legend-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.legend-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-blue);
    min-width: 40px;
    text-align: left;
}

.legend-percent {
    font-size: 0.875rem;
    color: var(--gray-600);
    min-width: 50px;
    text-align: left;
}

/* =================== Responsive =================== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .performance-cards {
        grid-template-columns: 1fr;
    }

    .contractor-bar-row {
        grid-template-columns: 50px 1fr;
    }

    .bar-name {
        display: none;
    }

    .doughnut-wrapper {
        flex-direction: column;
    }

    .doughnut-chart-container {
        width: 180px;
        height: 180px;
    }
}

@media (max-width: 992px) {
    .action-btn span {
        display: none;
    }

    .action-btn {
        min-width: auto;
        padding: 6px 10px;
    }

    .app-sidebar {
        transform: translateX(100%);
        width: var(--sidebar-width-expanded) !important;
    }

        .app-sidebar.show {
            transform: translateX(0);
        }

    .app-main {
        margin-right: 0 !important;
    }

    .header-search {
        display: none;
    }

    .user-info {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .performance-body {
        flex-direction: column;
    }

    .performance-main {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .mot-header {
        padding: 20px;
    }

    .mot-title {
        font-size: 22px;
    }

    .header-buttons {
        justify-content: flex-start;
        width: 100%;
        margin-top: 15px;
    }

    .table-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .table-card-tools {
        justify-content: center;
    }

    .search-box .table-search {
        width: 100%;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .filter-actions {
        width: 100%;
    }

        .filter-actions .btn-filter,
        .filter-actions .btn-clear {
            flex: 1;
            justify-content: center;
        }

    .pagination-container {
        flex-direction: column;
        text-align: center;
    }

    .action-btn-group {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }

        .action-btn span {
            display: inline;
        }

    .app-content {
        padding: 1rem;
    }

    .dashboard-header {
        padding: 1.5rem;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .performance-body {
        flex-direction: column;
    }

    .performance-main {
        width: 100%;
    }

    .chart-body {
        height: 250px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .custom-table {
        font-size: 12px;
    }

        .custom-table th,
        .custom-table td {
            padding: 8px 10px;
        }

    .empty-state-icon {
        font-size: 40px;
    }

    .page-title {
        font-size: 1rem;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem;
    }

    .stat-icon {
        margin-bottom: 1rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .chart-body {
        height: 250px;
    }

    .contractor-bar-row {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .bar-score {
        order: 2;
    }

    .bar-container {
        order: 3;
    }

    .bar-name {
        display: block;
        order: 1;
        text-align: center;
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .doughnut-chart-container {
        width: 160px;
        height: 160px;
    }

    .center-percent {
        font-size: 1.5rem;
    }

    .doughnut-wrapper {
        gap: 1rem;
    }

    .doughnut-legend {
        gap: 0.75rem;
    }

    .legend-row {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .legend-text,
    .legend-value,
    .legend-percent {
        font-size: 0.75rem;
    }
}

/* =================== Bootstrap Grid Classes =================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.5rem;
    margin-left: -0.5rem;
}

.col-12 {
    flex: 0 0 100%;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

.col-md-4 {
    flex: 0 0 33.333333%;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

.col-xl-6 {
    flex: 0 0 50%;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .col-md-4 {
        flex: 0 0 100%;
    }

    .col-xl-6 {
        flex: 0 0 100%;
    }
}

@media (max-width: 576px) {
    .custom-table {
        font-size: 12px;
    }

        .custom-table th,
        .custom-table td {
            padding: 8px 10px;
        }

    .empty-state-icon {
        font-size: 40px;
    }

    .page-title {
        font-size: 1rem;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem;
    }

    .stat-icon {
        margin-bottom: 1rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .chart-body {
        height: 250px;
    }
}

/* =================== الرسوم المتحركة =================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* =================== فئات المساعدة =================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mb-0 {
    margin-bottom: 0;
}

.mt-0 {
    margin-top: 0;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.p-0 {
    padding: 0;
}

.p-1 {
    padding: 0.25rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 1rem;
}

.p-4 {
    padding: 1.5rem;
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow {
    box-shadow: var(--shadow);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.rounded {
    border-radius: var(--radius);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

.border {
    border: 1px solid var(--gray-200);
}

.border-blue {
    border-color: var(--primary-blue);
}

.bg-white {
    background: var(--white);
}

.bg-gray-50 {
    background: var(--gray-50);
}

.bg-gray-100 {
    background: var(--gray-100);
}

.bg-blue {
    background: var(--primary-blue);
}

.text-blue {
    color: var(--primary-blue);
}

.text-dark-blue {
    color: var(--dark-blue);
}

.text-gray-600 {
    color: var(--gray-600);
}

.text-gray-700 {
    color: var(--gray-700);
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.text-sm {
    font-size: 0.875rem;
}

.text-base {
    font-size: 1rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-2xl {
    font-size: 1.5rem;
}

/* =================== SweetAlert2 RTL =================== */
.swal2-container {
    direction: rtl !important;
}

.swal2-popup {
    border-radius: var(--radius-lg) !important;
    font-family: 'Cairo', sans-serif !important;
}

.swal2-title {
    color: var(--dark-blue) !important;
    font-weight: 700 !important;
}

.swal2-confirm {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue)) !important;
    border-radius: var(--radius) !important;
    border: none !important;
    font-weight: 600 !important;
}

.swal2-cancel {
    border-radius: var(--radius) !important;
    font-weight: 600 !important;
}

/* =================== DataTables RTL =================== */
.dataTables_wrapper {
    direction: rtl !important;
    font-family: 'Cairo', sans-serif !important;
}

.dataTables_filter input {
    border-radius: var(--radius) !important;
    border: 1px solid var(--gray-300) !important;
    padding: 0.5rem 1rem !important;
    font-family: 'Cairo', sans-serif !important;
}

    .dataTables_filter input:focus {
        outline: none !important;
        border-color: var(--primary-blue) !important;
        box-shadow: 0 0 0 3px rgba(0, 104, 94, 0.1) !important;
    }

.dataTables_length select {
    border-radius: var(--radius) !important;
    border: 1px solid var(--gray-300) !important;
    padding: 0.5rem !important;
    font-family: 'Cairo', sans-serif !important;
}

.dataTables_paginate .paginate_button {
    border-radius: var(--radius) !important;
    margin: 0 2px !important;
    font-family: 'Cairo', sans-serif !important;
}

    .dataTables_paginate .paginate_button.current {
        background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue)) !important;
        border-color: var(--primary-blue) !important;
        color: var(--white) !important;
    }

    .dataTables_paginate .paginate_button:hover {
        background: var(--gray-100) !important;
        border-color: var(--gray-300) !important;
    }

/* =========================================================
   ثيم الأزرق والأبيض الاحترافي (Clean Professional)
   مطابق تماماً لألوان السيد بار
   ========================================================= */

.theme-blue-simple {
    /* 1. استخدام نفس لون السيد بار تماماً */
    --mot-primary: #00685E !important;
    --mot-secondary: #005049 !important;
    --mot-accent: #00685E !important;
    --mot-light: #E7F3F2 !important;
    background-color: #f8fafc;
}

    /* إلغاء التدرجات */
    .theme-blue-simple .mot-btn-primary,
    .theme-blue-simple .pagination li.active span {
        background-image: none !important;
        background-color: #00685E !important;
    }

    /* === تنسيق هيدر الجدول ليكون واضحاً === */
    .theme-blue-simple .table-card-header {
        background: white; /* أبيض احترافي */
        border-bottom: 1px solid #e2e8f0; /* خط فاصل واضح */
        padding: 15px 20px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.02); /* ظل خفيف جداً */
    }

    /* === تنسيق شريط البحث === */
    .theme-blue-simple .search-box .table-search {
        background-color: #f8fafc; /* رمادي فاتح جداً */
        color: #334155;
        border: 1px solid #cbd5e1;
        border-radius: 6px; /* حواف ناعمة */
    }

        .theme-blue-simple .search-box .table-search:focus {
            background-color: white;
            border-color: #00685E; /* حدود زرقاء عند التركيز */
            box-shadow: 0 0 0 3px rgba(0, 104, 94, 0.1);
        }

        .theme-blue-simple .search-box .table-search::placeholder {
            color: #94a3b8;
        }

    .theme-blue-simple .search-box i {
        color: #64748b;
        right: 12px !important; /* أيقونة البحث على اليمين */
        left: auto !important;
    }

    /* === تنسيق أزرار التصدير (Outline Style) === */
    .theme-blue-simple .export-btn {
        background-color: white;
        border: 1px solid #cbd5e1; /* حدود رمادية */
        color: #475569 !important; /* نص رمادي */
        box-shadow: none;
        border-radius: 6px;
        transition: all 0.2s;
    }

        .theme-blue-simple .export-btn:hover {
            background-color: #00685E !important; /* يتحول للأزرق عند التمرير */
            border-color: #00685E;
            color: white !important;
            transform: translateY(-1px);
            box-shadow: 0 2px 4px rgba(0, 104, 94, 0.1);
        }

    /* === تنسيق الجدول والعناوين === */
    .theme-blue-simple .custom-table {
        direction: rtl !important;
    }

        .theme-blue-simple .custom-table th {
            text-align: right !important;
            direction: rtl !important;
            background-color: #f8fafc; /* خلفية رمادية فاتحة لعناوين الأعمدة */
            color: #334155; /* نص رمادي غامق */
            font-weight: 600;
            border-bottom: 2px solid #e2e8f0;
        }

        .theme-blue-simple .custom-table td {
            border-bottom: 1px solid #f1f5f9;
            vertical-align: middle;
        }

        .theme-blue-simple .custom-table tbody tr:hover {
            background-color: #f1f5f9;
        }

    /* === شارات الحالة (بدون تكرار) === */
    .theme-blue-simple .status-badge {
        font-size: 12px;
        padding: 5px 12px;
        border-radius: 50px; /* دائري تماماً */
        font-weight: 600;
    }

.status-active {
    background-color: #dcfce7; /* أخضر فاتح */
    color: #166534;
}

.status-inactive {
    background-color: #f1f5f9; /* رمادي فاتح */
    color: #64748b;
}
/* =========================================================
   المكون الموحد: القائمة المنسدلة القابلة للبحث
   (Searchable Select Component)
   ========================================================= */

/* الحاوية الرئيسية */
.searchable-select-wrapper {
    position: relative;
    min-width: 240px;
}

/* الزر */
.searchable-select-btn {
    width: 100%;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 12px;
    text-align: right;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    transition: all 0.2s;
}

    .searchable-select-btn:hover {
        border-color: var(--mot-primary, #00685E);
        box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
    }

    .searchable-select-btn.open {
        border-color: var(--mot-primary, #00685E);
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        background: #f8fafc;
    }

/* القائمة */
.searchable-select-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 9999; /* رقم عالي لضمان الظهور فوق الجدول */
    display: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

    .searchable-select-menu.show {
        display: block;
        border-color: var(--mot-primary, #00685E);
    }

/* البحث */
.searchable-select-search {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

    .searchable-select-search input {
        width: 100%;
        padding: 8px 12px;
        border: 1px solid #e2e8f0;
        border-radius: 4px;
        font-size: 12px;
    }

        .searchable-select-search input:focus {
            outline: none;
            border-color: var(--mot-primary, #00685E);
        }

/* الخيارات */
.searchable-select-options {
    max-height: 250px;
    overflow: auto;
}

.searchable-option {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.1s;
}

    .searchable-option:hover {
        background: var(--mot-light, #E7F3F2);
    }

    .searchable-option.selected {
        background: var(--mot-primary, #00685E);
        color: white;
        font-weight: 700;
    }

        .searchable-option.selected .pid {
            background: rgba(255,255,255,0.2);
            color: white;
        }

    .searchable-option .pid {
        background: #e2e8f0;
        color: #64748b;
        padding: 2px 6px;
        border-radius: 999px;
        font-size: 10px;
        font-weight: 700;
        flex-shrink: 0;
    }

/* إصلاح مهم: منع النقرات المزعجة */
.searchable-select-menu:not(.show) {
    display: none !important;
    pointer-events: none !important;
}

.searchable-select-menu.show {
    display: block !important;
    pointer-events: auto !important;
}

/* =================== إصلاح تجاوز المحتوى مع السيد بار =================== */
.app-main {
    min-width: 0;
    /* لا تضع overflow-x: hidden هنا - يكسر position: sticky للهيدر */
}

.app-content {
    min-width: 0;
    overflow-x: hidden;
}

/* =================== عمود الترقيم (#) في جداول الـ Index =================== */
/* العمود الأول في الجداول الأساسية للموقع (Tickets/Maintenance/Projects/...)  */
/* احتياج للـ !important عشان نتغلب على inline width اللي بيحطه DataTables    */
.table-card-body .table > thead > tr > th:first-child,
.table-card-body .table > tbody > tr > td:first-child,
table.dataTable > thead > tr > th:first-child,
table.dataTable > tbody > tr > td:first-child {
    width: 48px !important;
    min-width: 40px !important;
    max-width: 56px !important;
    text-align: center;
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
    box-sizing: border-box;
}