/* ═══════════════════════════════════════════════════════════
   Rekhi Universal Mega Menu v2.1.2 — Frontend CSS
   FIXED: Kill v1.0.3 Products-anchored crop (left:0 under tab + 100vw)
   FIXED: Mega panel anchors to nav-bar full width (no right crop)
   FIXED: Larger readable text; overflow-x:auto last-resort on grid
   FIXED: Chrome clip — max-height + overflow-y:auto; body scroll lock
   FIXED: Soft lock desktop / hard lock mobile (stops sticky flicker loop)
   FIXED: Soft-lock also keeps header visible (no disappear on hover)
   ═══════════════════════════════════════════════════════════ */
:root {
  --rmm-accent: var(--rekhi-menu-accent, #FF6600);
  --rmm-bg: #0A0A0A;
  --rmm-surface: rgba(255,255,255,0.06);
  --rmm-surface-strong: rgba(255,255,255,0.10);
  --rmm-border: rgba(255,255,255,0.10);
  --rmm-text: #FFFFFF;
  --rmm-muted: #A1A1AA;
  --rmm-faint: #71717A;
  --rmm-radius: 12px;
  --rmm-radius-lg: 18px;
  --rmm-shadow: 0 20px 60px rgba(0,0,0,0.50);
  --rmm-transition: 0.22s cubic-bezier(0.4,0,0.2,1);
  --rmm-font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Distance from viewport top to mega panel top (nav bottom). JS may refine. */
  --rmm-mega-offset: 148px;
  --rmm-header-height: 148px;
}

/*
 * Soft lock (desktop mega): class only — sticky header stays in place.
 * Hard lock (mobile drawer): freeze body with top:-Y and pin header fixed.
 * Plain overflow:hidden alone unsticks .rekhi-hdr when scrolled → flicker loop.
 */
html.rekhi-rmm-soft-lock {
  overscroll-behavior: none;
}
html.rekhi-rmm-scroll-lock {
  overflow: hidden !important;
  overscroll-behavior: none;
}
html.rekhi-rmm-scroll-lock body {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  top: var(--rmm-scroll-lock-top, 0px) !important;
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
  padding-right: var(--rmm-scrollbar-gap, 0px);
}
/* Pin header to viewport while hard-locked OR marked menu-open; soft-lock stays sticky but visible */
html.rekhi-rmm-scroll-lock .rekhi-hdr,
html.rekhi-rmm-scroll-lock #rekhi-header,
html.rekhi-rmm-scroll-lock .b2b-header,
html.rekhi-rmm-soft-lock .rekhi-hdr,
html.rekhi-rmm-soft-lock #rekhi-header,
html.rekhi-rmm-soft-lock .b2b-header,
.rekhi-hdr.is-menu-open,
#rekhi-header.is-menu-open,
.b2b-header.is-menu-open {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: none !important;
  z-index: 10060 !important;
}
/* Only force fixed under hard lock (mobile) — soft lock keeps sticky */
html.rekhi-rmm-scroll-lock .rekhi-hdr,
html.rekhi-rmm-scroll-lock #rekhi-header,
html.rekhi-rmm-scroll-lock .b2b-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}
.admin-bar html.rekhi-rmm-scroll-lock .rekhi-hdr,
.admin-bar html.rekhi-rmm-scroll-lock #rekhi-header,
.admin-bar html.rekhi-rmm-scroll-lock .b2b-header {
  top: 32px !important;
}
@media (max-width: 782px) {
  .admin-bar html.rekhi-rmm-scroll-lock .rekhi-hdr,
  .admin-bar html.rekhi-rmm-scroll-lock #rekhi-header,
  .admin-bar html.rekhi-rmm-scroll-lock .b2b-header {
    top: 46px !important;
  }
}
html.rekhi-rmm-scroll-lock .rekhi-mega-menu__dropdown--mega,
html.rekhi-rmm-scroll-lock .rekhi-mega-menu__list.is-open,
html.rekhi-rmm-soft-lock .rekhi-mega-menu__dropdown--mega {
  touch-action: pan-y;
}

.rekhi-mega-menu,.rekhi-mega-menu *,.rekhi-mega-menu *::before,.rekhi-mega-menu *::after{box-sizing:border-box}

/* ═══════════ NAV BAR ═══════════ */
.rekhi-mega-menu {
  font-family: var(--rmm-font) !important;
  background: var(--rmm-bg) !important;
  color: var(--rmm-text) !important;
  border-bottom: 1px solid var(--rmm-border) !important;
  width: 100%;
  position: relative;
  z-index: 9999;
}

/* ═══════════ MOBILE BAR ═══════════ */
.rekhi-mega-menu__mobile-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--rmm-bg) !important;
}
.rekhi-mega-menu__mobile-logo {
  font-weight: 800;
  font-size: 1rem;
  color: var(--rmm-accent) !important;
  font-family: var(--rmm-font) !important;
}

/* ═══════════ HAMBURGER ═══════════ */
.rekhi-mega-menu__hamburger {
  display: flex; flex-direction: column; gap: 5px;
  background: none !important; border: none; padding: 6px; cursor: pointer;
  width: 36px; height: 36px; align-items: center; justify-content: center;
  border-radius: 8px; transition: background var(--rmm-transition);
}
.rekhi-mega-menu__hamburger:hover { background: var(--rmm-surface) !important; }
.rekhi-mega-menu__hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--rmm-text) !important; border-radius: 2px;
  transition: all var(--rmm-transition);
}
.rekhi-mega-menu__hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.rekhi-mega-menu__hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.rekhi-mega-menu__hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ═══════════ MAIN LIST ═══════════ */
.rekhi-mega-menu__list {
  list-style: none !important; margin: 0 !important; padding: 0 !important;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: nowrap; gap: 2px; width: 100%;
  background: var(--rmm-bg) !important;
}
.rekhi-mega-menu__item {
  position: relative; flex-shrink: 0;
  background: transparent !important;
}
.rekhi-mega-menu__link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 14px 12px;
  color: var(--rmm-muted) !important;
  text-decoration: none !important; font-size: 0.92rem; font-weight: 700;
  white-space: nowrap; border-radius: var(--rmm-radius);
  transition: all var(--rmm-transition); cursor: pointer;
  letter-spacing: 0.01em; font-family: var(--rmm-font) !important;
  background: transparent !important; border: none !important; line-height: 1.3;
}
.rekhi-mega-menu__link:hover,
.rekhi-mega-menu__link:focus-visible {
  color: var(--rmm-accent) !important;
  background: var(--rmm-surface) !important;
  outline: none; text-decoration: none !important;
}
.rekhi-mega-menu__link:focus-visible { box-shadow: 0 0 0 2px var(--rmm-accent) !important; }

.rekhi-mega-menu__arrow {
  font-size: 0.6rem; margin-left: 2px; opacity: 0.5;
  transition: transform var(--rmm-transition); flex-shrink: 0;
}

/* ═══════════ OPEN STATE ═══════════ */
.rekhi-mega-menu__item.is-open > .rekhi-mega-menu__link,
.rekhi-mega-menu__item:hover > .rekhi-mega-menu__link {
  color: var(--rmm-accent) !important;
  background: var(--rmm-surface-strong) !important;
  text-decoration: none !important;
}
.rekhi-mega-menu__item.is-open > .rekhi-mega-menu__link .rekhi-mega-menu__arrow,
.rekhi-mega-menu__item:hover > .rekhi-mega-menu__link .rekhi-mega-menu__arrow {
  transform: rotate(180deg); opacity: 1;
}

/* ═══════════ DROPDOWN — ALL TYPES ═══════════ */
.rekhi-mega-menu__dropdown {
  position: absolute; top: 100%; left: 0;
  background: #0E0E0E !important;
  background-color: #0E0E0E !important;
  border: 1px solid var(--rmm-border) !important;
  border-radius: var(--rmm-radius-lg) !important;
  box-shadow: var(--rmm-shadow) !important;
  min-width: 260px;
  opacity: 0; visibility: hidden; transform: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
  pointer-events: none;
  z-index: 10000;
}
.rekhi-mega-menu__item:hover > .rekhi-mega-menu__dropdown,
.rekhi-mega-menu__item.is-open > .rekhi-mega-menu__dropdown {
  opacity: 1; visibility: visible; transform: none; pointer-events: auto;
}

/* ── Standard dropdown inner ── */
.rekhi-mega-menu__dropdown-inner {
  padding: 10px 0;
  background: #0E0E0E !important;
  border-radius: var(--rmm-radius-lg) !important;
}

/* ═══════════ MEGA DROPDOWN (PRODUCTS) — FULL NAV-BAR WIDTH ═══════════
   v1.0.3 bug: item position:relative + width:min(1280px,100vw-40px) → right crop.
   Fix: static item + static .rekhi-mega-menu → absolute panel uses .rekhi-hdr__nav-bar
   (position:relative) as containing block = full display width under nav. */
@media (min-width: 1025px) {
  .rekhi-hdr__nav-bar,
  .b2b-header-mega {
    position: relative !important;
    overflow: visible !important;
  }
  .rekhi-hdr__nav-bar .rekhi-hdr__inner {
    overflow: visible !important;
  }
  .rekhi-mega-menu__item--mega {
    position: static !important;
  }
  .rekhi-hdr__nav-bar .rekhi-mega-menu,
  .b2b-header-mega .rekhi-mega-menu,
  .rekhi-mega-menu {
    position: static !important;
    overflow: visible !important;
  }
  .rekhi-mega-menu__list {
    position: relative;
    overflow: visible !important;
  }
  .rekhi-mega-menu__dropdown--mega {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    top: 100% !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    /* No translateY — 8px gap caused mouseleave / sticky thrash */
    transform: none !important;
    background: #0E0E0E !important;
    box-sizing: border-box !important;
    /* Reachable under-header height; Chrome clips without this */
    max-height: calc(100vh - var(--rmm-mega-offset)) !important;
    max-height: calc(100dvh - var(--rmm-mega-offset) - env(safe-area-inset-bottom, 0px)) !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    z-index: 10050 !important;
  }
  .rekhi-mega-menu__item:hover > .rekhi-mega-menu__dropdown--mega,
  .rekhi-mega-menu__item.is-open > .rekhi-mega-menu__dropdown--mega {
    transform: none !important;
  }
  .rekhi-mega-menu__dropdown--mega .rekhi-mega-menu__mega-grid {
    overflow-x: auto;
    overflow-y: visible;
  }
}

/* ═══════════ STANDARD SUBMENU LINKS ═══════════ */
.rekhi-mega-menu__sub-list {
  list-style: none !important; margin: 0 !important; padding: 0 !important;
  min-width: 220px; background: #0E0E0E !important;
}
.rekhi-mega-menu__sub-list li {
  list-style: none !important; margin: 0 !important; padding: 0 !important;
  background: transparent !important;
}
.rekhi-mega-menu__sub-list li a {
  display: block; padding: 10px 20px;
  color: var(--rmm-muted) !important; text-decoration: none !important;
  font-size: 0.9rem; font-weight: 600; font-family: var(--rmm-font) !important;
  transition: all 0.15s ease; background: transparent !important;
}
.rekhi-mega-menu__sub-list li a:hover {
  color: var(--rmm-accent) !important;
  background: var(--rmm-surface) !important;
  padding-left: 24px; text-decoration: none !important;
}

/* ═══════════ MEGA GRID — full width; scroll-x only if columns overflow ═══════════ */
.rekhi-mega-menu__mega-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px 0;
  padding: 24px 20px;
  background: #0E0E0E !important;
  border-radius: var(--rmm-radius-lg) !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rekhi-mega-menu__mega-col {
  padding: 0 14px;
  border-right: 1px solid var(--rmm-border);
  background: transparent !important;
  min-width: 140px;
}
.rekhi-mega-menu__mega-col:last-child { border-right: none; }
.rekhi-mega-menu__mega-heading {
  display: block; padding: 4px 0 12px;
  color: var(--rmm-accent) !important; text-decoration: none !important;
  font-size: 1rem; font-weight: 800; letter-spacing: 0.02em;
  text-transform: uppercase; font-family: var(--rmm-font) !important;
  transition: color var(--rmm-transition); background: transparent !important;
  line-height: 1.35;
}
.rekhi-mega-menu__mega-heading:hover { color: var(--rmm-accent) !important; text-decoration: none !important; }

.rekhi-mega-menu__mega-list {
  list-style: none !important; margin: 0 !important; padding: 0 !important;
  background: transparent !important;
}
.rekhi-mega-menu__mega-list li {
  list-style: none !important; margin: 0 !important; padding: 0 !important;
  background: transparent !important;
}
.rekhi-mega-menu__mega-list li a {
  display: block; padding: 7px 0;
  color: var(--rmm-muted) !important; text-decoration: none !important;
  font-size: 0.95rem; font-weight: 500; font-family: var(--rmm-font) !important;
  transition: all 0.15s ease; background: transparent !important;
  line-height: 1.45;
}
.rekhi-mega-menu__mega-list li a:hover {
  color: var(--rmm-accent) !important;
  padding-left: 4px; text-decoration: none !important;
}

/* ═══════════ THEME GUARDS — ultimate override ═══════════ */
.rekhi-mega-menu a { text-decoration: none !important; box-shadow: none !important; }
.rekhi-mega-menu ul { list-style: none !important; padding: 0 !important; margin: 0 !important; }
.rekhi-mega-menu li { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.rekhi-mega-menu li::before,
.rekhi-mega-menu li::after { display: none !important; content: none !important; }
/* Do NOT override dropdown backgrounds — they have their own dark colour */
.rekhi-mega-menu__dropdown,
.rekhi-mega-menu__dropdown--mega,
.rekhi-mega-menu__dropdown-inner,
.rekhi-mega-menu__mega-grid { background: #0E0E0E !important; background-color: #0E0E0E !important; color: #e8e8e8 !important; }
/* Force opaque background on dropdown elements that might inherit transparent */
.rekhi-mega-menu__sub-list li a { background: #0E0E0E !important; color: #a1a1aa !important; }
.rekhi-mega-menu__sub-list li a:hover { background: rgba(255,255,255,0.06) !important; color: var(--rmm-accent) !important; }
.rekhi-mega-menu__mega-heading { color: var(--rmm-accent) !important; }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 1200px) {
  .rekhi-mega-menu__link { padding: 14px 8px; font-size: 0.9rem; }
  .rekhi-mega-menu__mega-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); padding: 20px 16px; }
}
@media (max-width: 1024px) {
  .rekhi-mega-menu__mobile-bar { display: flex; }
  .rekhi-mega-menu__list {
    display: none !important; flex-direction: column; padding: 0 !important;
    max-height: calc(100vh - 68px); overflow-y: auto; overflow-x: hidden;
    border-top: 1px solid var(--rmm-border) !important;
    justify-content: flex-start; width: 100%; max-width: 100%;
  }
  .rekhi-mega-menu__list.is-open { display: flex !important; }
  .rekhi-mega-menu__item { flex-shrink: 0; flex: none; border-bottom: 1px solid var(--rmm-border); text-align: left; }
  .rekhi-mega-menu__item--mega { position: relative; }
  .rekhi-mega-menu__link { width: 100%; padding: 16px 20px; justify-content: space-between; font-size: 0.92rem; border-radius: 0 !important; }
  .rekhi-mega-menu__arrow { font-size: 0.7rem; }

  /* Mobile dropdowns — static position */
  .rekhi-mega-menu__dropdown {
    position: static; opacity: 1; visibility: visible; transform: none !important;
    box-shadow: none !important; border: none !important; border-radius: 0 !important;
    background: rgba(255,255,255,0.02) !important; display: none;
    pointer-events: auto; min-width: auto; z-index: auto;
  }
  .rekhi-mega-menu__dropdown-inner { background: transparent !important; }
  .rekhi-mega-menu__item:hover > .rekhi-mega-menu__dropdown { display: none; }
  .rekhi-mega-menu__item.is-open > .rekhi-mega-menu__dropdown { display: block; }
  .rekhi-mega-menu__sub-list li a { padding: 12px 36px; font-size: 0.88rem; }
  .rekhi-mega-menu__sub-list li a:hover { padding-left: 40px; }

  /* Mobile mega */
  .rekhi-mega-menu__dropdown--mega { width: 100% !important; left: 0 !important; right: auto !important; }
  .rekhi-mega-menu__mega-grid { grid-template-columns: 1fr; gap: 0; padding: 12px 20px; }
  .rekhi-mega-menu__mega-col { padding: 8px 0; border-right: none !important; border-bottom: 1px solid var(--rmm-border); }
  .rekhi-mega-menu__mega-col:last-child { border-bottom: none; }
  .rekhi-mega-menu__mega-heading { font-size: 0.95rem; padding: 8px 16px; }
  .rekhi-mega-menu__mega-list li a { padding: 8px 32px; font-size: 0.88rem; }
}
@media (max-width: 768px) {
  .rekhi-mega-menu { width: 100%; max-width: 100%; overflow-x: clip !important; }
  .rekhi-mega-menu__hamburger { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  /* Keep list closed until .is-open — never force flex on mobile */
  .rekhi-mega-menu__list:not(.is-open) { display: none !important; }
}
@media (max-width: 480px) {
  .rekhi-mega-menu__mega-grid { padding: 8px 12px; }
  .rekhi-mega-menu__dropdown-inner { padding: 6px 0; }
}

/* ═══════════ REDUCED MOTION ═══════════ */
@media (prefers-reduced-motion: reduce) {
  .rekhi-mega-menu__dropdown,
  .rekhi-mega-menu__link,
  .rekhi-mega-menu__sub-list li a,
  .rekhi-mega-menu__mega-list li a { transition-duration: 0.01ms !important; animation: none !important; }
}

/* ═══════════ SCROLLBAR STYLING ═══════════ */
.rekhi-mega-menu__mega-grid::-webkit-scrollbar,
.rekhi-mega-menu__dropdown--mega::-webkit-scrollbar { width: 6px; height: 6px; }
.rekhi-mega-menu__mega-grid::-webkit-scrollbar-track,
.rekhi-mega-menu__dropdown--mega::-webkit-scrollbar-track { background: transparent; }
.rekhi-mega-menu__mega-grid::-webkit-scrollbar-thumb,
.rekhi-mega-menu__dropdown--mega::-webkit-scrollbar-thumb { background: var(--rmm-border); border-radius: 3px; }

/* ═══════════ PREVENT DROPDOWN CLIPPING (non-mega only) ═══════════
   Mega panel MUST keep overflow-y:auto — do not force visible here. */
.rekhi-mega-menu { overflow: visible !important; }
.rekhi-mega-menu__item { overflow: visible !important; }
.rekhi-mega-menu__dropdown:not(.rekhi-mega-menu__dropdown--mega) { overflow: visible !important; }
