/* Mehwar Ultra Header v2.3 (Performance Optimized • High Speed) */
:root {
  --muh-bg: #04122b;
  --muh-ink: #061327;
  --muh-text: #eaf2ff;
  --muh-muted: #b7c7df;
  --muh-cyan: #00F2FE;

  /* glass states */
  --muh-glass: rgba(4,18,43,.26);
  --muh-glass-strong: rgba(4,18,43,.86);

  --muh-stroke: rgba(255,255,255,.14);
  --muh-stroke-strong: rgba(255,255,255,.18);

  --muh-radius-lg: 18px;
  --muh-radius-md: 14px;

  --muh-shadow-soft: 0 14px 44px rgba(0,0,0,.34);
  --muh-shadow-strong: 0 22px 72px rgba(0,0,0,.58);

  --muh-max: 1360px;

  /* hero-blend */
  --muh-top-bg: rgba(255,255,255,.06);
  --muh-top-stroke: rgba(255,255,255,.10);
  --muh-top-shadow: none;

  --muh-hero-mid: rgba(4,18,43,.55);
}

* { box-sizing: border-box; }
.muh-header a, .muh-header button { -webkit-tap-highlight-color: transparent; }

.muh-header {
  position: fixed; 
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 9999;
  padding: 14px 16px;
  background: transparent;
  /* PERFORMANCE FIX: Removed padding transition from main header wrapper */
}

.muh-shell { max-width: var(--muh-max); margin: 0 auto; }

.muh-pill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  padding: 12px 18px;
  border-radius: var(--muh-radius-lg);
  border: 1px solid var(--muh-top-stroke);
  background: var(--muh-top-bg);
  box-shadow: var(--muh-top-shadow);

  /* glass */
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);

  /* smooth dock feel */
  transform: translateZ(0);
  animation: muhDockIn .45s ease both;
  
  /* PERFORMANCE FIX: Removed padding and gap transitions to stop layout shifts */
transition: background-color 0.3s ease, transform 0.3s ease;
}

.muh-brand img { 
  display: block; 
  height: auto; 
  width: auto;
  max-width: clamp(150px, 22vw, 240px); 
  /* PERFORMANCE FIX: Removed max-width transition which caused massive CPU spikes */
  transition: filter 0.3s ease; 
}

.muh-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;

  color: var(--muh-text);
  text-decoration: none;
  font-weight: 900;
  font-size: 1.02rem;

  padding: 10px 10px;
  border-radius: 12px;
  white-space: nowrap;
  
  /* PERFORMANCE FIX: Strictly GPU accelerated transitions only */
  transition: transform .18s ease, background-color .18s ease, color .18s ease;
}

/* subtle animated sheen */
.muh-pill::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(900px 240px at 18% -20%, rgba(0,242,254,.22), transparent 55%),
    radial-gradient(700px 220px at 82% -10%, rgba(255,255,255,.10), transparent 55%);
  opacity: .85;
}

.muh-pill::after {
  content: "";
  position: absolute;
  left: 16px; right: 16px; bottom: 0;
  height: 1px;
  border-radius: 99px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(0,242,254,.55), transparent);
  opacity: .35;
  transform: scaleX(.55);
  transform-origin: center;
  transition: transform .35s ease, opacity .35s ease;
}

@keyframes muhDockIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Top-of-page */
.muh-header.muh-at-top .muh-pill {
  background: rgba(255,255,255,.012);
  border-color: transparent;
  box-shadow: none;
}
.muh-header.muh-at-top .muh-pill::after { opacity: 0; transform: scaleX(.25); }
.muh-header.muh-at-top .muh-pill::before { opacity: .65; }

/* Light Tone */
.muh-header[data-muh-tone="light"]:not(.muh-scrolled) .muh-pill {
  background: rgba(0,0,0,.10);
  border-color: rgba(0,0,0,.12);
}
.muh-header[data-muh-tone="light"]:not(.muh-scrolled) .muh-link { color: rgba(255,255,255,.92); text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.muh-header[data-muh-tone="light"]:not(.muh-scrolled) .muh-brand img { filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }

/* Scroll states */
.muh-header.muh-scrolled { padding: 10px 16px; }

.muh-header.muh-scrolled.muh-in-hero .muh-pill {
  background: var(--muh-hero-mid);
  border-color: var(--muh-stroke);
  box-shadow: var(--muh-shadow-soft);
}
.muh-header.muh-scrolled.muh-in-hero .muh-pill::after { opacity: .55; transform: scaleX(.9); }

.muh-header.muh-scrolled:not(.muh-in-hero) .muh-pill {
  background: var(--muh-glass-strong);
  border-color: var(--muh-stroke-strong);
  box-shadow: var(--muh-shadow-strong);
}
.muh-header.muh-scrolled:not(.muh-in-hero) .muh-pill::after { opacity: .75; transform: scaleX(1); }

.muh-header.muh-compact .muh-pill { padding: 10px 16px; gap: 16px; }
.muh-header.muh-compact .muh-link { padding: 8px 8px; font-size: 0.98rem; }
.muh-header.muh-compact .muh-brand img { max-width: clamp(145px, 20vw, 225px); }

/* Brand */
.muh-brand {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--muh-radius-md);
  text-decoration: none;
  min-width: 0;
  transition: transform .2s ease, background-color .2s ease;
}
.muh-brand:hover { transform: translateY(-1px); background-color: rgba(255,255,255,.05); }
.muh-brand-text { color: var(--muh-text); font-weight: 1000; letter-spacing: .2px; }

/* Desktop nav */
.muh-nav { flex: 1 1 auto; min-width: 0; }
.muh-menu {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  margin: 0;
  padding: 0;
}
.muh-item { position: relative; }

.muh-link:hover {
  background-color: rgba(255,255,255,.06);
  transform: translateY(-1px);
}
.muh-link::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 6px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(0,242,254,0), rgba(0,242,254,.92), rgba(0,242,254,0));
  transform: scaleX(0);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
}
.muh-item:hover > .muh-link::after,
.muh-item.current-menu-item > .muh-link::after,
.muh-item.current-menu-ancestor > .muh-link::after {
  transform: scaleX(1);
  opacity: 1;
}

/* caret rotate */
.muh-caret { opacity: .9; display: inline-flex; }
.muh-caret svg { transition: transform .18s ease; }
.muh-item:hover > .muh-link .muh-caret svg { transform: rotate(180deg); }

/* Desktop dropdowns (multi-level) */
.muh-dd {
  position: absolute;
  top: calc(100% + 12px);
  inset-inline-start: 0;
  min-width: 280px;
  padding: 10px;
  margin: 0;
  list-style: none;

  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(8,18,36,.98), rgba(6,12,26,.98));
  box-shadow: var(--muh-shadow-strong);

  /* animation-ready */
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(.98);
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.muh-item:hover > .muh-dd {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition: opacity .18s ease, transform .18s ease, visibility 0s;
}

/* 2nd level -> 3rd level */
.muh-dd .muh-item { position: relative; }
.muh-dd .muh-dd {
  top: -8px;
  inset-inline-start: calc(100% + 10px);
  transform: translateX(10px) scale(.98);
}
[dir="rtl"] .muh-dd .muh-dd {
  inset-inline-start: auto;
  inset-inline-end: calc(100% + 10px);
  transform: translateX(-10px) scale(.98);
}
.muh-dd .muh-link {
  width: 100%;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: .98rem;
  border-radius: 12px;
}

/* Actions */
.muh-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.muh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 11px 16px;
  border-radius: var(--muh-radius-md);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--muh-text);
  text-decoration: none;

  font-weight: 1000;
  letter-spacing: .2px;
  background-color: rgba(255,255,255,.06);
  line-height: 1;
  
  /* PERFORMANCE FIX: Cleaned up transitions */
transition: transform .18s ease, background-color .18s ease;

}
.muh-btn:hover {
  transform: translateY(-1px);
  background-color: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.22);
}
.muh-btn-ghost { background-color: rgba(255,255,255,.04); }

.muh-btn-glow {
  border-color: rgba(0,242,254,.34);
  background: linear-gradient(180deg, rgba(0,242,254,.20), rgba(0,242,254,.08));
  box-shadow: 0 0 0 rgba(0,242,254,0);
}
.muh-btn-glow:hover {
  border-color: rgba(0,242,254,.58);
  box-shadow: 0 14px 40px rgba(0,242,254,.10);
}

.muh-btn-long { display: inline-flex; }
.muh-btn-short { display: none; }

/* Burger */
.muh-burger {
  width: 46px; height: 46px;
  border-radius: var(--muh-radius-md);
  border: 1px solid rgba(255,255,255,.14);
  background-color: rgba(255,255,255,.06);
  color: var(--muh-text);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  
  /* PERFORMANCE FIX: Clean transitions */
transition: transform .18s ease, background-color .18s ease;
}
.muh-burger:hover { transform: translateY(-1px); background-color: rgba(255,255,255,.10); border-color: rgba(255,255,255,.22); }
.muh-header.muh-drawer-open .muh-burger { transform: rotate(90deg); }

/* Drawer */
.muh-drawer { position: fixed; inset: 0; z-index: 999999; display: none; }
.muh-drawer.open { display: block; }
.muh-backdrop { position: absolute; inset: 0; background-color: rgba(0,0,0,.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

.muh-panel {
  position: absolute; top: 14px; bottom: 14px; right: 14px; left: auto;
  width: min(420px, calc(100% - 28px));
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(8,18,36,.98), rgba(6,12,26,.98));
  box-shadow: var(--muh-shadow-strong);
  overflow: hidden;
  display: flex; flex-direction: column;
}

.muh-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.muh-title { flex: 1 1 auto; text-align: center; color: var(--muh-text); font-weight: 1000; letter-spacing: .2px; }
.muh-close {
  width: 44px; height: 44px;
  border-radius: var(--muh-radius-md);
  border: 1px solid rgba(255,255,255,.12);
  background-color: rgba(255,255,255,.06);
  color: var(--muh-text);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}

.muh-panel-brand { padding: 12px 16px; display: flex; justify-content: center; border-bottom: 1px solid rgba(255,255,255,.10); }
.muh-panel-brand img { max-width: 220px; height: auto; }

.muh-mnav { padding: 12px 10px; overflow: auto; flex: 1 1 auto; }
.muh-empty { padding: 14px; color: var(--muh-muted); font-weight: 700; }

.muh-mmenu, .muh-sub { list-style: none; margin: 0; padding: 0; }
.muh-m-item {
  border-radius: 16px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.10);
  background-color: rgba(255,255,255,.04);
  margin: 10px 6px;
}
.muh-sub .muh-m-item { margin: 8px 6px 8px 16px; }
[dir="rtl"] .muh-sub .muh-m-item { margin: 8px 16px 8px 6px; }

.muh-m-row { display: flex; align-items: center; justify-content: space-between; }
.muh-m-link { flex: 1 1 auto; padding: 14px 14px; color: var(--muh-text); text-decoration: none; font-weight: 900; }
.muh-sub-btn {
  width: 52px; height: 52px;
  border: none;
  border-inline-start: 1px solid rgba(255,255,255,.10);
  background-color: rgba(255,255,255,.03);
  color: var(--muh-text);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.muh-sub { display: none; border-top: 1px solid rgba(255,255,255,.10); }
.muh-m-item.open > .muh-sub { display: block; }
.muh-sub .muh-m-link { font-weight: 800; color: var(--muh-muted); }

/* Drawer actions */
.muh-panel-actions {
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,.10);
  display: flex; flex-direction: column; gap: 10px;
}
.muh-panel-actions a {
  width: 100%;
  text-align: center;
  padding: 14px 16px;
  border-radius: 16px;
}

/* Helpers */
.muh-full { width: 100%; }
html.muh-lock, body.muh-lock { overflow: hidden !important; }

/* RTL FINAL OVERRIDE */
html body header.muh-header.is-rtl .muh-pill { direction: ltr !important; flex-direction: row !important; }
html body header.muh-header.is-rtl .muh-actions { order: 1 !important; direction: ltr !important; }
html body header.muh-header.is-rtl .muh-nav { order: 2 !important; direction: rtl !important; }
html body header.muh-header.is-rtl .muh-brand { order: 3 !important; }

/* Responsive */
@media (max-width: 991px) {
  .muh-header { padding: 12px 12px; }
  .muh-nav { display: none; }
  .muh-burger { display: inline-flex; }
  .muh-btn-long { display: none; }
  .muh-btn-short { display: inline-flex; font-weight: 1000; }

  .muh-actions { gap: 12px; }
  .muh-btn.muh-lang { width: 46px; height: 46px; padding: 0; border-radius: var(--muh-radius-md); }
  .muh-wa--desktop { display: none; }
  .muh-wa--mobile { display: none !important; }
  .muh-actions > * { margin: 0 !important; }
  .muh-brand img { max-width: clamp(128px, 46vw, 210px); }
}

@media (max-width: 420px) {
  .muh-pill { padding: 11px 12px; gap: 12px; border-radius: 16px; }
  .muh-actions { gap: 10px; }
  .muh-burger { width: 44px; height: 44px; }
  .muh-btn.muh-lang { width: 44px; height: 44px; }
}

/* Desktop: hover bridge */
@media (min-width: 992px) {
  .muh-menu > .muh-item.has-children {
    position: relative !important;
    z-index: 50 !important;
  }
  .muh-menu > .muh-item.has-children::before {
    content: "";
    position: absolute;
    left: -12px;
    right: -12px;
    top: 100%;
    height: 44px;
    background-color: transparent;
    pointer-events: auto;
    z-index: 9999 !important;
  }
  .muh-menu > .muh-item.has-children > .muh-dd { z-index: 10000 !important; }

  .muh-dd .muh-item.has-children { position: relative !important; }
  .muh-dd .muh-item.has-children::before {
    content: "";
    position: absolute;
    top: -12px;
    bottom: -12px;
    left: 100%;
    width: 44px;
    background-color: transparent;
    pointer-events: auto;
    z-index: 9999 !important;
  }
  [dir="rtl"] .muh-dd .muh-item.has-children::before { left: auto; right: 100%; }
}

/* Motion safety */
@media (prefers-reduced-motion: reduce) {
  .muh-pill { animation: none !important; }
  .muh-link, .muh-btn, .muh-burger, .muh-dd, .muh-pill::after { transition: none !important; }
}

.muh-wa--mobile { display: none !important; }



/* GLOBAL HEADER STABILITY PATCH */
.muh-header,
.muh-header.muh-scrolled,
.muh-header.muh-compact {
padding: 14px 16px !important;
}

.muh-pill,
.muh-header.muh-scrolled .muh-pill,
.muh-header.muh-compact .muh-pill {
padding: 12px 18px !important;
gap: 18px !important;
}

.muh-link,
.muh-header.muh-compact .muh-link {
padding: 10px 10px !important;
font-size: 1.02rem !important;
}

.muh-brand img,
.muh-header.muh-compact .muh-brand img {
max-width: clamp(150px, 22vw, 240px) !important;
}


.muh-drawer {
  display: none;
}

.muh-drawer.open,
.muh-drawer.is-open {
  display: block !important;
}



.muh-burger{
  display:none;
  position:relative;
  z-index:1000001;
  pointer-events:auto;
}

@media (max-width: 991px){
  .muh-burger{
    display:inline-flex !important;
    align-items:center;
    justify-content:center;
  }

  .muh-actions{
    position:relative;
    z-index:1000001;
  }
}