/* ==========================================================================
   Mashref – Site header (.mh-*)
   ========================================================================== */

:root {
	--mh-ink: #0E2A30;
	--mh-ink-2: #3E534E;
	--mh-muted: #5B706B;
	--mh-primary: #14705A;
	--mh-primary-dark: #0E5544;
	--mh-mint: #EAF3EF;
	--mh-ground: #F4F7F6;
	--mh-line: #D5E0DC;
	--mh-line-2: #E2EAE7;
	--mh-top: #0B2227;
	--mh-font: 'IBM Plex Sans Arabic', system-ui, sans-serif;
	--mh-bar-h: 84px;
	--mh-admin: var(--wp-admin--admin-bar--height, 0px);
}

.mh-topbar, .mh-bar, .mh-drawer, .mh-scrim { font-family: var(--mh-font); direction: rtl; text-align: right; }
.mh-topbar *, .mh-bar *, .mh-drawer * { box-sizing: border-box; }
.mh-wrap { max-width: 1240px; margin-inline: auto; padding-inline: 24px; }
.mh-icon { width: 20px; height: 20px; flex: none; }
.mh-bar a, .mh-topbar a, .mh-drawer a { text-decoration: none; }
.mh-bar :focus-visible, .mh-topbar :focus-visible, .mh-drawer :focus-visible { outline: 2px solid var(--mh-primary); outline-offset: 2px; }
.mh-bar button, .mh-drawer button { font-family: inherit; }
.mh-bar ul, .mh-drawer ul { list-style: none; margin: 0; padding: 0; }

/* ---------- Top bar ---------- */

.mh-topbar { background: var(--mh-top); color: #CFE0DB; font-size: 14px; }
.mh-topbar__inner { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.mh-topbar__contacts { display: flex; align-items: center; gap: 28px; }
.mh-topbar a { color: #CFE0DB; display: inline-flex; align-items: center; gap: 8px; }
.mh-topbar a:hover { color: #fff; }
.mh-topbar .mh-icon { width: 16px; height: 16px; color: #7FC4AE; }
.mh-topbar .mh-topbar__emergency { color: #fff; font-weight: 600; }
.mh-dot { width: 8px; height: 8px; border-radius: 50%; background: #F08A5D; box-shadow: 0 0 0 0 rgba(240, 138, 93, .6); animation: mh-pulse 2s infinite; }
@keyframes mh-pulse { 70% { box-shadow: 0 0 0 8px rgba(240, 138, 93, 0); } 100% { box-shadow: 0 0 0 0 rgba(240, 138, 93, 0); } }

/* ---------- Main bar ---------- */

.mh-bar {
	position: sticky;
	top: var(--mh-admin);
	z-index: 1000;
	background: #fff;
	border-bottom: 1px solid var(--mh-line-2);
	transition: box-shadow .2s;
}
.mh-bar.is-stuck { box-shadow: 0 6px 20px rgba(14, 42, 48, .08); }
.mh-bar__inner { height: var(--mh-bar-h); display: flex; align-items: center; gap: 28px; }

.mh-logo { flex: none; display: flex; align-items: center; }
.mh-logo img { height: 60px; width: auto; display: block; }

.mh-nav { flex: 1; display: flex; justify-content: center; }
.mh-nav__list { display: flex; align-items: center; gap: 4px; }
.mh-nav__item { margin: 0; }
.mh-bar .mh-nav__link {
	height: 44px;
	padding: 0 16px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: var(--mh-ink);
	font-size: 16px;
	font-weight: 500;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color .15s, color .15s;
}
.mh-bar .mh-nav__link:hover { background: var(--mh-ground); color: var(--mh-ink); }
.mh-bar .mh-nav__link.is-current { background: var(--mh-mint); color: var(--mh-primary); font-weight: 600; }
.mh-nav__toggle .mh-icon { width: 16px; height: 16px; transition: transform .2s; }
.mh-bar .mh-nav__toggle[aria-expanded="true"] { background: var(--mh-ink); color: #fff; }
.mh-nav__toggle[aria-expanded="true"] .mh-icon { transform: rotate(180deg); }

.mh-actions { flex: none; display: flex; align-items: center; gap: 10px; }
.mh-bar .mh-iconbtn,
.mh-bar .mh-burger {
	width: 44px;
	height: 44px;
	padding: 0;
	border-radius: 12px;
	border: 1px solid var(--mh-line);
	background: #fff;
	color: var(--mh-ink);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.mh-bar .mh-iconbtn:hover, .mh-bar .mh-iconbtn[aria-expanded="true"] { border-color: var(--mh-ink); background: #fff; color: var(--mh-ink); }

.mh-cta,
.mh-bar .mh-cta,
.mh-drawer .mh-cta {
	min-height: 46px;
	padding: 0 20px;
	border: 0;
	border-radius: 12px;
	background: var(--mh-primary);
	color: #fff;
	font-family: var(--mh-font);
	font-size: 15px;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .15s;
}
.mh-cta:hover, .mh-bar .mh-cta:hover, .mh-drawer .mh-cta:hover { background: var(--mh-primary-dark); color: #fff; }
.mh-cta .mh-icon { width: 18px; height: 18px; }

.mh-burger { display: none !important; }
.mh-bar .mh-burger { background: #fff; }
.mh-burger .mh-icon--close { display: none; }
.mh-bar .mh-burger[aria-expanded="true"] { background: var(--mh-ink); border-color: var(--mh-ink); color: #fff; }
.mh-burger[aria-expanded="true"] .mh-icon--menu { display: none; }
.mh-burger[aria-expanded="true"] .mh-icon--close { display: block; }

/* ---------- Mega menu ---------- */

.mh-mega {
	position: absolute;
	top: 100%;
	right: 0;
	left: 0;
	background: #fff;
	border-top: 1px solid var(--mh-line-2);
	border-radius: 0 0 24px 24px;
	box-shadow: 0 24px 48px rgba(14, 42, 48, .18);
	animation: mh-drop .18s ease-out;
}
@keyframes mh-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.mh-mega[hidden] { display: none; }
.mh-mega__inner { padding-block: 28px 32px; display: flex; gap: 28px; }
.mh-mega__main { flex: 1; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mh-mega__head { display: flex; align-items: center; justify-content: space-between; }
.mh-mega__label { font-size: 13px; font-weight: 600; color: var(--mh-muted); }
.mh-bar .mh-mega__all { color: var(--mh-primary); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.mh-mega__all .mh-icon { width: 14px; height: 14px; }
.mh-mega__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mh-mega__grid li { margin: 0; }

.mh-bar .mh-tile { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; color: var(--mh-ink); transition: background-color .15s; }
.mh-bar .mh-tile:hover { background: var(--mh-ground); color: var(--mh-ink); }
.mh-tile__icon { width: 48px; height: 48px; flex: none; border-radius: 12px; background: var(--mh-mint); color: var(--mh-primary); display: flex; align-items: center; justify-content: center; transition: background-color .15s, color .15s; }
.mh-tile:hover .mh-tile__icon { background: var(--mh-primary); color: #fff; }
.mh-tile__icon svg { width: 24px; height: 24px; }
.mh-tile__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mh-tile__name { font-size: 15px; font-weight: 600; line-height: 1.4; }
.mh-tile__sub { font-size: 13px; color: var(--mh-muted); line-height: 17px; }

.mh-mega__side { width: 300px; flex: none; display: flex; flex-direction: column; gap: 12px; }
.mh-promo { background: var(--mh-ink); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 10px; color: #fff; }
.mh-promo__title { font-size: 18px; font-weight: 700; }
.mh-promo__text { font-size: 14px; line-height: 1.8; color: #CFE0DB; }
.mh-bar .mh-promo__btn { align-self: flex-start; margin-top: 4px; min-height: 44px; padding: 0 18px; border-radius: 12px; background: #fff; color: var(--mh-ink); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.mh-bar .mh-promo__btn:hover { background: var(--mh-mint); color: var(--mh-ink); }
.mh-promo__btn .mh-icon { width: 14px; height: 14px; }

.mh-bar .mh-callcard { border: 1px solid #F1D7C8; background: #FCF5F1; border-radius: 18px; padding: 16px 18px; display: flex; align-items: center; gap: 12px; color: var(--mh-ink); }
.mh-bar .mh-callcard:hover { border-color: #A85A2A; color: var(--mh-ink); }
.mh-callcard__icon { width: 44px; height: 44px; flex: none; border-radius: 50%; background: #A85A2A; color: #fff; display: flex; align-items: center; justify-content: center; }
.mh-callcard__text { display: flex; flex-direction: column; }
.mh-callcard__label { font-size: 13px; color: #8A4A22; font-weight: 600; }
.mh-callcard__num { font-size: 18px; font-weight: 700; text-align: right; }

/* ---------- Search panel ---------- */

.mh-search { position: absolute; top: 100%; right: 0; left: 0; background: #fff; border-top: 1px solid var(--mh-line-2); box-shadow: 0 16px 32px rgba(14, 42, 48, .12); animation: mh-drop .18s ease-out; }
.mh-search[hidden] { display: none; }
.mh-search__form { padding-block: 18px; display: flex; gap: 10px; }
.mh-search__field { flex: 1; position: relative; display: flex; align-items: center; margin: 0; }
.mh-search__field .mh-icon { position: absolute; right: 16px; color: var(--mh-muted); pointer-events: none; }
.mh-bar .mh-search input[type="search"] {
	width: 100%;
	height: 52px;
	margin: 0;
	border: 1px solid var(--mh-line);
	border-radius: 14px;
	background: #F7FAF9;
	padding: 0 48px 0 16px;
	font-family: var(--mh-font);
	font-size: 16px;
	color: var(--mh-ink);
	box-shadow: none;
}
.mh-bar .mh-search input[type="search"]:focus { outline: 2px solid var(--mh-primary); outline-offset: 1px; border-color: transparent; background: #fff; }
.mh-search .mh-cta { min-height: 52px; }

/* ---------- Scrim ---------- */

.mh-scrim { position: fixed; inset: 0; z-index: 999; background: rgba(14, 42, 48, .45); animation: mh-fade .18s ease-out; }
.mh-scrim[hidden] { display: none; }
@keyframes mh-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Mobile drawer ---------- */

.mh-drawer {
	position: fixed;
	top: var(--mh-drawer-top, 128px);
	right: 0;
	left: 0;
	bottom: 0;
	z-index: 1001;
	background: #fff;
	display: flex;
	flex-direction: column;
	animation: mh-fade .18s ease-out;
}
.mh-drawer[hidden] { display: none; }
.mh-drawer__nav { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 20px 0; display: flex; flex-direction: column; }
.mh-drawer .mh-drawer__link {
	min-height: 54px;
	width: 100%;
	padding: 0;
	border: 0;
	border-bottom: 1px solid #EEF3F1;
	border-radius: 0;
	background: transparent;
	color: var(--mh-ink);
	font-size: 17px;
	font-weight: 500;
	display: flex;
	align-items: center;
	justify-content: space-between;
	text-align: right;
	cursor: pointer;
	letter-spacing: 0 !important;
}
.mh-drawer .mh-drawer__link:hover { color: var(--mh-primary); background: transparent; }
.mh-drawer .mh-drawer__link.is-current { color: var(--mh-primary); font-weight: 600; }
.mh-drawer__acc .mh-icon { width: 18px; height: 18px; transition: transform .2s; }
.mh-drawer__acc[aria-expanded="true"] .mh-icon { transform: rotate(180deg); }
.mh-drawer__depts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px 0 14px !important; border-bottom: 1px solid #EEF3F1; }
.mh-drawer__depts[hidden] { display: none; }
.mh-drawer__depts li { margin: 0; }
.mh-drawer .mh-drawer__depts a { min-height: 48px; padding: 0 12px; border-radius: 12px; background: var(--mh-ground); color: var(--mh-ink); font-size: 14px; font-weight: 500; display: flex; align-items: center; }
.mh-drawer .mh-drawer__depts a:hover { background: var(--mh-mint); color: var(--mh-primary); }

.mh-drawer__foot { padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--mh-line-2); display: flex; flex-direction: column; gap: 10px; }
.mh-cta--block { width: 100%; min-height: 50px !important; font-size: 16px !important; }
.mh-drawer__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mh-drawer .mh-drawer__call,
.mh-drawer .mh-drawer__mail { min-height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 600; }
.mh-drawer .mh-drawer__call { border: 1px solid #F1D7C8; background: #FCF5F1; color: #8A4A22; }
.mh-drawer .mh-drawer__mail { border: 1px solid var(--mh-line); color: var(--mh-ink); font-weight: 500; }
.mh-drawer .mh-icon { width: 16px; height: 16px; }

html.mh-lock, html.mh-lock body { overflow: hidden; }

/* ---------- Responsive ---------- */

@media (max-width: 1199px) {
	.mh-bar__inner { gap: 16px; }
	.mh-bar .mh-nav__link { padding: 0 12px; font-size: 15px; }
	.mh-mega__side { width: 260px; }
	.mh-mega__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
	:root { --mh-bar-h: 72px; }
	.mh-nav { display: none; }
	.mh-burger { display: inline-flex !important; }
	.mh-actions { margin-inline-start: auto; }
	.mh-logo img { height: 54px; }
	.mh-topbar__mail { display: none !important; }
}

@media (max-width: 599px) {
	:root { --mh-bar-h: 68px; }
	.mh-wrap { padding-inline: 16px; }
	.mh-bar { top: 0; } /* the admin bar scrolls away on phones */
	.mh-topbar { font-size: 13px; }
	.mh-topbar__inner { min-height: 40px; }
	.mh-topbar .mh-topbar__emergency { font-size: 13px; }
	.mh-logo img { height: 48px; }
	.mh-actions .mh-cta { display: none; }
	.mh-search .mh-cta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.mh-mega, .mh-search, .mh-scrim, .mh-drawer { animation: none; }
	.mh-dot { animation: none; }
}
