/* ============================
   MULTILINGUAL SUPPORT
   Arabe (RTL) + Anglais + Français
   ============================ */

/* Language Selector */
.language-selector {
  position: relative;
  z-index: 100;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-light);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-primary);
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.lang-flag {
  font-size: 1.25rem;
  line-height: 1;
}

.lang-name {
  font-weight: 600;
}

.lang-arrow {
  font-size: 0.75rem;
  transition: transform var(--transition);
}

.lang-btn:hover .lang-arrow {
  transform: translateY(2px);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: rgba(11, 13, 23, 0.98);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: var(--shadow-strong);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.lang-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  transition: var(--transition);
  border-bottom: 1px solid var(--border-subtle);
}

.lang-option:last-child {
  border-bottom: none;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-light);
}

.lang-option.active {
  background: rgba(123, 63, 242, 0.15);
  color: var(--text-light);
  font-weight: 600;
}

.lang-option.active::after {
  content: '✓';
  margin-left: auto;
  color: #7B3FF2;
  font-weight: 700;
}

/* ============================
   RTL SUPPORT (ARABIC)
   ============================ */

/* Direction globale pour l'arabe */
html[dir="rtl"] {
  direction: rtl;
}

/* Ajustements header pour RTL */
html[dir="rtl"] .header-container {
  flex-direction: row-reverse;
}

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

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

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

/* Ajustements texte pour RTL */
html[dir="rtl"] .hero-content {
  grid-template-columns: 0.8fr 1.2fr;
}

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

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

html[dir="rtl"] .hero-features li {
  flex-direction: row-reverse;
  text-align: right;
}

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

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

html[dir="rtl"] .footer-content {
  grid-template-columns: 1fr 1fr 1.5fr;
}

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

/* Navigation mobile RTL */
@media (max-width: 968px) {
  html[dir="rtl"] .nav-menu {
    right: auto;
    left: -100%;
    border-right: 1px solid var(--border-subtle);
    border-left: none;
  }
  
  html[dir="rtl"] .nav-menu.active {
    right: auto;
    left: 0;
  }
}

/* Formulaires RTL */
html[dir="rtl"] .form-control {
  text-align: right;
}

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

/* Polices arabes optimisées */
html[lang="ar"] {
  font-family: 'Cairo', 'Tajawal', 'Almarai', var(--font-primary);
}

html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3 {
  font-family: 'Cairo', 'Tajawal', 'Almarai', var(--font-heading);
}

/* Ajustement espacement arabe */
html[lang="ar"] h1 {
  line-height: 1.3;
  letter-spacing: 0;
}

html[lang="ar"] h2 {
  line-height: 1.35;
  letter-spacing: 0;
}

html[lang="ar"] p {
  line-height: 1.8;
}

/* ============================
   RESPONSIVE LANGUAGE SELECTOR
   ============================ */

@media (max-width: 640px) {
  .lang-btn {
    padding: 8px 12px;
  }
  
  .lang-name {
    display: none;
  }
  
  .lang-dropdown {
    min-width: 150px;
  }
}
