/**
 * نظام الصراف الخندقاوي - نظام التصميم الموحد
 * الهوية البصرية: أحمر داكن + أزرق ملكي
 * Version: 2.0 - Professional ERP Design System
 */

/*=============================================================
  1. المتغيرات والإعدادات الأساسية
=============================================================*/
:root {
    /* ألوان الهوية البصرية للصراف الخندقاوي */
    --primary:        #c62828;
    --primary-dark:   #7f0000;
    --primary-deeper: #4a0000;
    --primary-light:  #ffebee;
    --primary-pale:   #ffcdd2;
    --primary-soft:   #fff5f5;
    --primary-grad:   linear-gradient(135deg, #c62828 0%, #7f0000 100%);
    --primary-shadow: rgba(198, 40, 40, 0.18);

    /* ── Bootstrap 5 متغيرات مُعاد تعريفها لتجاوز اللون الأزرق ── */
    --bs-primary:           #c62828;
    --bs-primary-rgb:       198, 40, 40;
    --bs-link-color:        #c62828;
    --bs-link-hover-color:  #7f0000;
    --bs-link-color-rgb:    198, 40, 40;
    --bs-link-hover-color-rgb: 127, 0, 0;
    /* ──────────────────────────────────────────────────── */

    /* ── aliases للتوافق مع القوالب القديمة (لا تُحذف) ── */
    --blue-primary:   #c62828;
    --blue-dark:      #7f0000;
    --blue-light:     #fff5f5;
    --blue-soft:      #ffebee;
    --blue-pale:      #ffcdd2;
    --blue-gradient:  linear-gradient(135deg, #c62828 0%, #7f0000 100%);
    --blue-shadow:    rgba(198, 40, 40, 0.18);
    /* ──────────────────────────────────────────────────── */

    /* الأزرق الثانوي */
    --secondary:      #1a237e;
    --secondary-light:#e8eaf6;

    /* السايدبار الداكن */
    --sidebar-bg:         #1c0505;
    --sidebar-bg2:        #2d0808;
    --sidebar-hover:      rgba(198, 40, 40, 0.15);
    --sidebar-active-bg:  rgba(198, 40, 40, 0.22);
    --sidebar-border:     rgba(198, 40, 40, 0.35);
    --sidebar-text:       rgba(255, 255, 255, 0.82);
    --sidebar-text-muted: rgba(255, 255, 255, 0.45);
    --sidebar-icon:       #ef9a9a;
    --sidebar-active-icon:#ff8a80;

    /* الألوان المحايدة */
    --white:       #ffffff;
    --bg-page:     #f4f5f7;
    --bg-card:     #ffffff;
    --border:      #e8e8e8;
    --border-light:#f0f0f0;
    --text-dark:   #1a1a2e;
    --text-body:   #3d3d4e;
    --text-muted:  #8a8a9a;
    --text-light:  #b0b0c0;

    /* حالات النظام */
    --success:     #2e7d32;
    --success-bg:  #e8f5e9;
    --warning:     #e65100;
    --warning-bg:  #fff3e0;
    --danger:      #c62828;
    --danger-bg:   #ffebee;
    --info:        #01579b;
    --info-bg:     #e1f5fe;

    /* الظلال */
    --shadow-sm:   0 1px 4px rgba(0,0,0,0.06);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.09);
    --shadow-lg:   0 8px 32px rgba(0,0,0,0.12);
    --shadow-red:  0 4px 20px rgba(198,40,40,0.2);

    /* أبعاد التخطيط */
    --header-h:    68px;
    --sidebar-w:   270px;
    --sidebar-col: 68px;
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   20px;

    --transition: all 0.25s ease;
    scroll-behavior: smooth;
}

/*=============================================================
  2. الخطوط - Cairo Arabic Font
=============================================================*/
@font-face {
    font-family: 'Cairo';
    src: url('/static/font/cairo/Cairo-Light.ttf') format('truetype');
    font-weight: 300; font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('/static/font/cairo/Cairo-Regular.ttf') format('truetype');
    font-weight: 400; font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('/static/font/cairo/Cairo-Bold.ttf') format('truetype');
    font-weight: 700; font-display: swap;
}

/*=============================================================
  3. الأنماط العامة (Reset + Base)
=============================================================*/
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
}

html { font-size: 15px; }

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg-page);
    color: var(--text-body);
    line-height: 1.65;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); text-decoration: none; }

h1,h2,h3,h4,h5,h6 { font-weight: 700; color: var(--text-dark); line-height: 1.3; }
p { margin-bottom: 0; }

img { max-width: 100%; }

/*=============================================================
  4. تخطيط الصفحة الرئيسي
=============================================================*/
#main {
    margin-top: var(--header-h);
    margin-right: var(--sidebar-w);
    padding: 28px;
    min-height: calc(100vh - var(--header-h));
    transition: margin-right 0.3s ease;
}

/* بعض القوالب القديمة تضع <main id="main"> داخل block content
   فيتداخل مع #main الخارجي في base.html — نُلغي الإضافة المزدوجة */
#main #main,
#main main {
    margin-top: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
    min-height: unset !important;
}

/* كذلك <body> داخل القوالب القديمة لا يجب أن يُضيف padding */
#main body { display: contents; }

@media (max-width: 992px) {
    #main { margin-right: 0 !important; padding: 16px; }
}
@media (max-width: 576px) {
    #main { padding: 12px; }
}

/*=============================================================
  5. الهيدر (Header)
=============================================================*/
#header {
    height: var(--header-h);
    position: fixed;
    top: 0; right: 0; left: 0;
    z-index: 1030;
    background: var(--white);
    border-bottom: 3px solid var(--primary);
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    transition: padding-right 0.3s ease;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 22px;
}

/* القسم الأيسر: شعار + زر التبديل */
.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.toggle-sidebar-btn {
    width: 40px; height: 40px;
    border: none;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.toggle-sidebar-btn:hover {
    background: var(--primary-pale);
    transform: rotate(90deg);
}

.logo {
    display: flex; align-items: center; gap: 11px;
    text-decoration: none;
}

.logo-image {
    height: 44px; width: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-pale);
    box-shadow: var(--shadow-sm);
}

.logo-text h1 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 0;
    line-height: 1.2;
}

.logo-text .version {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
    font-weight: 400;
}

/* القسم الأوسط: معلومات المستخدم */
.header-center { flex: 1; display: flex; justify-content: center; margin: 0 16px; }

.user-info {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-page);
    border: 1.5px solid var(--border);
    border-radius: 40px;
    padding: 6px 18px;
}

.user-details {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-dark);
}

.user-details i { color: var(--primary); font-size: 1rem; }

.user-name { font-weight: 700; font-size: 0.9rem; color: var(--text-dark); }

.user-branch {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 5px;
    padding-right: 10px;
    border-right: 1px solid var(--border);
}

.user-level {
    background: var(--primary-grad);
    color: var(--white);
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* القسم الأيمن: الإشعارات والملف الشخصي */
.header-right { flex-shrink: 0; }

.nav-menu {
    display: flex; align-items: center; gap: 10px;
    list-style: none; margin: 0; padding: 0;
}

.nav-menu .nav-link {
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-body);
    border: none; background: none;
    display: flex; align-items: center; gap: 6px;
    transition: var(--transition);
}
.nav-menu .nav-link:hover { background: var(--primary-soft); color: var(--primary); }
.nav-menu .nav-link i { font-size: 1.25rem; color: var(--primary); }

/* الإشعارات */
.notification-icon { position: relative; }
.notification-badge {
    position: absolute; top: -4px; right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem; font-weight: 700;
    min-width: 17px; height: 17px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid white;
}

.dropdown-notifications {
    width: 340px; max-width: 92vw;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0; overflow: hidden;
    margin-top: 8px;
}
.dropdown-header {
    background: var(--primary-soft);
    padding: 14px 18px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--primary-pale);
}
.dropdown-header h6 { margin: 0; color: var(--primary-dark); font-weight: 700; font-size: 0.9rem; }
.dropdown-header .badge { background: var(--primary); color: white; }

.notifications-list { max-height: 320px; overflow-y: auto; }

.notification-item {
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}
.notification-item:hover { background: var(--primary-soft); }
.notification-item h6 { font-size: 0.85rem; color: var(--text-dark); margin: 0 0 3px; }
.notification-item p { font-size: 0.78rem; color: var(--text-muted); margin: 0; }
.notification-item small { font-size: 0.7rem; color: var(--text-light); }

.notification-empty { text-align: center; padding: 30px; color: var(--text-light); }
.notification-empty i { font-size: 2rem; display: block; margin-bottom: 8px; }
.dropdown-footer { padding: 12px 18px; background: var(--bg-page); text-align: center; }
.view-all { color: var(--primary); font-weight: 600; font-size: 0.82rem; display: flex; align-items: center; justify-content: center; gap: 5px; }

/* الملف الشخصي */
.profile-link {
    padding: 4px 10px 4px 4px;
    border: 1.5px solid var(--border);
    border-radius: 30px;
    display: flex; align-items: center; gap: 8px;
    background: white;
    transition: var(--transition);
}
.profile-link:hover { border-color: var(--primary); background: var(--primary-soft); }

.profile-avatar {
    width: 36px; height: 36px;
    border-radius: 50%; overflow: hidden;
    flex-shrink: 0;
}
.profile-avatar img, .profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }

.avatar-placeholder {
    width: 100%; height: 100%;
    background: var(--primary-grad);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem;
}

.profile-name { font-size: 0.82rem; font-weight: 600; color: var(--text-dark); }

.dropdown-profile {
    width: 260px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-top: 8px; padding: 0; overflow: hidden;
}
.profile-header {
    background: var(--primary-grad);
    padding: 20px;
    text-align: center;
}
.profile-avatar-large {
    width: 62px; height: 62px;
    border-radius: 50%; margin: 0 auto 10px;
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.4);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.avatar-placeholder-large {
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.2);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.6rem;
}
.profile-header h6 { color: white; font-weight: 700; margin: 0; font-size: 0.95rem; }
.user-role {
    background: rgba(255,255,255,0.2);
    color: white; padding: 3px 12px;
    border-radius: 20px; font-size: 0.75rem; font-weight: 600;
    display: inline-block; margin-top: 5px;
    border: 1px solid rgba(255,255,255,0.3);
}
.profile-menu { padding: 8px 0; }
.profile-menu .dropdown-item {
    padding: 10px 18px; color: var(--text-dark);
    display: flex; align-items: center; gap: 10px;
    font-size: 0.88rem;
    transition: var(--transition);
}
.profile-menu .dropdown-item:hover { background: var(--primary-soft); padding-right: 22px; }
.profile-menu .dropdown-item i { color: var(--primary); font-size: 1rem; }
.profile-menu .logout:hover { background: var(--danger-bg); }
.profile-menu .logout:hover i { color: var(--danger); }

@media (max-width: 992px) {
    .header-center { display: none; }
    .logo-text { display: none; }
}
@media (max-width: 576px) {
    .header-container { padding: 0 12px; }
    .nav-menu { gap: 5px; }
}

/*=============================================================
  6. الشريط الجانبي - Dark Professional Sidebar
=============================================================*/
.sidebar {
    position: fixed;
    top: var(--header-h);
    right: 0; bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
    border-left: 1px solid rgba(255,255,255,0.05);
    z-index: 1020;
    overflow-y: auto; overflow-x: hidden;
    transition: transform 0.3s ease, width 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(198,40,40,0.4) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(198,40,40,0.4); border-radius: 4px; }

.sidebar.collapsed { transform: translateX(calc(100% - var(--sidebar-col))); }
.sidebar.collapsed .sidebar-header h4,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-link .bi-chevron-down,
.sidebar.collapsed .nav-content,
.sidebar.collapsed .nav-section-title { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 14px 0; }
.sidebar.collapsed .nav-link i { margin: 0; font-size: 1.4rem; }

/* رأس السايدبار */
.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(0,0,0,0.2);
}
.sidebar-header h4 {
    color: white; font-weight: 700; margin: 0;
    font-size: 0.88rem;
    text-transform: uppercase; letter-spacing: 1.5px;
    opacity: 0.7;
}
.sidebar-close {
    background: transparent; border: none;
    color: var(--sidebar-text-muted);
    font-size: 1.3rem; cursor: pointer;
    display: none; padding: 2px;
    transition: var(--transition);
}
.sidebar-close:hover { color: white; }

/* عناوين الأقسام */
.nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--sidebar-text-muted);
    padding: 16px 20px 6px;
    display: block;
}

/* قائمة السايدبار */
.sidebar-nav { list-style: none; padding: 8px 0; margin: 0; }
.nav-item { margin: 1px 8px; }

.nav-link {
    display: flex; align-items: center;
    padding: 11px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: none; background: none;
    width: 100%;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: white;
    border-left-color: var(--primary);
    text-decoration: none;
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: white;
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-link i:first-child {
    margin-left: 11px;
    font-size: 1.1rem;
    color: var(--sidebar-icon);
    width: 22px; text-align: center;
    flex-shrink: 0;
}

.nav-link.active i:first-child { color: var(--sidebar-active-icon); }

.nav-link span { flex: 1; white-space: nowrap; }

.nav-link .bi-chevron-down {
    font-size: 0.8rem;
    margin-left: 0;
    transition: transform 0.25s ease;
    color: var(--sidebar-text-muted);
}
.nav-link[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }

/* القائمة الفرعية */
.nav-content {
    list-style: none; padding: 4px 0;
    margin: 0;
    background: rgba(0,0,0,0.25);
    border-radius: var(--radius-sm);
    margin: 2px 0;
    border-right: 2px solid var(--sidebar-border);
}
.nav-content li { margin: 0; }
.nav-content a {
    display: flex; align-items: center;
    padding: 9px 14px 9px 14px;
    padding-right: 44px;
    color: var(--sidebar-text-muted);
    font-size: 0.84rem;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    gap: 8px;
}
.nav-content a:hover {
    background: var(--sidebar-hover);
    color: white;
    text-decoration: none;
    padding-right: 48px;
}
.nav-content a i { font-size: 0.85rem; color: var(--sidebar-icon); flex-shrink: 0; }

/* فاصل */
.nav-content .divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 5px 12px;
}

/* تراكب الجوال */
.sidebar-overlay {
    display: none; position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1010;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* الاستجابة */
@media (min-width: 993px) {
    .sidebar ~ #main { margin-right: var(--sidebar-w); }
    .sidebar.collapsed ~ #main { margin-right: var(--sidebar-col); }
    .sidebar ~ #header { padding-right: var(--sidebar-w); }
    .sidebar.collapsed ~ #header { padding-right: var(--sidebar-col); }
}
@media (max-width: 992px) {
    .sidebar { transform: translateX(100%); box-shadow: none; }
    .sidebar.mobile-open { transform: translateX(0); box-shadow: -6px 0 30px rgba(0,0,0,0.3); }
    .sidebar-close { display: flex; }
    .sidebar ~ #main, .sidebar ~ #header {
        margin-right: 0 !important; padding-right: 0 !important;
    }
    .sidebar.collapsed { transform: translateX(100%); }
}

/*=============================================================
  7. عنوان الصفحة - Page Title
=============================================================*/
.pagetitle {
    margin-bottom: 24px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.pagetitle h1 {
    font-size: 1.45rem; font-weight: 800;
    color: var(--text-dark);
    display: flex; align-items: center; gap: 10px;
    margin: 0;
}
.pagetitle h1 i {
    width: 38px; height: 38px;
    background: var(--primary-grad);
    color: white;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-red);
}

.pagetitle-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/*=============================================================
  8. شريط التنقل التفصيلي (Breadcrumb Banner)
=============================================================*/
.breadcrumbs {
    background: var(--primary-grad);
    border-radius: var(--radius-md);
    padding: 20px 28px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-red);
}

.breadcrumbs::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.page-header {
    display: flex; align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; gap: 14px;
    position: relative;
}

.page-title {
    display: flex; align-items: center; gap: 14px;
}

.page-title i {
    font-size: 1.6rem;
    background: rgba(255,255,255,0.15);
    color: white; padding: 10px;
    border-radius: var(--radius-sm);
}

.page-title h2 {
    font-size: 1.5rem; font-weight: 800;
    color: white; margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.page-title .breadcrumb-sub {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    display: block; margin-top: 2px;
}

.search-btn {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1.5px solid rgba(255,255,255,0.3);
    padding: 10px 22px;
    border-radius: 30px;
    font-weight: 600; font-size: 0.88rem;
    display: inline-flex; align-items: center; gap: 8px;
    transition: var(--transition);
    backdrop-filter: blur(6px);
    white-space: nowrap;
}
.search-btn:hover {
    background: rgba(255,255,255,0.28);
    color: white;
    transform: translateY(-2px);
    text-decoration: none;
}

@media (max-width: 768px) {
    .breadcrumbs { padding: 16px 18px; }
    .page-title h2 { font-size: 1.2rem; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .search-btn { width: 100%; justify-content: center; }
}

/*=============================================================
  9. البطاقات (Cards)
=============================================================*/
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    margin-bottom: 0;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-body { padding: 22px; }
.card-title {
    font-size: 1rem; font-weight: 700;
    color: var(--text-dark);
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
    display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--primary); }

/* بطاقات KPI */
.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 5px; height: 100%;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
.kpi-card.primary::before { background: var(--primary-grad); }
.kpi-card.success::before { background: linear-gradient(180deg, #2e7d32, #1b5e20); }
.kpi-card.warning::before { background: linear-gradient(180deg, #e65100, #bf360c); }
.kpi-card.info::before   { background: linear-gradient(180deg, #01579b, #003c6b); }

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 14px;
}
.kpi-card.primary .kpi-icon { background: var(--primary-soft); color: var(--primary); }
.kpi-card.success .kpi-icon { background: var(--success-bg); color: var(--success); }
.kpi-card.warning .kpi-icon { background: var(--warning-bg); color: var(--warning); }
.kpi-card.info .kpi-icon    { background: var(--info-bg); color: var(--info); }

.kpi-label {
    font-size: 0.8rem; color: var(--text-muted);
    font-weight: 500; margin-bottom: 4px;
}
.kpi-value {
    font-size: 1.8rem; font-weight: 800;
    color: var(--text-dark); line-height: 1;
    margin-bottom: 8px;
}
.kpi-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.75rem; font-weight: 600;
    padding: 3px 10px; border-radius: 20px;
}
.kpi-badge.up   { background: var(--success-bg); color: var(--success); }
.kpi-badge.down { background: var(--danger-bg); color: var(--danger); }
.kpi-badge.neutral { background: var(--secondary-light); color: var(--secondary); }

/* بطاقة المحتوى العامة */
.info-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
}
.info-box::before {
    content: '';
    position: absolute; top: 0; right: 0; left: 0;
    height: 4px;
    background: var(--primary-grad);
}
.info-box h5 {
    font-size: 1rem; font-weight: 700;
    color: var(--text-dark);
    padding-bottom: 14px; margin-bottom: 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 8px;
}
.info-box h5 i { color: var(--primary); }

/* بطاقة حسابية/ملخص */
.summary-card {
    background: var(--primary-grad);
    border-radius: var(--radius-md);
    padding: 18px 22px;
    color: white;
    text-align: center;
}
.summary-card .label { font-size: 0.78rem; opacity: 0.75; margin-bottom: 4px; }
.summary-card .value { font-size: 1.6rem; font-weight: 800; }

/*=============================================================
  10. عناصر النموذج (Forms)
=============================================================*/
.form-group { margin-bottom: 18px; }

label, .form-label {
    font-size: 0.85rem; font-weight: 600;
    color: var(--text-dark); margin-bottom: 6px;
    display: flex; align-items: center; gap: 6px;
}
label i, .form-label i { color: var(--primary); font-size: 0.9rem; }

.form-control {
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: 'Cairo', sans-serif;
    color: var(--text-dark);
    background: #fafafa;
    height: 46px;
    width: 100%;
    transition: var(--transition);
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(198,40,40,0.1);
    background: white;
    outline: none;
}
.form-control:disabled,
.form-control[readonly] {
    background: var(--bg-page);
    color: var(--text-muted);
    border-color: var(--border);
    cursor: not-allowed;
    opacity: 0.7;
}
textarea.form-control { height: auto; min-height: 100px; resize: vertical; }

.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { color: var(--danger); font-size: 0.78rem; margin-top: 4px; display: flex; align-items: center; gap: 4px; }

/* حقول الإجمالي */
#Gtot, #subTot, #grandTotal {
    background: var(--primary-soft) !important;
    border: 2px solid var(--primary) !important;
    font-weight: 700 !important; color: var(--primary-dark) !important;
    text-align: center; font-size: 1.05rem !important;
    height: 46px;
}

h6 {
    color: var(--text-dark); font-weight: 600;
    margin-bottom: 10px; font-size: 0.92rem;
    display: flex; align-items: center; gap: 8px;
}
h6 i { color: var(--primary); }

@media (max-width: 768px) {
    .form-control { height: 42px; font-size: 0.88rem; }
}

/*=============================================================
  11. الأزرار (Buttons)
=============================================================*/
.btn {
    font-family: 'Cairo', sans-serif;
    font-weight: 600; font-size: 0.9rem;
    border-radius: var(--radius-sm);
    padding: 10px 22px;
    height: 44px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: none; cursor: pointer;
    transition: var(--transition);
    position: relative; overflow: hidden;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-default, .btn-primary {
    background: var(--primary-grad);
    color: white;
    box-shadow: var(--shadow-red);
}
.btn-default:hover, .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-deeper) 100%);
    box-shadow: 0 6px 20px var(--primary-shadow);
    color: white;
}
.btn-default { width: 100%; }
.btn-primary { min-width: 180px; margin: 0 auto; display: flex; }

.btn-secondary {
    background: var(--secondary);
    color: white;
    box-shadow: 0 4px 12px rgba(26,35,126,0.2);
}
.btn-secondary:hover { background: #0d1666; color: white; }

.btn-success {
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    color: white;
    box-shadow: 0 4px 12px rgba(46,125,50,0.25);
}
.btn-success:hover { background: linear-gradient(135deg, #1b5e20, #0a3d0a); color: white; }

.btn-warning {
    background: linear-gradient(135deg, #e65100, #bf360c);
    color: white;
    box-shadow: 0 4px 12px rgba(230,81,0,0.25);
}
.btn-warning:hover { background: linear-gradient(135deg, #bf360c, #8d1f00); color: white; }

.btn-danger {
    background: linear-gradient(135deg, #c62828, #7f0000);
    color: white;
    box-shadow: var(--shadow-red);
}
.btn-danger:hover { background: linear-gradient(135deg, #7f0000, #4a0000); color: white; }

.btn-info {
    background: linear-gradient(135deg, #01579b, #003c6b);
    color: white;
}
.btn-info:hover { background: linear-gradient(135deg, #003c6b, #002040); color: white; }

.btn-outline-primary {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary-soft); }

.btn-light {
    background: var(--bg-page);
    color: var(--text-body);
    border: 1.5px solid var(--border);
}
.btn-light:hover { background: var(--border); color: var(--text-dark); }

/* أزرار الإجراءات في الجداول */
.btn-action {
    padding: 6px 14px; height: 34px;
    font-size: 0.82rem; border-radius: 20px;
    min-width: 80px;
}
.btn-delete {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--primary-pale);
}
.btn-delete:hover { background: var(--danger); color: white; }

.btn-edit {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid #b3e5fc;
}
.btn-edit:hover { background: var(--info); color: white; }

.btn-print {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #c8e6c9;
}
.btn-print:hover { background: var(--success); color: white; }

@media (max-width: 768px) {
    .btn { padding: 9px 16px; font-size: 0.85rem; height: 40px; }
    .btn-primary { min-width: 100%; }
}

/*=============================================================
  12. الجداول (Tables)
=============================================================*/
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: white;
    margin-bottom: 0;
}

.table {
    width: 100%; margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 700px;
    color: var(--text-body);
}

.table thead th {
    background: var(--primary-grad);
    color: white; font-weight: 700;
    padding: 14px 16px;
    font-size: 0.85rem;
    border: none; white-space: nowrap;
    text-align: center; position: sticky; top: 0; z-index: 1;
}
.table thead th:first-child { border-radius: 0; }

.table tbody td {
    padding: 13px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    text-align: center;
    font-size: 0.88rem;
    background: white;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--primary-soft); }

.table tfoot td {
    background: var(--primary-soft);
    padding: 13px 16px;
    font-weight: 700; color: var(--primary-dark);
    border-top: 2px solid var(--primary-pale);
    text-align: center;
}

/* بادجات الجداول */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem; font-weight: 600;
    display: inline-block;
}
.bg-primary  { background: var(--primary) !important; color: white !important; }
.bg-success  { background: var(--success) !important; color: white !important; }
.bg-warning  { background: var(--warning) !important; color: white !important; }
.bg-danger   { background: var(--danger)  !important; color: white !important; }
.bg-info     { background: var(--info)    !important; color: white !important; }
.bg-secondary { background: var(--secondary) !important; color: white !important; }

/* بادج مخصص */
.badge-soft-primary  { background: var(--primary-soft);  color: var(--primary); }
.badge-soft-success  { background: var(--success-bg);    color: var(--success); }
.badge-soft-warning  { background: var(--warning-bg);    color: var(--warning); }
.badge-soft-danger   { background: var(--danger-bg);     color: var(--danger); }
.badge-soft-info     { background: var(--info-bg);       color: var(--info); }

@media (max-width: 768px) {
    .table-responsive { margin: 0 -4px; border-radius: var(--radius-sm); }
    .table thead th { padding: 11px 10px; font-size: 0.8rem; }
    .table tbody td { padding: 10px 8px; font-size: 0.82rem; }
}

/*=============================================================
  13. Select2 مخصص
=============================================================*/
.select2-container { width: 100% !important; z-index: 1055 !important; }

.select2-dropdown {
    z-index: 1060 !important;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.select2-container--default .select2-selection--single {
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-sm);
    height: 46px;
    background: #fafafa;
    transition: var(--transition);
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 44px; padding-right: 14px;
    color: var(--text-dark); font-size: 0.9rem;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 44px; left: 12px; right: auto;
}
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(198,40,40,0.1);
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--primary); color: white;
}

@media (max-width: 768px) {
    .select2-container--default .select2-selection--single { height: 42px; }
    .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 40px; }
}

/*=============================================================
  14. التنبيهات والرسائل
=============================================================*/
.alert {
    border-radius: var(--radius-md);
    border: none;
    padding: 13px 18px;
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 0.88rem;
}
.alert i { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); color: var(--success); border-right: 4px solid var(--success); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-right: 4px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-right: 4px solid var(--warning); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-right: 4px solid var(--info); }
.alert-primary { background: var(--primary-soft); color: var(--primary); border-right: 4px solid var(--primary); }

/* رسالة منبثقة ثابتة */
.alert-message {
    position: fixed; top: 86px; left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 320px; max-width: 90vw;
    border-radius: 30px;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease;
    padding: 13px 22px;
    font-weight: 500;
    text-align: center;
}
@keyframes slideDown {
    from { transform: translate(-50%, -100%); opacity: 0; }
    to   { transform: translate(-50%, 0);     opacity: 1; }
}

/* تحذير التكرار */
.duplicate-warning {
    animation: shake 0.5s ease-in-out;
    border: 2px solid var(--danger) !important;
    background: var(--danger-bg) !important;
}
@keyframes shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.focus-highlight, .field-highlight {
    background: var(--primary-soft) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(198,40,40,0.1) !important;
}

@media (max-width: 768px) {
    .alert-message { min-width: 260px; top: 76px; }
}

/*=============================================================
  15. الفلاتر وأشرطة البحث
=============================================================*/
.filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 18px;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

.filter-bar .form-control { flex: 1; min-width: 180px; }

.date-range-group {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.date-range-group label { white-space: nowrap; margin: 0; }
.date-range-group .form-control { min-width: 140px; flex: none; }

@media (max-width: 768px) {
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .btn { width: 100%; justify-content: center; }
}

/*=============================================================
  16. لوحة التحكم - Dashboard Specific
=============================================================*/
.section.dashboard { padding: 0; }

.branch-section { margin-bottom: 28px; }
.branch-section-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 1rem; font-weight: 700; color: var(--text-dark);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-light);
}
.branch-section-title i {
    color: var(--primary);
    background: var(--primary-soft);
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem;
}

.performance-header {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 24px;
    position: relative; overflow: hidden;
}
.performance-header::before {
    content: '';
    position: absolute; top: 0; right: 0; left: 0; height: 4px;
    background: var(--primary-grad);
}
.performance-header h3 {
    font-size: 1.05rem; font-weight: 700;
    color: var(--text-dark); margin-bottom: 18px;
    display: flex; align-items: center; gap: 8px;
}
.performance-header h3 i { color: var(--primary); }

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 22px;
}

/*=============================================================
  17. الجداول في لوحة التحكم - Top Selling
=============================================================*/
.top-selling {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.top-selling .card-body { padding: 0; }
.top-selling .card-title {
    padding: 18px 22px 14px; margin: 0;
    border-bottom: 2px solid var(--border-light);
    border-radius: 0;
    display: flex; align-items: center; gap: 8px;
    font-size: 0.95rem;
}

/*=============================================================
  18. إطار بيانات (PHP form container)
=============================================================*/
.contact { padding: 0; }
.contact .container-fluid { padding: 0; }

.php-email-form {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 26px;
    margin-bottom: 22px;
    position: relative; overflow: hidden;
}
.php-email-form::before {
    content: '';
    position: absolute; top: 0; right: 0; left: 0;
    height: 4px;
    background: var(--primary-grad);
}

/*=============================================================
  19. خلفيات مساعدة
=============================================================*/
.bg-primary-light  { background-color: var(--primary-soft) !important; }
.bg-success-light  { background-color: var(--success-bg) !important; }
.bg-danger-light   { background-color: var(--danger-bg) !important; }
.bg-warning-light  { background-color: var(--warning-bg) !important; }
.bg-info-light     { background-color: var(--info-bg) !important; }

.text-primary  { color: var(--primary) !important; }
.text-success  { color: var(--success) !important; }
.text-warning  { color: var(--warning) !important; }
.text-danger   { color: var(--danger) !important; }
.text-info     { color: var(--info) !important; }
.text-muted    { color: var(--text-muted) !important; }
.text-dark     { color: var(--text-dark) !important; }

.border-primary { border-color: var(--primary) !important; }

/*=============================================================
  20. بطاقات الأيقونات
=============================================================*/
.icon-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 20px 22px;
    display: flex; align-items: center; gap: 16px;
    transition: var(--transition);
}
.icon-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.icon-card .ic-icon {
    width: 50px; height: 50px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
}
.icon-card .ic-icon.red    { background: var(--primary-soft); color: var(--primary); }
.icon-card .ic-icon.green  { background: var(--success-bg);   color: var(--success); }
.icon-card .ic-icon.orange { background: var(--warning-bg);   color: var(--warning); }
.icon-card .ic-icon.blue   { background: var(--info-bg);      color: var(--info); }

.icon-card .ic-body { flex: 1; }
.icon-card .ic-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 3px; }
.icon-card .ic-value { font-size: 1.4rem; font-weight: 800; color: var(--text-dark); }
.icon-card .ic-sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/*=============================================================
  21. إضافات التبويبات (Tabs)
=============================================================*/
.nav-tabs { border-bottom: 2px solid var(--border-light); margin-bottom: 18px; }
.nav-tabs .nav-link {
    border: none; color: var(--text-muted);
    padding: 10px 20px; font-weight: 600; font-size: 0.88rem;
    border-radius: 0;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    margin-bottom: -2px;
}
.nav-tabs .nav-link:hover { color: var(--primary); background: none; }
.nav-tabs .nav-link.active {
    color: var(--primary); background: none;
    border-bottom-color: var(--primary);
}

/*=============================================================
  22. التذييل (Footer)
=============================================================*/
.footer {
    padding: 16px 22px;
    font-size: 0.8rem;
    border-top: 1px solid var(--border-light);
    background: white;
    color: var(--text-muted);
    text-align: center;
    margin-top: 20px;
}

/*=============================================================
  23. صفحة 404
=============================================================*/
.error-404 { padding: 40px; text-align: center; }
.error-404 h1 { font-size: 140px; font-weight: 800; color: var(--primary-pale); line-height: 1; }
.error-404 h2 { font-size: 1.5rem; color: var(--text-dark); margin-bottom: 20px; }

/*=============================================================
  24. زر العودة للأعلى
=============================================================*/
.back-to-top {
    position: fixed; bottom: 20px; left: 20px; z-index: 9999;
    width: 42px; height: 42px; border-radius: var(--radius-sm);
    background: var(--primary-grad);
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; cursor: pointer;
    box-shadow: var(--shadow-red);
    opacity: 0; visibility: hidden;
    transition: var(--transition);
}
.back-to-top.active { opacity: 1; visibility: visible; }
.back-to-top:hover { transform: translateY(-4px); }

/*=============================================================
  25. مساعدات مخصصة إضافية
=============================================================*/
.gap-10 { gap: 10px; }
.gap-16 { gap: 16px; }

.section-label {
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px; display: block;
}

.divider-h {
    height: 1px; background: var(--border-light);
    margin: 18px 0;
}

/* بطاقة الإجراء السريع */
.quick-action {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 8px; padding: 20px 12px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    text-align: center; text-decoration: none;
    color: var(--text-dark); font-size: 0.82rem; font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}
.quick-action i {
    font-size: 1.5rem; color: var(--primary);
    width: 44px; height: 44px;
    background: var(--primary-soft);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
}
.quick-action:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-dark);
    transform: translateY(-2px);
    text-decoration: none;
}

/* حالة فارغة */
.empty-state {
    text-align: center; padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 14px; display: block; opacity: 0.35; }
.empty-state h6 { font-size: 1rem; margin-bottom: 6px; color: var(--text-muted); }
.empty-state p { font-size: 0.85rem; }

/* تمييز الصف المحدد */
.selected-row td { background: var(--primary-soft) !important; font-weight: 600; }

/* معلومات الكرت الداخلية */
.info-card { transition: var(--transition); }
.info-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.info-card h6 { font-size: 1.6rem; color: var(--text-dark); font-weight: 800; margin: 0; }

.card-icon {
    font-size: 1.8rem; line-height: 0;
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
}
.sales-card .card-icon    { color: var(--primary);  background: var(--primary-soft); }
.revenue-card .card-icon  { color: var(--success);  background: var(--success-bg); }
.customers-card .card-icon { color: var(--warning); background: var(--warning-bg); }

/* قيمة المساهمة في الداشبورد */
.contribution {
    font-size: 1.6rem; font-weight: 800;
    color: var(--text-dark); margin: 0; line-height: 1.2;
}

/* شارات النسبة المئوية */
.percentage-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.75rem; font-weight: 600;
    padding: 4px 10px; border-radius: 20px;
    margin-top: 6px;
}
.percentage-up   { background: var(--success-bg); color: var(--success); }
.percentage-down { background: var(--danger-bg);  color: var(--danger); }
.percentage-flat { background: var(--secondary-light); color: var(--secondary); }

/* بطاقة مميزة بخلفية تدرج */
.bg-primary-dark { background: var(--primary-grad); }
.bg-primary-dark * { color: white; }

/*=============================================================
  ** BOOTSTRAP PRIMARY COLOR OVERRIDE **
  يُلغي لون الأزرق من Bootstrap ويستبدله بالأحمر الرسمي
  يجب أن يكون في نهاية الملف لضمان الأولوية
=============================================================*/

/* ─── نصوص ─── */
.text-primary,
.text-primary-dark,
.text-blue,
a.text-primary:hover,
a.text-primary:focus          {
    color: rgba(198, 40, 40, var(--bs-text-opacity, 1)) !important;
}

/* ─── خلفيات ─── */
/* نستخدم rgba مع المتغير حتى تعمل bg-opacity-10/25/50 بشكل صحيح */
.bg-primary {
    background-color: rgba(198, 40, 40, var(--bs-bg-opacity, 1)) !important;
}
.bg-primary-dark,
.bg-blue                      {
    background-color: #7f0000 !important;
    color: #fff !important;
}
.bg-primary-gradient          { background: linear-gradient(135deg,#c62828,#7f0000) !important; }

/* ─── حدود ─── */
.border-primary               { border-color: #c62828 !important; }

/* ─── أزرار Bootstrap 4 & 5 ─── */
.btn-primary {
    background-color: #c62828 !important;
    border-color:     #c62828 !important;
    color: #fff !important;
    background-image: linear-gradient(135deg,#c62828,#7f0000) !important;
    box-shadow: 0 4px 14px rgba(198,40,40,.25) !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active           {
    background-color: #7f0000 !important;
    border-color:     #7f0000 !important;
    color: #fff !important;
    background-image: linear-gradient(135deg,#7f0000,#4a0000) !important;
    box-shadow: 0 6px 20px rgba(198,40,40,.35) !important;
}
.btn-outline-primary {
    color:        #c62828 !important;
    border-color: #c62828 !important;
    background: transparent !important;
}
.btn-outline-primary:hover,
.btn-outline-primary:focus    {
    background-color: #c62828 !important;
    color: #fff !important;
}

/* ─── شارات (Badges) Bootstrap 4 & 5 ─── */
.badge-primary,
.badge.bg-primary,
.badge.badge-primary          {
    background-color: #c62828 !important;
    color: #fff !important;
}

/* ─── تنبيهات ─── */
.alert-primary {
    color: #7f0000 !important;
    background-color: #fff5f5 !important;
    border-color: #ffcdd2 !important;
}

/* ─── جداول ─── */
.table-primary,
.table-primary > td,
.table-primary > th           {
    background-color: #ffebee !important;
    color: #7f0000 !important;
}
.table thead.bg-primary th,
.table thead.bg-primary td    {
    background: linear-gradient(135deg,#c62828,#7f0000) !important;
    color: #fff !important;
}

/* ─── بطاقات ─── */
.card.border-primary          { border-color: #c62828 !important; }
.card-header.bg-primary       {
    background: linear-gradient(135deg,#c62828,#7f0000) !important;
    color: #fff !important;
}

/* ─── رأس الجدول bg-primary ─── */
thead.bg-primary th,
th.bg-primary                 {
    background: linear-gradient(135deg,#c62828,#7f0000) !important;
    color: #fff !important;
}

/* ─── Bootstrap links ─── */
a                             { color: #c62828; }
a:hover                       { color: #7f0000; }

/* ─── Nav pills ─── */
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link  {
    background-color: #c62828 !important;
    color: #fff !important;
}

/* ─── Progress bars ─── */
.progress-bar                 { background-color: #c62828 !important; }

/* ─── Spinners / loaders ─── */
.text-primary.spinner-border,
.spinner-border.text-primary  { color: #c62828 !important; }

/* ─── Form elements ─── */
.form-check-input:checked {
    background-color: #c62828 !important;
    border-color:     #c62828 !important;
}
.form-range::-webkit-slider-thumb { background-color: #c62828 !important; }

/* ─── Dropdown active ─── */
.dropdown-item.active,
.dropdown-item:active         {
    background-color: #c62828 !important;
    color: #fff !important;
}

/* ─── Page link pagination ─── */
.page-item.active .page-link  {
    background-color: #c62828 !important;
    border-color:     #c62828 !important;
    color: #fff !important;
}
.page-link                    { color: #c62828 !important; }
.page-link:hover              { color: #7f0000 !important; }

/* ─── Bootstrap 4 specifics ─── */
.bg-primary-light             { background-color: #fff5f5 !important; }
.text-primary-dark            { color: #7f0000 !important; }

/* ─── Classes مستخدمة في الداشبورد ─── */
.fw-bold.text-primary-dark    { color: #7f0000 !important; }
.border-primary-light         { border-color: #ffcdd2 !important; }
.bg-primary-light.bg-opacity-10 { background-color: rgba(198,40,40,0.08) !important; }
.bg-primary.bg-opacity-10    { background-color: rgba(198,40,40,0.08) !important; }
.text-primary.fs-2            { color: #c62828 !important; }

/* ─── لون رابط القائمة العلوية في Bootstrap navbar ─── */
.navbar-light .navbar-brand,
.navbar-light .navbar-nav .nav-link { color: #c62828 !important; }

/* ─── حقول الإدخال Bootstrap override (حدود حمراء دائمة) ─── */
.form-control,
.custom-select,
input[type="text"].form-control,
input[type="number"].form-control,
input[type="email"].form-control,
input[type="password"].form-control,
input[type="date"].form-control,
input[type="search"].form-control,
textarea.form-control,
select.form-control                {
    border-color: #c62828 !important;
}
.form-control:disabled,
.custom-select:disabled            { border-color: #ccc !important; opacity: 0.7; }

/* ─── Override focus ring ─── */
*:focus { outline-color: rgba(198,40,40,0.4) !important; }
.form-control:focus,
.custom-select:focus,
.form-check-input:focus       {
    border-color: #c62828 !important;
    box-shadow: 0 0 0 0.2rem rgba(198,40,40,0.2) !important;
}

/* ─── select2 ─── */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border-color: #c62828 !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #c62828 !important;
}
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: #c62828 !important;
    box-shadow: 0 0 0 3px rgba(198,40,40,0.12) !important;
}

/* ─── SweetAlert2 confirm button ─── */
.swal2-confirm { background-color: #c62828 !important; }

