/**
 * Nahdet Misr Learning — RTL + bilingual layout mirrors
 * Loaded for Arabic (dir=rtl) / is_rtl().
 */

html[dir="rtl"],
html[dir="rtl"] body,
body.rtl,
body.nm-lang-ar {
  direction: rtl;
  text-align: start;
  font-family: "Noto Sans Arabic", "DM Sans", Tahoma, Arial, sans-serif;
}

html[dir="ltr"],
body.ltr,
body.nm-lang-en {
  direction: ltr;
  text-align: left;
}

html[dir="rtl"] {
  overflow-x: clip;
  max-width: 100%;
}

html[dir="rtl"] body,
body.rtl,
body.nm-lang-ar {
  overflow-x: clip;
  max-width: 100%;
}

/* Language switcher — keep Figma dark chrome styles (do not flatten to light pills) */
.nm-lang-switch {
  display: inline-flex !important;
}

.nm-lang-switch__btn {
  text-decoration: none !important;
}

/* Structural mirrors */
html[dir="rtl"] .nm-site-header__inner,
html[dir="rtl"] .nm-utility-bar__inner,
html[dir="rtl"] .nm-footer-bottom,
html[dir="rtl"] .nm-hero__stats,
html[dir="rtl"] .nm-header-tools,
html[dir="rtl"] .nm-btn-row,
html[dir="rtl"] .nm-btn-row,
html[dir="rtl"] .nm-utility-bar__inner {
  direction: rtl;
}

html[dir="rtl"] .nm-hero__grid,
html[dir="rtl"] .nm-shop-band__grid,
html[dir="rtl"] .nm-featured,
html[dir="rtl"] .nm-library-layout,
html[dir="rtl"] .nm-footer-grid,
html[dir="rtl"] .nm-grid {
  direction: rtl;
}

html[dir="rtl"] .nm-timeline {
  padding-left: 0;
  padding-right: 24px;
  border-left: 0;
  border-right: 3px solid var(--nm-cyan, #8cd4f4);
}

html[dir="rtl"] .nm-timeline__item {
  padding-left: 0;
  padding-right: 8px;
}

html[dir="rtl"] .nm-timeline__item::before {
  left: auto;
  right: -31px;
}

html[dir="rtl"] .nm-breadcrumb span[aria-hidden="true"] {
  display: inline-block;
  transform: scaleX(-1);
}

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

html[dir="rtl"] .nm-tabs,
html[dir="rtl"] .nm-level-toggle,
html[dir="rtl"] .nm-partners,
html[dir="rtl"] .nm-header-tools {
  flex-direction: row-reverse;
}

html[dir="rtl"] .nm-pill {
  margin: 0 0 8px 6px;
}

html[dir="rtl"] .nm-form__consent,
html[dir="rtl"] .nm-form__consent {
  flex-direction: row-reverse;
}

html[dir="rtl"] .nm-accordion summary {
  flex-direction: row-reverse;
}

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

html[dir="rtl"] .nm-footer-explore__arrow,
html[dir="rtl"] .nm-link-cta::after {
  display: inline-block;
  transform: scaleX(-1);
}

html[dir="rtl"] .nm-footer-col h5::before {
  left: auto;
  right: 0;
}

html[dir="rtl"] .nm-hero__brand,
html[dir="rtl"] .nm-hero__title,
html[dir="rtl"] .nm-page-header,
html[dir="rtl"] .nm-section,
html[dir="rtl"] .nm-page-body,
html[dir="rtl"] .nm-lead,
html[dir="rtl"] .nm-eyebrow,
html[dir="rtl"] .nm-paths__head,
html[dir="rtl"] .nm-path-row__body {
  text-align: right;
}

html[dir="rtl"] .nm-paths__aside {
  justify-self: end;
  text-align: right;
}

html[dir="rtl"] .nm-figma-hero__actions,
html[dir="rtl"] .nm-figma-cta__actions {
  justify-content: flex-start;
}

html[dir="rtl"] .nm-grid {
  direction: rtl;
}

html[dir="rtl"] .nm-library-layout {
  direction: rtl;
}

html[dir="rtl"] .nm-cta-band,
html[dir="rtl"] .nm-cta-band {
  text-align: center;
}

html[dir="rtl"] .nm-logo img {
  margin-inline: 0;
}

/* Desktop RTL: keep logo on the right / CTAs on the left (natural RTL chrome).
   Do NOT flip the inline nav list — Polylang AR menu order is already correct. */
@media (min-width: 901px) {
  html[dir="rtl"] .nm-site-header__bar {
    direction: rtl;
  }

  html[dir="rtl"] .nm-header-actions {
    direction: rtl;
  }

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

html[dir="rtl"] .nm-card,
html[dir="rtl"] .nm-quote {
  text-align: right;
}

html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea {
  text-align: right;
}

/* Drawer (≤900): Menu on the RIGHT (natural RTL); stacked RTL nav list */
@media (max-width: 900px) {
  html[dir="rtl"] .nm-site-header__bar {
    direction: rtl;
    justify-content: space-between;
  }

  html[dir="rtl"] .nm-header-actions {
    direction: rtl;
    margin-inline-start: 0;
  }

  html[dir="rtl"] .nm-nav-panel,
  html[dir="rtl"] .nm-nav-panel.is-open,
  html[dir="rtl"] .nm-nav-panel.is-open .nm-nav {
    direction: rtl;
    text-align: right;
  }

  html[dir="rtl"] .nm-nav-panel .nm-nav {
    flex-direction: column !important;
    align-items: stretch;
    width: 100%;
  }

  html[dir="rtl"] .nm-nav-panel .nm-nav > li {
    width: 100%;
  }

  html[dir="rtl"] .nm-nav-panel .nm-nav a {
    display: block;
    width: 100%;
    white-space: normal;
    text-align: right;
  }
}

/* v1.7.1 — white chrome RTL (Menu end / logo / lang start) */
html[dir="rtl"] .nm-site-header {
  background: #fff !important;
}
html[dir="rtl"] .nm-nav a {
  color: var(--nm-navy, #1a2b4c) !important;
}
