/* Minimal RTL support for Arabic */

/* 1. Base Layout Direction */
html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

/* 2. Bootstrap Utility Flips */
html[dir="rtl"] .text-left { text-align: right !important; }
html[dir="rtl"] .text-right { text-align: left !important; }
html[dir="rtl"] .text-md-right { text-align: left !important; }
html[dir="rtl"] .text-lg-right { text-align: left !important; }
html[dir="rtl"] .text-center { text-align: center !important; }

/* Force center for headers inside text-center containers to override global RTL header alignment */
html[dir="rtl"] .text-center h1, 
html[dir="rtl"] .text-center h2, 
html[dir="rtl"] .text-center h3, 
html[dir="rtl"] .text-center h4, 
html[dir="rtl"] .text-center h5, 
html[dir="rtl"] .text-center h6,
html[dir="rtl"] .text-center p {
  text-align: center !important;
}

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

html[dir="rtl"] .pl-0 { padding-right: 0 !important; padding-left: 15px !important; } /* Restore default BS gutter roughly if needed, or just unset */
html[dir="rtl"] .pr-0 { padding-left: 0 !important; padding-right: 15px !important; }

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

/* 3. Navbar & Dropdowns */
html[dir="rtl"] .navbar-nav {
  padding-right: 0;
}

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

html[dir="rtl"] .dropdown-menu {
  right: 0;
  left: auto;
  text-align: right;
}

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

/* Fix for icons in navbar if they have margin-right */
html[dir="rtl"] .navbar-nav .nav-link i,
html[dir="rtl"] .dropdown-item i {
  margin-left: 5px;
  margin-right: 0;
}

/* Mega menu headers */
html[dir="rtl"] .mega-menu-header {
  text-align: right;
}

/* 4. Forms */
html[dir="rtl"] .form-control {
  text-align: right;
}

html[dir="rtl"] label {
  text-align: right;
  width: 100%;
}

/* Input groups (e.g. search bars) */
html[dir="rtl"] .input-group > .input-group-prepend,
html[dir="rtl"] .input-group > .input-group-append {
  flex-direction: row-reverse;
}

/* 5. Floating Buttons */
html[dir="rtl"] .floating-buttons {
  right: auto;
  left: 20px;
}

/* 6. Typography & Icons */
html[dir="rtl"] h1, 
html[dir="rtl"] h2, 
html[dir="rtl"] h3, 
html[dir="rtl"] h4, 
html[dir="rtl"] h5, 
html[dir="rtl"] h6 {
  text-align: right;
}

/* Flip directional icons */
html[dir="rtl"] .fa-arrow-right,
html[dir="rtl"] .fa-chevron-right,
html[dir="rtl"] .fa-long-arrow-right,
html[dir="rtl"] .ion-ios-arrow-forward {
  transform: rotate(180deg);
  display: inline-block; /* Required for transform */
}

/* Breadcrumbs */
html[dir="rtl"] .breadcrumbs {
  flex-direction: row-reverse;
}
html[dir="rtl"] .breadcrumbs span {
    display: inline-block;
}

/* Footer specific fixes */
html[dir="rtl"] footer .ftco-footer-social li {
  margin-left: 10px;
  margin-right: 0;
}

/* Service list items */
html[dir="rtl"] .service-features-list li {
  padding-right: 25px;
  padding-left: 0;
}
html[dir="rtl"] .service-features-list li:before {
  right: 0;
  left: auto;
}

/* Contact form helpers */
html[dir="rtl"] .contact-form-wrapper h2,
html[dir="rtl"] .contact-form-wrapper p {
    text-align: right;
}

/* About page checks */
html[dir="rtl"] .ftco-animate {
    text-align: right;
}

/* ============================================
   MODERN NAVBAR RTL FIXES
   ============================================ */

/* Mobile Toggle Icon */
html[dir="rtl"] .mobile-toggle i {
    margin-left: 8px;
    margin-right: 0;
}

/* Mega Menu Items Hover Effect */
html[dir="rtl"] .mega-menu-item {
    text-align: right;
}

html[dir="rtl"] .mega-menu-item:hover {
    transform: translateX(-5px); /* Move left instead of right */
    padding-right: 20px;
    padding-left: 10px; /* Reset LTR padding */
}

/* The vertical bar on hover */
html[dir="rtl"] .mega-menu-item::before {
    left: auto;
    right: 0;
    border-radius: 0 8px 8px 0; /* Flip border radius */
}

/* Mega Menu Item Icon */
html[dir="rtl"] .mega-menu-item i {
    margin-left: 10px; /* Add spacing between icon and text */
    margin-right: 0;
}

/* Mega Menu Wrapper Positioning */
/* Ensure it doesn't overflow left on small screens if fixed width */
@media (min-width: 992px) {
    html[dir="rtl"] .mega-menu-wrapper {
        /* transform: translateX(50%); */ /* Only if we wanted to center differently, but -50% is fine for centering relative to parent center */
    }
}
