/* RTL Support for Arabic and similar languages */

/* Apply base RTL settings */
html[dir="rtl"],
html[dir="rtl"] body {
  font-family: var(--font-global);
  direction: rtl;
  text-align: right;
}

/* Headings use the country-specific --font-alt */
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6 {
  font-family: var(--font-alt), serif;
}

/* Invert margins and paddings */
html[dir="rtl"] .ms-auto {
  margin-left: 0 !important;
  margin-right: auto !important;
}

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

/* Float inversions */
html[dir="rtl"] .float-end {
  float: left !important;
}

html[dir="rtl"] .float-start {
  float: right !important;
}

/* Flex direction inversions */
html[dir="rtl"] .flex-row {
  flex-direction: row-reverse;
}

/* Text alignment */
html[dir="rtl"] .text-start {
  text-align: right !important;
}

html[dir="rtl"] .text-end {
  text-align: left !important;
}

/* Transform inversions for animations */
html[dir="rtl"] [style*="translateX("] {
  transform: scaleX(-1) !important;
}

/* Invert arrows and directional icons */
html[dir="rtl"] .bx-right-arrow-alt,
html[dir="rtl"] .bx-chevron-right,
html[dir="rtl"] .fa-arrow-right,
html[dir="rtl"] .mdi-arrow-right {
  transform: scaleX(-1);
  display: inline-block;
}

html[dir="rtl"] .bx-left-arrow-alt,
html[dir="rtl"] .bx-chevron-left,
html[dir="rtl"] .fa-arrow-left,
html[dir="rtl"] .mdi-arrow-left {
  transform: scaleX(-1);
  display: inline-block;
}

/* Navigation menu adjustments */
html[dir="rtl"] .main-nav ul {
  padding-right: 0;
  padding-left: 0;
}

html[dir="rtl"] .main-nav li {
  text-align: right;
}

/* Card and container adjustments */
html[dir="rtl"] .card {
  text-align: right;
}

/* Bootstrap overrides for RTL */
html[dir="rtl"] .dropdown-menu {
  right: auto;
  left: 0;
  text-align: right;
}

html[dir="rtl"] .dropdown-menu-end {
  right: auto !important;
  left: 0 !important;
}

html[dir="rtl"] .modal-header .btn-close {
  margin: -0.5rem auto -0.5rem -0.5rem;
}

/* Form controls */
html[dir="rtl"] .form-check {
  padding-right: 1.5em;
  padding-left: 0;
}

html[dir="rtl"] .form-check-input {
  margin-right: -1.5em;
  margin-left: 0;
}

/* Input groups */
html[dir="rtl"]
  .input-group
  > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(
    .valid-feedback
  ):not(.invalid-tooltip):not(.invalid-feedback) {
  margin-right: -1px;
  margin-left: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-top-left-radius: 0.25rem;
  border-bottom-left-radius: 0.25rem;
}

/* Swiper / Carousel RTL support */
html[dir="rtl"] .swiper {
  direction: ltr; /* Keep swiper LTR but invert controls */
}

html[dir="rtl"] .swiper-button-next {
  left: 10px;
  right: auto;
}

html[dir="rtl"] .swiper-button-prev {
  right: 10px;
  left: auto;
}
