/* ============================================
   ATAMAP ASSOCIATES — i18n Language Switcher
   Globe icon + dropdown, RTL overrides for Arabic
   ============================================ */

/* ── Switcher Wrapper ── */
.i18n-switcher {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: var(--z-dropdown, 100);
}

/* ── Toggle Button (Globe Icon) ── */
.i18n-switcher__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
  padding: 0 10px;
  background: none;
  border: 1px solid var(--color-graphite-500);
  border-radius: 20px;
  color: var(--color-steel-300);
  cursor: pointer;
  transition: all var(--duration-fast, 150ms) var(--ease-spring-settle, cubic-bezier(0.25, 0.46, 0.45, 0.94));
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  min-height: 40px;
}

.i18n-switcher__btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.i18n-switcher__btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Globe SVG icon */
.i18n-switcher__icon {
  width: 16px;
  height: 16px;
  transition: transform var(--duration-normal, 250ms) var(--ease-spring-1, cubic-bezier(0.175, 0.885, 0.32, 1.1));
}

.i18n-switcher__btn:hover .i18n-switcher__icon {
  transform: rotate(20deg);
}

/* Language code label (EN / FR / AR) */
.i18n-switcher__code {
  font-family: var(--font-family, 'Inter', sans-serif);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
}

/* ── Dropdown ── */
.i18n-switcher__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: var(--color-pure-white, #ffffff);
  border: 1px solid var(--color-graphite-500);
  border-radius: var(--border-radius-md, 8px);
  box-shadow: var(--shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.4));
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transition: all var(--duration-fast, 150ms) var(--ease-spring-settle, cubic-bezier(0.25, 0.46, 0.45, 0.94));
  pointer-events: none;
}

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

/* ── Language Option ── */
.i18n-switcher__option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: var(--border-radius-sm, 6px);
  color: var(--color-steel-300, #9ca3af);
  cursor: pointer;
  font-family: var(--font-family, 'Inter', sans-serif);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 500;
  text-align: left;
  transition: all var(--duration-fast, 150ms) ease;
  white-space: nowrap;
  min-height: 40px;
}

.i18n-switcher__option:hover {
  background: var(--color-navy-600, #eef0f4);
  color: var(--color-white, #f9fafb);
}

.i18n-switcher__option:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

/* Active language — highlighted with gold accent */
.i18n-switcher__option--active {
  color: var(--color-accent, #d4af37);
  background: rgba(212, 175, 55, 0.08);
}

.i18n-switcher__option--active:hover {
  color: var(--color-accent-hover, #e0c04a);
  background: rgba(212, 175, 55, 0.12);
}

/* Flag emoji */
.i18n-switcher__flag {
  font-size: 1.1rem;
  line-height: 1;
  width: 1.5rem;
  text-align: center;
}

/* Language label text */
.i18n-switcher__label {
  flex: 1;
}

/* ── Light theme adjustments ── */
[data-theme=dark] .i18n-switcher__dropdown {
  background: var(--color-pure-white, #ffffff);
  border-color: var(--color-graphite-500, #adb5bd);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
}

[data-theme=dark] .i18n-switcher__option:hover {
  background: var(--color-navy-700, #dee2e6);
  color: var(--color-white, #1a1a2e);
}

/* ── Mobile responsive ── */
@media (max-width: 639px) {
  /* Hide the i18n switcher on small mobile — language is in mobile nav instead */
  .i18n-switcher {
    display: none;
  }
}

/* On tablet (640–767px), show as compact icon-only */
@media (min-width: 640px) and (max-width: 767px) {
  .i18n-switcher__btn {
    padding: 0 8px;
    gap: 0;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
  }

  /* Hide the text code on tablet — icon only */
  .i18n-switcher__code {
    display: none;
  }

  .i18n-switcher__icon {
    width: 16px;
    height: 16px;
  }

  .i18n-switcher__dropdown {
    right: -4px;
    min-width: 140px;
  }
}

/* ============================================
   RTL OVERRIDES FOR ARABIC (dir="rtl")
   ============================================ */

/* Flip navigation direction */
[dir="rtl"] .site-header__nav {
  direction: rtl;
}

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

[dir="rtl"] .site-footer__grid {
  direction: rtl;
}

[dir="rtl"] .site-footer__bottom {
  direction: rtl;
}

/* Align text to the right in RTL */
[dir="rtl"] .nav__link {
  text-align: right;
}

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

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

/* Fix dropdown positioning for RTL */
[dir="rtl"] .nav__dropdown {
  right: auto;
  left: 0;
}

/* Reverse button icon order in RTL */
[dir="rtl"] .btn svg {
  order: 1;
}

/* Fix search button in RTL */
[dir="rtl"] .site-header__search-btn {
  order: 0;
}

/* CTA banner text alignment */
[dir="rtl"] .cta-banner {
  direction: rtl;
  text-align: right;
}

/* Newsletter form alignment */
[dir="rtl"] .newsletter-banner__form {
  direction: rtl;
}

/* Hero content RTL */
[dir="rtl"] .home-hero__content {
  direction: rtl;
}

/* Fix breadcrumbs for RTL */
[dir="rtl"] .breadcrumbs {
  direction: rtl;
}

/* Card content RTL */
[dir="rtl"] .card {
  direction: rtl;
  text-align: right;
}

/* Grid items in RTL */
[dir="rtl"] .grid {
  direction: rtl;
}

/* Service dropdown in header */
[dir="rtl"] .nav__item .nav__dropdown {
  right: auto;
  left: 0;
}

/* Fix logo position (should stay left even in RTL) */
[dir="rtl"] .site-header__logo {
  direction: ltr;
}

/* Ensure the i18n switcher itself stays LTR */
[dir="rtl"] .i18n-switcher {
  direction: ltr;
}

/* Fix footer contact items in RTL */
[dir="rtl"] .site-footer__contact-item {
  direction: rtl;
  text-align: right;
}

/* Fix skip link for RTL */
[dir="rtl"] .skip-link {
  left: auto;
  right: -100%;
}

[dir="rtl"] .skip-link:focus {
  right: var(--space-4, 1rem);
}

/* ============================================
   RTL + LIGHT THEME COMBINED OVERRIDES
   ============================================ */

[data-theme=dark][dir=rtl] .i18n-switcher__dropdown {
  background: #ffffff;
}
