/*
 * ═══════════════════════════════════════════════════════════════════
 *  LANG SWITCHER + RTL SUPPORT — Cabinet Dr. Meliani Samira
 *  Inclus automatiquement quand multilingue est actif.
 *  Responsive : mobile-first.
 * ═══════════════════════════════════════════════════════════════════
 */

/* ────────────────────────────────────────────────────────────────
   1. SÉLECTEUR DE LANGUE
   ──────────────────────────────────────────────────────────────── */

.lang-switcher {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 200;
}

/* --- Bouton principal --- */
.lang-switcher__toggle {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  border: 1.5px solid rgba(26, 107, 124, 0.25);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  color: var(--c-primary, #1A6B7C);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
  line-height: 1;
}

.lang-switcher__toggle:hover {
  background: rgba(26, 107, 124, 0.07);
  border-color: rgba(26, 107, 124, 0.5);
}

.lang-switcher__toggle:focus-visible {
  outline: 2px solid var(--c-primary, #1A6B7C);
  outline-offset: 2px;
}

.lang-switcher__toggle[aria-expanded="true"] {
  background: rgba(26, 107, 124, 0.1);
  border-color: var(--c-primary, #1A6B7C);
  box-shadow: 0 0 0 3px rgba(26, 107, 124, 0.12);
}

.lang-switcher__flag {
  font-size: 1.25em;
  line-height: 1;
  display: inline-block;
}

.lang-switcher__code {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.lang-switcher__chevron {
  width: 14px;
  height: 14px;
  opacity: 0.55;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.lang-switcher__toggle[aria-expanded="true"] .lang-switcher__chevron {
  transform: rotate(180deg);
}

/* --- Dropdown --- */
.lang-switcher__dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  min-width: 170px;
  background: #fff;
  border-radius: 12px;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.05),
    0 10px 28px rgba(0,0,0,0.12),
    0 1px 3px rgba(0,0,0,0.06);
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  z-index: 300;
  /* Animation fermé → ouvert */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top right;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease;
  pointer-events: none;
}

.lang-switcher__dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* RTL : le dropdown s'aligne à gauche */
[dir="rtl"] .lang-switcher__dropdown {
  right: auto;
  left: 0;
  transform-origin: top left;
}

.lang-switcher__dropdown li {
  margin: 0;
  padding: 0;
}

.lang-switcher__dropdown a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: #1a1a2e;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.14s ease;
  white-space: nowrap;
}

.lang-switcher__dropdown a:hover {
  background: #f5f9fa;
}

.lang-switcher__dropdown a[aria-current="true"] {
  background: #eef6f7;
  color: var(--c-primary, #1A6B7C);
  font-weight: 700;
}

.lang-switcher__lang-name {
  flex: 1;
}

.lang-switcher__check {
  width: 15px;
  height: 15px;
  color: var(--c-primary, #1A6B7C);
  flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────────
   2. SUPPORT RTL — Arabe
   ──────────────────────────────────────────────────────────────── */

/* Police de base pour l'arabe */
[dir="rtl"],
[dir="rtl"] body {
  font-family: 'Segoe UI', Tahoma, 'Arabic Typesetting', 'Geeza Pro', Arial, sans-serif;
}

/* ── Header ── */
[dir="rtl"] .site-header__inner {
  flex-direction: row-reverse;
}

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

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

/* Navigation : items de droite à gauche */
[dir="rtl"] .site-nav ul {
  flex-direction: row-reverse;
}

[dir="rtl"] .site-nav li {
  text-align: right;
}

/* ── Hero ── */
[dir="rtl"] .hero__inner {
  flex-direction: row-reverse;
}

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

[dir="rtl"] .hero__badge {
  justify-content: flex-end;
}

[dir="rtl"] .hero__actions {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

[dir="rtl"] .hero__stats {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

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

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

/* ── Stats bar ── */
[dir="rtl"] .stats-bar__grid {
  direction: rtl;
}

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

/* ── Section titres ── */
[dir="rtl"] .section__header {
  text-align: right;
}

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

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

/* ── Services grid ── */
[dir="rtl"] .services-grid {
  direction: rtl;
}

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

[dir="rtl"] .service-card__link {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

/* ── About strip ── */
[dir="rtl"] .about-strip__grid {
  flex-direction: row-reverse;
}

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

[dir="rtl"] .feature-item {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .about-strip__features {
  direction: rtl;
}

/* ── Testimonials ── */
[dir="rtl"] .testimonials-grid {
  direction: rtl;
}

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

[dir="rtl"] .stars {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

/* ── CTA block ── */
[dir="rtl"] .cta-block__inner {
  text-align: right;
}

[dir="rtl"] .cta-block__actions {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

/* ── Location section ── */
[dir="rtl"] .location-grid {
  flex-direction: row-reverse;
}

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

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

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

[dir="rtl"] .footer-contact-item {
  flex-direction: row-reverse;
  text-align: right;
}

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

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

/* ────────────────────────────────────────────────────────────────
   3. RESPONSIVE — Tablette (481–768 px) et Mobile (≤ 480 px)
   ──────────────────────────────────────────────────────────────── */

/* Tablette : drapeau + code, pas le nom complet */
@media (max-width: 768px) {
  /* Dropdown aligné à droite sur tablette/mobile */
  .lang-switcher__dropdown {
    right: 0;
    left: auto;
    min-width: 160px;
  }

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

  /* Masquer le nom complet de la langue sur tablette */
  .lang-switcher__lang-name {
    display: none;
  }

  /* Dropdown tablette : éléments centrés */
  .lang-switcher__dropdown a {
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
  }

  /* RTL mobile : hero empilé */
  [dir="rtl"] .hero__inner {
    flex-direction: column-reverse;
  }

  [dir="rtl"] .hero__actions {
    flex-direction: column;
    align-items: flex-end;
  }
}

/* Mobile : drapeau uniquement dans le bouton toggle */
@media (max-width: 480px) {
  .lang-switcher__toggle {
    padding: 0.3rem 0.5rem;
    gap: 0.2rem;
  }

  .lang-switcher__code {
    display: none; /* Afficher uniquement le drapeau */
  }

  .lang-switcher__chevron {
    width: 12px;
    height: 12px;
  }

  /* Sur très petit écran, le dropdown reste accessible */
  .lang-switcher__dropdown {
    min-width: 130px;
  }
}

/* ────────────────────────────────────────────────────────────────
   4. CLASSES UTILITAIRES — langue active
   ──────────────────────────────────────────────────────────────── */

/* Corps avec classe lang-ar → forcer RTL même si [dir] n'est pas encore appliqué */
body.lang-ar {
  direction: rtl;
  text-align: right;
}

body.lang-fr,
body.lang-en {
  direction: ltr;
  text-align: left;
}

/* ────────────────────────────────────────────────────────────────
   5. ACCESSIBILITÉ
   ──────────────────────────────────────────────────────────────── */

.lang-switcher__toggle:focus-visible,
.lang-switcher__dropdown a:focus-visible {
  outline: 2px solid var(--c-primary, #1A6B7C);
  outline-offset: 2px;
}

/* Animation d'ouverture du menu (respect de prefers-reduced-motion) */
@media (prefers-reduced-motion: reduce) {
  .lang-switcher__dropdown,
  .lang-switcher__chevron,
  .lang-switcher__toggle {
    transition: none;
  }
}
