/*! ══════════════════════════════════════════════════════════════════════════════
 *  PREMIUM RESKIN v3.0 — Iraq CRM SaaS Dashboard
 *  
 *  DESIGN-ONLY transformation. Zero color overrides.
 *  Respects the existing theme color system (--color-customColor, theme-* classes).
 *  
 *  FIXES in v3:
 *    ✅ Font override via Bootstrap CSS variable --bs-font-sans-serif
 *    ✅ Arabic font via html[lang="ar"] AND dir="rtl" 
 *    ✅ Proper sidebar targeting for both expanded and minimenu states
 *    ✅ Stronger design transformations
 * ══════════════════════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════════════════════════
   1. GOOGLE FONTS
   ═══════════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');


/* ═══════════════════════════════════════════════════════════════════════════════
   2. DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════════════════════ */
:root {
    /* ── Override Bootstrap font variable ───────────────────────────────── */
    --bs-font-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
    --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;

    /* ── Radius ─────────────────────────────────────────────────────────── */
    --rs-radius-xs:        6px;
    --rs-radius-sm:        8px;
    --rs-radius:           12px;
    --rs-radius-lg:        16px;
    --rs-radius-xl:        20px;
    --rs-radius-pill:      9999px;

    /* ── Shadows ─────────────────────────────────────────────────────────── */
    --rs-shadow-xs:        0 1px 2px rgba(0, 0, 0, 0.04);
    --rs-shadow-sm:        0 2px 8px -2px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
    --rs-shadow:           0 4px 12px -2px rgba(0, 0, 0, 0.06);
    --rs-shadow-md:        0 8px 24px -4px rgba(0, 0, 0, 0.08);
    --rs-shadow-lg:        0 16px 40px -8px rgba(0, 0, 0, 0.1);
    --rs-shadow-xl:        0 24px 56px -12px rgba(0, 0, 0, 0.14);
    --rs-shadow-header:    0 2px 12px rgba(0, 0, 0, 0.04);
    --rs-shadow-dropdown:  0 12px 36px -8px rgba(0, 0, 0, 0.12);
    --rs-shadow-sidebar:   0 0 20px rgba(0, 0, 0, 0.04);

    /* ── Neutral overlays ────────────────────────────────────────────────── */
    --rs-border-subtle:    rgba(0, 0, 0, 0.06);
    --rs-border-light:     rgba(0, 0, 0, 0.04);
    --rs-bg-hover:         rgba(0, 0, 0, 0.03);

    /* ── Transitions ─────────────────────────────────────────────────────── */
    --rs-transition:       all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --rs-transition-fast:  all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Arabic language — override the font variable at the html level */
html[dir="rtl"]:root,
html[lang="ar"]:root {
    --bs-font-sans-serif: 'Cairo', 'IBM Plex Sans Arabic', 'Inter', sans-serif !important;
    --bs-body-font-family: 'Cairo', 'IBM Plex Sans Arabic', 'Inter', sans-serif !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   3. GLOBAL TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Force Inter on everything (English mode) */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.01em;
}

/* Arabic mode — force Cairo/IBM Plex Arabic */
html[dir="rtl"] body,
html[lang="ar"] body {
    font-family: 'Cairo', 'IBM Plex Sans Arabic', 'Inter', sans-serif !important;
    letter-spacing: 0 !important;
}

/* Note: Do NOT use * { font-family: inherit } here — it breaks icon fonts */

/* Headings — crisper, bolder */
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 {
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: -0.02em;
}

h4, .h4, h5, .h5, h6, .h6 {
    font-weight: 600 !important;
}

/* Muted / secondary text */
.text-muted, small, .small, .form-text {
    font-size: 0.8125rem;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   4. SIDEBAR — Premium Internal Refinements (NO floating/margins)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Sidebar container — keep original position, refine shadow and border */
nav.dash-sidebar {
    box-shadow: var(--rs-shadow-sidebar) !important;
    border-right: 1px solid var(--rs-border-light) !important;
    transition: var(--rs-transition) !important;
}

html[dir="rtl"] nav.dash-sidebar {
    border-right: none !important;
    border-left: 1px solid var(--rs-border-light) !important;
}

/* Sidebar logo area — clean separator */
nav.dash-sidebar .m-header,
nav.dash-sidebar .main-logo {
    padding: 16px 20px !important;
    border-bottom: 1px solid var(--rs-border-light) !important;
}

/* Sidebar nav links */
body:not(.minimenu) nav.dash-sidebar .dash-navbar > .dash-item > .dash-link {
    margin: 2px 10px !important;
    padding: 9px 14px !important;
    border-radius: var(--rs-radius) !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    transition: var(--rs-transition) !important;
    text-decoration: none !important;
    gap: 10px;
}

/* Sidebar icons — refined size & opacity */
nav.dash-sidebar .dash-micon {
    min-width: 22px !important;
}

nav.dash-sidebar .dash-micon i {
    font-size: 18px !important;
    opacity: 0.6;
    transition: var(--rs-transition-fast);
}

/* Sidebar active & hover — shape/weight only, NO color override */
body:not(.minimenu) nav.dash-sidebar .dash-navbar > .dash-item.active > .dash-link,
body:not(.minimenu) nav.dash-sidebar .dash-navbar > .dash-item:hover > .dash-link,
body:not(.minimenu) nav.dash-sidebar .dash-navbar > .dash-item:focus > .dash-link {
    border-radius: var(--rs-radius) !important;
    font-weight: 600 !important;
    text-decoration: none !important;
}

nav.dash-sidebar .dash-item.active > .dash-link .dash-micon i,
nav.dash-sidebar .dash-item:hover > .dash-link .dash-micon i {
    opacity: 1 !important;
}

/* Submenu items */
body:not(.minimenu) nav.dash-sidebar .dash-submenu .dash-item > .dash-link {
    font-size: 0.75rem !important;
    border-radius: var(--rs-radius-sm) !important;
    margin: 1px 10px !important;
    padding: 6px 14px !important;
}

/* Submenu bullet/dot before — rounded */
body:not(.minimenu) nav.dash-sidebar .dash-submenu .dash-item:before {
    border-radius: 50% !important;
    width: 5px !important;
    height: 5px !important;
}

/* Section caption labels in sidebar */
nav.dash-sidebar .dash-caption {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    padding: 16px 24px 6px !important;
    opacity: 0.45;
}

/* Sidebar scrollbar — thin & subtle */
nav.dash-sidebar .navbar-content {
    scrollbar-width: thin;
}

nav.dash-sidebar .navbar-content::-webkit-scrollbar {
    width: 4px;
}

nav.dash-sidebar .navbar-content::-webkit-scrollbar-thumb {
    border-radius: var(--rs-radius-pill);
    background: rgba(0, 0, 0, 0.08);
}

/* Minimenu (collapsed sidebar) — clean icon buttons */
.minimenu nav.dash-sidebar .dash-link {
    border-radius: var(--rs-radius-sm) !important;
    margin: 2px 6px !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   5. HEADER / NAVBAR — Clean Refinements (NO floating/margins)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Header container — keep original position */
header.dash-header {
    border-bottom: 1px solid var(--rs-border-light) !important;
    box-shadow: var(--rs-shadow-xs) !important;
    backdrop-filter: blur(12px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(150%) !important;
    z-index: 1024;
    transition: var(--rs-transition) !important;
}

/* Header icon buttons — rounded, hover effect */
header.dash-header .dash-head-link {
    border-radius: var(--rs-radius-sm) !important;
    transition: var(--rs-transition-fast);
    width: 36px;
    height: 36px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

header.dash-header .dash-head-link:hover {
    background: var(--rs-bg-hover) !important;
}

header.dash-header .dash-head-link > i {
    font-size: 18px;
}

/* User profile avatar — circular */
header.dash-header .drp-company .theme-avtar {
    border-radius: 50% !important;
    overflow: hidden;
}

header.dash-header .drp-company .theme-avtar img {
    border-radius: 50% !important;
}

/* User greeting text */
header.dash-header .hide-mob {
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
}

/* Language dropdown button */
header.dash-header .drp-language .dash-head-link {
    width: auto !important;
    padding: 5px 10px !important;
    gap: 5px;
    border-radius: var(--rs-radius-sm) !important;
    font-size: 0.8125rem !important;
}

/* Notification badge */
header.dash-header .dash-h-badge {
    font-size: 0.6rem !important;
    min-width: 16px;
    height: 16px;
    border-radius: var(--rs-radius-pill) !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   6. CARDS — Premium Look
   ═══════════════════════════════════════════════════════════════════════════════ */

.card {
    border-radius: var(--rs-radius-lg) !important;
    box-shadow: var(--rs-shadow-sm) !important;
    border: 1px solid var(--rs-border-subtle) !important;
    overflow: hidden;
    transition: var(--rs-transition) !important;
    margin-bottom: 24px !important;
}

.card:hover {
    box-shadow: var(--rs-shadow) !important;
}

.card .card-header {
    border-radius: var(--rs-radius-lg) var(--rs-radius-lg) 0 0 !important;
    background: transparent !important;
    border-bottom: 1px solid var(--rs-border-light) !important;
    padding: 16px 22px !important;
}

.card .card-header h5,
.card .card-header .h5 {
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    margin: 0;
}

/* Remove colored underline accent from card h5 */
.card .card-header h5:after,
.card .card-header .h5:after {
    display: none !important;
}

.card .card-body {
    padding: 22px !important;
}

.card .card-footer {
    border-radius: 0 0 var(--rs-radius-lg) var(--rs-radius-lg) !important;
    border-top: 1px solid var(--rs-border-light) !important;
    padding: 14px 22px !important;
}

/* Stat/widget card icon avatars */
.card .theme-avtar {
    border-radius: var(--rs-radius) !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   7. BUTTONS — Refined Geometry
   ═══════════════════════════════════════════════════════════════════════════════ */

.btn {
    border-radius: var(--rs-radius) !important;
    font-weight: 500 !important;
    font-size: 0.8125rem !important;
    padding: 0.5rem 1.1rem !important;
    transition: var(--rs-transition) !important;
    letter-spacing: -0.01em;
    text-decoration: none !important;
}

.btn:hover {
    transform: translateY(-1px);
    text-decoration: none !important;
}

.btn:active {
    transform: translateY(0) !important;
}

.btn-sm {
    border-radius: var(--rs-radius-sm) !important;
    padding: 0.3rem 0.75rem !important;
    font-size: 0.75rem !important;
}

.btn-lg {
    border-radius: var(--rs-radius-lg) !important;
    padding: 0.6rem 1.4rem !important;
}

/* Action buttons */
.action-btn {
    border-radius: var(--rs-radius-sm) !important;
    width: 30px !important;
    height: 30px !important;
    transition: var(--rs-transition-fast) !important;
}

.action-btn:hover {
    transform: scale(1.08);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   8. FORM CONTROLS
   ═══════════════════════════════════════════════════════════════════════════════ */

.form-control,
.form-select,
.dataTable-selector,
.dataTable-input,
.custom-select {
    border-radius: var(--rs-radius) !important;
    font-size: 0.8125rem !important;
    padding: 0.5rem 0.85rem !important;
    transition: var(--rs-transition) !important;
}

/* Focus ring — no color override, just shape */
.form-control:focus,
.form-select:focus {
    outline: none !important;
}

/* Input groups */
.input-group .form-control {
    border-radius: 0 var(--rs-radius) var(--rs-radius) 0 !important;
}

.input-group .input-group-text {
    border-radius: var(--rs-radius) 0 0 var(--rs-radius) !important;
}

html[dir="rtl"] .input-group .form-control {
    border-radius: var(--rs-radius) 0 0 var(--rs-radius) !important;
}

html[dir="rtl"] .input-group .input-group-text {
    border-radius: 0 var(--rs-radius) var(--rs-radius) 0 !important;
}

/* Labels */
.form-label,
label:not(.btn):not(.form-check-label):not(.colorinput) {
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    margin-bottom: 5px !important;
}

/* Switch */
.form-switch .form-check-input {
    border-radius: var(--rs-radius-pill) !important;
}

/* Select2 */
.select2-container--default .select2-selection--single {
    border-radius: var(--rs-radius) !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   9. DATA TABLES — Clean, Borderless, Spaced Rows
   ═══════════════════════════════════════════════════════════════════════════════ */

.table-responsive,
.dataTable-wrapper {
    border-radius: var(--rs-radius) !important;
}

/* Spaced rows */
.table,
.dataTable-table {
    border-collapse: separate !important;
    border-spacing: 0 3px !important;
}

/* Header row */
.table > thead > tr > th,
.dataTable-table > thead > tr > th {
    border: none !important;
    padding: 10px 18px !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    white-space: nowrap;
}

.table > thead > tr > th:first-child { border-radius: var(--rs-radius-xs) 0 0 var(--rs-radius-xs) !important; }
.table > thead > tr > th:last-child { border-radius: 0 var(--rs-radius-xs) var(--rs-radius-xs) 0 !important; }
.dataTable-table > thead > tr > th:first-child { border-radius: var(--rs-radius-xs) 0 0 var(--rs-radius-xs) !important; }
.dataTable-table > thead > tr > th:last-child { border-radius: 0 var(--rs-radius-xs) var(--rs-radius-xs) 0 !important; }

/* Body cells — remove ALL borders */
.table > tbody > tr > td,
.dataTable-table > tbody > tr > td {
    padding: 12px 18px !important;
    font-size: 0.8125rem !important;
    border: none !important;
    vertical-align: middle !important;
}

/* Rounded row edges */
.table > tbody > tr > td:first-child { border-radius: var(--rs-radius-xs) 0 0 var(--rs-radius-xs) !important; }
.table > tbody > tr > td:last-child { border-radius: 0 var(--rs-radius-xs) var(--rs-radius-xs) 0 !important; }
.dataTable-table > tbody > tr > td:first-child { border-radius: var(--rs-radius-xs) 0 0 var(--rs-radius-xs) !important; }
.dataTable-table > tbody > tr > td:last-child { border-radius: 0 var(--rs-radius-xs) var(--rs-radius-xs) 0 !important; }

/* Row transitions */
.table > tbody > tr,
.dataTable-table > tbody > tr {
    transition: var(--rs-transition-fast);
    border: none !important;
}

/* Pagination */
.dataTable-pagination li a,
.page-link {
    border-radius: var(--rs-radius-sm) !important;
    font-size: 0.8125rem !important;
    margin: 0 2px;
    transition: var(--rs-transition-fast);
}

.dataTable-selector {
    border-radius: var(--rs-radius-sm) !important;
}

.dataTable-input {
    border-radius: var(--rs-radius) !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   10. MODALS
   ═══════════════════════════════════════════════════════════════════════════════ */

.modal-content {
    border-radius: var(--rs-radius-xl) !important;
    border: none !important;
    box-shadow: var(--rs-shadow-xl) !important;
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--rs-border-light) !important;
    padding: 16px 22px !important;
}

.modal-header .modal-title {
    font-size: 1rem !important;
    font-weight: 600 !important;
}

.modal-body {
    padding: 22px !important;
}

.modal-footer {
    border-top: 1px solid var(--rs-border-light) !important;
    padding: 14px 22px !important;
}

.modal-backdrop.show {
    opacity: 0.35 !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   11. DROPDOWNS
   ═══════════════════════════════════════════════════════════════════════════════ */

.dropdown-menu {
    border-radius: var(--rs-radius) !important;
    box-shadow: var(--rs-shadow-dropdown) !important;
    border: 1px solid var(--rs-border-subtle) !important;
    padding: 6px !important;
    animation: rs-dropdown-in 0.15s ease-out;
    overflow: hidden;
}

.dropdown-item {
    border-radius: var(--rs-radius-sm) !important;
    padding: 8px 12px !important;
    font-size: 0.8125rem !important;
    transition: var(--rs-transition-fast);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--rs-bg-hover) !important;
}

@keyframes rs-dropdown-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   12. BADGES, ALERTS, MISC
   ═══════════════════════════════════════════════════════════════════════════════ */

.badge {
    border-radius: var(--rs-radius-xs) !important;
    font-weight: 500 !important;
    font-size: 0.7rem !important;
    padding: 0.3em 0.65em !important;
}

.badge.rounded-pill {
    border-radius: var(--rs-radius-pill) !important;
}

.status_badge {
    border-radius: var(--rs-radius-pill) !important;
    font-size: 0.7rem !important;
    padding: 4px 12px !important;
}

.alert {
    border-radius: var(--rs-radius) !important;
    font-size: 0.8125rem;
    padding: 14px 20px;
}

.breadcrumb {
    font-size: 0.8125rem;
}

.page-header {
    margin-bottom: 22px !important;
}

.page-header-title h4 {
    font-weight: 700 !important;
}

/* Nav pills */
.nav-pills .nav-link {
    border-radius: var(--rs-radius) !important;
    transition: var(--rs-transition);
    font-size: 0.8125rem;
}

/* Accordion */
.accordion-item {
    border-radius: var(--rs-radius) !important;
    margin-bottom: 8px;
    overflow: hidden;
}

.accordion-button {
    font-weight: 500 !important;
    box-shadow: none !important;
}

/* Progress */
.progress {
    border-radius: var(--rs-radius-pill) !important;
}

.progress-bar {
    border-radius: var(--rs-radius-pill) !important;
}

/* Toast */
.toast {
    border-radius: var(--rs-radius) !important;
    box-shadow: var(--rs-shadow-md) !important;
}

/* Tooltip */
.tooltip-inner {
    border-radius: var(--rs-radius-xs);
}

/* Popover */
.popover {
    border-radius: var(--rs-radius) !important;
}

/* List group */
.list-group-item {
    padding: 11px 16px;
    font-size: 0.8125rem;
}

/* Avatars */
.avatar {
    border-radius: var(--rs-radius) !important;
}

.avatar.rounded-circle,
.avatar.rounded-circle img {
    border-radius: 50% !important;
}

/* Theme avtar */
.theme-avtar {
    border-radius: var(--rs-radius) !important;
}

/* File upload */
.choose-files div {
    border-radius: var(--rs-radius) !important;
}

/* Calendar */
.fc .fc-button-primary {
    border-radius: var(--rs-radius-sm) !important;
}

/* Charts */
.apexcharts-canvas {
    font-family: inherit !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   13. SCROLLBARS
   ═══════════════════════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border-radius: var(--rs-radius-pill);
    background: rgba(0, 0, 0, 0.12);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

* {
    scrollbar-width: thin;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   14. MICRO-ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════════ */

.dash-content {
    animation: rs-fade-up 0.25s ease-out;
}

@keyframes rs-fade-up {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: rs-card-in 0.3s ease-out forwards;
}

@keyframes rs-card-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-pane {
    animation: rs-fade-up 0.2s ease-out;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   15. RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    nav.dash-sidebar {
        box-shadow: var(--rs-shadow-lg) !important;
    }
}

@media (max-width: 768px) {
    .card .card-body {
        padding: 16px !important;
    }

    .card .card-header {
        padding: 12px 16px !important;
    }

    .table > thead > tr > th,
    .table > tbody > tr > td {
        padding: 8px 12px !important;
    }
}

@media (max-width: 576px) {
    .btn {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.8rem !important;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   16. RTL / ARABIC — Comprehensive Design Fixes
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Typography Override ─────────────────────────────────────────────────── */

/* Force Cairo for ALL elements in RTL mode (overrides Inter from section 3) */
html[dir="rtl"] body {
    font-family: 'Cairo', 'IBM Plex Sans Arabic', -apple-system, sans-serif !important;
    letter-spacing: 0 !important;
    word-spacing: 0.5px;
    line-height: 1.7 !important;
}

/* Note: Do NOT use * { font-family: inherit } — it breaks icon fonts (ti, feather, fa) */
html[dir="rtl"] body,
html[dir="rtl"] p,
html[dir="rtl"] span:not([class*="ti"]):not([class*="feather"]):not([class*="fa"]):not(.dash-micon):not(.dash-arrow),
html[dir="rtl"] a,
html[dir="rtl"] li,
html[dir="rtl"] td,
html[dir="rtl"] th,
html[dir="rtl"] label,
html[dir="rtl"] .btn,
html[dir="rtl"] .badge,
html[dir="rtl"] .form-control,
html[dir="rtl"] .form-select,
html[dir="rtl"] .dropdown-item,
html[dir="rtl"] .nav-link,
html[dir="rtl"] .breadcrumb-item,
html[dir="rtl"] .modal-title,
html[dir="rtl"] .card-header h5,
html[dir="rtl"] .dash-mtext,
html[dir="rtl"] .alert {
    font-family: 'Cairo', 'IBM Plex Sans Arabic', -apple-system, sans-serif !important;
}

/* Arabic headings — slightly larger line-height for readability */
html[dir="rtl"] h1, html[dir="rtl"] .h1,
html[dir="rtl"] h2, html[dir="rtl"] .h2,
html[dir="rtl"] h3, html[dir="rtl"] .h3,
html[dir="rtl"] h4, html[dir="rtl"] .h4,
html[dir="rtl"] h5, html[dir="rtl"] .h5,
html[dir="rtl"] h6, html[dir="rtl"] .h6 {
    letter-spacing: 0 !important;
    line-height: 1.5 !important;
}

/* Arabic text in buttons */
html[dir="rtl"] .btn {
    letter-spacing: 0 !important;
}

/* Arabic text in badges */
html[dir="rtl"] .badge {
    letter-spacing: 0 !important;
}


/* ── Sidebar RTL Fixes ───────────────────────────────────────────────────── */

/* Sidebar border direction */
html[dir="rtl"] nav.dash-sidebar {
    border-right: none !important;
    border-left: 1px solid var(--rs-border-light) !important;
}

/* Sidebar submenu indentation — mirror padding for RTL */
html[dir="rtl"] body:not(.minimenu) nav.dash-sidebar .dash-submenu .dash-item > .dash-link {
    padding: 6px 40px 6px 14px !important;
}

/* Submenu dot/bullet — position on right side for RTL */
html[dir="rtl"] body:not(.minimenu) nav.dash-sidebar .dash-submenu .dash-item:before {
    left: auto !important;
    right: 20px !important;
}

/* Sidebar arrow indicator (chevron) — flip for RTL */
html[dir="rtl"] nav.dash-sidebar .dash-arrow {
    margin-left: 0 !important;
    margin-right: auto !important;
}

html[dir="rtl"] nav.dash-sidebar .dash-arrow i {
    transform: scaleX(-1);
}

/* Sidebar icon margin */
html[dir="rtl"] nav.dash-sidebar .dash-micon {
    margin-left: 10px !important;
    margin-right: 0 !important;
}

/* Sidebar caption text */
html[dir="rtl"] nav.dash-sidebar .dash-caption {
    text-align: right !important;
}


/* ── Header RTL Fixes ────────────────────────────────────────────────────── */

/* Header element margins */
html[dir="rtl"] header.dash-header .dash-head-link {
    margin-left: 0;
    margin-right: 0;
}

/* Notification badge position */
html[dir="rtl"] header.dash-header .dash-h-badge {
    right: auto !important;
    left: 0 !important;
}

/* User dropdown arrow */
html[dir="rtl"] header.dash-header .drp-arrow {
    margin-right: 4px !important;
    margin-left: 0 !important;
}


/* ── Table RTL Fixes ─────────────────────────────────────────────────────── */

/* Table text alignment */
html[dir="rtl"] .table > thead > tr > th,
html[dir="rtl"] .dataTable-table > thead > tr > th {
    text-align: right !important;
}

html[dir="rtl"] .table > tbody > tr > td,
html[dir="rtl"] .dataTable-table > tbody > tr > td {
    text-align: right !important;
}

/* Table row rounded corners — mirror for RTL */
html[dir="rtl"] .table > thead > tr > th:first-child,
html[dir="rtl"] .dataTable-table > thead > tr > th:first-child {
    border-radius: 0 var(--rs-radius-xs) var(--rs-radius-xs) 0 !important;
}

html[dir="rtl"] .table > thead > tr > th:last-child,
html[dir="rtl"] .dataTable-table > thead > tr > th:last-child {
    border-radius: var(--rs-radius-xs) 0 0 var(--rs-radius-xs) !important;
}

html[dir="rtl"] .table > tbody > tr > td:first-child,
html[dir="rtl"] .dataTable-table > tbody > tr > td:first-child {
    border-radius: 0 var(--rs-radius-xs) var(--rs-radius-xs) 0 !important;
}

html[dir="rtl"] .table > tbody > tr > td:last-child,
html[dir="rtl"] .dataTable-table > tbody > tr > td:last-child {
    border-radius: var(--rs-radius-xs) 0 0 var(--rs-radius-xs) !important;
}

/* DataTable sorter arrows — move to left side in RTL */
html[dir="rtl"] .dataTable-sorter::before,
html[dir="rtl"] .dataTable-sorter::after {
    right: auto !important;
    left: -18px !important;
}


/* ── Card RTL Fixes ──────────────────────────────────────────────────────── */

/* Card header text alignment */
html[dir="rtl"] .card .card-header h5,
html[dir="rtl"] .card .card-header .h5 {
    text-align: right !important;
}

/* Page header */
html[dir="rtl"] .page-header-title h4 {
    text-align: right !important;
}

html[dir="rtl"] .page-header .breadcrumb {
    justify-content: flex-start !important;
}


/* ── Dropdown RTL ────────────────────────────────────────────────────────── */

html[dir="rtl"] .dropdown-item {
    text-align: right !important;
}

html[dir="rtl"] .dropdown-item i {
    margin-left: 8px !important;
    margin-right: 0 !important;
}


/* ── Modal RTL ───────────────────────────────────────────────────────────── */

html[dir="rtl"] .modal-header .btn-close {
    margin-left: 0 !important;
    margin-right: auto !important;
}


/* ── Form RTL ────────────────────────────────────────────────────────────── */

html[dir="rtl"] .form-label,
html[dir="rtl"] label:not(.btn):not(.form-check-label):not(.colorinput) {
    text-align: right !important;
}

html[dir="rtl"] .form-control,
html[dir="rtl"] .form-select {
    text-align: right !important;
}


/* ── Action Buttons RTL ──────────────────────────────────────────────────── */

html[dir="rtl"] .action-btn + .action-btn {
    margin-left: 0 !important;
    margin-right: 4px !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   17. PRINT
   ═══════════════════════════════════════════════════════════════════════════════ */

@media print {
    nav.dash-sidebar,
    header.dash-header {
        box-shadow: none !important;
    }

    .card {
        box-shadow: none !important;
        animation: none !important;
    }
}
