/* RTL (Right-to-Left) Support for Arabic Pages */

html[dir="rtl"] {
  direction: rtl;
}

html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

/* Header RTL adjustments */
html[dir="rtl"] .header-content {
  flex-direction: row-reverse;
  /* Ensure same spacing between logo and nav as LTR */
  justify-content: space-between;
  /* Match exact spacing - same as LTR version */
  gap: 0;
  /* Ensure proper alignment */
  align-items: center;
}

html[dir="rtl"] nav ul {
  flex-direction: row-reverse;
  /* Keep same gap as LTR */
  gap: 2rem;
}

html[dir="rtl"] .logo {
  margin-right: 0;
  margin-left: 0;
  /* Ensure logo has proper spacing from the right edge (start in RTL) */
  margin-top: 0;
  margin-bottom: 0;
  /* Add flex-grow to push nav to the left, matching LTR spacing */
  flex: 0 0 auto;
}

/* Ensure nav has no extra margins that could affect spacing */
html[dir="rtl"] nav {
  margin: 0;
  padding: 0;
  /* Ensure nav positioning matches LTR spacing */
  flex: 0 0 auto;
}

/* Ensure mobile button doesn't affect spacing in RTL */
html[dir="rtl"] .mobile-menu-btn {
  margin: 0;
  order: 0;
}

/* Ensure language switcher has same spacing in RTL */
/* When nav is reversed, we need margin-right instead of margin-left for same visual spacing */
html[dir="rtl"] .language-switcher {
  margin-left: 0 !important;
  margin-right: 1rem !important;
}

/* Ensure header styling matches English version */
html[dir="rtl"] header {
  background: white;
  color: #1a1a1a;
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  width: 100%;
}

/* Ensure header-content has exact same spacing behavior */
html[dir="rtl"] .header-content {
  padding: 0 2rem;
  max-width: 1200px;
  margin: 0 auto;
  /* Ensure space-between works correctly in RTL */
  justify-content: space-between;
  align-items: center;
}

/* Navigation RTL */
html[dir="rtl"] nav a {
  text-align: right;
}

/* Footer RTL */
html[dir="rtl"] .footer-grid {
  direction: rtl;
}

/* Form elements RTL */
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select {
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] .form-group label {
  text-align: right;
}

/* Contact info cards RTL */
html[dir="rtl"] .info-card {
  text-align: right;
}

html[dir="rtl"] .info-card svg {
  margin-left: 1rem;
  margin-right: 0;
}

/* Grid layouts RTL */
html[dir="rtl"] .features-grid,
html[dir="rtl"] .services-grid,
html[dir="rtl"] .pool-types-grid {
  direction: rtl;
}

/* Pool Types Carousel RTL */
html[dir="rtl"] .pool-types-slides {
  direction: rtl;
}

html[dir="rtl"] .pool-type-card-home {
  direction: rtl;
}

html[dir="rtl"] .pool-type-card-home > div {
  text-align: center; /* Keep center for images, but ensure RTL flow */
}

html[dir="rtl"] .pool-type-card-home h3,
html[dir="rtl"] .pool-type-card-home p {
  direction: rtl;
  text-align: center;
}

/* Timeline RTL */
html[dir="rtl"] .timeline {
  padding-right: 3rem;
  padding-left: 0;
  position: relative;
}

html[dir="rtl"] .timeline::before {
  content: '';
  position: absolute;
  right: 0;
  left: auto;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #0066cc;
}

html[dir="rtl"] .timeline-item {
  padding-right: 2rem;
  padding-left: 0;
  position: relative;
}

html[dir="rtl"] .timeline-item::before {
  right: -3rem;
  left: auto;
  top: 0.5rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0066cc;
  border: 4px solid white;
  box-shadow: 0 0 0 3px #0066cc;
}

/* Language switcher - same spacing for both directions */
.language-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* RTL will reverse the margin automatically via flex-direction: row-reverse on nav ul */
/* Keep margin-left: 1rem in both versions for consistent spacing */
html[dir="rtl"] .language-switcher {
  margin-left: 1rem;
  margin-right: 0;
}

.language-switcher a {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  color: #1a1a1a;
  font-size: 0.9rem;
}

.language-switcher a:hover {
  background: rgba(0, 102, 204, 0.1);
  color: #0066cc;
}

.language-switcher a.active {
  background: rgba(0, 102, 204, 0.15);
  color: #0066cc;
  font-weight: 600;
}

/* Mobile menu RTL */
html[dir="rtl"] .mobile-menu-btn {
  margin-left: 0;
  margin-right: auto;
}

html[dir="rtl"] #main-nav.mobile-open {
  right: 0;
  left: auto;
}

/* Contact form RTL */
html[dir="rtl"] .contact-container {
  direction: rtl;
}

html[dir="rtl"] .contact-info {
  text-align: right;
}

/* Pool designer RTL */
html[dir="rtl"] .designer-wrapper {
  direction: rtl;
}

html[dir="rtl"] .progress-steps {
  direction: rtl;
}

/* Gallery RTL */
html[dir="rtl"] .inspiration-grid {
  direction: rtl;
}

/* Button alignment RTL */
html[dir="rtl"] .cta-button,
html[dir="rtl"] .submit-button {
  text-align: center;
}

/* Text alignment utilities */
html[dir="rtl"] [style*="text-align: left"] {
  text-align: right !important;
}

html[dir="rtl"] [style*="margin-left"] {
  margin-right: inherit;
  margin-left: 0;
}

html[dir="rtl"] [style*="margin-right"] {
  margin-left: inherit;
  margin-right: 0;
}

/* Partners Section RTL */
html[dir="rtl"] .partner-header {
  text-align: right;
}

html[dir="rtl"] .partner-header h3::after {
  margin-right: 0;
  margin-left: auto;
}

html[dir="rtl"] .system-advantages {
  text-align: right;
}

html[dir="rtl"] .advantages-content h4 {
  padding-right: 1rem;
  padding-left: 0;
}

html[dir="rtl"] .advantages-content h4::before {
  right: 0;
  left: auto;
}

html[dir="rtl"] .system-advantages ul {
  text-align: right;
  align-items: flex-start;
}

html[dir="rtl"] .system-advantages li {
  flex-direction: row-reverse;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] .system-advantages .bullet {
  margin-right: 0;
  margin-left: 0.75rem;
  order: 2;
  flex-shrink: 0;
}

html[dir="rtl"] .system-advantages li span:not(.bullet) {
  order: 1;
  text-align: right;
  flex: 1;
}

/* Partners Section Home RTL */
html[dir="rtl"] .partner-header-home {
  text-align: right;
}

html[dir="rtl"] .partner-header-home h3::after {
  margin-right: auto;
  margin-left: 0;
}

html[dir="rtl"] .advantages-content-home h4 {
  padding-right: 1rem;
  padding-left: 0;
  text-align: right;
}

html[dir="rtl"] .advantages-content-home h4::before {
  right: 0;
  left: auto;
}

html[dir="rtl"] .advantages-content-home ul {
  text-align: right;
  align-items: flex-start;
}

html[dir="rtl"] .advantages-content-home li {
  flex-direction: row-reverse;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] .advantages-content-home .bullet {
  margin-right: 0;
  margin-left: 1rem;
  order: 2;
  flex-shrink: 0;
}

html[dir="rtl"] .advantages-content-home li span:not(.bullet) {
  order: 1;
  text-align: right;
  flex: 1;
}

html[dir="rtl"] .advantages-content-home li:hover {
  transform: translateX(-5px);
  padding-right: 1rem;
  padding-left: 0;
}

html[dir="rtl"] .system-advantages-home {
  text-align: right;
}

html[dir="rtl"] .system-advantages-home {
  grid-template-columns: 1fr auto;
}

html[dir="rtl"] .system-advantages {
  grid-template-columns: 1fr auto;
}

@media (max-width: 768px) {
  html[dir="rtl"] .system-advantages-home {
    grid-template-columns: 1fr;
  }
  
  html[dir="rtl"] .advantages-content-home {
    text-align: right;
  }
}

/* Who Are We Section RTL */
html[dir="rtl"] .who-are-we-content {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .who-are-we-text {
  text-align: right;
}

html[dir="rtl"] .who-are-we-content {
  border-left: none;
  border-right: 5px solid #0066cc;
}

@media (max-width: 768px) {
  html[dir="rtl"] .who-are-we-content {
    flex-direction: column;
  }
}

/* About Section RTL */
html[dir="rtl"] .about-intro {
  text-align: right;
}

html[dir="rtl"] .mission-vision {
  direction: rtl;
}

html[dir="rtl"] .mission-card {
  text-align: right;
}

/* Responsive RTL */
@media (max-width: 768px) {
  html[dir="rtl"] .language-switcher {
    margin-right: 0.5rem;
    margin-left: 0;
  }
  
  html[dir="rtl"] .header-content {
    flex-direction: row;
  }
}

