/* Multilingual navigation enhancement. Loaded after the existing site styles. */
.i18n-desktop-item {
  position: relative;
  display: flex;
  align-items: center;
  margin-inline-start: 2px;
}

.i18n-trigger {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 9px;
  border: 1px solid #d9e1ea;
  border-radius: 6px;
  background: #ffffff;
  color: #25465f;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.i18n-trigger:hover,
.i18n-trigger:focus-visible,
.i18n-desktop-item.is-open .i18n-trigger {
  border-color: #6f8798;
  background: #f4f6f8;
}

.i18n-chevron {
  font-size: 9px;
  transition: transform 160ms ease;
}

.i18n-desktop-item.is-open .i18n-chevron {
  transform: rotate(180deg);
}

.i18n-menu {
  position: absolute;
  z-index: 180;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  display: none;
  width: 184px;
  margin: 0;
  padding: 7px;
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(21, 45, 63, 0.16);
  list-style: none;
}

.i18n-desktop-item.is-open .i18n-menu {
  display: grid;
}

.i18n-menu a {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 5px;
  color: #111827;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
}

.i18n-flag {
  flex: 0 0 auto;
  direction: ltr;
  font-size: 18px;
  line-height: 1;
  unicode-bidi: isolate;
}

.i18n-language-name {
  min-width: 0;
  unicode-bidi: plaintext;
}

.i18n-menu a:hover,
.i18n-menu a:focus-visible {
  background: #f4f6f8;
  color: #152d3f;
}

.i18n-menu a[aria-current="true"] {
  background: #edf2f5;
  color: #25465f;
  font-weight: 700;
}

.i18n-mobile-item {
  display: none;
}

@media (max-width: 1439px) {
  body:not(.mobile-redesign-site) #site-navigation .i18n-desktop-item {
    display: none;
  }

  body:not(.mobile-redesign-site) #site-navigation .i18n-mobile-item {
    display: block;
    width: 100%;
    padding: 18px 12px 20px;
  }

  body:not(.mobile-redesign-site) #site-navigation .i18n-mobile-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 13px;
    color: #152d3f;
    font-size: 14px;
    font-weight: 700;
  }

  body:not(.mobile-redesign-site) #site-navigation .i18n-mobile-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body:not(.mobile-redesign-site) #site-navigation .i18n-mobile-links a {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid #d9e1ea;
    border-radius: 6px;
    background: #ffffff;
    color: #334754;
    font-size: 13px;
    line-height: 1.2;
    text-decoration: none;
  }

  body:not(.mobile-redesign-site) #site-navigation .i18n-mobile-links a[aria-current="true"] {
    border-color: #6f8798;
    background: #edf2f5;
    color: #152d3f;
    font-weight: 700;
  }
}

@media (max-width: 1439px) {
  .i18n-desktop-item {
    display: none !important;
  }

  body.mobile-redesign-site .mobile-editorial-nav-list > .i18n-mobile-item {
    display: block;
    padding: 18px 0 20px;
  }

  .i18n-mobile-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 13px;
    color: #152d3f;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  .i18n-mobile-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.mobile-redesign-site .mobile-editorial-nav-list .i18n-mobile-links a {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid #d9e1ea;
    border-radius: 6px;
    background: #ffffff;
    color: #334754;
    font-size: 13px;
    line-height: 1.2;
    text-decoration: none;
  }

  body.mobile-redesign-site .mobile-editorial-nav-list .i18n-mobile-links .i18n-flag {
    font-size: 17px;
  }

  body.mobile-redesign-site .mobile-editorial-nav-list .i18n-mobile-links a[aria-current="true"] {
    border-color: #6f8798;
    background: #edf2f5;
    color: #152d3f;
    font-weight: 700;
  }
}

/* Keep the English grid and flex order while Arabic text reads right to left. */
html[lang="ar"],
html[lang="ar"] body {
  direction: ltr;
}

html[lang="ar"] body {
  text-align: right;
}

html[lang="ar"] :is(h1, h2, h3, h4, h5, h6, p, blockquote, figcaption, label, legend, summary, dt, dd, th, td) {
  direction: rtl;
  text-align: right;
}

html[lang="ar"] :is(a, button, span, small) {
  unicode-bidi: plaintext;
}

html[lang="ar"] :is(input:not([type="number"]):not([type="tel"]):not([type="email"]):not([type="url"]), textarea, select) {
  direction: rtl;
  text-align: right;
}

html[lang="ar"] img,
html[lang="ar"] picture,
html[lang="ar"] svg,
html[lang="ar"] video {
  direction: ltr;
}

html[lang="ar"] a[href^="tel:"],
html[lang="ar"] a[href*="wa.me"],
html[lang="ar"] [data-copy-value],
html[lang="ar"] [class*="model"],
html[lang="ar"] [class*="code"],
html[lang="ar"] .product-card h3,
html[lang="ar"] .cs-product-info h3 {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
}

html[lang="ar"] .i18n-menu {
  text-align: right;
}

/* Stable header slots: all primary controls exist before JavaScript runs. */
.site-header {
  display: flex;
  align-items: center;
}

.site-header .logo {
  order: 1;
  flex: 0 0 auto;
  flex-shrink: 0;
}

.site-header .site-navigation {
  order: 2;
  flex: 1 1 auto;
  min-width: 0;
}

.site-header .language-switcher {
  order: 3;
  flex: 0 0 auto;
  flex-shrink: 0;
}

.site-header .header-contact {
  order: 4;
  flex: 0 0 auto;
  flex-shrink: 0;
}

.site-header .desktop-menu-toggle,
.site-header .mobile-menu-toggle,
.site-header .nav-toggle {
  order: 5;
  flex: 0 0 auto;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
}

@media (max-width: 1439px) {
  .site-header { column-gap: 10px; }
  .site-header .site-navigation { flex: 0 0 auto; }
}

@media (max-width: 919px) {
  .site-header { column-gap: 6px; }
  body.mobile-redesign-site .site-header .header-contact { display: inline-flex; }
}

@media (max-width: 520px) {
  .site-header { column-gap: 4px; }
  .site-header .logo { gap: 4px; font-size: 15px; }
  .site-header .logo img { width: 32px; height: 32px; }
  .site-header .header-contact { min-height: 38px; max-width: 82px; padding-inline: 7px; font-size: 10px; }
  .site-header .mobile-menu-toggle,
  .site-header .nav-toggle { min-width: 38px; min-height: 38px; padding-inline: 8px; }
}
