/*===================================================================================*/
/*  RTL (Right-to-Left) Support for Arabic Language
/*===================================================================================*/

/* Apply RTL when Arabic language is active */
.rtl {
  direction: rtl;
  text-align: right;
}

.rtl * {
  direction: rtl;
}

/* Specific RTL adjustments */
.rtl .container,
.rtl .container-fluid {
  direction: rtl;
}

/* Bootstrap grid RTL: reverse columns order and alignment */
.rtl .row {
  direction: rtl; /* ensure inline content flows right-to-left */
}
.rtl .row > [class^="col-"],
.rtl .row > [class*=" col-"] {
  float: right; /* flip column flow to place first column on the right */
}

/* Navigation RTL */
.rtl .navbar-nav {
  float: right;
}

.rtl .navbar-nav > li {
  float: right;
}

.rtl .dropdown-menu {
  text-align: right;
  left: auto;
  right: 0;
}

/* Breadcrumbs RTL */
.rtl .breadcrumb {
  direction: rtl;
}

.rtl .breadcrumb > li + li:before {
  content: "/" !important;
  color: var(--text-secondary);
  padding: 0 8px;
}

/* Product Grid RTL */
.rtl .product-grid {
  direction: rtl;
}

.rtl .product .product-image {
  float: right;
}

.rtl .product .product-info {
  text-align: right;
}

/* Sidebar RTL */
.rtl .sidebar {
  float: right;
}

.rtl .content {
  float: left;
}

/* Forms RTL */
.rtl .form-control {
  text-align: right;
}

.rtl .input-group .form-control:first-child {
  border-radius: 0 4px 4px 0;
}

.rtl .input-group .form-control:last-child {
  border-radius: 4px 0 0 4px;
}

.rtl .input-group-btn:first-child > .btn {
  border-radius: 0 4px 4px 0;
}

.rtl .input-group-btn:last-child > .btn {
  border-radius: 4px 0 0 4px;
}

/* Cart RTL */
.rtl .cart-item {
  direction: rtl;
}

.rtl .cart-item .item-info {
  text-align: right;
}

/* Pagination RTL */
.rtl .pagination > li > a,
.rtl .pagination > li > span {
  float: right;
}

/* Search RTL */
.rtl .search-area .search-field {
  text-align: right;
  padding-right: 40px;
  padding-left: 15px;
}

.rtl .search-area .search-button {
  right: auto;
  left: 0;
}

/* Language Switcher RTL Position */
.rtl .language-switcher {
  float: left;
}

/* Icons RTL */
.rtl .fa-chevron-right:before {
  content: "\f053";
}

.rtl .fa-chevron-left:before {
  content: "\f054";
}

.rtl .fa-angle-right:before {
  content: "\f104";
}

.rtl .fa-angle-left:before {
  content: "\f105";
}

/* Table RTL */
.rtl table {
  direction: rtl;
}

.rtl th,
.rtl td {
  text-align: right;
}

/* Modal RTL */
.rtl .modal-header {
  text-align: right;
}

.rtl .modal-header .close {
  float: left;
}

/* Buttons RTL */
.rtl .btn-group > .btn:first-child {
  border-radius: 0 4px 4px 0;
}

.rtl .btn-group > .btn:last-child {
  border-radius: 4px 0 0 4px;
}

/* Price Display RTL */
.rtl .price {
  direction: ltr;
  display: inline-block;
}

/* Numbers should remain LTR */
.rtl .number,
.rtl .price,
.rtl .phone,
.rtl .email {
  direction: ltr;
  text-align: left;
  unicode-bidi: embed;
}

/* Footer RTL */
.rtl .footer {
  direction: rtl;
}

.rtl .footer .module-body ul li {
  text-align: right;
}

.rtl .footer .social-icons {
  float: left;
}

/* Carousel RTL */
.rtl .carousel-control.left {
  right: 0;
  left: auto;
}

.rtl .carousel-control.right {
  left: 0;
  right: auto;
}

.rtl .carousel-control .fa-angle-left:before {
  content: "\f105";
}

.rtl .carousel-control .fa-angle-right:before {
  content: "\f104";
}

/* Owl Carousel v1 RTL compatibility
   Force carousel containers back to LTR so plugin calculations work.
   Keep item flow as left to avoid invisible slides in RTL mode. */
.rtl .owl-carousel {
  direction: ltr;
}
.rtl .owl-carousel .owl-wrapper,
.rtl .owl-carousel .owl-item {
  float: left;
}
/* Optional: align content within items to the right for RTL pages */
.rtl .owl-carousel .owl-item .item,
.rtl .home-owl-carousel .owl-item .item,
.rtl .best-seller .owl-item .item,
.rtl .brand-slider .owl-item .item {
  text-align: right;
}

/* Typography RTL */
.rtl h1, .rtl h2, .rtl h3, .rtl h4, .rtl h5, .rtl h6 {
  text-align: right;
}

.rtl p, .rtl div, .rtl span {
  text-align: right;
}

/* Ensure anchors and buttons text align to right in RTL */
.rtl a,
.rtl button,
.rtl .btn {
  text-align: right;
}

/* Flexbox RTL Support */
.rtl .d-flex {
  direction: rtl;
}

.rtl .justify-content-start {
  justify-content: flex-end !important;
}

.rtl .justify-content-end {
  justify-content: flex-start !important;
}

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

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

.rtl .float-left {
  float: right !important;
}

.rtl .float-right {
  float: left !important;
}

.rtl .pull-left {
  float: right !important;
}

.rtl .pull-right {
  float: left !important;
}

/* Margin and Padding RTL */
.rtl .ml-1 { margin-left: 0 !important; margin-right: 0.25rem !important; }
.rtl .ml-2 { margin-left: 0 !important; margin-right: 0.5rem !important; }
.rtl .ml-3 { margin-left: 0 !important; margin-right: 1rem !important; }
.rtl .ml-4 { margin-left: 0 !important; margin-right: 1.5rem !important; }
.rtl .ml-5 { margin-left: 0 !important; margin-right: 3rem !important; }

.rtl .mr-1 { margin-right: 0 !important; margin-left: 0.25rem !important; }
.rtl .mr-2 { margin-right: 0 !important; margin-left: 0.5rem !important; }
.rtl .mr-3 { margin-right: 0 !important; margin-left: 1rem !important; }
.rtl .mr-4 { margin-right: 0 !important; margin-left: 1.5rem !important; }
.rtl .mr-5 { margin-right: 0 !important; margin-left: 3rem !important; }

.rtl .pl-1 { padding-left: 0 !important; padding-right: 0.25rem !important; }
.rtl .pl-2 { padding-left: 0 !important; padding-right: 0.5rem !important; }
.rtl .pl-3 { padding-left: 0 !important; padding-right: 1rem !important; }
.rtl .pl-4 { padding-left: 0 !important; padding-right: 1.5rem !important; }
.rtl .pl-5 { padding-left: 0 !important; padding-right: 3rem !important; }

.rtl .pr-1 { padding-right: 0 !important; padding-left: 0.25rem !important; }
.rtl .pr-2 { padding-right: 0 !important; padding-left: 0.5rem !important; }
.rtl .pr-3 { padding-right: 0 !important; padding-left: 1rem !important; }
.rtl .pr-4 { padding-right: 0 !important; padding-left: 1.5rem !important; }
.rtl .pr-5 { padding-right: 0 !important; padding-left: 3rem !important; }

/* User Dashboard specific layout fixes */
.rtl .user-dashboard {
  display: flex;
  flex-direction: row-reverse;
}
.rtl .user-dashboard > [class^="col-"],
.rtl .user-dashboard > [class*=" col-"] {
  float: none; /* neutralize Bootstrap floats inside flex container */
}
.rtl .user-dashboard .sidebar {
  order: 1;
}
.rtl .user-dashboard .col-md-6 {
  order: 2;
}
.rtl .user-dashboard .col-md-2:not(.sidebar) {
  order: 3;
}

/* Sidebar buttons/text alignment */
.rtl .sidebar .list-group a {
  text-align: right;
}

/* Responsive RTL */
@media (max-width: 768px) {
  .rtl .navbar-toggle {
    float: left;
  }

  .rtl .navbar-brand {
    float: right;
  }
}

/* Animation RTL */
.rtl .slide-in-left {
  animation: slideInRight 0.5s ease-in-out;
}

.rtl .slide-in-right {
  animation: slideInLeft 0.5s ease-in-out;
}

@keyframes slideInRight {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes slideInLeft {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
