/* ==========================================================================
   Mashref – Doctors archive
   All selectors are prefixed .md- to stay clear of Astra.
   ========================================================================== */

.md-page {
	--md-ink: #0E2A30;
	--md-ink-2: #3E534E;
	--md-muted: #5B706B;
	--md-primary: #14705A;
	--md-primary-dark: #0E5544;
	--md-accent: #A85A2A;
	--md-mint: #EAF3EF;
	--md-ground: #F4F7F6;
	--md-line: #D5E0DC;
	--md-line-2: #E2EAE7;
	--md-radius: 20px;
	--md-font: 'IBM Plex Sans Arabic', system-ui, sans-serif; /* swap for the site font if preferred */

	font-family: var(--md-font);
	color: var(--md-ink);
	background: var(--md-ground);
	direction: rtl;
	text-align: right;
}

.md-page *,
.md-page *::before,
.md-page *::after { box-sizing: border-box; }

.md-page a { color: var(--md-primary); }
.md-page :focus-visible { outline: 2px solid var(--md-primary); outline-offset: 2px; }

.md-wrap { max-width: 1240px; margin-inline: auto; padding-inline: 24px; }

.md-icon { width: 1.15em; height: 1.15em; flex: none; }

/* ---------- Hero ---------- */

.md-hero { background: var(--md-ink); color: #fff; padding: 56px 0 104px; }
.md-hero .md-wrap { display: flex; flex-direction: column; gap: 14px; }
.md-breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: #A9C2BC; }
.md-page .md-breadcrumb a { color: #A9C2BC; text-decoration: none; }
.md-page .md-breadcrumb a:hover { color: #fff; }
.md-breadcrumb [aria-current] { color: #fff; }
.md-hero__title { margin: 0; color: #fff; font-family: inherit; font-size: clamp(28px, 4vw, 44px); line-height: 1.3; font-weight: 700; }
.md-hero__lead { margin: 0; max-width: 720px; font-size: clamp(16px, 1.6vw, 18px); line-height: 1.9; color: #CFE0DB; }

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

.md-main { margin-top: -64px; padding-bottom: 80px; display: flex; flex-direction: column; gap: 24px; position: relative; }

/* ---------- Filter ---------- */

.md-filter {
	background: #fff;
	border-radius: var(--md-radius);
	box-shadow: 0 10px 30px rgba(14, 42, 48, .08);
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.md-search { display: flex; gap: 10px; }
.md-search__field { flex: 1; position: relative; display: flex; align-items: center; margin: 0; }
.md-search__field .md-icon { position: absolute; right: 16px; color: var(--md-muted); pointer-events: none; }
.md-page .md-search input[type="search"] {
	width: 100%;
	height: 52px;
	margin: 0;
	border: 1px solid var(--md-line);
	border-radius: 14px;
	background: #F7FAF9;
	padding: 0 48px 0 16px;
	font: inherit;
	font-size: 16px;
	color: var(--md-ink);
	box-shadow: none;
}
.md-page .md-search input[type="search"]::placeholder { color: #6B7F7A; }
.md-page .md-search input[type="search"]:focus { outline: 2px solid var(--md-primary); outline-offset: 1px; border-color: transparent; background: #fff; }
.md-page .md-search__submit {
	height: 52px;
	padding: 0 22px;
	border: 0;
	border-radius: 14px;
	background: var(--md-ink);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
/* With JS, search runs as you type, so the button is only a fallback. */
.md-js .md-search__submit { display: none; }

.md-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.md-page .md-chip {
	flex: none;
	min-height: 44px;
	padding: 0 16px;
	border-radius: 999px;
	border: 1px solid var(--md-line);
	background: #fff;
	color: var(--md-ink);
	font-size: 15px;
	font-weight: 500;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
	text-decoration: none;
	transition: background-color .15s, border-color .15s, color .15s;
}
.md-page .md-chip:hover { border-color: var(--md-ink); color: var(--md-ink); }
.md-chip__count {
	min-width: 24px;
	height: 24px;
	padding: 0 6px;
	border-radius: 999px;
	background: #EEF3F1;
	color: var(--md-ink-2);
	font-size: 13px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.md-page .md-chip.is-active { background: var(--md-ink); border-color: var(--md-ink); color: #fff; }
.md-chip.is-active .md-chip__count { background: var(--md-primary); color: #fff; }

@media (max-width: 700px) {
	.md-chips {
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
		margin-inline: -20px;
		padding-inline: 20px;
		scroll-padding-inline: 20px;
	}
	.md-chips::-webkit-scrollbar { display: none; }
}

/* ---------- Results ---------- */

.md-results { display: flex; flex-direction: column; gap: 20px; transition: opacity .2s; }
.md-results[aria-busy="true"] { opacity: .45; pointer-events: none; }
.md-results__count { margin: 0; font-size: 15px; color: var(--md-ink-2); }
.md-results__count strong { color: var(--md-ink); font-size: 18px; }

.md-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 24px; }

/* ---------- Card ---------- */

.md-card {
	background: #fff;
	border: 1px solid var(--md-line-2);
	border-radius: var(--md-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow .2s, transform .2s;
}
.md-card:hover { box-shadow: 0 12px 28px rgba(14, 42, 48, .10); transform: translateY(-2px); }

.md-card__media {
	position: relative;
	height: 250px;
	background: var(--md-mint);
	display: flex;
	align-items: flex-end;
	justify-content: center;
}
.md-card__photo-link { display: flex; align-items: flex-end; justify-content: center; height: 100%; width: 100%; }
.md-card__media .md-photo {
	height: 236px;
	width: auto;
	max-width: 100%;
	object-fit: contain;
	object-position: bottom;
	mix-blend-mode: multiply; /* blends white photo backgrounds into the mint panel */
}
.md-photo--empty { fill: #C9DDD5; height: 190px !important; width: 150px !important; }

.md-card__dept {
	position: absolute;
	top: 14px;
	right: 14px;
	background: #fff;
	color: var(--md-primary);
	font-size: 13px;
	font-weight: 600;
	padding: 6px 12px;
	border-radius: 999px;
	max-width: calc(100% - 84px);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.md-page .md-card__info {
	position: absolute;
	top: 10px;
	left: 10px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--md-ink);
	box-shadow: 0 4px 12px rgba(14, 42, 48, .12);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color .15s, color .15s;
}
.md-page .md-card__info:hover { background: var(--md-ink); color: #fff; }
.md-card__info .md-icon { width: 20px; height: 20px; }
/* Without JS the popup can't open, so hide the button. */
.md-page:not(.md-js) .md-card__info { display: none; }

.md-card__body { padding: 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.md-card__name { margin: 0; font-family: inherit; font-size: 20px; line-height: 1.4; font-weight: 700; }
.md-page .md-card__name a { color: var(--md-ink); text-decoration: none; }
.md-page .md-card__name a:hover { color: var(--md-primary); }
.md-card__title { margin: -6px 0 0; font-size: 15px; color: var(--md-primary); font-weight: 600; }

.md-card__facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.md-card__facts li {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--md-ground);
	border-radius: 10px;
	padding: 6px 10px;
	font-size: 13px;
	color: var(--md-ink-2);
	margin: 0;
}
.md-card__facts .md-icon { color: var(--md-accent); width: 15px; height: 15px; }

.md-card__actions { margin-top: auto; padding-top: 8px; display: flex; gap: 10px; }
.md-card__actions .md-btn--primary { flex: 1; }

/* ---------- Buttons ---------- */

.md-page .md-btn {
	min-height: 46px;
	padding: 0 8px;
	border-radius: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .15s, border-color .15s;
}
.md-page .md-btn--primary { background: var(--md-primary); color: #fff; border: 1px solid var(--md-primary); }
.md-page .md-btn--primary:hover { background: var(--md-primary-dark); color: #fff; }
.md-page .md-btn--ghost { background: #fff; color: var(--md-ink); border: 1px solid var(--md-line); font-weight: 500; }
.md-page .md-btn--ghost:hover { border-color: var(--md-ink); color: var(--md-ink); }

/* ---------- Pagination ---------- */

.md-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding-top: 12px; }
.md-page .md-pagination .page-numbers {
	min-width: 44px;
	height: 44px;
	padding: 0 12px;
	border-radius: 12px;
	border: 1px solid var(--md-line);
	background: #fff;
	color: var(--md-ink);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 500;
	text-decoration: none;
}
.md-page .md-pagination a.page-numbers:hover { border-color: var(--md-ink); }
.md-page .md-pagination .page-numbers.current { background: var(--md-ink); border-color: var(--md-ink); color: #fff; }
.md-page .md-pagination .page-numbers.dots { border-color: transparent; background: transparent; min-width: 24px; padding: 0; }

/* ---------- Empty ---------- */

.md-empty {
	background: #fff;
	border-radius: var(--md-radius);
	padding: 48px 24px;
	text-align: center;
	color: var(--md-ink-2);
	font-size: 17px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}
.md-empty p { margin: 0; }

/* ---------- Bio dialog ---------- */

.md-dialog {
	width: min(720px, calc(100% - 32px));
	height: min(560px, calc(100vh - 48px));
	max-height: none;
	padding: 0;
	border: 0;
	border-radius: 24px;
	background: #fff;
	color: var(--md-ink);
	overflow: hidden;
	font-family: var(--md-font);
	direction: rtl;
	text-align: right;
}
.md-dialog::backdrop { background: rgba(14, 42, 48, .55); }
.md-dialog[open] { display: flex; animation: md-pop .18s ease-out; }
.md-dialog__body { flex: 1; min-height: 0; display: flex; }
@keyframes md-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.md-page .md-dialog__close {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 2;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--md-ground);
	color: var(--md-ink);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.md-page .md-dialog__close:hover { background: var(--md-line); }

/* Photo stays fixed; the text column scrolls, with the buttons pinned at its bottom. */
.md-bio { flex: 1; min-height: 0; display: flex; }
.md-bio__media {
	flex: 0 0 280px;
	position: relative;
	background: var(--md-mint);
	overflow: hidden;
}
.md-bio__photo,
.md-bio__media .md-photo--empty {
	position: absolute;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	height: min(92%, 440px) !important;
	width: auto !important;
	max-width: 100%;
	object-fit: cover;
	object-position: bottom;
	mix-blend-mode: multiply;
}
.md-bio__content {
	flex: 1;
	min-width: 0;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 28px 28px 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scrollbar-width: thin;
	scrollbar-color: var(--md-line) transparent;
}
.md-page .md-bio__dept {
	align-self: flex-start;
	background: var(--md-mint);
	color: var(--md-primary);
	font-size: 13px;
	font-weight: 600;
	padding: 4px 12px;
	border-radius: 999px;
	text-decoration: none;
}
.md-page .md-bio__dept:hover { background: #DCEBE4; }
.md-bio__name { margin: 4px 0 0; padding-inline-end: 44px; font-family: inherit; font-size: 24px; line-height: 1.35; font-weight: 700; color: var(--md-ink); }
.md-bio__title { margin: 0; color: var(--md-primary); font-weight: 600; font-size: 16px; }
.md-bio__text { margin: 4px 0 0; font-size: 15px; line-height: 1.9; color: var(--md-ink-2); }
.md-bio__subtitle { margin: 6px 0 0; font-family: inherit; font-size: 15px; font-weight: 700; color: var(--md-ink); }
.md-bio__quals { margin: 0; padding: 0 18px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.7; color: var(--md-ink-2); }
.md-bio__quals li { margin: 0; }
.md-bio__actions {
	position: sticky;
	bottom: 0;
	margin: auto -28px 0;
	padding: 14px 28px 22px;
	background: #fff;
	box-shadow: 0 -10px 16px -12px rgba(14, 42, 48, .25);
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}
.md-bio__actions .md-btn { flex: 1 1 140px; }

@media (max-width: 560px) {
	.md-hero { padding: 40px 0 96px; }
	.md-filter { padding: 16px; }
	.md-dialog { height: calc(100vh - 32px); }
	.md-bio { flex-direction: column; }
	.md-bio__media { flex: 0 0 200px; }
	.md-bio__content { padding: 20px 20px 0; }
	.md-bio__actions { margin-inline: -20px; padding: 12px 20px 18px; }
}

@media (prefers-reduced-motion: reduce) {
	.md-card, .md-results, .md-dialog[open] { transition: none; animation: none; }
	.md-card:hover { transform: none; }
}

/* ---------- Astra fallback: full-width container on doctor screens ---------- */
body.post-type-archive-doctor .site-content > .ast-container,
body.tax-department .site-content > .ast-container {
	max-width: none;
	padding: 0;
	display: block;
}

/* ==========================================================================
   Single doctor profile
   ========================================================================== */

body.single-doctor .site-content > .ast-container { max-width: none; padding: 0; display: block; }

.md-single__hero { background: var(--md-ink); padding: 32px 0 120px; }

.md-single__layout {
	margin-top: -88px;
	padding-bottom: 56px;
	display: grid;
	grid-template-columns: 360px minmax(0, 1fr);
	gap: 28px;
	align-items: start;
	position: relative;
}

/* Profile card */
.md-profile {
	position: sticky;
	top: calc(var(--mh-bar-h, 84px) + var(--mh-admin, 0px) + 24px);
	background: #fff;
	border-radius: 24px;
	box-shadow: 0 10px 30px rgba(14, 42, 48, .08);
	overflow: hidden;
}
.md-profile__media { height: 320px; background: var(--md-mint); display: flex; align-items: flex-end; justify-content: center; }
.md-profile__photo { height: 304px; width: auto; max-width: 100%; object-fit: contain; object-position: bottom; mix-blend-mode: multiply; display: block; }
.md-profile__media .md-photo--empty { height: 220px !important; width: 174px !important; }
.md-profile__body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 12px; }
.md-page .md-profile__dept { align-self: flex-start; background: var(--md-mint); color: var(--md-primary); font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; text-decoration: none; }
.md-page .md-profile__dept:hover { background: #DCEBE4; }
.md-profile__name { margin: 0; font-family: inherit; font-size: 26px; line-height: 1.35; font-weight: 700; color: var(--md-ink); }
.md-profile__title { margin: -6px 0 0; font-size: 16px; line-height: 1.6; color: var(--md-primary); font-weight: 600; }
.md-profile__actions { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.md-profile__actions .md-btn { width: 100%; }

/* Main column */
.md-single__main { display: flex; flex-direction: column; gap: 20px; }
.md-section { background: #fff; border-radius: 24px; padding: 28px 32px; display: flex; flex-direction: column; gap: 14px; }
.md-section__title { margin: 0; font-family: inherit; font-size: 22px; line-height: 1.4; font-weight: 700; color: var(--md-ink); }
.md-section__lead { margin: 0; font-size: 17px; line-height: 2; color: var(--md-ink-2); }
.md-section__content { font-size: 16px; line-height: 2; color: var(--md-ink-2); }
.md-section__content > *:last-child { margin-bottom: 0; }

.md-quals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.md-quals__item { margin: 0; display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--md-ground); font-size: 16px; line-height: 1.75; color: var(--md-ink); }
.md-quals__icon { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--md-primary); color: #fff; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.md-quals__icon .md-icon { width: 16px; height: 16px; }

/* Booking band */
.md-cta-band { background: var(--md-ink); color: #fff; border-radius: 24px; padding: 28px 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.md-cta-band__text { display: flex; flex-direction: column; gap: 6px; }
.md-cta-band__title { margin: 0; font-family: inherit; font-size: 20px; line-height: 1.4; font-weight: 700; color: #fff; }
.md-cta-band p { margin: 0; color: #CFE0DB; font-size: 15px; }
.md-cta-band__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.md-page .md-btn--light { background: #fff; color: var(--md-ink); border: 1px solid #fff; }
.md-page .md-btn--light:hover { background: var(--md-mint); color: var(--md-ink); }
.md-page .md-btn--outline-light { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .35); }
.md-page .md-btn--outline-light:hover { border-color: #fff; color: #fff; }

/* Related doctors */
.md-related { padding-bottom: 80px; display: flex; flex-direction: column; gap: 20px; }
.md-related__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.md-page .md-related__all { font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }

@media (max-width: 960px) {
	.md-single__layout { grid-template-columns: minmax(0, 1fr); margin-top: -96px; }
	.md-profile { position: static; }
	.md-profile__media { height: 280px; }
	.md-profile__photo { height: 264px; }
	.md-profile__actions { flex-direction: row; flex-wrap: wrap; }
	.md-profile__actions .md-btn { flex: 1 1 200px; }
}

@media (max-width: 560px) {
	.md-single__hero { padding: 24px 0 112px; }
	.md-section, .md-cta-band { padding: 22px 20px; border-radius: 20px; }
	.md-section__title { font-size: 20px; }
	.md-profile__name { font-size: 23px; }
}
