/* ==========================================================================
   Arzical Custom Header
   Prefix: .arz-hdr, .arz-mob, .arz-menu — isolated from Jannah/Elementor.
   ========================================================================== */

:root {
  --arz-primary: #1e84d4;
  --arz-primary-dark: #1a6cae;
  --arz-text: #0f172a;
  --arz-text-muted: #6b7280;
  --arz-border: #e5e7eb;
  --arz-bg: #ffffff;
  --arz-bg-soft: #f8fafc;
  --arz-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
  --arz-radius: 12px;
  --arz-radius-sm: 8px;
  --arz-font: inherit;
  --arz-hdr-side: 28px;
}

/* Prevent horizontal scroll caused by 100vw breakout (scrollbar width difference) */
html { overflow-x: clip; }
@supports not (overflow-x: clip) {
  html, body { overflow-x: hidden; }
}

/* Reset (scoped) */
.arz-hdr *,
.arz-hdr *::before,
.arz-hdr *::after,
.arz-mob *,
.arz-mob *::before,
.arz-mob *::after {
  box-sizing: border-box;
}

/* ==========================================================================
   HEADER WRAPPER
   ========================================================================== */
.arz-hdr {
  background: var(--arz-bg);
  border-bottom: 1px solid var(--arz-border);
  font-family: var(--arz-font);
  direction: rtl;
  position: relative;
  z-index: 50;

  /* Break out of Elementor Kit body padding to span full viewport width */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  max-width: none;
}

/* When the widget sits inside an Elementor column/section, neutralize their wrappers */
.elementor-widget-arz-header,
.elementor-widget-arz-header > .elementor-widget-container {
  padding: 0 !important;
  margin: 0 !important;
}
.elementor-widget-arz-header .elementor-widget-container {
  width: 100%;
}

/* Kill vertical space above the header widget caused by Elementor section/column wrappers.
   Targets every ancestor up to the section that contains our widget. */
.elementor-section:has(.elementor-widget-arz-header),
.elementor-section:has(.elementor-widget-arz-header) > .elementor-container,
.elementor-column:has(.elementor-widget-arz-header),
.elementor-column:has(.elementor-widget-arz-header) > .elementor-widget-wrap,
.elementor-widget-wrap:has(> .elementor-widget-arz-header) {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Elementor v3+ flex containers (.e-con / .e-flex / .e-con-full / .e-parent / .e-child).
   These replace the legacy .elementor-section/.elementor-column and have their own
   CSS variables (--padding-block-start, --margin-block-end, etc.) plus a default
   10px padding. Neutralize every ancestor container that wraps our header widget. */
.e-con:has(.elementor-widget-arz-header),
.e-con:has(.elementor-widget-arz-header) > .e-con-inner,
.e-parent:has(.elementor-widget-arz-header),
.e-child:has(.elementor-widget-arz-header) {
  --padding-block-start: 0 !important;
  --padding-block-end: 0 !important;
  --padding-top: 0 !important;
  --padding-bottom: 0 !important;
  --margin-block-start: 0 !important;
  --margin-block-end: 0 !important;
  --margin-top: 0 !important;
  --margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  row-gap: 0 !important;
}

/* HFE (Header Footer Elementor) wrapper — if present */
.hfe-header,
.hfe-site-header,
.elementor-location-header {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.arz-hdr__main {
  background: var(--arz-bg);
}

.arz-hdr__container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 12px var(--arz-hdr-side);
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Right: logo + nav */
.arz-hdr__right {
  display: flex;
  align-items: center;
  gap: 24px;
  order: 1;
  flex: 0 0 auto;
}

/* Center: search */
.arz-hdr__center {
  flex: 1 1 auto;
  order: 2;
  display: flex;
  justify-content: center;
  min-width: 0;
}

/* Left: CTA + mobile icons */
.arz-hdr__left {
  display: flex;
  align-items: center;
  gap: 10px;
  order: 3;
  flex: 0 0 auto;
}

/* ==========================================================================
   LOGO
   ========================================================================== */
.arz-hdr__logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.arz-hdr__logo img {
  height: 40px;
  width: auto;
  display: block;
}
.arz-hdr__logo-text {
  font-size: 22px;
  font-weight: 900;
  color: var(--arz-primary);
}

/* ==========================================================================
   NAV (desktop)
   ========================================================================== */
.arz-hdr__nav {
  display: flex;
}
.arz-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
  align-items: center;
}
.arz-menu > li {
  position: relative;
  margin: 0;
  padding: 0;
}
.arz-menu-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  color: var(--arz-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--arz-radius-sm);
  transition: color .15s ease, background .15s ease;
  white-space: nowrap;
  position: relative;
}
.arz-menu-link:hover,
.arz-menu-link:focus {
  color: var(--arz-primary);
  background: var(--arz-bg-soft);
}
.arz-menu-link .arz-menu-chevron {
  display: inline-flex;
  align-items: center;
  color: currentColor;
  opacity: .65;
  transition: transform .2s ease;
}
.arz-menu .arz-has-children:hover > a .arz-menu-chevron {
  transform: rotate(180deg);
}
.arz-menu .arz-menu-toggle {
  display: none; /* desktop uses hover */
}

/* Indicator dot for items with red bullet (e.g., "محصولات ارزیکال") */
.arz-menu .menu-item.has-dot > a::after,
.arz-menu .menu-item-has-children.has-dot > a::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  margin-inline-start: 4px;
  margin-bottom: 10px;
}

/* Sub-menu */
.arz-menu .sub-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--arz-border);
  border-radius: var(--arz-radius);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .10);
  padding: 6px;
  list-style: none;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
  z-index: 100;
}
.arz-menu .arz-has-children:hover > .sub-menu,
.arz-menu .arz-has-children:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.arz-menu .sub-menu li {
  margin: 0;
  list-style: none;
}
.arz-menu .sub-menu .arz-menu-link {
  padding: 9px 10px;
  width: 100%;
  border-radius: var(--arz-radius-sm);
}
.arz-menu .sub-menu .arz-menu-chevron {
  display: none;
}

/* ==========================================================================
   SEARCH (desktop)
   ========================================================================== */
.arz-hdr__search {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 420px;
  background: var(--arz-bg-soft);
  border: 1px solid var(--arz-border);
  border-radius: 999px;
  padding: 4px 14px;
  height: 42px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.arz-hdr__search:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(147, 197, 253, .25);
  background: #fff;
}
.arz-hdr__search-icon {
  color: var(--arz-text-muted);
  display: inline-flex;
  align-items: center;
  margin-inline-end: 8px;
  flex-shrink: 0;
}
.arz-hdr__search-input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 14px;
  color: var(--arz-text);
  font-family: inherit;
}
.arz-hdr__search-input::placeholder {
  color: var(--arz-text-muted);
}

/* ==========================================================================
   CTA BUTTON
   ========================================================================== */
.arz-hdr__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--arz-primary);
  color: #fff !important;
  font-weight: 800;
  font-size: 14px;
  padding: 10px 22px;
  border-radius: var(--arz-radius);
  text-decoration: none;
  transition: background .15s ease, transform .12s ease;
  white-space: nowrap;
  border: 0;
  cursor: pointer;
}
.arz-hdr__cta:hover {
  background: var(--arz-primary-dark);
  color: #fff;
}
.arz-hdr__cta:active {
  transform: translateY(1px);
}

/* Mobile icon buttons */
.arz-hdr__icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--arz-text);
  cursor: pointer;
  padding: 0;
  border-radius: var(--arz-radius-sm);
}
.arz-hdr__icon-btn:hover {
  background: var(--arz-bg-soft);
}

/* ==========================================================================
   TICKER
   ========================================================================== */
.arz-hdr__ticker {
  background: var(--arz-bg);
  border-top: 1px solid var(--arz-border);
}
.arz-hdr__ticker-container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 8px var(--arz-hdr-side);
  overflow: hidden;
}
.arz-hdr__ticker-track {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  /* No gap here — spacing is applied via margin-inline-end on items.
     This guarantees a perfectly seamless marquee loop on mobile. */
}
.arz-hdr__ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--arz-text);
  white-space: nowrap;
  font-weight: 600;
  margin-inline-end: 28px;
}
.arz-hdr__ticker-label {
  color: var(--arz-text);
}
.arz-hdr__ticker-value {
  color: var(--arz-primary);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

/* Desktop only (>900px): show only the first half — duplicates are needed only
   for the mobile marquee. On screens 768-900px we keep all items so the marquee
   stays seamless. */
@media (min-width: 901px) {
  .arz-hdr__ticker-track > .arz-hdr__ticker-item:nth-child(n+5) {
    display: none;
  }
  .arz-hdr__ticker-track {
    justify-content: flex-start; /* RTL: aligns to the RIGHT side */
  }
  .arz-hdr__ticker-item {
    margin-inline-end: 36px;
  }
  /* The rightmost visible item should sit flush with the logo edge */
  .arz-hdr__ticker-track > .arz-hdr__ticker-item:first-child {
    margin-inline-start: 0;
  }
}

/* ==========================================================================
   MOBILE FULL-SCREEN MENU
   ========================================================================== */
.arz-mob {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%); /* RTL: comes from right */
  visibility: hidden;
  transition: transform .25s ease, visibility .25s ease;
  overflow-y: auto;
}
.arz-mob.is-open {
  transform: translateX(0);
  visibility: visible;
}
html.arz-no-scroll,
html.arz-no-scroll body {
  overflow: hidden;
}

.arz-mob__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--arz-border);
  flex-shrink: 0;
}
.arz-mob__logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.arz-mob__logo img {
  height: 36px;
  width: auto;
}
.arz-mob__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.arz-mob__actions .arz-hdr__icon-btn {
  display: inline-flex;
}

/* Mobile inline search (toggleable) */
.arz-mob__search-wrap {
  padding: 12px 18px;
  border-bottom: 1px solid var(--arz-border);
  display: none;
  flex-shrink: 0;
}
.arz-mob__search-wrap.is-open {
  display: block;
}
.arz-mob__search input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--arz-border);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  background: var(--arz-bg-soft);
  font-family: inherit;
}
.arz-mob__search input:focus {
  background: #fff;
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(147, 197, 253, .25);
}

/* Mobile nav */
.arz-mob__nav {
  flex: 1 1 auto;
  padding: 0 0 24px;
}
.arz-mob-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}
.arz-mob-menu li {
  list-style: none;
  margin: 0;
}
.arz-mob-menu > li {
  border-bottom: 1px solid var(--arz-border);
}
.arz-mob-menu .arz-menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  font-size: 15px;
  font-weight: 800;
  color: var(--arz-text);
  text-decoration: none;
  width: 100%;
}
.arz-mob-menu .arz-menu-link .arz-menu-chevron {
  display: none; /* mobile uses toggle button */
}
.arz-mob-menu .arz-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
  color: var(--arz-text);
  transition: transform .2s ease;
  margin-inline-end: 12px;
}
.arz-mob-menu .arz-menu-toggle[aria-expanded="true"] {
  transform: rotate(180deg);
}
.arz-mob-menu .arz-has-children > a {
  flex: 1 1 auto;
}
.arz-mob-menu .arz-has-children {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.arz-mob-menu .arz-has-children > a {
  width: calc(100% - 60px);
}
.arz-mob-menu .arz-has-children > .arz-menu-toggle {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
}
.arz-mob-menu .arz-has-children > .arz-menu-toggle[aria-expanded="true"] {
  transform: translateY(-50%) rotate(180deg);
}

/* Mobile sub-menu */
.arz-mob-menu .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--arz-bg-soft);
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
  width: 100%;
  order: 99;
}
.arz-mob-menu .sub-menu.is-open {
  max-height: 1000px;
}
.arz-mob-menu .sub-menu li {
  border-top: 1px solid var(--arz-border);
}
.arz-mob-menu .sub-menu .arz-menu-link {
  padding: 14px 32px;
  font-weight: 600;
  font-size: 14px;
}

/* Mobile CTA at bottom */
.arz-mob__cta-wrap {
  padding: 16px 18px 24px;
  border-top: 1px solid var(--arz-border);
  background: #fff;
  flex-shrink: 0;
}
.arz-mob__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--arz-primary);
  color: #fff !important;
  text-decoration: none;
  height: 52px;
  border-radius: var(--arz-radius);
  font-weight: 800;
  font-size: 15px;
}
.arz-mob__cta:hover {
  background: var(--arz-primary-dark);
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1100px) {
  .arz-hdr__container {
    gap: 12px;
  }
  .arz-menu-link {
    padding: 8px 8px;
    font-size: 13px;
  }
  .arz-hdr__cta {
    padding: 9px 16px;
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  .arz-hdr__nav,
  .arz-hdr__center,
  .arz-hdr__cta {
    display: none;
  }
  .arz-hdr__icon-btn {
    display: inline-flex;
  }
  .arz-hdr__container {
    padding: 10px 14px;
    justify-content: space-between;
  }
  .arz-hdr__logo img {
    height: 36px;
  }

  /* Eliminate empty space ABOVE the header on mobile by aggressively neutralizing
     all Elementor wrappers' top spacing (inline styles included via !important). */
  .arz-hdr {
    margin-top: 0 !important;
  }
  .elementor-widget-arz-header,
  .elementor-widget-arz-header > .elementor-widget-container,
  .elementor-widget-wrap:has(> .elementor-widget-arz-header),
  .elementor-column:has(.elementor-widget-arz-header),
  .elementor-column:has(.elementor-widget-arz-header) > .elementor-element-populated,
  .elementor-section:has(.elementor-widget-arz-header),
  .elementor-section:has(.elementor-widget-arz-header) > .elementor-container,
  .elementor-top-section:has(.elementor-widget-arz-header),
  .elementor-location-header:first-child,
  .hfe-header,
  .hfe-site-header {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }
  /* Also zero out bottom space below to avoid extra gap to next section */
  .elementor-section:has(.elementor-widget-arz-header),
  .elementor-section:has(.elementor-widget-arz-header) > .elementor-container,
  .elementor-column:has(.elementor-widget-arz-header) > .elementor-element-populated {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  /* Mobile: keep desktop side order — logo on RIGHT, hamburger+search on LEFT (RTL default).
     DOM order is right → center → left, so default RTL flex already places .arz-hdr__right
     on the visual right and .arz-hdr__left on the visual left. No order overrides needed. */
  .arz-hdr__right { order: 1; }   /* RTL flex: order 1 = rightmost (logo stays right) */
  .arz-hdr__left  { order: 3; }   /* RTL flex: order 3 = leftmost  (icons stay left)  */

  /* Mobile ticker — marquee continuous, LEFT → RIGHT direction */
  .arz-hdr__ticker-container {
    padding: 6px 0;
  }
  .arz-hdr__ticker-track {
    animation: arz-ticker-scroll 35s linear infinite; /* keyframe goes -50%→0 → items flow LEFT→RIGHT */
    width: max-content;
  }
  .arz-hdr__ticker-track:hover {
    animation-play-state: paused;
  }
  .arz-hdr__ticker-item {
    padding: 0 4px;
    font-size: 12px;
    margin-inline-end: 28px;
  }
}

@keyframes arz-ticker-scroll {
  /* Marquee flow: LEFT → RIGHT (items enter from the LEFT edge and exit on the RIGHT).
     The track translates from -50% to 0 (i.e. moves rightward over time),
     so every child item appears to drift to the right.
     50% works because we duplicate ticker items (visible = first 4, duplicate = next 4),
     so after one cycle the visible content is identical → instant reset is invisible. */
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}

/* Force LTR animation direction regardless of doc dir */
@media (max-width: 900px) {
  .arz-hdr__ticker-container { direction: ltr; }
  .arz-hdr__ticker-track     { direction: rtl; }
}

/* Hide Jannah's default header (only inside Arzical wrapper to be safe) */
#tie-wrapper > #theme-header,
#tie-wrapper > .main-nav,
#tie-wrapper > #top-nav {
  display: none !important;
}

/* Prevent double scrollbar conflicts */
.arz-mob a:focus-visible,
.arz-mob button:focus-visible,
.arz-hdr a:focus-visible,
.arz-hdr button:focus-visible,
.arz-hdr input:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}
