/* Linked portal identities dropdown (Client marketing header + Partner/Admin dashboards).
   All row/menu styles are self-contained (no Tailwind) so Partner/Admin match Client. */

/* Positioning context: shrink-wrap to trigger so the panel aligns under the avatar */
.partner-portal-profile-root {
	position: relative;
	display: inline-flex;
	flex-direction: column;
	align-items: stretch;
	width: max-content;
	max-width: 100%;
	flex: 0 0 auto;
	overflow: visible;
}

.header-profile-panel {
	position: absolute;
	top: calc(100% + 0.25rem);
	inset-inline-start: 0;
	min-width: max(100%, 14rem);
	max-width: min(22rem, 92vw);
	background: #fff;
	border-radius: 0.75rem;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
	border: 1px solid rgb(229, 231, 235);
	z-index: 100000;
	overflow: hidden;
	box-sizing: border-box;
}

.header-profile-panel__body {
	max-height: 16rem;
	overflow-y: auto;
	box-sizing: border-box;
	background: #fff;
}

/* Partner mobile drawer: panel is fixed under “Linked accounts”; column layout for scroll + footer */
.header-profile-panel.header-profile-panel--drawer-mode {
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.header-profile-panel.header-profile-panel--drawer-mode .header-profile-panel__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	touch-action: pan-y;
}

/* Client marketing header: fixed panel matches full drawer action width — long labels wrap; calmer focus than default ring */
.header-profile-panel.header-profile-panel--marketing-mobile {
	border-radius: 12px;
	box-shadow: 0 16px 48px rgba(24, 28, 45, 0.18);
	background-color: #ffffff !important;
	background-image: none !important;
	opacity: 1 !important;
	isolation: isolate;
	mix-blend-mode: normal;
}

.header-profile-panel.header-profile-panel--marketing-mobile .header-profile-panel__body {
	background-color: #ffffff !important;
	background-image: none !important;
	mix-blend-mode: normal;
}

.header-profile-panel.header-profile-panel--marketing-mobile button.header-profile-panel__row,
.header-profile-panel.header-profile-panel--marketing-mobile button.header-profile-panel__footer-btn {
	white-space: normal;
	overflow-wrap: anywhere;
	word-break: break-word;
	hyphens: auto;
	text-align: start;
	padding-top: 0.75rem;
	padding-bottom: 0.75rem;
	background-color: #ffffff !important;
	background-image: none !important;
}

.header-profile-panel.header-profile-panel--marketing-mobile button.header-profile-panel__row:focus {
	outline: none;
}

.header-profile-panel.header-profile-panel--marketing-mobile button.header-profile-panel__row:focus-visible {
	outline: 2px solid #6b5b95;
	outline-offset: 2px;
}

/* Menu rows: explicit reset — overrides global typography `button { … !important }` + theme */
.header-profile-panel button.header-profile-panel__row {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 0.625rem;
	width: 100%;
	text-align: start;
	box-sizing: border-box;
	margin: 0;
	padding: 0.625rem 0.875rem;
	font-family: inherit !important;
	font-size: 0.9375rem !important;
	font-weight: 600 !important;
	line-height: 1.35 !important;
	letter-spacing: normal !important;
	color: #111111 !important;
	background-color: #ffffff !important;
	border: none;
	border-radius: 0;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.header-profile-panel__avatar-wrap {
	flex: 0 0 auto;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 0.625rem;
	overflow: hidden;
	background: #6a5d8b;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Default user silhouette (no photo): light tile — overrides purple wrap */
.header-profile-panel__avatar-wrap.header-profile-panel__avatar-wrap--default-photo {
	background: #f3f4f6;
	color: #111;
	border: 1px solid #e5e7eb;
	box-sizing: border-box;
}

/* Inset the graphic inside the tile (padding *within* the icon), not extra row spacing */
.header-profile-panel__avatar-wrap--default-photo .header-profile-panel__avatar-img--placeholder {
	width: 72%;
	height: 72%;
	max-width: 72%;
	max-height: 72%;
	object-fit: contain;
	object-position: center;
	flex-shrink: 0;
	display: block;
}

.header-profile-panel__avatar-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Full-width Aqar360 marks: cover crops sides in a square; match header / client brand tile */
.header-profile-panel__avatar-wrap--brand-contain {
	background: #fff;
	border: 1px solid rgb(229, 231, 235);
}

.header-profile-panel__avatar-img.header-profile-panel__avatar-img--contain {
	object-fit: contain;
	object-position: center;
	padding: 0.125rem;
	box-sizing: border-box;
}

/* Match partner header fallback: purple tile + single white initial (override global h1/button typography). */
.header-profile-panel__avatar-initial {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-family: 'Rubik', 'IBM Plex Sans Arabic', Helvetica, sans-serif !important;
	font-size: 1rem !important;
	font-weight: 700 !important;
	line-height: 1 !important;
	letter-spacing: 0 !important;
	color: #fff !important;
}

.header-profile-panel__row-text {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.125rem;
}

.header-profile-panel__row-primary {
	font-size: 0.9375rem !important;
	font-weight: 600 !important;
	line-height: 1.35 !important;
	color: #111111 !important;
}

.header-profile-panel__row-partner-type {
	font-size: 0.75rem;
	font-weight: 500;
	line-height: 1.35;
	color: #6b7280;
}

/* Post Listing / profile picker: Nafath logo + verified check or unverified X */
.header-profile-panel__row-nafath {
	flex: 0 0 auto;
	display: inline-flex;
	flex-direction: row;
	align-items: center;
	gap: 0.5rem;
	margin-inline-start: auto;
	padding-inline-start: 0.35rem;
	flex-shrink: 0;
}

.header-profile-panel__row-nafath-logo {
	width: 1.75rem;
	height: 1.75rem;
	object-fit: contain;
	display: block;
	flex-shrink: 0;
}

.header-profile-panel__row-nafath-mark {
	font-size: 1.1875rem;
	font-weight: 800;
	line-height: 1;
	flex-shrink: 0;
	font-family: system-ui, 'Segoe UI', sans-serif !important;
}

.header-profile-panel__row-nafath-mark--verified {
	color: #15803d;
}

.header-profile-panel__row-nafath-mark--unverified {
	color: #b91c1c;
}

.header-profile-panel__body .header-profile-panel__row + .header-profile-panel__row {
	border-top: 1px solid rgb(229, 231, 235);
}

.header-profile-panel button.header-profile-panel__row:hover,
.header-profile-panel button.header-profile-panel__footer-btn:hover {
	background-color: rgb(245, 243, 255) !important;
}

.header-profile-panel__loading,
.header-profile-panel__error {
	margin: 0;
	padding: 0.75rem 0.875rem;
	font-size: 0.875rem;
	line-height: 1.4;
	font-family: inherit;
	box-sizing: border-box;
}

.header-profile-panel__loading {
	color: #6b7280;
	background: #fff;
}

.header-profile-panel__error {
	color: #b91c1c;
	background: #fff;
}

/* “New partner” action — no Tailwind */
.header-profile-panel button.header-profile-panel__footer-btn {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 0.625rem 0.875rem;
	text-align: start;
	font-family: inherit !important;
	font-size: 0.875rem !important;
	font-weight: 600 !important;
	line-height: 1.35 !important;
	letter-spacing: normal !important;
	color: #6a5d8b !important;
	background-color: #ffffff !important;
	border: none;
	border-top: 1px solid rgb(229, 231, 235);
	border-radius: 0;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.header-profile-panel__footer-logout {
	background: #fff;
	border-top: 1px solid rgb(229, 231, 235);
}

/* Avoid double rule when “New partner” row already has a top border */
.header-profile-panel__footer-btn + .header-profile-panel__footer-logout {
	border-top: none;
}

/* Logout row: override admin/partner layout CSS (.profile-dropdown-logout-btn uses row-reverse + flex-end in LTR, which clips text). */
.header-profile-panel__footer-logout > a,
.header-profile-panel__footer-logout a.profile-dropdown-logout-btn {
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	justify-content: flex-start !important;
	gap: 0.5rem;
	padding: 0.75rem 0.875rem !important;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	text-decoration: none !important;
	color: inherit;
	min-width: 0;
}

.header-profile-panel__footer-logout .profile-dropdown-type {
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	gap: 0.5rem;
	width: 100%;
	min-width: 0;
	flex: 1 1 auto;
}

/* Icon before label (DOM is text then icon) */
.header-profile-panel__footer-logout .profile-dropdown-logout-icon {
	float: none !important;
	flex-shrink: 0;
	order: -1;
}

.header-profile-panel__footer-logout .profile-dropdown-logout-text {
	flex: 1 1 auto !important;
	min-width: 0;
	text-align: start !important;
	text-overflow: clip;
	overflow: visible;
	white-space: nowrap;
	color: #db3a34;
	font-size: 0.875rem;
	font-weight: 500;
}

[dir="rtl"] .header-profile-panel__footer-logout > a,
[dir="rtl"] .header-profile-panel__footer-logout a.profile-dropdown-logout-btn {
	flex-direction: row-reverse !important;
	justify-content: flex-end !important;
}

[dir="rtl"] .header-profile-panel__footer-logout .profile-dropdown-type {
	flex-direction: row-reverse !important;
}

[dir="rtl"] .header-profile-panel__footer-logout .profile-dropdown-logout-icon {
	order: 1;
}

[dir="rtl"] .header-profile-panel__footer-logout .profile-dropdown-logout-text {
	text-align: start !important;
}

.header-profile-panel__footer-logout > a:hover {
	background-color: rgb(245, 243, 255);
}

/* Partner header: allow dropdown to paint outside toolbar row */
.DashboardHeader-toolbar .partner-portal-profile-root {
	overflow: visible;
}

/* Admin dashboard: same portal menu host */
#adminPortalProfileDropdownRoot.profile {
	position: relative;
	overflow: visible;
	flex: 0 0 auto;
}

/* Admin: profile lives at the header’s inline-end; pin the panel’s inline-end to the trigger so it opens inward —
   LTR → extends left; RTL → extends right (overrides global .header-profile-panel used on Client marketing). */
#adminPortalProfileDropdownRoot .header-profile-panel {
	inset-inline-end: 0;
	inset-inline-start: auto;
}

/* Partner: inverted .Verification dir — pin panel to root’s inline-end so it always opens inward (en + ar). */
.Verification #partnerPortalProfileDropdownRoot .header-profile-panel {
	inset-inline-end: 0;
	inset-inline-start: auto;
}
