/* سكاراب للخدمات - الأنماط المخصصة */

/* --- متغيرات CSS --- */
:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --secondary: #7C3AED;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    --dark: #1F2937;
    --gray: #6B7280;
    --light: #F3F4F6;
    --white: #FFFFFF;
    --sidebar-width: 280px;
    --header-height: 64px;
    --border-radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --transition: all .2s ease;
}

/* --- إعادة تعيين عامة --- */
* { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #F9FAFB;
    color: var(--dark);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* --- دعم RTL --- */
[dir="rtl"] body {
    font-family: 'Tajawal', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --- ضمان وراثة الخط في عناصر النماذج ---
   المتصفحات لا تورّث font-family تلقائياً لعناصر input/select/button/textarea */
input, select, textarea, button, optgroup {
    font-family: inherit;
}

/* --- الشريط الجانبي --- */
.sidebar {
    position: fixed;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 50%, var(--secondary) 100%);
    color: var(--white);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

[dir="ltr"] .sidebar { left: 0; }
[dir="rtl"] .sidebar { right: 0; }

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

.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.3px;
}

.sidebar-nav {
    padding: 16px 12px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,.5);
    padding: 12px 16px 8px;
    margin-top: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: rgba(255,255,255,.8);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 2px;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255,255,255,.15);
    color: var(--white);
}

.nav-link.active {
    background: rgba(255,255,255,.2);
    color: var(--white);
    font-weight: 600;
}

.nav-link i {
    width: 20px;
    font-size: 16px;
    text-align: center;
    flex-shrink: 0;
}

/* --- المحتوى الرئيسي --- */
.main-content {
    transition: var(--transition);
    min-height: 100vh;
}

[dir="ltr"] .main-content { margin-left: var(--sidebar-width); }
[dir="rtl"] .main-content { margin-right: var(--sidebar-width); }

/* --- الهيدر العلوي --- */
.top-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.btn-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--dark);
    cursor: pointer;
    padding: 4px;
}

/* --- أزرار اللغة --- */
.lang-switcher {
    display: flex;
    gap: 4px;
    background: var(--light);
    padding: 3px;
    border-radius: 8px;
}

.lang-btn {
    padding: 5px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--gray);
    text-decoration: none;
    transition: var(--transition);
}

.lang-btn.active, .lang-btn:hover {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow);
}

/* --- معلومات المستخدم --- */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 10px;
    transition: var(--transition);
}

.user-menu:hover { background: var(--light); }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 14px;
}

.user-info-text {
    line-height: 1.3;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

.user-role {
    font-size: 11px;
    color: var(--gray);
}

/* --- منطقة المحتوى --- */
.content-area {
    padding: 24px 28px;
}

/* --- البطاقات الإحصائية --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    border: 1px solid #E5E7EB;
}

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue { background: #EFF6FF; color: var(--info); }
.stat-icon.green { background: #ECFDF5; color: var(--success); }
.stat-icon.purple { background: #F5F3FF; color: var(--secondary); }
.stat-icon.orange { background: #FFF7ED; color: var(--warning); }

.stat-info h3 {
    font-size: 28px;
    font-weight: 800;
    color: var(--dark);
    margin: 0;
    line-height: 1;
}

.stat-info p {
    font-size: 13px;
    color: var(--gray);
    margin: 4px 0 0;
}

/* --- الجداول --- */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid #E5E7EB;
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: var(--dark);
}

.card-body {
    padding: 24px;
}

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: #F9FAFB;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 2px solid #E5E7EB;
    text-align: start;
    white-space: nowrap;
}

/* محاذاة رؤوس الجداول حسب اتجاه اللغة (RTL/LTR) */
table.dataTable thead > tr > th,
table.dataTable thead > tr > td,
table.dataTable tfoot > tr > th,
table.dataTable tfoot > tr > td {
    text-align: start;
}

table.dataTable tbody th,
table.dataTable tbody td {
    text-align: start;
}

table.dataTable thead > tr > th.sorting,
table.dataTable thead > tr > th.sorting_asc,
table.dataTable thead > tr > th.sorting_desc {
    padding-inline-end: 26px;
    padding-right: unset;
}

/* أسهم الترتيب تتبع اتجاه اللغة */
[dir="rtl"] table.dataTable thead > tr > th.sorting:before,
[dir="rtl"] table.dataTable thead > tr > th.sorting:after,
[dir="rtl"] table.dataTable thead > tr > th.sorting_asc:before,
[dir="rtl"] table.dataTable thead > tr > th.sorting_asc:after,
[dir="rtl"] table.dataTable thead > tr > th.sorting_desc:before,
[dir="rtl"] table.dataTable thead > tr > th.sorting_desc:after {
    right: auto;
    left: 10px;
}

/* DataTables wrapper alignment */
[dir="rtl"] .dataTables_wrapper .dataTables_length { float: right; }
[dir="rtl"] .dataTables_wrapper .dataTables_filter { float: left; text-align: left; }
[dir="rtl"] .dataTables_wrapper .dataTables_info { float: right; }
[dir="rtl"] .dataTables_wrapper .dataTables_paginate { float: left; text-align: left; }

.table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid #F3F4F6;
    color: var(--dark);
}

.table tr:hover td {
    background: #F9FAFB;
}

.table tr:last-child td {
    border-bottom: none;
}

/* --- الأزرار --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn i { font-size: 14px; }

.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
}

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #059669; color: var(--white); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #DC2626; color: var(--white); }

.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover { background: #D97706; color: var(--white); }

.btn-secondary { background: var(--light); color: var(--dark); }
.btn-secondary:hover { background: #E5E7EB; color: var(--dark); }

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-group {
    display: inline-flex;
    gap: 6px;
}

/* --- البادجات --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-preparing { background: #DBEAFE; color: #1E40AF; }
.badge-out_for_delivery { background: #E0E7FF; color: #3730A3; }
.badge-delivered { background: #D1FAE5; color: #065F46; }
.badge-cancelled { background: #FEE2E2; color: #991B1B; }
.badge-active { background: #D1FAE5; color: #065F46; }
.badge-suspended { background: #FEE2E2; color: #991B1B; }
.badge-offline { background: #F3F4F6; color: #6B7280; }
.badge-approved { background: #D1FAE5; color: #065F46; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-expired { background: #F3F4F6; color: #6B7280; }
.badge-pending_payment { background: #FEF3C7; color: #92400E; }

/* --- النماذج --- */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    color: var(--dark);
    background: var(--white);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}

.form-control::placeholder {
    color: #9CA3AF;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: left 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-left: 36px;
}

[dir="ltr"] select.form-control {
    background-position: right 12px center;
    padding-left: 14px;
    padding-right: 36px;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* --- التنبيهات --- */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* عنوان قسم داخل النموذج */
.form-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--primary);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

/* ========================================
   صفحات المصادقة (دخول/تسجيل/استعادة)
   ======================================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 20%, rgba(124, 58, 237, .35), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(79, 70, 229, .35), transparent 50%),
        linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #EC4899 100%);
}

/* أشكال زخرفية متحركة في الخلفية */
.auth-wrapper::before,
.auth-wrapper::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .35;
    pointer-events: none;
    animation: authFloat 14s ease-in-out infinite;
}
.auth-wrapper::before {
    width: 320px; height: 320px;
    background: #F472B6;
    top: -80px; inset-inline-start: -80px;
}
.auth-wrapper::after {
    width: 360px; height: 360px;
    background: #38BDF8;
    bottom: -120px; inset-inline-end: -120px;
    animation-delay: -7s;
}
@keyframes authFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(20px, -30px) scale(1.08); }
}

.auth-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, .98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 24px;
    padding: 44px 40px 36px;
    width: 100%;
    max-width: 460px;
    box-shadow:
        0 30px 80px rgba(15, 23, 42, .25),
        0 0 0 1px rgba(255, 255, 255, .1) inset;
    animation: authCardIn .55s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes authCardIn {
    from { opacity: 0; transform: translateY(24px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--white);
    margin-bottom: 14px;
    box-shadow: 0 12px 28px rgba(79, 70, 229, .4);
    transform: rotate(-4deg);
    transition: transform .3s ease;
}
.auth-logo-icon:hover { transform: rotate(0deg) scale(1.05); }

.auth-logo h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--dark);
    margin: 0 0 6px;
    letter-spacing: -.5px;
}

.auth-logo p {
    color: var(--gray);
    font-size: 14px;
    margin: 0;
}

/* مجموعة حقل مع أيقونة بداخله */
.auth-form .form-group { margin-bottom: 18px; }

.auth-form .form-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    display: block;
}

.auth-input {
    position: relative;
}
.auth-input .form-control {
    padding-block: 13px;
    padding-inline-start: 44px;
    padding-inline-end: 16px;
    font-size: 15px;
    border-radius: 12px;
    border: 1.5px solid #E5E7EB;
    background: #F9FAFB;
    transition: var(--transition);
    width: 100%;
}
.auth-input .form-control:focus {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
    outline: none;
}
.auth-input > i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    inset-inline-start: 14px;
    color: #9CA3AF;
    font-size: 18px;
    pointer-events: none;
    transition: color .2s ease;
}
.auth-input .form-control:focus + i,
.auth-input .form-control:not(:placeholder-shown) + i {
    color: var(--primary);
}

/* زر إظهار/إخفاء كلمة المرور */
.auth-input .toggle-pwd {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    inset-inline-end: 12px;
    background: transparent;
    border: 0;
    color: #9CA3AF;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}
.auth-input .toggle-pwd:hover { color: var(--primary); background: rgba(79, 70, 229, .08); }
.auth-input:has(.toggle-pwd) .form-control { padding-inline-end: 44px; }

/* صف "تذكرني" + "نسيت كلمة المرور" */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -4px 0 18px;
    font-size: 13px;
}
.auth-row label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #4B5563;
    cursor: pointer;
    user-select: none;
}
.auth-row a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}
.auth-row a:hover { text-decoration: underline; }

.auth-form .btn-primary {
    width: 100%;
    padding: 13px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    box-shadow: 0 10px 24px rgba(79, 70, 229, .35);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.auth-form .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(79, 70, 229, .45);
    filter: brightness(1.05);
}
.auth-form .btn-primary:active { transform: translateY(0); }

/* فاصل اختياري بين الأقسام */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 18px;
    color: #9CA3AF;
    font-size: 12px;
    font-weight: 500;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #E5E7EB;
}

.auth-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 14px;
    color: var(--gray);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover { text-decoration: underline; }

/* مبدّل اللغة في صفحة الدخول */
.auth-lang {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

/* تنبيهات داخل الكارت */
.auth-card .alert {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* صيغة بديلة داكنة (للسائق/الإدارة) */
.auth-wrapper.auth-dark {
    background:
        radial-gradient(circle at 20% 20%, rgba(245, 158, 11, .25), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(239, 68, 68, .25), transparent 50%),
        linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #334155 100%);
}
.auth-wrapper.auth-dark::before { background: #F59E0B; }
.auth-wrapper.auth-dark::after  { background: #EF4444; }

.auth-wrapper.auth-admin {
    background:
        radial-gradient(circle at 20% 20%, rgba(16, 185, 129, .25), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(59, 130, 246, .25), transparent 50%),
        linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #1E40AF 100%);
}
.auth-wrapper.auth-admin::before { background: #10B981; }
.auth-wrapper.auth-admin::after  { background: #3B82F6; }

.auth-logo-icon.icon-driver {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    box-shadow: 0 12px 28px rgba(245, 158, 11, .4);
}
.auth-logo-icon.icon-admin {
    background: linear-gradient(135deg, #0F172A, #1E40AF);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .45);
}

.auth-form.has-driver .btn-primary {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    box-shadow: 0 10px 24px rgba(245, 158, 11, .4);
}
.auth-form.has-admin .btn-primary {
    background: linear-gradient(135deg, #0F172A, #1E40AF);
    box-shadow: 0 10px 24px rgba(30, 64, 175, .4);
}

/* --- صفحة التتبع --- */
.tracking-wrapper {
    min-height: 100vh;
    background: #F9FAFB;
    padding: 40px 20px;
}

.tracking-container {
    max-width: 680px;
    margin: 0 auto;
}

.tracking-header {
    text-align: center;
    margin-bottom: 40px;
}

.tracking-header h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--dark);
    margin: 0 0 8px;
}

.tracking-header p {
    color: var(--gray);
    font-size: 16px;
    margin: 0;
}

.tracking-search {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

.tracking-search .form-control {
    flex: 1;
    padding: 14px 18px;
    font-size: 16px;
    border-radius: 12px;
}

.tracking-search .btn {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: 12px;
}

/* --- تايملاين التتبع --- */
.tracking-timeline {
    position: relative;
    padding: 0;
}

.tracking-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #E5E7EB;
}

[dir="ltr"] .tracking-timeline::before { left: 18px; }
[dir="rtl"] .tracking-timeline::before { right: 18px; }

.timeline-item {
    position: relative;
    display: flex;
    gap: 20px;
    padding-bottom: 24px;
}

.timeline-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--white);
    flex-shrink: 0;
    z-index: 1;
}

.timeline-dot.completed { background: var(--success); }
.timeline-dot.active { background: var(--primary); animation: pulse 2s infinite; }
.timeline-dot.inactive { background: #D1D5DB; }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79,70,229,.4); }
    50% { box-shadow: 0 0 0 12px rgba(79,70,229,0); }
}

.timeline-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--dark);
    padding-top: 8px;
}

.timeline-content p {
    font-size: 13px;
    color: var(--gray);
    margin: 0;
}

/* --- خلية فارغة --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state i {
    font-size: 48px;
    color: #D1D5DB;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--dark);
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

/* --- Media Queries --- */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .btn-sidebar-toggle {
        display: block;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,.5);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 640px) {
    .content-area {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .auth-card {
        padding: 32px 24px;
    }

    .tracking-search {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ====== إصلاحات الموبايل: منع السكرول الأفقي للهيدر ====== */
@media (max-width: 768px) {
    body { overflow-x: hidden; }
    .top-header {
        padding: 0 12px;
        gap: 8px;
    }
    .header-left { gap: 8px; min-width: 0; flex: 1; }
    .header-right {
        gap: 6px;
        flex-shrink: 0;
    }
    /* تصغير العنوان وقصّ النص الزائد */
    .page-title {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 50vw;
    }
    /* إخفاء النص بجانب الأڤاتار للحفاظ على المساحة */
    .user-info-text { display: none; }
    .user-menu { padding: 4px; }
    .user-avatar { width: 32px; height: 32px; font-size: 13px; border-radius: 8px; }
    /* تبديل اللغة مدمج */
    .lang-switcher { padding: 2px; }
    .lang-btn { padding: 4px 8px; font-size: 11px; min-width: auto; }
    /* أيقونة الإشعار أصغر */
    .header-notification {
        width: 36px; height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    /* زر الخروج كأيقونة فقط */
    .header-right .btn-secondary {
        padding: 6px 8px;
        font-size: 13px;
    }
    .header-right .btn-secondary span,
    .header-right .btn-secondary .btn-text { display: none; }
}

/* الشاشات الصغيرة جداً (هواتف ضيقة) */
@media (max-width: 380px) {
    .lang-switcher { display: none; }
    .page-title { max-width: 40vw; font-size: 15px; }
}

/* أيقونة الإشعار العامة */
.header-notification {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--gray);
    background: var(--light);
    text-decoration: none;
    transition: var(--transition);
}
.header-notification:hover { background: #E5E7EB; color: var(--dark); }
.header-notification-payment { color: #047857; background: #ECFDF5; }
.header-notification-payment:hover { background: #D1FAE5; color: #065F46; }
.notification-badge {
    position: absolute;
    top: -4px;
    inset-inline-end: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px var(--white);
}

/* ========================================
   مودال التأكيد (Confirmation Modal)
   ======================================== */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.confirm-overlay.show {
    opacity: 1;
    visibility: visible;
}

.confirm-box {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

.confirm-overlay.show .confirm-box {
    transform: scale(1);
}

.confirm-icon {
    font-size: 48px;
    color: #f59e0b;
    margin-bottom: 16px;
}

.confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.confirm-message {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 24px;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-actions .btn {
    min-width: 120px;
    padding: 10px 24px;
    font-weight: 600;
    border-radius: 10px;
}

/* --- شارات الإشعارات --- */
.nav-badge {
    margin-inline-start: auto;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    line-height: 1;
}

.header-notification {
    position: relative;
    color: var(--gray);
    font-size: 20px;
    text-decoration: none;
    transition: color .2s;
}

.header-notification:hover {
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: -6px;
    inset-inline-end: -8px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* ======================================================
   DataTables — تخصيص شكل الجداول ليتوافق مع التصميم
   ====================================================== */

/* إخفاء CSS الافتراضي لـ DataTables واستبداله بالتصميم */
table.dataTable {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 0 !important;
}

table.dataTable thead th,
table.dataTable thead td {
    background: var(--light) !important;
    color: var(--dark) !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    padding: 12px 16px !important;
    border-bottom: 2px solid var(--border) !important;
    white-space: nowrap;
    cursor: pointer;
}

table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
    opacity: 0.6;
}

table.dataTable tbody tr {
    transition: background 0.15s;
}

table.dataTable tbody tr:hover td {
    background: var(--primary-light) !important;
}

table.dataTable tbody td {
    padding: 12px 16px !important;
    border-bottom: 1px solid var(--border) !important;
    font-size: 14px !important;
    vertical-align: middle !important;
    color: var(--dark) !important;
}

/* حاوي DataTables */
.dataTables_wrapper {
    padding: 0 !important;
}

.dataTables_wrapper .dataTables_filter {
    margin-bottom: 12px;
}

.dataTables_wrapper .dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray);
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    min-width: 200px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.dataTables_wrapper .dataTables_length {
    margin-bottom: 12px;
}

.dataTables_wrapper .dataTables_length label {
    font-size: 13px;
    color: var(--gray);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 13px;
    font-family: inherit;
}

/* شريط المعلومات السفلي */
.dataTables_wrapper .dataTables_info {
    font-size: 12px;
    color: var(--gray);
    padding-top: 8px;
}

/* أزرار الترقيم */
.dataTables_wrapper .dataTables_paginate {
    padding-top: 8px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    margin: 0 2px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border) !important;
    background: #fff !important;
    color: var(--dark) !important;
    transition: all 0.15s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-light) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* شاشة التحميل */
.dataTables_wrapper .dataTables_processing {
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 13px;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* دعم RTL */
[dir="rtl"] .dataTables_wrapper .dataTables_filter,
[dir="rtl"] .dataTables_wrapper .dataTables_length {
    float: right;
}

[dir="rtl"] .dataTables_wrapper .dataTables_info {
    float: right;
}

[dir="rtl"] .dataTables_wrapper .dataTables_paginate {
    float: left;
}

/* الصف الفارغ */
table.dataTable tbody td.dataTables_empty {
    text-align: center !important;
    color: var(--gray) !important;
    padding: 40px !important;
    font-size: 14px !important;
}

/* Input group */
.input-group { display:flex;align-items:stretch }
.input-group .form-control { flex:1;border-radius:0 }
.input-group-text { background:var(--light);border:1px solid #d1d5db;padding:8px 12px;font-size:14px;white-space:nowrap;color:var(--dark) }
[dir="ltr"] .input-group > :first-child,
[dir="rtl"] .input-group > :last-child  { border-radius:8px 0 0 8px;border-inline-end:none }
[dir="ltr"] .input-group > :last-child,
[dir="rtl"] .input-group > :first-child { border-radius:0 8px 8px 0;border-inline-start:none }
/* إصلاح: input-group[dir="ltr"] داخل صفحة RTL — border-radius تُطبَّق على الجانب الخارجي الصحيح */
[dir="rtl"] .input-group[dir="ltr"] > :first-child { border-radius:8px 0 0 8px;border-inline-start:1px solid #d1d5db;border-inline-end:none }
[dir="rtl"] .input-group[dir="ltr"] > :last-child  { border-radius:0 8px 8px 0;border-inline-end:1px solid #d1d5db;border-inline-start:none }

/* شبكة الرسوم البيانية — 4 أعمدة دائماً على سطر واحد */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
    width: 100%;
    max-width: 100%;
}

/* الأجهزة اللوحية والمتوسطة (تحت 1280px) — عمودان */
@media (max-width: 1280px) {
    .charts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* الهواتف — عمود واحد دون تجاوز عرض الشاشة */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* حاوية الـ canvas بارتفاع ثابت لضمان responsive صحيح مع Chart.js */
.chart-wrapper {
    position: relative;
    height: 220px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* إجبار canvas على عدم تجاوز أبعاد حاويته — يمنع horizontal scroll */
.chart-wrapper canvas {
    max-width: 100% !important;
    height: 100% !important;
}

/* بطاقة مندوب في لوحة الأعباء */
.workload-driver-card {
    background: var(--light);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1.5px solid var(--border);
    transition: border-color .15s, background .15s;
}
.workload-driver-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* ========================================
   مودال عام (Modal - Header / Body / Footer)
   يختلف عن confirm-overlay في أنه يدعم نماذج
   ======================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.modal-overlay.show {
    display: flex;
    animation: modalFadeIn 0.2s ease forwards;
}
.modal-box {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.2s ease forwards;
}
@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes modalSlideIn {
    from { transform: scale(0.95); }
    to   { transform: scale(1); }
}
.modal-overlay.show .modal-box {
    transform: scale(1);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--gray);
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
}
.modal-close:hover { background: var(--light); }
.modal-body { padding: 24px; }
.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: #F9FAFB;
    border-radius: 0 0 16px 16px;
}
