/* ======================
   AquaNex RTL Styles
   ====================== */

/* Apply RTL direction */
[dir="rtl"] {
  direction: rtl;
}

/* Arabic Typography */
[dir="rtl"] body {
  font-family: 'Noto Kufi Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* Text Alignment */
[dir="rtl"] .text-left {
  text-align: right;
}

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

/* Navigation */
[dir="rtl"] nav {
  flex-direction: row-reverse;
  justify-content: flex-start; /* Align items to the right (start in RTL) */
}

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

[dir="rtl"] .logo {
  flex-direction: row-reverse;
  margin-right: 0;
  margin-left: auto; /* Push logo to the right in RTL */
  order: 2; /* Logo on the right in RTL */
}

/* Header container for RTL */
[dir="rtl"] header .container {
  direction: rtl;
}

[dir="rtl"] header nav {
  direction: rtl;
}

/* Home page header - overlay on hero for RTL */
[dir="rtl"] body.home-page header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  box-shadow: none;
  z-index: 1000;
}

[dir="rtl"] body.home-page header .nav-links a {
  color: var(--white);
}

[dir="rtl"] body.home-page header .nav-links a:hover {
  color: var(--aqua);
}

[dir="rtl"] body.home-page header .mobile-menu-toggle span {
  background: var(--white);
}

[dir="rtl"] body.home-page header.scrolled {
  position: sticky;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

[dir="rtl"] body.home-page header.scrolled .nav-links a {
  color: var(--navy);
}

[dir="rtl"] body.home-page header.scrolled .mobile-menu-toggle span {
  background: var(--navy);
}

@media (max-width: 768px) {
  /* Keep home page header transparent on mobile for RTL too */
  [dir="rtl"] body.home-page header {
    position: absolute;
    background: transparent;
    box-shadow: none;
    z-index: 1010 !important;
  }
  
  /* Ensure nav-links are always visible in DOM for proper animation */
  [dir="rtl"] body.home-page header .nav-links.active {
    z-index: 1010 !important;
  }
  
  [dir="rtl"] body.home-page header .mobile-menu-toggle {
    display: flex !important;
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    left: 1rem !important;
    right: auto !important;
    order: 1 !important; /* Ensure hamburger is on the left */
  }
  
  [dir="rtl"] body.home-page header .logo {
    margin-left: auto !important; /* Push logo to the right */
    margin-right: 0 !important;
    order: 2 !important; /* Logo on the right */
  }
  
  [dir="rtl"] nav {
    padding: 0.25rem 0 !important; /* Reduce header padding on mobile */
    align-items: center; /* Center items vertically */
  }
  
  [dir="rtl"] body.home-page header .mobile-menu-toggle span {
    background: var(--white);
  }
  
  /* When scrolled, show white background */
  [dir="rtl"] body.home-page header.scrolled {
    position: fixed;
    background: var(--white);
    box-shadow: var(--shadow-sm);
  }
  
  [dir="rtl"] body.home-page header.scrolled .mobile-menu-toggle span {
    background: var(--navy);
  }
}

/* Underline animation for links */
[dir="rtl"] .nav-links a::after {
  left: auto;
  right: 0;
}

/* Buttons */
[dir="rtl"] .btn-group {
  flex-direction: row-reverse;
}

/* Cards & Grid */
[dir="rtl"] .card-body {
  text-align: right;
}

[dir="rtl"] .grid,
[dir="rtl"] .grid-2,
[dir="rtl"] .grid-3,
[dir="rtl"] .grid-4 {
  direction: rtl;
}

[dir="rtl"] .services-grid,
[dir="rtl"] .projects-grid,
[dir="rtl"] .brands-grid {
  direction: rtl;
}

[dir="rtl"] .filter-bar {
  direction: rtl;
}

[dir="rtl"] .filter-pills {
  flex-direction: row-reverse;
}

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

[dir="rtl"] .project-card {
  direction: rtl;
}

[dir="rtl"] .project-category-badge {
  right: auto;
  left: 1rem;
}

[dir="rtl"] .project-section ul li {
  padding-right: 2rem;
  padding-left: 0;
}

[dir="rtl"] .project-section ul li::before {
  right: 0;
  left: auto;
}

[dir="rtl"] .services-list {
  direction: rtl;
}

[dir="rtl"] .service-detail {
  direction: rtl;
}

[dir="rtl"] .service-features li {
  padding-right: 2.5rem;
  padding-left: 0;
}

[dir="rtl"] .service-features li::before {
  right: 0;
  left: auto;
  content: '←';
}

[dir="rtl"] .service-features li:hover {
  padding-right: 3rem;
  padding-left: 0;
}

[dir="rtl"] .service-cta {
  flex-direction: row-reverse;
}

[dir="rtl"] .service-content {
  text-align: right;
}

[dir="rtl"] .service-detail:nth-child(even) .service-content {
  order: 1;
}

[dir="rtl"] .service-detail:nth-child(even) .service-visual {
  order: 2;
}

/* Footer */
[dir="rtl"] .footer-content {
  direction: rtl;
}

[dir="rtl"] .footer-section ul {
  padding-right: 0;
}

/* Forms */
[dir="rtl"] label {
  text-align: right;
}

[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea {
  text-align: right;
}

/* Modal */
[dir="rtl"] .modal-close {
  right: auto;
  left: 1rem;
}

/* Floating CTA */
[dir="rtl"] .floating-cta {
  right: auto;
  left: 2rem;
}

@media (max-width: 640px) {
  [dir="rtl"] .floating-cta {
    left: 1rem;
    right: 1rem;
  }
}

/* Filter Buttons and Pills */
[dir="rtl"] .filter-buttons {
  flex-direction: row-reverse;
}

[dir="rtl"] .filter-pills {
  flex-direction: row-reverse;
}

[dir="rtl"] .filter-section {
  text-align: right;
}

[dir="rtl"] .filter-label {
  text-align: right;
}

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

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

/* Stats / Numbers */
[dir="rtl"] .stats-grid,
[dir="rtl"] .trust-bar {
  direction: rtl;
}

/* Process Steps */
[dir="rtl"] .process-step::before {
  right: auto;
  left: 50%;
}

/* Gallery & Carousel */
[dir="rtl"] .carousel-control.prev {
  right: auto;
  left: 1rem;
}

[dir="rtl"] .carousel-control.next {
  left: auto;
  right: 1rem;
}

/* Tags */
[dir="rtl"] .tags {
  flex-direction: row-reverse;
}

/* Hero Content */
[dir="rtl"] .hero-content {
  text-align: right;
}

/* Section Headers and Icons */
[dir="rtl"] .section-header {
  text-align: center;
}

[dir="rtl"] .value-icon,
[dir="rtl"] .service-icon,
[dir="rtl"] .contact-icon {
  text-align: center;
}

[dir="rtl"] .card-title::before,
[dir="rtl"] .project-section h3::before {
  right: 0;
  left: auto;
}

/* Value Proposition Cards */
[dir="rtl"] .value-props-grid {
  direction: rtl;
}

[dir="rtl"] .value-card {
  text-align: center;
}

/* Contact Info Icons */
[dir="rtl"] .contact-info-item {
  flex-direction: row-reverse;
  text-align: right;
}

/* Timeline */
[dir="rtl"] .timeline-item::before {
  right: auto;
  left: 0;
}

/* Lists with Icons and Bullets */
[dir="rtl"] .icon-list li {
  padding-right: 2rem;
  padding-left: 0;
}

[dir="rtl"] .icon-list li::before {
  right: 0;
  left: auto;
}

[dir="rtl"] ul li::before,
[dir="rtl"] .service-bullets li::before,
[dir="rtl"] .project-section ul li::before {
  right: 0;
  left: auto;
}

[dir="rtl"] .service-bullets li,
[dir="rtl"] .project-section ul li {
  padding-right: 2rem;
  padding-left: 0;
}

/* Mobile Menu - Arabic version slides from left */
@media (max-width: 768px) {
  [dir="rtl"] .nav-links {
    right: auto !important;
    left: 0 !important;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    text-align: right;
    direction: rtl;
    padding: 2rem 1.5rem !important;
    width: 80% !important;
    max-width: 320px !important;
    overflow-x: visible;
    overflow-y: auto;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    align-items: stretch !important;
    list-style: none !important;
    z-index: 1010 !important;
    visibility: visible;
    opacity: 1;
  }
  
  [dir="rtl"] .nav-links.active {
    transform: translateX(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important; /* Ensure menu is clickable when active */
  }
  
  /* Override home page nav link colors when menu is open for RTL - ensure text is visible */
  [dir="rtl"] body.home-page header .nav-links.active a {
    color: var(--navy) !important;
  }
  
  [dir="rtl"] body.home-page header .nav-links.active a:hover,
  [dir="rtl"] body.home-page header .nav-links.active a.active {
    color: var(--aqua) !important;
  }
  
  /* Ensure nav-links are hidden when not active for RTL */
  [dir="rtl"] .nav-links:not(.active) {
    transform: translateX(-100%) !important;
  }
  
  [dir="rtl"] .nav-links li {
    width: 100%;
    text-align: right;
    direction: rtl;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid var(--gray-200);
  }
  
  [dir="rtl"] .nav-links li:last-child {
    border-bottom: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
  }
  
  [dir="rtl"] .nav-links a {
    display: block;
    width: 100%;
    padding: 1rem 0 !important;
    text-align: right;
    direction: rtl;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--navy) !important; /* Ensure text is visible on white background */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
    transition: all var(--transition-base);
  }
  
  [dir="rtl"] .nav-links a:hover,
  [dir="rtl"] .nav-links a.active {
    padding-right: 0.5rem !important;
    color: var(--aqua);
  }
  
  [dir="rtl"] .nav-links a::after {
    left: auto !important;
    right: 0 !important;
    bottom: 0.75rem;
  }
  
  [dir="rtl"] .nav-links .lang-switcher {
    width: 100%;
    text-align: center;
    padding: 0.875rem 1.5rem !important;
    margin: 0;
    direction: rtl;
  }
  
  [dir="rtl"] .mobile-menu-toggle {
    order: 1 !important; /* Hamburger on the left in RTL */
    display: flex !important;
    z-index: 1011 !important;
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    left: 1rem !important;
    right: auto !important;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border-radius: 4px;
    padding: 8px;
    box-shadow: none !important;
  }
  
  [dir="rtl"] .logo {
    margin-left: auto !important; /* Push logo to the right */
    margin-right: 0 !important;
    order: 2 !important; /* Logo on the right */
  }
  
  [dir="rtl"] .mobile-menu-toggle.active {
    z-index: 1011 !important;
    transform: translateY(-50%) !important; /* Maintain vertical centering when active */
  }
  
  [dir="rtl"] .mobile-menu-toggle.active span {
    background: var(--navy) !important;
  }
  
  [dir="rtl"] .mobile-menu-toggle.active span:nth-child(1) {
    transform: translate(-50%, -50%) rotate(45deg) !important;
    top: 50% !important;
    left: 50% !important;
  }
  
  [dir="rtl"] .mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0 !important;
    transform: translate(-50%, -50%) scale(0) !important;
  }
  
  [dir="rtl"] .mobile-menu-toggle.active span:nth-child(3) {
    transform: translate(-50%, -50%) rotate(-45deg) !important;
    top: 50% !important;
    left: 50% !important;
  }
  
  /* Ensure backdrop works correctly for RTL */
  [dir="rtl"] .mobile-menu-backdrop {
    left: 0;
    right: 0;
  }
}

/* Number formatting for Arabic */
[dir="rtl"] .number {
  font-family: 'Inter', sans-serif;
}


