body.rtl {
  direction: rtl;
  text-align: right;
}

/* Navbar RTL Fixes */
/* Keep normal row direction; control layout via explicit flex order */

/* Force the brand (logo) to the far right for Arabic */
body.rtl .navbar > .container,
body.rtl .navbar > .container-fluid {
  display: flex;
  flex-direction: row-reverse;
}

/* Neutralize ms-auto on the menu for RTL so it sits next to the logo on the right */
body.rtl .navbar .ms-auto {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Keep collapsible content aligned from the right side */
body.rtl .navbar .navbar-collapse {
  justify-content: flex-end; /* pack items to the right in RTL */
}

/* Menu list alignment and flow */
body.rtl .navbar .navbar-nav {
  flex-direction: row; /* keep order as defined in HTML */
  text-align: right;
  margin-right: 0.75rem;
  margin-left: 0;
  order: 1; /* first inside collapse on RTL */
}

/* Keep brand docked to far right with small spacing before menu */
body.rtl .navbar .navbar-brand {
  margin-right: 0 !important;
  margin-left: 1rem !important;
  order: 3; /* make brand the last element so it sits at far right */
}

/* Horizontal spacing between nav items flowing to the left */
body.rtl .navbar .navbar-nav .nav-item + .nav-item {
  margin-right: 0.75rem;
}

/* Mobile: ensure collapsed menu aligns from right and fills full width properly */
@media (max-width: 991.98px) {
  body.rtl .navbar .navbar-collapse {
    text-align: right;
  }
  body.rtl .navbar .navbar-nav {
    flex-direction: column; /* stack items in mobile */
    align-items: flex-end; /* align items to the right edge */
    margin-right: 0;
  }
  body.rtl .navbar .nav-item {
    width: 100%;
  }
  body.rtl .navbar .nav-link {
    text-align: right;
  }
}

/* Spacing utilities mirrored */
body.rtl .navbar .ms-lg-3 {
  margin-left: 0 !important;
  margin-right: 1rem !important;
}

body.rtl .navbar .ms-lg-4 {
  margin-left: 0 !important;
  margin-right: 1.5rem !important;
}

/* Explicit ordering for RTL inside collapse: menu -> lang switcher -> CTA */
body.rtl .navbar .language-switcher {
  order: 2;
}

body.rtl .navbar .navbar-collapse > .btn {
  order: 3;
}

/* Place entire collapse block just left of brand; toggler stays on far left */
body.rtl .navbar .navbar-collapse {
  order: 2;
}

body.rtl .navbar .navbar-toggler {
  order: 1;
}

/* Icon Fixes - Prevent icons from being flipped */
body.rtl .bi,
body.rtl i[class*="bi-"] {
  display: inline-block;
  transform: scaleX(-1); /* Flip back icons that shouldn't be flipped */
}

/* Keep certain icons normal (don't flip) */
body.rtl .bi-whatsapp,
body.rtl .bi-facebook,
body.rtl .bi-instagram,
body.rtl .bi-linkedin,
body.rtl .bi-envelope,
body.rtl .bi-telephone,
body.rtl .bi-check-circle,
body.rtl .bi-globe2,
body.rtl .bi-lightning-charge,
body.rtl .bi-people {
  transform: none; /* Keep social icons and basic icons normal */
}

/* Image fixes - prevent flipping */
body.rtl img {
  transform: none !important;
}

/* Value card icons */
body.rtl .value-icon {
  transform: none;
}

body.rtl .value-icon i {
  transform: none !important;
}

/* Timeline fixes */
body.rtl .timeline-list {
  border-left: none;
  border-right: 2px solid #dee2e6;
  padding-left: 0;
  padding-right: 2rem;
}

body.rtl .timeline-list li {
  padding-left: 0;
  padding-right: 2rem;
}

body.rtl .timeline-year {
  left: auto;
  right: -1rem;
}

/* Breadcrumb RTL */
body.rtl .breadcrumb-item + .breadcrumb-item::before {
  float: right;
  padding-left: 0.5rem;
  padding-right: 0;
  content: "\\";
}

/* Button and badge RTL */
body.rtl .btn .bi {
  margin-left: 0.5rem;
  margin-right: 0;
}

body.rtl .me-2 {
  margin-right: 0 !important;
  margin-left: 0.5rem !important;
}

body.rtl .ms-2 {
  margin-left: 0 !important;
  margin-right: 0.5rem !important;
}

/* Floating buttons RTL */
body.rtl .floating-cta {
  right: auto;
  left: 30px;
}

body.rtl .floating-whatsapp {
  left: auto;
  right: 30px;
}

/* Form RTL */
body.rtl .form-check-input {
  float: right;
  margin-left: 0.5em;
  margin-right: 0;
}

/* Gap fixes */
body.rtl .d-flex.gap-2,
body.rtl .d-flex.gap-3 {
  direction: rtl;
}

/* Social icons - don't flip */
body.rtl .social-icon i {
  transform: none !important;
}

/* Contact details icons */
body.rtl .contact-card .bi {
  margin-left: 0.5rem;
  margin-right: 0;
}

/* Team cards */
body.rtl .team-card {
  text-align: right;
}

/* Certification badges - don't flip images */
body.rtl .cert-badge img {
  transform: none !important;
}

/* Product cards */
body.rtl .product-card {
  text-align: right;
}

/* Alignment fixes */
body.rtl .text-start {
  text-align: right !important;
}

body.rtl .text-end {
  text-align: left !important;
}

/* Language switcher */
body.rtl .language-switcher {
  margin-left: 0 !important;
  margin-right: 1rem;
}

@media (max-width: 768px) {
  body.rtl .floating-cta {
    left: 20px;
  }
  
  body.rtl .floating-whatsapp {
    right: 20px;
  }
}
