/* ==========================================================================
   header.css — Slim fixed top bar + slide-down glass nav panel
   ========================================================================== */

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --sh-h:           84px;                        /* top bar height */
  --sh-bg:          #0F172A;                     /* bar background */
  --sh-border:      rgba(255, 255, 255, 0.08);   /* bar bottom border */
  --sh-text:        rgba(241, 245, 249, 0.90);   /* default text */
  --sh-muted:       rgba(148, 163, 184, 0.80);   /* phone / secondary */
  --sh-accent:      #f59e0b;                     /* orange CTA */
  --sh-zindex:      1000;

  --np-bg:          rgba(10, 20, 40, 0.45);      /* glass panel bg */
  --np-blur:        16px;                        /* backdrop blur */
  --np-border:      rgba(255, 255, 255, 0.10);   /* panel bottom border */
  --np-zindex:      999;

  --ns-bg:          rgba(8, 20, 44, 0.98);       /* submenu bg */
  --ns-border:      rgba(255, 255, 255, 0.12);
  --ns-radius:      14px;

  --nb-zindex:      998;                         /* backdrop z-index */

  --t-spring:       0.28s cubic-bezier(0.22, 1, 0.36, 1);
  --t-ease:         0.22s ease;
}

/* ── Body offset so content isn't hidden under fixed bar ─────────────────── */
body { padding-top: var(--sh-h); }

/* ── Scroll lock when panel is open ──────────────────────────────────────── */
body.menu-open { overflow: hidden; }

/* ── Hero sections: compensate bar height ────────────────────────────────── */
.dh-hero,
.pl-hero,
.video-hero {
  min-height: calc(100vh - var(--sh-h));
}

/* ══════════════════════════════════════════════════════════════════════════
   TOP BAR
   ══════════════════════════════════════════════════════════════════════════ */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--sh-h);
  z-index: var(--sh-zindex);
  background: var(--sh-bg);
  display: flex;
  align-items: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sh-border);
  overflow: visible !important;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  height: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 22px;
  position: relative;
}

/* Right column (RTL start): utilities — phone + portal */
.site-header__utils {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;
  margin-inline-end: 8px;
}

/* Logo — straddles the bottom edge of the header bar.
   These properties can be overridden at runtime via CSS custom properties
   that are injected by `apps.core.context_processors.global_settings` from
   the HeaderLayoutSettings model. Defaults preserve the historical look. */
.site-header__brand {
  position: absolute;
  bottom: var(--logo-bottom, 0);
  top: var(--logo-top, auto);
  left: var(--logo-left, 20px);
  right: var(--logo-right, auto);
  transform: translateY(var(--logo-offset-y, 50%)) translateX(var(--logo-center-x, 0));
  z-index: 100;
  background: var(--logo-bg, transparent);
  border-radius: var(--logo-bg-radius, 0);
  padding: var(--logo-bg-padding, 0);
}

.site-header__desktop-nav {
  display: none;
  flex: 1;
  padding-left: var(--nav-left-padding, 110px);
  margin-inline: 18px 10px;
  min-width: 0;
  align-self: stretch;
}

.site-header__brand-text {
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

/* Logo image — Admin size is the rendered height; width follows the file. */
.site-header__logo-img {
  height: var(--logo-size-desktop, 120px) !important;
  width: auto !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: contain;
  display: block;
  transition: transform 0.3s ease;
  filter: var(--logo-drop-shadow, drop-shadow(0 3px 10px rgba(0, 0, 0, 0.40)));
}

.site-header__brand:hover .site-header__logo-img {
  transform: scale(1.04);
}

/* Always render logo with its original colors (orange/navy). */
.site-logo {
  filter: none !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  -webkit-filter: none !important;
}

/* Placement landing pages: improve logo contrast on dark hero backgrounds */
.site-header--exam-logo-contrast {
  background: #0F172A !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-header--exam-logo-contrast .exam-logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.65);
  padding: 6px 16px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.site-header--exam-logo-contrast .exam-logo {
  /* Same size as all other site pages (HeaderLayoutSettings vars) */
  height: var(--logo-size-desktop, 120px) !important;
  width: auto !important;
  max-height: none !important;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4)) !important;
  -webkit-filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4)) !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
}

/* Left column (RTL end): toggle */
.site-header__toggle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end; /* RTL: visual left */
}

/* ── Phone link ─────────────────────────────────────────────────────────── */
.site-header__phone {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  direction: ltr;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.site-header__phone svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: #ffffff;
  stroke: #ffffff;
}

.site-header__phone span {
  color: #ffffff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.site-header__phone:hover {
  color: #ffffff;
}

.site-header__phone:hover svg {
  color: #ffffff;
  stroke: #ffffff;
}

.site-header__learn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid rgba(251, 146, 60, 0.9);
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 8px 18px -12px rgba(249, 115, 22, 0.7);
  transition: transform var(--t-ease), filter var(--t-ease), box-shadow var(--t-ease);
}

/* Desktop: full CTA copy. Compact labels shown on mobile via responsive.css. */
.site-header__learn-label--short,
.site-header__learn-label--xs {
  display: none;
}

.site-header__learn-btn:hover {
  color: #fff;
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.site-header__learn-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px -16px rgba(249, 115, 22, 0.8);
}

/* ── Portal button ───────────────────────────────────────────────────── */
.site-header__portal {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 4px;
  padding: 5px 10px;
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  color: rgba(241, 245, 249, 0.82);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.22s ease, border-color 0.22s ease,
              color 0.22s ease, transform 0.22s ease;
}

.site-header__portal:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.75);
  color: #ffffff;
  transform: translateY(-1px);
}

.site-header__portal:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(255, 122, 0, 0.30);
}

.site-header__auth-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: 4px;
}

.site-header__auth-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 5px 11px;
  font-family: Vazirmatn, IRANSans, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.20s ease, background 0.20s ease,
              border-color 0.20s ease, color 0.20s ease, box-shadow 0.20s ease;
}

/* Desktop shows the full account label; the compact "MyDIAKO" label is
   revealed on mobile via responsive.css. */
.site-header__auth-label--short {
  display: none;
}

/* ── خانه ─────────────────────────────────────────────────────────────────── */
.site-header__auth-pill--account {
  color: #0f172a;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: rgba(251, 146, 60, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}
.site-header__auth-pill--account:hover {
  background: linear-gradient(135deg, #ffffff 0%, #ffedd5 100%);
  border-color: #fb923c;
  color: #0f172a;
  transform: translateY(-1px);
}

.site-header__auth-pill--home {
  color: rgba(241, 245, 249, 0.95);
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.45);
}
.site-header__auth-pill--home:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.70);
  transform: translateY(-1px);
}

/* ── عضویت ───────────────────────────────────────────────────────────────── */
.site-header__auth-pill--membership {
  color: #0f172a;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-color: rgba(255, 255, 255, 0.70);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}
.site-header__auth-pill--membership:hover {
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border-color: #fff;
  color: #0f172a;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

/* ── solid variant (kept for any other usage) ─────────────────────────────── */
.site-header__auth-pill--solid {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: #fff;
  box-shadow: 0 4px 18px -8px rgba(249, 115, 22, 0.7);
}
.site-header__auth-pill--solid:hover {
  border-color: #fb923c;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px -10px rgba(249, 115, 22, 0.85);
}

/* ══════════════════════════════════════════════════════════════════════════
   Desktop Mega Menu
   ══════════════════════════════════════════════════════════════════════════ */

.mega-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
}

.mega-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

.mega-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: rgba(241, 245, 249, 0.93);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--t-ease), background-color var(--t-ease);
}

.mega-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.11);
}

.mega-nav-link__caret {
  display: inline-flex;
  opacity: 0.72;
  transition: transform var(--t-ease);
}

.mega-nav-item.has-mega.is-mega-open > .mega-nav-link .mega-nav-link__caret {
  transform: rotate(180deg);
}

/* Narrow hover-bridge from the title down to the panel. Must NOT be
   full-viewport width — that was the overlap bug (a fixed overlay kept
   the previous item hovered while the next one opened). */
.mega-nav-item.has-mega::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 100%;
  height: 16px;
  z-index: 1203;
  pointer-events: none;
}

.mega-nav-item.has-mega.is-mega-open::after {
  pointer-events: auto;
}

.mega-menu-panel {
  position: fixed;
  inset-inline: 0;
  top: var(--sh-h);
  z-index: 1202;
  padding: 10px 18px 0;
  max-width: 100vw;
  box-sizing: border-box;
  overflow-x: hidden;
  display: none;
  pointer-events: none;
}

.mega-nav-item.has-mega.is-mega-open > .mega-menu-panel {
  display: block;
  pointer-events: none;
}

.mega-nav-item.has-mega.is-mega-open > .mega-menu-panel > .mega-menu-panel__inner {
  pointer-events: auto;
}

.mega-menu-panel__inner {
  max-width: min(1240px, calc(100vw - 36px));
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  background: rgba(8, 10, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  box-shadow: 0 28px 60px -20px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255,255,255,0.04) inset;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  padding: 22px 24px;
}

.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.mega-menu-grid.has-feature {
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(220px, 260px);
}

.mega-menu-column {
  min-width: 0;
}

.mega-menu-column__head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
}

.mega-menu-column__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid rgba(165, 180, 252, 0.3);
  font-size: 0.9rem;
}

.mega-menu-column__head h4 {
  margin: 0;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.9;
}

.mega-menu-column__head p {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.73rem;
}

.mega-menu-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.mega-menu-link {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-radius: 10px;
  padding: 8px 9px;
  text-decoration: none;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  transition: border-color var(--t-ease), background-color var(--t-ease), transform var(--t-ease);
}

.mega-menu-link:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.mega-menu-link__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

.mega-menu-link__icon--dot {
  position: relative;
}

.mega-menu-link__icon--dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #818cf8, #a5b4fc);
  transition: transform 0.18s ease, background 0.18s ease;
  display: block;
}

.mega-menu-link:hover .mega-menu-link__icon--dot::before {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  transform: scale(1.4);
}

.mega-menu-link__content {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.mega-menu-link__title {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.82rem;
  font-weight: 600;
}

.mega-menu-link:hover .mega-menu-link__title {
  color: #ffffff;
}

.mega-menu-link__desc {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 7px;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 999px;
  color: rgba(199, 210, 254, 0.9);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.6;
  white-space: nowrap;
}

.mega-menu-link__badge {
  align-self: center;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
  padding: 2px 7px;
  font-size: 0.67rem;
  font-weight: 700;
  white-space: nowrap;
}

.mega-menu-feature {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.mega-menu-feature h4 {
  margin: 0;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
}

.mega-menu-feature p {
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  line-height: 1.7;
}

.mega-menu-feature__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: 10px;
  text-decoration: none;
  background: #0f172a;
  color: #ffffff;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  transition: background-color var(--t-ease), transform var(--t-ease);
}

.mega-menu-feature__cta:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════════════════════════
   Membership Modal
   ══════════════════════════════════════════════════════════════════════════ */

body.membership-modal-open {
  overflow: hidden;
}

.membership-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1120;
  background: rgba(15, 23, 42, 0.56);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}

.membership-modal {
  position: fixed;
  inset: 0;
  z-index: 1125;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}

body.membership-modal-open .membership-modal,
body.membership-modal-open .membership-modal-backdrop {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.22s ease, visibility 0s linear 0s;
}

.membership-modal__dialog {
  position: relative;
  width: min(720px, calc(100vw - 32px));
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 28px 70px -38px rgba(15, 23, 42, 0.42);
  padding: 28px 26px 22px;
  transform: translateY(10px) scale(0.985);
  transition: transform 0.24s ease;
}

body.membership-modal-open .membership-modal__dialog {
  transform: translateY(0) scale(1);
}

.membership-modal__close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  color: #334155;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--t-ease), background-color var(--t-ease);
}

.membership-modal__close:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.membership-modal__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #dbe3ef;
  color: #0f172a;
  background: #f8fafc;
  padding: 5px 11px;
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.membership-modal__head {
  margin-top: 12px;
}

.membership-modal__head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 1.35rem;
  font-weight: 800;
}

.membership-modal__head p {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.9;
}

.membership-modal__form {
  margin-top: 20px;
}

.membership-modal__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.membership-modal__field {
  display: grid;
  gap: 7px;
}

.membership-modal__field--full {
  grid-column: 1 / -1;
}

.membership-modal__field label {
  color: #1e293b;
  font-size: 0.84rem;
  font-weight: 700;
}

.membership-modal__field input,
.membership-modal__field select {
  width: 100%;
  min-height: 52px;
  border-radius: 12px;
  border: 1px solid #d8e0eb;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.92rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--t-ease), box-shadow var(--t-ease), background-color var(--t-ease);
}

.membership-modal__field input::placeholder {
  color: #94a3b8;
}

.membership-modal__field input:focus,
.membership-modal__field select:focus {
  border-color: #fb923c;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.17);
}

.membership-modal__select-wrap {
  position: relative;
}

.membership-modal__select-wrap::after {
  content: "";
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-left: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: translateY(-65%) rotate(-45deg);
  pointer-events: none;
}

.membership-modal__field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-inline-end: 14px;
  padding-inline-start: 34px;
  cursor: pointer;
}

.membership-modal__submit {
  margin-top: 16px;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 13px;
  background: #ff7a00;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color var(--t-ease), transform var(--t-ease), box-shadow var(--t-ease);
  box-shadow: 0 16px 28px -18px rgba(255, 122, 0, 0.72);
}

.membership-modal__submit:hover {
  background: #f97316;
  transform: translateY(-1px);
}

.membership-modal__submit:active {
  transform: translateY(0);
}

.membership-modal__note {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 0.79rem;
  line-height: 1.8;
}

.membership-modal__success {
  margin: 8px 0 0;
  color: #15803d;
  font-size: 0.79rem;
  font-weight: 700;
}

/* ══════════════════════════════════════════════════════════════════════════
   Header Auth Modal
   ══════════════════════════════════════════════════════════════════════════ */

body.auth-modal-open,
html.auth-modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10100;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0s linear 0.28s;
}

.auth-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: 100svh;
  z-index: 10110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0s linear 0.28s;
}

body.auth-modal-open .auth-modal,
body.auth-modal-open .auth-modal-backdrop {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.28s ease, visibility 0s linear 0s;
}

/* Form controls do not inherit the page font by default — force the global
   DIAKO body font on every element inside the auth modal. */
.auth-modal,
.auth-modal button,
.auth-modal input,
.auth-modal select,
.auth-modal textarea {
  font-family: var(--font-body, "Vazirmatn", "Tahoma", sans-serif);
}

.auth-modal__dialog {
  position: relative;
  width: min(480px, 95vw);
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: #fff;
  box-shadow: 0 32px 80px -28px rgba(15, 23, 42, 0.45);
  padding: 28px 28px 22px;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-modal__dialog--dual,
.auth-modal__dialog--mydiako {
  width: min(440px, calc(100vw - 32px));
  max-height: min(92dvh, 720px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1.25rem 1.35rem 1.05rem;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 22px;
  box-shadow: 0 32px 80px -28px rgba(15, 23, 42, 0.4);
  background: #fff;
}

.mydiako-auth__logo {
  width: auto;
  height: 52px;
  max-width: 52px;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto 0.45rem;
}

.mydiako-auth__brand {
  text-align: center;
  margin-bottom: 0.35rem;
}

.mydiako-auth__kicker {
  margin: 0 0 0.4rem;
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: #0f766e;
  direction: ltr;
}

.mydiako-auth__question {
  display: none;
}

.mydiako-auth__region {
  display: grid;
  gap: 0.65rem;
}

.mydiako-auth__choice {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  min-height: 88px;
  text-align: right;
  padding: 0.9rem 1rem;
  border: 1px solid #d5deea;
  border-radius: 16px;
  background: #f8fafc;
  cursor: pointer;
  appearance: none;
  box-shadow: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.mydiako-auth__choice:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.mydiako-auth__choice:active,
.mydiako-auth__choice:focus-visible {
  outline: none;
  border-color: #93c5fd;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.mydiako-auth__flag {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  overflow: hidden;
}

.mydiako-auth__flag-svg {
  width: 28px;
  height: 20px;
  display: block;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.mydiako-auth__choice[value="abroad"] .mydiako-auth__flag-svg {
  width: 26px;
  height: 26px;
  border-radius: 0;
  box-shadow: none;
}

.mydiako-auth__choice-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
  flex: 1 1 auto;
  min-width: 0;
}

.mydiako-auth__choice-text strong {
  font-size: 1.02rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}

.mydiako-auth__choice-text span {
  font-size: 0.8rem;
  font-weight: 500;
  color: #64748b;
  line-height: 1.55;
}

.mydiako-auth__staff-link {
  display: block;
  width: 100%;
  margin-top: 0.65rem;
  text-align: center;
}

.mydiako-auth__staff .auth-modal__form {
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.mydiako-auth__staff .auth-modal__form input {
  min-height: 44px;
}

.mydiako-auth__staff .auth-modal__form .da-pw-field {
  min-height: 44px;
}

.mydiako-auth__staff .auth-modal__form .da-pw-field > input {
  padding-inline-end: 0.35rem;
  min-height: 42px;
}

.mydiako-auth__staff .auth-modal__forgot {
  color: #64748b;
  font-weight: 600;
}

.mydiako-auth__staff .auth-modal__forgot:hover,
.mydiako-auth__staff .auth-modal__forgot:focus-visible {
  color: #334155;
  text-decoration: underline;
}

.mydiako-auth__staff-footer {
  margin: 0.9rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.65;
}

.mydiako-auth__staff-footer a {
  color: #0f766e;
  font-weight: 700;
  text-decoration: none;
}

.mydiako-auth__staff-footer a:hover,
.mydiako-auth__staff-footer a:focus-visible {
  text-decoration: underline;
}

.mydiako-auth__phone {
  display: grid;
  grid-template-columns: minmax(7.5rem, 0.9fr) 1.4fr;
  gap: 0.45rem;
}

/* Iran row: standard intl layout — flag + code pinned left, number fills the
   rest. The page stays RTL; only this control renders LTR. */
.mydiako-auth__phone--iran {
  direction: ltr;
  grid-template-columns: auto 1fr;
  gap: 0;
}

.mydiako-auth__phone--iran input {
  border-radius: 0 10px 10px 0;
}

.mydiako-auth__phone select,
.mydiako-auth__phone input {
  min-width: 0;
}

.mydiako-auth__req {
  color: #dc2626;
  font-weight: 800;
}

/* Reused intl-tel-input country picker (same as consultation/placement). */
.mydiako-auth__phone.is-iti {
  grid-template-columns: 1fr;
}

.mydiako-auth__phone .iti {
  width: 100%;
  direction: ltr;
}

.mydiako-auth__phone .iti input[type="tel"] {
  width: 100%;
}

.mydiako-auth__phone .iti__country-list {
  max-height: 14rem;
}

/* Country list above the auth modal (page → overlay 10100 → modal 10110 → list). */
#mydiako-iti-dropdown-host {
  position: fixed;
  inset: 0;
  z-index: 10120;
  pointer-events: none;
  overflow: visible;
  transform: none;
  filter: none;
  isolation: isolate;
}
#mydiako-iti-dropdown-host .iti.iti--container,
#mydiako-iti-dropdown-host .mydiako-iti-portal {
  pointer-events: auto !important;
  position: fixed !important;
  z-index: 1 !important;
  transform: none !important;
  filter: none !important;
}
#mydiako-iti-dropdown-host .iti__country-list {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  display: block !important;
  width: 100% !important;
  max-height: min(320px, calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))) !important;
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto !important;
  text-align: left;
  z-index: 1;
}
#mydiako-iti-dropdown-host .iti__country {
  cursor: pointer;
}
html.mydiako-iti-open,
html.mydiako-iti-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}
html.mydiako-iti-open #mydiako-iti-dropdown-host .iti__country-list {
  touch-action: pan-y !important;
}

.mydiako-auth__iran-code {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.8rem;
  /* Same border color/weight as .auth-modal__form input so the joined
     prefix and the field read as one control with equal height. */
  border: 1px solid #cbd5e1;
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.auth-modal__dialog--mydiako .auth-modal__form select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 0.7rem 0.75rem;
  font-size: 0.86rem;
  color: #0f172a;
}

.auth-modal__flash.is-visible {
  display: block;
}

body.mydiako-auth-page #main-content {
  min-height: 28vh;
  background: transparent;
}

body.mydiako-auth-page .mydiako-auth-page__fallback {
  min-height: 12vh;
}

.mydiako-auth-page__noscript {
  max-width: 26rem;
  margin: 2rem auto;
  text-align: center;
  color: #475569;
}

body.auth-modal-open .auth-modal__dialog {
  transform: translateY(0) scale(1);
}

.auth-modal__close {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-modal__close:hover {
  background: #e2e8f0;
  border-color: transparent;
  color: #0f172a;
}

.auth-modal__close:focus-visible {
  outline: 2px solid #f97316;
  outline-offset: 2px;
}

.auth-modal__dialog--dual .auth-modal__head {
  text-align: center;
  padding-inline: 2.5rem;
  margin-bottom: 0.25rem;
}

.auth-modal__dialog--mydiako .auth-modal__head {
  text-align: center;
  padding-inline: 1.75rem;
  margin-bottom: 0;
}

.auth-modal__head h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.45rem);
  color: #0f172a;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.45;
}

.auth-modal__head p {
  margin: 0.4rem 0 0;
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.65;
  font-weight: 500;
}

.auth-chooser {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.35rem;
  align-items: stretch;
}

.auth-chooser__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  width: 100%;
  min-height: 220px;
  text-align: center;
  padding: 1.35rem 1.15rem 1.2rem;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fafbfc;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.auth-chooser__card:hover {
  border-color: #fdba74;
  background: #fffaf5;
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -22px rgba(249, 115, 22, 0.55);
}

.auth-chooser__card:focus-visible {
  outline: 2px solid #f97316;
  outline-offset: 2px;
}

.auth-chooser__icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff7ed;
  color: #ea580c;
  flex: 0 0 auto;
}

.auth-chooser__icon--staff {
  background: #f1f5f9;
  color: #334155;
}

.auth-chooser__body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 auto;
  width: 100%;
}

.auth-chooser__title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.4;
}

.auth-chooser__desc {
  font-size: 0.86rem;
  color: #64748b;
  line-height: 1.65;
  max-width: 22ch;
  margin-inline: auto;
}

.auth-chooser__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 800;
  pointer-events: none;
}

.auth-chooser__card--staff .auth-chooser__cta {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
}

.auth-chooser__card:hover .auth-chooser__cta {
  filter: brightness(1.04);
}

@media (max-width: 640px) {
  .auth-modal {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100svh;
    height: 100dvh;
    padding: max(16px, env(safe-area-inset-top, 0px)) 12px max(16px, env(safe-area-inset-bottom, 0px));
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .auth-modal__dialog--dual,
  .auth-modal__dialog--mydiako {
    width: min(100%, calc(100vw - 24px));
    max-height: min(78svh, calc(100svh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
    margin: 0 auto;
    align-self: center;
    padding: 1.1rem 0.95rem 0.95rem;
    border-radius: 20px;
  }

  .mydiako-auth__logo {
    height: 48px;
    max-width: 48px;
    margin-bottom: 0.35rem;
  }

  .auth-modal__dialog--mydiako .auth-modal__head {
    padding-inline: 1.6rem;
  }

  .auth-modal__head h2 {
    font-size: 1.12rem;
  }

  .auth-modal__head p {
    font-size: 0.8rem;
    margin-top: 0.28rem;
  }

  .auth-modal__dialog--mydiako:has(#auth-panel-staff.is-active) {
    max-height: min(88dvh, calc(100dvh - 24px));
  }

  .mydiako-auth__choice {
    min-height: 80px;
    padding: 0.8rem 0.85rem;
    gap: 0.7rem;
  }

  .mydiako-auth__choice-text strong {
    font-size: 0.95rem;
  }

  .mydiako-auth__choice-text span {
    font-size: 0.74rem;
  }

  .mydiako-auth__flag {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }

  .auth-chooser {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .auth-chooser__card {
    min-height: 0;
    padding: 1.15rem 1rem 1.05rem;
  }

  .auth-chooser__icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
  }

  .auth-modal__close {
    top: 12px;
    left: 12px;
    width: 30px;
    height: 30px;
  }
}

.auth-modal__back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.75rem 0 0.35rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.auth-modal__back:hover {
  color: #ea580c;
}

/* ── Segmented OTP boxes ─────────────────────────────────────────────────── */
.mydiako-otp {
  display: flex;
  direction: ltr;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 4px;
}

.mydiako-otp__box {
  width: clamp(40px, 12vw, 48px);
  height: 52px;
  padding: 0;
  text-align: center;
  font-size: 1.25rem !important; /* beats the global 16px mobile input rule */
  font-weight: 800;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  outline: none;
  caret-color: #ea580c;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

/* Extra specificity: must beat both .auth-modal__form input:focus (blue) and
   design-system.css input:not(...):not(...):focus (navy), which loads later. */
.auth-modal .auth-modal__form input.mydiako-otp__box:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}

.auth-modal .auth-modal__form input.mydiako-otp__box.is-filled {
  border-color: #fdba74;
  background: #fffaf5;
}

.auth-modal__otp-hint {
  margin: 0 0 0.35rem;
  color: #475569;
  font-size: 0.84rem;
  line-height: 1.6;
}

.auth-modal__otp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.auth-modal__link-btn {
  border: 0;
  background: transparent;
  color: #ea580c;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.auth-modal__link-btn:disabled {
  color: #94a3b8;
  cursor: not-allowed;
}

.auth-modal__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin: 0.15rem 0 0.35rem;
}

.auth-modal__remember {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-modal__remember input {
  width: 16px;
  height: 16px;
  accent-color: #f97316;
}

.auth-modal__forgot {
  color: #ea580c;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.auth-modal__forgot:hover {
  text-decoration: underline;
}

.auth-modal__tabs {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-modal__tab {
  border: 1px solid #d6dfeb;
  background: #ffffff;
  color: #334155;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}

.auth-modal__tab.is-active {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}

.auth-modal__flash {
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #991b1b;
  padding: 9px 10px;
  font-size: 0.82rem;
}

.auth-modal__flash.is-success {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}

.auth-modal__panel {
  margin-top: 0.85rem;
}

.auth-modal__dialog--mydiako .auth-modal__panel[data-auth-panel="region"] {
  margin-top: 0.7rem;
}

.auth-modal__form {
  display: grid;
  gap: 8px;
}

.auth-modal__form label {
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
}

.auth-modal__form input {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  outline: none;
}

.auth-modal__form input:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14);
}

.auth-modal__form .da-pw-field {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

.auth-modal__form .da-pw-field:focus-within {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14);
}

.auth-modal__form .da-pw-field > input,
.auth-modal__form .da-pw-field > input:focus {
  border: 0 !important;
  box-shadow: none !important;
  min-height: 42px;
}

.auth-modal__form input.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.auth-modal__field-error {
  min-height: 16px;
  color: #b91c1c;
  font-size: 0.74rem;
}

.auth-modal__submit {
  margin-top: 6px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #fff;
  padding: 13px;
  min-height: 48px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 22px -16px rgba(234, 88, 12, 0.7);
}

.auth-modal__submit:hover {
  filter: brightness(1.03);
}

.auth-modal__dialog--dual .auth-modal__form input {
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 0 12px;
}

.auth-modal__dialog--dual .auth-modal__form input:focus {
  border-color: #fdba74;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14);
}

.auth-modal__divider {
  margin: 10px 0;
  text-align: center;
  position: relative;
}

.auth-modal__divider span {
  background: #f8fafc;
  color: #64748b;
  padding: 0 8px;
  font-size: 0.78rem;
  position: relative;
  z-index: 1;
}

.auth-modal__divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1px solid #e2e8f0;
}

.auth-modal__socials {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-modal__social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d6dfeb;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  text-decoration: none;
  padding: 10px 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

.auth-modal__social--google:hover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.auth-modal__social--apple:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

/* ── Hamburger toggle button ────────────────────────────────────────────── */
.nav-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: var(--sh-text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-ease), border-color var(--t-ease);
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.28);
}

.nav-toggle__label { user-select: none; }

/* Hamburger icon — 3 lines → X */
.nav-toggle__ham {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 18px;
  height: 16px;
  flex-shrink: 0;
}

.nav-toggle__ham span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transform-origin: center;
  transition: transform var(--t-ease), opacity var(--t-ease);
}

/* Animate to X when panel is open */
body.menu-open .nav-toggle .nav-toggle__ham span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
body.menu-open .nav-toggle .nav-toggle__ham span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
body.menu-open .nav-toggle .nav-toggle__ham span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ══════════════════════════════════════════════════════════════════════════
   NAV PANEL — slides down from below the top bar
   ══════════════════════════════════════════════════════════════════════════ */

.nav-panel {
  position: fixed;
  top: var(--sh-h);
  left: 0;
  right: 0;
  max-height: calc(100vh - var(--sh-h));
  overflow-y: auto;
  z-index: var(--np-zindex);
  background: var(--np-bg);
  backdrop-filter: blur(var(--np-blur));
  -webkit-backdrop-filter: blur(var(--np-blur));
  border-bottom: 1px solid var(--np-border);
  padding: 12px 0 20px;

  /* Closed state */
  transform: translateY(-16px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0s linear 0.2s;
}

body.menu-open .nav-panel {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0s linear 0s;
}

.nav-panel__inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Nav list ────────────────────────────────────────────────────────────── */

.nav-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Top-level nav item ─────────────────────────────────────────────────── */

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  color: var(--sh-text);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 10px;
  white-space: nowrap;
  transition: background var(--t-ease), color var(--t-ease);
}

.nav-link:hover,
.nav-item--has-children:hover > .nav-link,
.nav-item--sub-open > .nav-link {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}

.nav-link__icon {
  font-size: 1rem;
  line-height: 1;
}

.nav-link__caret {
  display: inline-flex;
  align-items: center;
  opacity: 0.65;
  transition: transform var(--t-ease);
}

.nav-item--sub-open > .nav-link .nav-link__caret,
.nav-item--has-children:hover > .nav-link .nav-link__caret {
  transform: rotate(180deg);
}

/* ══════════════════════════════════════════════════════════════════════════
   SUBMENU — desktop: absolute dropdown on hover
              mobile:  accordion on click
   ══════════════════════════════════════════════════════════════════════════ */

.nav-submenu {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Desktop overlay submenu (hamburger is used below 1025px) ─────────── */
@media (min-width: 1025px) {
  .nav-submenu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0; /* RTL: open to the left of the parent item */
    min-width: 190px;
    background: var(--ns-bg);
    border: 1px solid var(--ns-border);
    border-radius: var(--ns-radius);
    padding: 8px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
    transition:
      opacity 0.18s ease,
      transform 0.18s ease,
      visibility 0s linear 0.18s;
    z-index: 10;
  }

  /* Show on hover or JS-added class */
  .nav-item--has-children:hover > .nav-submenu,
  .nav-item--sub-open > .nav-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition:
      opacity 0.18s ease,
      transform 0.18s ease,
      visibility 0s linear 0s;
  }
}

/* ── Mobile / tablet submenu (accordion; matches hamburger breakpoint) ── */
@media (max-width: 1024px) {
  .nav-panel {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .nav-submenu {
    display: block;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    max-height: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0 6px;
    margin: 2px 0 0;
    transition: max-height 0.3s ease, padding 0.25s ease;
  }

  .nav-item--sub-open > .nav-submenu {
    max-height: 1200px;
    padding: 6px;
  }

  .nav-sub-link {
    white-space: normal;
  }
}

/* ── Submenu link ───────────────────────────────────────────────────────── */

.nav-sub-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: rgba(241, 245, 249, 0.82);
  font-size: 0.88rem;
  text-decoration: none;
  border-radius: 8px;
  transition: background var(--t-ease), color var(--t-ease);
  white-space: nowrap;
  /* Emoji in menu titles (flags/books) need a color-emoji fallback */
  font-family: Vazirmatn, "Segoe UI", Tahoma, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.nav-sub-link:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}

.nav-sub-badge {
  display: inline-block;
  padding: 1px 7px;
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  font-size: 0.72rem;
  border-radius: 999px;
  margin-inline-start: 4px;
}

/* ══════════════════════════════════════════════════════════════════════════
   BACKDROP
   ══════════════════════════════════════════════════════════════════════════ */

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--nb-zindex);
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0s linear 0.2s;
}

body.menu-open .nav-backdrop {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition:
    opacity 0.2s ease,
    visibility 0s linear 0s;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — mobile adjustments
   ══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 1025px) {
  :root {
    --sh-h: max(84px, calc(var(--logo-size-desktop, 120px) + 8px));
  }

  .site-header__inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
  }

  .site-header__utils {
    order: 1;
    flex: 0 0 auto;
    margin-inline-end: 0;
  }

  .site-header__desktop-nav {
    display: flex;
    align-items: stretch;
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 0;
    margin-inline: 0;
  }

  .site-header__desktop-nav .mega-nav-list {
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: center;
  }

  /* Dedicated in-flow logo column on the visual left (RTL end). */
  .site-header__brand {
    order: 3;
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    transform: none;
    flex: 0 0 auto;
    z-index: 2;
    display: flex;
    align-items: center;
    align-self: center;
    max-height: 100%;
    padding: 0;
    margin-inline-start: 8px;
  }

  .site-header__toggle { display: none; }
  .nav-panel,
  .nav-backdrop { display: none !important; }
  body.menu-open { overflow: auto; }
}

@media (max-width: 1260px) {
  .mega-menu-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .mega-menu-grid.has-feature {
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(210px, 240px);
  }
}

@media (max-width: 1140px) {
  .mega-menu-panel__inner {
    padding: 18px 18px;
  }
  .mega-menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .mega-menu-grid.has-feature {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mega-menu-feature {
    grid-column: 1 / -1;
  }
}

/* Tablet / narrow desktop: compact further */
@media (max-width: 1100px) {
  .site-header__phone {
    font-size: 0.95rem;
    gap: 6px;
  }

  .site-header__phone svg {
    width: 16px;
    height: 16px;
  }

  .site-header__learn-btn { font-size: 0.72rem; padding: 6px 10px; }
  .site-header__auth-pill { font-size: 0.72rem; padding: 6px 10px; }
  .site-header__portal { font-size: 0.72rem; padding: 6px 10px; }
  .site-header__utils { gap: 8px; }
  .site-header__auth-actions { gap: 6px; }
  .site-header__inner { gap: 18px; }
  .mega-nav-list { gap: 8px; }
  .mega-nav-link { font-size: 0.8rem; padding: 8px 10px; }
}

/* Below 860px: hide portal button to save space */
@media (max-width: 860px) {
  .site-header__portal--learner { display: none; }
}

@media (max-width: 768px) {
  :root { --sh-h: 64px; }
  .site-header__desktop-nav { display: none; }
  .site-header__toggle { display: flex; }
  /* Keep logo in document flow on mobile so header stays one aligned row.
     Absolute desktop logo positioning is restored above 768 via base rules. */
  .site-header__brand {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    transform: none;
    background: transparent;
    border-radius: 0;
    padding: 0;
  }
  .site-header__logo-img,
  .site-header--exam-logo-contrast .exam-logo {
    height: auto !important;
    width: auto !important;
    max-width: min(28vw, 100px) !important;
    max-height: var(--logo-size-mobile, 44px) !important;
    object-fit: contain;
  }
  .site-header__inner {
    padding: 0 12px;
    gap: 8px;
  }
  .site-header--exam-logo-contrast .exam-logo-wrapper { padding: 2px 6px; }
  .membership-modal__dialog {
    width: min(96vw, 560px);
    padding: 22px 16px 18px;
    border-radius: 18px;
  }
  .membership-modal__grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .membership-modal__field--full {
    grid-column: auto;
  }
  .membership-modal__field input,
  .membership-modal__field select {
    font-size: 16px;
  }
}

/* Mobile: stack nav list vertically — aligned RTL column, fixed caret column */
@media (max-width: 640px) {
  .site-header__phone { display: none; }
  .site-header__utils { gap: 4px; }
  .site-header__auth-actions { gap: 3px; }

  .nav-panel {
    padding: 10px 0 18px;
  }

  .nav-panel__inner {
    width: 100%;
    max-width: none;
    padding: 0 14px;
    box-sizing: border-box;
  }

  .nav-list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap;
    width: 100%;
    gap: 4px;
    margin: 0;
    padding: 0;
  }

  .nav-item {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
  }

  /*
    Uniform row layout for every top-level item:
    - reserved start column for optional icon
    - reserved end column for dropdown caret
    Opening a submenu must not shift sibling label/caret alignment.
  */
  .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    margin: 0;
    padding: 12px 44px 12px 44px;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    border-radius: 10px;
    white-space: normal;
    text-align: right;
    gap: 0;
  }

  .nav-link__icon {
    position: absolute;
    top: 50%;
    right: 14px;
    left: auto;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    pointer-events: none;
  }

  .nav-link__caret {
    position: absolute;
    top: 50%;
    left: 14px;
    right: auto;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    opacity: 0.75;
    flex: none;
    pointer-events: none;
  }

  .nav-item--sub-open > .nav-link .nav-link__caret {
    transform: translateY(-50%) rotate(180deg);
  }

  .nav-item--has-children:hover > .nav-link .nav-link__caret {
    transform: translateY(-50%);
  }

  .nav-item--sub-open > .nav-link:hover .nav-link__caret,
  .nav-item--has-children.nav-item--sub-open > .nav-link .nav-link__caret {
    transform: translateY(-50%) rotate(180deg);
  }

  .nav-submenu {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .nav-sub-link {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-size: 0.9rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.45;
    min-height: 44px;
    text-align: right;
  }

  .auth-modal__dialog {
    width: min(96vw, 420px);
    padding: 18px 16px 16px;
  }
  .auth-modal__socials {
    grid-template-columns: 1fr;
  }
  .membership-modal {
    padding: 14px;
  }
  .membership-modal__badge {
    font-size: 0.66rem;
  }
  .membership-modal__head h2 {
    font-size: 1.2rem;
  }
  .membership-modal__head p {
    font-size: 0.82rem;
  }
}

/* Very small screens — keep equal control heights; labels handled in responsive.css */
@media (max-width: 400px) {
  .site-header__portal { font-size: 0.62rem; padding: 4px 7px; }
  .nav-toggle__label { display: none; }
  .nav-toggle { padding: 6px 8px; }
}
