/* FINAL i18n layout fixes */

.latin-number,
[dir="ltr"] {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  display: inline-block !important;
}

/* Header dropdown order/layout */
html[lang="ar"] body .site-header,
html[lang="ar"] body .header-container,
html[lang="ar"] body .nav-links,
html[lang="ar"] body .nav-links > ul {
  direction: rtl !important;
}

html[lang="ar"] body .header-right {
  direction: ltr !important;
}

html[lang="ar"] body .products-horizontal-menu {
  direction: rtl !important;
}

html[lang="ar"] body .product-tab,
html[lang="ar"] body .product-submenu {
  text-align: right !important;
}

/* Arabic home media: same size as other languages, fair right, video left */
html[lang="ar"] body .video-and-fair {
  width: min(100% - 70px, 1380px) !important;
  margin: 0 auto !important;
  direction: ltr !important;
  display: grid !important;
  grid-template-columns: minmax(0, 940px) 390px !important;
  gap: 58px !important;
  align-items: center !important;
  justify-content: center !important;
}

html[lang="ar"] body .home-video-panel {
  width: 940px !important;
  max-width: 100% !important;
  margin-left: -42px !important;
  margin-right: 0 !important;
  justify-self: end !important;
}

html[lang="ar"] body .fair-slideshow {
  width: 390px !important;
  max-width: 390px !important;
  margin-left: 34px !important;
  margin-right: 0 !important;
  justify-self: start !important;
}

/* Arrows: do not reverse their physical sides */
html[lang="ar"] body .fair-arrow.left,
html[lang="ar"] body .video-arrow.left,
html[lang="ar"] body .media-arrow.left {
  left: 6px !important;
  right: auto !important;
}

html[lang="ar"] body .fair-arrow.right,
html[lang="ar"] body .video-arrow.right,
html[lang="ar"] body .media-arrow.right {
  right: 6px !important;
  left: auto !important;
}

/* Arabic product slideshow: image right, text left */
html[lang="ar"] body .products-section .product-slide-image-frame {
  left: auto !important;
  right: 130px !important;
}

html[lang="ar"] body .products-section .slide .text {
  left: 130px !important;
  right: auto !important;
  direction: rtl !important;
  text-align: center !important;
}

html[lang="ar"] body .products-section .product-slider-arrow.prev {
  left: auto !important;
  right: 30px !important;
}

html[lang="ar"] body .products-section .product-slider-arrow.next {
  right: auto !important;
  left: 30px !important;
}

/* Loading popups: bullet and text must stay on the same side */
html[lang="ar"] body .loading-popup-content {
  direction: rtl !important;
}

html[lang="ar"] body .loading-popup-content ul {
  direction: rtl !important;
  text-align: right !important;
  padding-right: 28px !important;
  padding-left: 0 !important;
  list-style-position: outside !important;
}

html[lang="ar"] body .loading-popup-content li {
  direction: rtl !important;
  text-align: right !important;
  padding-right: 4px !important;
  margin: 8px 0 !important;
}

html[lang="ar"] body .loading-popup-content li::marker {
  font-size: 1em !important;
}

/* Arabic contact/footer numbers */
html[lang="ar"] body .contact-card .latin-number,
html[lang="ar"] body .footer .latin-number {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  display: inline-block !important;
}

/* Arabic contact page text alignment */
html[lang="ar"] body .contact-card {
  direction: rtl !important;
  text-align: center !important;
}

html[lang="ar"] body .contact-card p {
  direction: rtl !important;
}

/* Arabic footer */
html[lang="ar"] body .footer {
  direction: rtl !important;
}

html[lang="ar"] body .footer-menu {
  direction: rtl !important;
  text-align: right !important;
}

html[lang="ar"] body .footer-bottom {
  text-align: right !important;
}

/* Russian/English product menu width: keep old-style order and fit */
html[lang="en"] body .products-horizontal-menu,
html[lang="ru"] body .products-horizontal-menu,
html[lang="ar"] body .products-horizontal-menu {
  width: max-content !important;
  max-width: calc(100vw - 60px) !important;
  overflow: visible !important;
  white-space: nowrap !important;
}

/* Mobile safety */
@media (max-width: 1280px) {
  html[lang="ar"] body .video-and-fair {
    width: min(100% - 50px, 1180px) !important;
    grid-template-columns: minmax(0, 820px) 350px !important;
    gap: 36px !important;
  }

  html[lang="ar"] body .home-video-panel {
    width: 820px !important;
    margin-left: -28px !important;
  }

  html[lang="ar"] body .fair-slideshow {
    width: 350px !important;
    max-width: 350px !important;
    margin-left: 24px !important;
  }
}

@media (max-width: 980px) {
  html[lang="ar"] body .video-and-fair {
    width: min(100% - 28px, 900px) !important;
    grid-template-columns: 1fr !important;
    gap: 22px !important;
  }

  html[lang="ar"] body .home-video-panel,
  html[lang="ar"] body .fair-slideshow {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    justify-self: center !important;
  }
}

@media (max-width: 900px) {
  html[lang="ar"] body .products-section .product-slide-image-frame,
  html[lang="ar"] body .products-section .slide .text {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
  }
}
