:root{
  --egx-font: "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;

  --egx-bg: #f3f6fb;
  --egx-ink: #0b1220;
  --egx-sub: rgba(11,18,32,.62);

  --egx-blue: #1d4ed8;
  --egx-blue2: #60a5fa;

  --egx-card: rgba(255,255,255,.78);
  --egx-stroke: rgba(15,23,42,.10);

  --egx-shadow: 0 10px 26px rgba(2,8,23,.10);
  --egx-shadow2: 0 6px 16px rgba(2,8,23,.10);

  --egx-h: 48px;
  --egx-radius: 999px;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family: var(--egx-font);
  background: var(--egx-bg);
  color: var(--egx-ink);
}

.sr-only{
  position:absolute !important;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;border:0;
}

/* ================= Header ================= */
.egx-header{
  position: sticky;
  top: 0;
  z-index: 999;
  padding: 8px 0 0;
  background: linear-gradient(180deg, rgba(15,23,42,.10), rgba(15,23,42,.04));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15,23,42,.08);
}

/* ================= Main Row ================= */
.egx-wrap{
  width: min(1220px, calc(100% - 28px));
  margin-inline: auto;
  height: var(--egx-h);
  display:flex;
  align-items:center;
  gap:12px;
  padding: 6px 10px;
  border-radius: 16px;
  background: var(--egx-card);
  border: 1px solid var(--egx-stroke);
  box-shadow: var(--egx-shadow);
}

/* ================= Brand ================= */
.egx-brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:inherit;
  min-width:210px;
}
.egx-logo{
  width:34px;height:34px;
  border-radius:12px;
  overflow:hidden;
  background:#fff;
  border:1px solid rgba(29,78,216,.14);
}
.egx-logo img{ width:100%; height:100%; object-fit:contain; }

.egx-brandText{ line-height:1.05; }
.egx-brandName{ font-weight:900; font-size:14px; }
.egx-brandTag{ font-size:11px; color:var(--egx-sub); font-weight:700; }

/* ================= Search ================= */
.egx-search{
  flex:1;
  height:38px;
  display:flex;
  border-radius:var(--egx-radius);
  overflow:hidden;
  background:#fff;
  border:1px solid rgba(15,23,42,.10);
  box-shadow: var(--egx-shadow2);
}

.egx-cat{
  display:flex;
  align-items:center;
  gap:6px;
  padding:0 12px;
  border-inline-start:1px solid rgba(15,23,42,.08);
}
.egx-cat select{
  appearance:none;
  border:0;
  background:transparent;
  font-family:var(--egx-font);
  font-weight:900;
  font-size:12.5px;
  color:#0f172a;
  cursor:pointer;
}
.egx-cat svg{ width:16px;height:16px; fill:#475569; }

.egx-field{ flex:1; display:flex; align-items:center; padding:0 10px; }
.egx-field input{
  width:100%;
  border:0;
  outline:none;
  font-size:13px;
  font-weight:700;
}

.egx-go{
  width:46px;
  border:0;
  background:linear-gradient(135deg,var(--egx-blue),#2563eb);
  display:grid;
  place-items:center;
}
.egx-go svg{ width:18px;height:18px; fill:#fff; }

/* ================= Actions ================= */
.egx-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.egx-ic{
  width:36px;height:36px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:#fff;
  border:1px solid rgba(15,23,42,.10);
  box-shadow:0 8px 14px rgba(2,8,23,.08);
  position:relative;
  cursor:pointer;
}
.egx-ic svg{ width:18px;height:18px; }

.egx-ic--notif svg{ fill:#1d4ed8; }
.egx-ic--wa svg{ fill:#16a34a; }
.egx-ic--call svg{ fill:#0ea5e9; }
.egx-ic--user svg{ fill:#475569; }

/* Badge رقم أحمر + empty dot */
.egx-badge{
  position:absolute;
  top:-8px; right:-8px;
  min-width:18px; height:18px;
  padding:0 6px;
  border-radius:999px;
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:900;
  color:#fff;
  background:#ef4444;
  border:2px solid #fff;
}
.egx-badge--empty{
  width:8px; height:8px; min-width:8px;
  padding:0;
  background:rgba(15,23,42,.25);
  border:2px solid #fff;
  top:-5px; right:-5px;
}

/* ================= Updates popover ================= */
.egx-updWrap{ position:relative; }

.egx-updatesDrop{
  position:absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 320px;
  padding:10px;
  border-radius:14px;
  background:#fff;
  border:1px solid rgba(15,23,42,.12);
  box-shadow:0 18px 40px rgba(2,8,23,.14);
  display:none;
  z-index:9999;
}
.egx-updatesDrop.egx-open{ display:block; }

.egx-updHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:8px;
  font-weight:900;
  font-size:13px;
  color:#0f172a;
}
.egx-updCount{
  font-size:12px;
  color:rgba(15,23,42,.60);
  font-weight:900;
}
.egx-updList{ display:flex; flex-direction:column; gap:6px; }
.egx-updItem{
  display:flex;
  flex-direction:column;
  padding:10px;
  border-radius:12px;
  text-decoration:none;
  border:1px solid transparent;
  color:#0f172a;
}
.egx-updItem:hover{
  background:rgba(29,78,216,.06);
  border-color:rgba(29,78,216,.10);
}
.egx-updTitle{ font-weight:900; font-size:12.5px; }
.egx-updDate{
  font-size:11px;
  color:rgba(15,23,42,.55);
  font-weight:800;
  margin-top:4px;
}
.egx-updFooter a{
  display:flex;
  justify-content:center;
  margin-top:8px;
  padding:10px;
  border-radius:12px;
  text-decoration:none;
  font-weight:900;
  color:#1d4ed8;
  background:rgba(29,78,216,.06);
}

/* ================= User Dropdown (CLICK ONLY) ================= */
.egx-user{ position:relative; }

.egx-userBtn{
  width:36px;height:36px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:#fff;
  border:1px solid rgba(15,23,42,.10);
  cursor:pointer;
}

.egx-userImg{
  width:32px;height:32px;
  border-radius:12px;
  object-fit:cover;
}

.egx-userDrop{
  position:absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width:220px;
  padding:8px;
  background:#fff;
  border:1px solid rgba(15,23,42,.12);
  border-radius:14px;
  box-shadow:0 18px 40px rgba(2,8,23,.14);
  display:none;
  z-index:9999;
}

/* منع الفتح بالهوفر */
.egx-user:hover .egx-userDrop{ display:none !important; }

/* الفتح بالـ class */
.egx-user.egx-open .egx-userDrop{ display:block !important; }

.egx-userDrop li a{
  display:flex;
  justify-content:space-between;
  padding:10px;
  font-weight:900;
  font-size:12.5px;
  color:#0f172a !important;
  border-radius:12px;
  text-decoration:none;
}
.egx-userDrop li a:hover{ background:rgba(29,78,216,.06); }

.egx-miniBadge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 11px;
  color:#fff;
  background: linear-gradient(135deg, rgba(29,78,216,.95), rgba(96,165,250,.95));
}

.egx-user.egx-open .egx-userBtn{
  border-color: rgba(29,78,216,.25);
  box-shadow: 0 10px 20px rgba(29,78,216,.12);
}

/* ================= CTA ================= */
.egx-cta{
  height:36px;
  padding:0 12px;
  border-radius:999px;
  display:flex;
  align-items:center;
  gap:8px;
  color:#fff;
  font-weight:900;
  font-size:12.5px;
  text-decoration:none;
  background:linear-gradient(135deg,#0b2a5a,var(--egx-blue));
  box-shadow:0 14px 22px rgba(29,78,216,.20);
}
.egx-ctaDot{
  width:10px;height:10px;
  border-radius:999px;
  background:#fff;
  opacity:.92;
}

/* ================= Subbar ================= */
.egx-sub{ padding:6px 0 10px; }
.egx-subWrap{
  width: min(1220px, calc(100% - 28px));
  margin-inline:auto;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:8px 10px;
  border-radius:16px;
  background:rgba(255,255,255,.7);
  border:1px solid rgba(15,23,42,.08);
}

/* Menu */
.egx-menuList{
  display:flex;
  gap:8px;
  list-style:none;
  padding:0;margin:0;
  flex-wrap:wrap;
}
.egx-menuList > li > a{
  height:32px;
  padding:0 12px;
  border-radius:999px;
  display:flex;
  align-items:center;
  font-weight:900;
  font-size:12.5px;
  color:#334155;
  background:rgba(15,23,42,.04);
  text-decoration:none;
}
.egx-menuList > li.current-menu-item > a,
.egx-menuList > li.current-menu-ancestor > a,
.egx-menuList > li.current-menu-parent > a{
  color:#fff;
  background:linear-gradient(135deg,var(--egx-blue),var(--egx-blue2));
}

/* Submenu support */
.egx-menuList li{ position:relative; }
.egx-menuList li ul{
  position:absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  margin: 0;
  list-style: none;
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(2,8,23,.14);
  display:none;
  z-index: 99;
}
.egx-menuList li:hover > ul{ display:block; }
.egx-menuList li ul li a{
  display:flex;
  align-items:center;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(15,23,42,.85);
  font-weight: 900;
  font-size: 12.5px;
  text-decoration:none;
}
.egx-menuList li ul li a:hover{
  background: rgba(29,78,216,.06);
  border-color: rgba(29,78,216,.10);
}

/* Stats */
.egx-stats{ display:flex; gap:8px; flex-wrap:wrap; }
.egx-pill{
  height:32px;
  padding:0 10px;
  border-radius:999px;
  display:flex;
  align-items:center;
  gap:6px;
  font-size:12.5px;
  font-weight:800;
  background:#fff;
  border:1px solid rgba(15,23,42,.08);
}
.egx-pill b{ opacity:.55; }

/* Responsive */
@media (max-width:820px){
  .egx-brandTag{ display:none; }
  .egx-cat{ display:none; }
  .egx-subWrap{ flex-direction:column; align-items:flex-start; }
  .egx-updatesDrop{ left: auto; right: 0; }
}
@media (max-width:560px){
  .egx-brandText{ display:none; }
}

/* ===== Join Contractor CTA ===== */
.egx-search{
  max-width:520px;
}

.egx-cta--join{
  background: linear-gradient(135deg, #f97316, #fb923c);
  box-shadow: 0 14px 22px rgba(249,115,22,.25);
}

.egx-ctaIco{
  width:18px;
  height:18px;
  display:inline-grid;
  place-items:center;
}
.egx-ctaIco svg{
  width:18px;
  height:18px;
  fill:#fff;
}


/* =====================================================
   EGX STATS – FINAL COMPACT (4 ITEMS ALWAYS)
   ===================================================== */

.egx-subWrap{
  gap: 10px;
}

.egx-menu{
  flex: 1 1 auto;
  min-width: 0;
}

.egx-stats{
  flex: 0 0 25%;
  max-width: 25%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  opacity: .95;
}



.egx-pill{
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 800;
  background: rgba(15,23,42,.035);
  border: 1px solid rgba(15,23,42,.06);
  box-shadow: none;
  white-space: nowrap;
}

.egx-pill b{
  font-weight: 900;
  color: rgba(15,23,42,.78);
}

.egx-pillIco{
  font-size: 12px;
  line-height: 1;
  transform: translateY(.5px);
  opacity: .85;
}

.egx-pill:nth-child(1){ background: rgba(29,78,216,.05); }
.egx-pill:nth-child(2){ background: rgba(16,185,129,.05); }
.egx-pill:nth-child(3){ background: rgba(249,115,22,.05); }
.egx-pill:nth-child(4){ background: rgba(99,102,241,.05); }

@media (max-width: 920px){
  .egx-stats{
    flex: 1 1 100%;
    max-width: 100%;
    justify-content: flex-start;
    margin-top: 4px;
  }
}



/* =====================================================
   EGX STATS – FINAL COMPACT (4 ITEMS INLINE)
   ===================================================== */

.egx-subWrap{
  gap: 10px;
}

.egx-menu{
  flex: 1 1 auto;
  min-width: 0;
}

.egx-stats{
  flex: 0 0 25%;
  max-width: 25%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;                 /* تقارب العناصر */
  opacity: .95;
  flex-wrap: nowrap;        /* منع النزول تحت بعض */
}

/* عنصر الإحصائية – أصغر وأكثر إحكام */
.egx-pill{
  height: 24px;             /* أصغر */
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(15,23,42,.035);
  border: 1px solid rgba(15,23,42,.06);
  box-shadow: none;
  white-space: nowrap;
}

.egx-pill b{
  font-weight: 900;
  color: rgba(15,23,42,.75);
}

.egx-pillIco{
  font-size: 11px;
  line-height: 1;
  transform: translateY(.5px);
  opacity: .85;
}

/* خلفيات خفيفة مختلفة */
.egx-pill:nth-child(1){ background: rgba(29,78,216,.05); }
.egx-pill:nth-child(2){ background: rgba(16,185,129,.05); }
.egx-pill:nth-child(3){ background: rgba(249,115,22,.05); }
.egx-pill:nth-child(4){ background: rgba(99,102,241,.05); }

@media (max-width: 920px){
  .egx-stats{
    flex: 1 1 100%;
    max-width: 100%;
    justify-content: flex-start;
    margin-top: 4px;
  }
}
