/* RTL (Right-to-Left) Styles for Arabic */

/* ========================================
   BASE RTL ADJUSTMENTS
========================================= */
html[dir="rtl"] {
  direction: rtl;
}

html[dir="rtl"] body {
  text-align: right;
}

/* ========================================
   LAYOUT ADJUSTMENTS
========================================= */
html[dir="rtl"] .text-start {
  text-align: right;
}

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

/* Navbar */
html[dir="rtl"] .navbar-nav {
  flex-direction: row-reverse;
}

html[dir="rtl"] .navbar-brand {
  flex-direction: row-reverse;
}

html[dir="rtl"] .navbar-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .social-icons {
  flex-direction: row-reverse;
}

html[dir="rtl"] .language-toggle {
  order: -1;
}

/* ========================================
   SPACING ADJUSTMENTS
========================================= */
html[dir="rtl"] .gap-1 > * + * {
  margin-right: 0.25rem;
  margin-left: 0;
}

html[dir="rtl"] .gap-2 > * + * {
  margin-right: 0.5rem;
  margin-left: 0;
}

html[dir="rtl"] .gap-3 > * + * {
  margin-right: 1rem;
  margin-left: 0;
}

html[dir="rtl"] .gap-4 > * + * {
  margin-right: 1.5rem;
  margin-left: 0;
}

/* ========================================
   FORM ELEMENTS
========================================= */
html[dir="rtl"] .search-box i {
  right: 16px;
  left: auto;
}

html[dir="rtl"] .search-box .form-control {
  padding-right: 48px;
  padding-left: 16px;
}

html[dir="rtl"] .category-filter i {
  right: 16px;
  left: auto;
}

html[dir="rtl"] .category-filter .form-select {
  padding-right: 48px;
  padding-left: 40px;
  background-position: left 12px center;
}

html[dir="rtl"] .form-select {
  background-position: left 12px center;
  padding-right: 16px;
  padding-left: 40px;
}

/* ========================================
   CARDS AND COMPONENTS
========================================= */
html[dir="rtl"] .quick-link-card .card-link {
  text-align: right;
}

html[dir="rtl"] .product-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .category-link i {
  transform: scaleX(-1);
}

html[dir="rtl"] .overlay-btn {
  order: -1;
}

/* ========================================
   TIMELINE
========================================= */
html[dir="rtl"] .timeline {
  padding-right: 2rem;
  padding-left: 0;
}

html[dir="rtl"] .timeline::before {
  right: 0;
  left: auto;
}

html[dir="rtl"] .timeline-item {
  padding-right: 3rem;
  padding-left: 0;
}

html[dir="rtl"] .timeline-item::before {
  right: -8px;
  left: auto;
}

/* ========================================
   TESTIMONIALS
========================================= */
html[dir="rtl"] .testimonial-author {
  flex-direction: row-reverse;
}

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

/* ========================================
   CONTACT FORMS
========================================= */
html[dir="rtl"] .contact-item {
  flex-direction: row-reverse;
  text-align: right;
}

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

html[dir="rtl"] .social-link {
  flex-direction: row-reverse;
}

html[dir="rtl"] .social-link:hover {
  transform: translateX(-5px);
}

/* ========================================
   FOOTER
========================================= */
html[dir="rtl"] .footer-logo {
  flex-direction: row-reverse;
}

html[dir="rtl"] .footer-links a:hover {
  transform: translateX(-5px);
}

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

html[dir="rtl"] .social-links {
  flex-direction: row-reverse;
}

html[dir="rtl"] .newsletter-form .form-control {
  border-radius: 0 25px 25px 0;
  padding-left: 60px;
  padding-right: 16px;
}

html[dir="rtl"] .newsletter-form .btn {
  border-radius: 25px 0 0 25px;
  right: auto;
  left: 0;
}

html[dir="rtl"] .footer-badges {
  justify-content: flex-start;
}

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

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

html[dir="rtl"] .hero-cta i,
html[dir="rtl"] .btn i {
  order: -1;
}

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

html[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
  content: "<";
}

/* ========================================
   SCROLL TO TOP
========================================= */
html[dir="rtl"] .scroll-to-top {
  right: auto;
  left: 30px;
}

/* ========================================
   VIEW OPTIONS
========================================= */
html[dir="rtl"] .view-options {
  flex-direction: row-reverse;
}

html[dir="rtl"] .view-toggle {
  flex-direction: row-reverse;
}

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

/* ========================================
   DROPDOWNS
========================================= */
html[dir="rtl"] .dropdown-menu {
  right: 0;
  left: auto;
}

/* ========================================
   MOBILE SPECIFIC RTL
========================================= */
@media (max-width: 767.98px) {
  html[dir="rtl"] .timeline {
    padding-right: 1.5rem;
  }
  
  html[dir="rtl"] .timeline-item {
    padding-right: 2rem;
  }
  
  html[dir="rtl"] .testimonial-author {
    flex-direction: column;
  }
  
  html[dir="rtl"] .scroll-to-top {
    left: 20px;
  }
}

@media (max-width: 575.98px) {
  html[dir="rtl"] .scroll-to-top {
    left: 20px;
  }
  
  html[dir="rtl"] .footer-badges {
    justify-content: flex-start;
  }
}

/* ========================================
   ANIMATIONS RTL ADJUSTMENTS
========================================= */
html[dir="rtl"] .social-link:hover {
  animation: slideInRight 0.3s ease;
}

html[dir="rtl"] .footer-links a:hover {
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-5px);
  }
}

/* ========================================
   TEXT DIRECTION SPECIFIC
========================================= */
html[dir="rtl"] .quote-icon {
  transform: scaleX(-1);
}

html[dir="rtl"] .hero-content {
  text-align: center; /* Keep hero centered for both languages */
}

html[dir="rtl"] .page-hero .hero-content {
  text-align: center; /* Keep page hero centered */
}

html[dir="rtl"] .section-header {
  text-align: center; /* Keep section headers centered */
}

html[dir="rtl"] .error-section {
  text-align: center; /* Keep error pages centered */
}

html[dir="rtl"] .no-results,
html[dir="rtl"] .no-products {
  text-align: center; /* Keep no results centered */
}

/* ========================================
   SPECIFIC COMPONENT RTL FIXES
========================================= */
html[dir="rtl"] .input-group {
  flex-direction: row-reverse;
}

html[dir="rtl"] .input-group .form-control {
  border-radius: 0 8px 8px 0;
}

html[dir="rtl"] .input-group .btn {
  border-radius: 8px 0 0 8px;
}

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

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

/* Ensure icons that should not be flipped remain in correct orientation */
html[dir="rtl"] .fa-star,
html[dir="rtl"] .fa-check-circle,
html[dir="rtl"] .fa-phone,
html[dir="rtl"] .fa-envelope,
html[dir="rtl"] .fa-map-marker-alt,
html[dir="rtl"] .fa-clock {
  transform: none;
}
