/* ==========================================================================
   طبقة تصحيح RTL — لأنماط القالب المخصّصة التي لا يغطّيها bootstrap.rtl
   تُحمَّل فقط حين تكون لغة الواجهة عربية
   ========================================================================== */

html[dir="rtl"] body,
html[dir="rtl"] .form-control,
html[dir="rtl"] .form-select,
html[dir="rtl"] .btn,
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select {
  font-family: "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
}

/* الأرقام تبقى لاتينية داخل الجداول لتصطفّ عموديًا */
html[dir="rtl"] table td,
html[dir="rtl"] table th,
html[dir="rtl"] .fs-number,
html[dir="rtl"] .progress-label {
  font-variant-numeric: tabular-nums;
}

/* ── الشريط الجانبي ───────────────────────────────── */
html[dir="rtl"] .sidebar,
html[dir="rtl"] .sidebar-menu,
html[dir="rtl"] .main-sidebar { left: auto; right: 0; }
html[dir="rtl"] .content-wrapper,
html[dir="rtl"] .main-content,
html[dir="rtl"] .page-content { margin-left: 0; }

/* ── الهوامش الاتجاهية: نحوّل الفيزيائية إلى منطقية ── */
html[dir="rtl"] .me-1{margin-right:0!important;margin-left:.25rem!important}
html[dir="rtl"] .me-2{margin-right:0!important;margin-left:.5rem!important}
html[dir="rtl"] .me-3{margin-right:0!important;margin-left:1rem!important}
html[dir="rtl"] .ms-1{margin-left:0!important;margin-right:.25rem!important}
html[dir="rtl"] .ms-2{margin-left:0!important;margin-right:.5rem!important}
html[dir="rtl"] .ms-3{margin-left:0!important;margin-right:1rem!important}

html[dir="rtl"] .m-r-5 {margin-right:0!important;margin-left:5px!important}
html[dir="rtl"] .m-r-10{margin-right:0!important;margin-left:10px!important}
html[dir="rtl"] .m-r-15{margin-right:0!important;margin-left:15px!important}
html[dir="rtl"] .m-r-20{margin-right:0!important;margin-left:20px!important}
html[dir="rtl"] .m-l-5 {margin-left:0!important;margin-right:5px!important}
html[dir="rtl"] .m-l-10{margin-left:0!important;margin-right:10px!important}
html[dir="rtl"] .m-l-15{margin-left:0!important;margin-right:15px!important}
html[dir="rtl"] .m-l-20{margin-left:0!important;margin-right:20px!important}

html[dir="rtl"] .p-r-10{padding-right:0!important;padding-left:10px!important}
html[dir="rtl"] .p-r-15{padding-right:0!important;padding-left:15px!important}
html[dir="rtl"] .p-l-10{padding-left:0!important;padding-right:10px!important}
html[dir="rtl"] .p-l-15{padding-left:0!important;padding-right:15px!important}

/* ── محاذاة النص ──────────────────────────────────── */
html[dir="rtl"] .text-start{text-align:right!important}
html[dir="rtl"] .text-end{text-align:left!important}
html[dir="rtl"] .text-left{text-align:right!important}
html[dir="rtl"] .text-right{text-align:left!important}
html[dir="rtl"] table th,
html[dir="rtl"] table td{text-align:right}
html[dir="rtl"] table th.text-center,
html[dir="rtl"] table td.text-center{text-align:center}

/* ── الأيقونات الاتجاهية تُعكس ────────────────────── */
html[dir="rtl"] .fa-chevron-right,
html[dir="rtl"] .fa-chevron-left,
html[dir="rtl"] .fa-angle-right,
html[dir="rtl"] .fa-angle-left,
html[dir="rtl"] .fa-arrow-right,
html[dir="rtl"] .fa-arrow-left,
html[dir="rtl"] .fa-long-arrow-right,
html[dir="rtl"] .fa-long-arrow-left { transform: scaleX(-1); }

/* أيقونات غير اتجاهية يجب ألّا تنعكس */
html[dir="rtl"] .fa-whatsapp,
html[dir="rtl"] .fa-paper-plane,
html[dir="rtl"] .fa-search,
html[dir="rtl"] .fa-spinner,
html[dir="rtl"] .fa-circle-notch { transform: none; }

/* ── الحقول والقوائم ──────────────────────────────── */
html[dir="rtl"] .input-group > :first-child{border-radius:0 .375rem .375rem 0}
html[dir="rtl"] .input-group > :last-child {border-radius:.375rem 0 0 .375rem}
html[dir="rtl"] .dropdown-menu{text-align:right}
html[dir="rtl"] .form-check{padding-right:1.5em;padding-left:0}
html[dir="rtl"] .form-check .form-check-input{float:right;margin-right:-1.5em;margin-left:0}
html[dir="rtl"] .list-group{padding-right:0}

/* ── مكوّنات خاصة بالقالب ─────────────────────────── */
html[dir="rtl"] .progress-bar{float:right}
html[dir="rtl"] .breadcrumb-item + .breadcrumb-item{padding-right:.5rem;padding-left:0}
html[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before{float:right;padding-left:.5rem;padding-right:0}
html[dir="rtl"] .modal-header .btn-close{margin-right:auto;margin-left:0}
html[dir="rtl"] .toast-close-button,
html[dir="rtl"] .iziToast-close{right:auto;left:8px}

/* النصوص المختلطة (روابط، أرقام، أكواد) تُعرض بالاتجاه الصحيح */
html[dir="rtl"] code,
html[dir="rtl"] .text-ltr,
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="tel"]{direction:ltr;text-align:left}
