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

/* Base RTL Settings */
html[dir="rtl"],
.rtl-body {
  direction: rtl;
  text-align: right;
}

/* Arabic Typography - Using IBM Plex Sans Arabic */
html[dir="rtl"] body,
.rtl-body {
  font-family: 'IBM Plex Sans Arabic', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6 {
  font-family: 'IBM Plex Sans Arabic', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
}

/* Adjust line height for Arabic */
html[dir="rtl"] p,
html[dir="rtl"] li {
  line-height: 1.8;
}

/* Header - Full RTL Support */
/* Reverse the entire header layout for RTL */
html[dir="rtl"] .header {
  direction: rtl !important;
}

html[dir="rtl"] .header .container {
  direction: rtl !important;
}

/* Flip header: Logo moves right, Actions move left */
html[dir="rtl"] .header-inner {
  flex-direction: row-reverse !important;
}

/* Flip nav links order */
html[dir="rtl"] .nav-desktop {
  flex-direction: row-reverse !important;
}

/* Flip actions: CTA on far left, lang switcher towards middle */
html[dir="rtl"] .header-actions {
  flex-direction: row-reverse !important;
}

/* Navigation */
html[dir="rtl"] .nav-mobile-panel {
  right: auto;
  left: 0;
  transform: translateX(-100%);
}

html[dir="rtl"] .nav-mobile.active .nav-mobile-panel {
  transform: translateX(0);
}

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

html[dir="rtl"] .logo-icon {
  margin-right: 0;
  margin-left: 8px;
}

/* Buttons */
html[dir="rtl"] .btn svg {
  margin-left: 0;
  margin-right: 8px;
  transform: scaleX(-1);
}

html[dir="rtl"] .btn-lg svg {
  margin-right: 10px;
}

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

html[dir="rtl"] .icon-box {
  margin-right: 0;
  margin-left: auto;
}

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

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

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

html[dir="rtl"] .hero-info-label svg {
  margin-right: 0;
  margin-left: 8px;
}

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

/* Grid Layouts */
html[dir="rtl"] .grid {
  direction: rtl;
}

/* Architecture Section */
html[dir="rtl"] .architecture-section {
  direction: rtl;
}

/* Info Box */
html[dir="rtl"] .info-box {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .info-box-icon {
  margin-right: 0;
  margin-left: 16px;
}

/* Checklist */
html[dir="rtl"] .checklist-item {
  flex-direction: row-reverse;
}

html[dir="rtl"] .checklist-icon {
  margin-right: 0;
  margin-left: 12px;
}

html[dir="rtl"] ul.checklist li {
  padding-left: 0;
  padding-right: 28px;
}

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

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

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

html[dir="rtl"] .footer-links {
  align-items: flex-start;
}

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

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

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

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

/* Cards with border-left become border-right */
html[dir="rtl"] .card[style*="border-left"] {
  border-left: none !important;
  border-right: 4px solid var(--primary) !important;
}

/* Tables */
html[dir="rtl"] table {
  direction: rtl;
}

html[dir="rtl"] th,
html[dir="rtl"] td {
  text-align: right;
}

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

html[dir="rtl"] label {
  text-align: right;
  display: block;
}

/* Timeline */
html[dir="rtl"] .timeline {
  padding-left: 0;
  padding-right: 32px;
}

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

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

/* Agent Cards */
html[dir="rtl"] .agent-card {
  text-align: right;
}

/* CTA Section */
html[dir="rtl"] .cta-content {
  text-align: center;
}

html[dir="rtl"] .cta-buttons {
  justify-content: center;
}

/* Overline */
html[dir="rtl"] .overline {
  text-align: inherit;
}

/* Flex row reverse adjustments */
html[dir="rtl"] [style*="display:flex"][style*="gap"] {
  flex-direction: row-reverse;
}

/* Skip link */
html[dir="rtl"] .skip-link {
  right: 0;
  left: auto;
}

/* Scroll animations */
html[dir="rtl"] [data-animate="slide-right"] {
  transform: translateX(30px);
}

html[dir="rtl"] [data-animate="slide-left"] {
  transform: translateX(-30px);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  html[dir="rtl"] .hero-content {
    text-align: center;
  }
  
  html[dir="rtl"] .hero-ctas {
    justify-content: center;
  }
  
  html[dir="rtl"] .architecture-section {
    direction: ltr;
  }
  
  html[dir="rtl"] .architecture-section > * {
    direction: rtl;
    text-align: right;
  }
}

/* Print styles */
@media print {
  html[dir="rtl"] {
    direction: rtl;
  }
}

/* ==========================================
   RTL Language Switcher Adjustments
   ========================================== */
html[dir="rtl"] .lang-switcher {
  margin-right: 0;
  margin-left: 8px;
}

html[dir="rtl"] .lang-switcher-btn {
  flex-direction: row-reverse;
}

html[dir="rtl"] .lang-switcher-dropdown {
  right: auto;
  left: 0;
}

/* ==========================================
   RTL Dark Mode Contrast Improvements
   ========================================== */
html[dir="rtl"][data-theme="dark"] .card {
  background: #1E293B;
  border-color: #334155;
}

html[dir="rtl"][data-theme="dark"] .nav-link {
  color: #CBD5E1;
}

html[dir="rtl"][data-theme="dark"] .nav-link:hover {
  color: #FFFFFF;
}

html[dir="rtl"][data-theme="dark"] .info-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(37, 99, 235, 0.15) 100%);
}

/* Ensure text contrast in RTL sections */
html[dir="rtl"] .section-header h2 {
  color: var(--text-primary);
}

html[dir="rtl"] .card-desc {
  color: var(--text-secondary);
}
