/*
 * خدمات mega menu (desktop only, >=1025px). Scoped under .pjmm-* and
 * #menu-item-1914.pjmm-enhanced; no global button/header/body rules and none of
 * the shared "Reusable Mega Menu System" rules are touched. Placement (left /
 * top / width / caret / max-height) is set inline by pejvak-services-megamenu.js
 * from the trigger's and the header container's real geometry; this file only
 * holds the look.
 *
 * Palette: navy #233A7A, cyan #29AAE1, white, pale blue #F4F8FC.
 * RTL: the panel has direction:rtl, so the first flex child (the category
 * column) sits on the right and the services pane to its left; logical
 * properties are used for the active marker.
 */

@media (min-width: 1025px) {
	/* Suppress the legacy hover-grid on this one item only once the script has
	   attached (if it fails, the old grid still works). */
	#menu-item-1914.pjmm-enhanced > ul.sub-menu,
	#menu-item-1914.pjmm-enhanced:hover > ul.sub-menu {
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
	}
}

.pjmm-panel {
	--pjmm-navy: #233A7A;
	--pjmm-cyan: #29AAE1;
	--pjmm-cyan-soft: rgba(41, 170, 225, 0.12);
	--pjmm-pale: #F4F8FC;
	--pjmm-line: #E3EAF3;
	--pjmm-muted: #5B6B7F;

	position: fixed;
	z-index: 9999;
	direction: rtl;
	text-align: start;
	box-sizing: border-box;
	/* JS sets the exact width/left/top; these are the pre-measurement fallbacks. */
	width: min(1000px, calc(100% - 32px));
	color: var(--pjmm-navy);
	font-family: inherit;
	line-height: 1.7;
	word-spacing: normal;
	letter-spacing: normal;
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}
.pjmm-panel.pjmm-open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
.pjmm-panel *,
.pjmm-panel *::before,
.pjmm-panel *::after {
	box-sizing: border-box;
}

/* The white sheet. It is the scroll container, so the caret (a sibling above
   it) is never clipped; the sheet scrolls only if the viewport height needs it. */
.pjmm-surface {
	position: relative;
	padding: 20px 22px 22px;
	background: #FFFFFF;
	border: 1px solid var(--pjmm-line);
	border-radius: 16px;
	box-shadow: 0 14px 34px rgba(35, 58, 122, 0.12), 0 2px 6px rgba(35, 58, 122, 0.05);
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* Small caret pointing at the خدمات item (left set by JS). */
.pjmm-caret {
	position: absolute;
	top: -6px;
	width: 12px;
	height: 12px;
	background: #FFFFFF;
	border-top: 1px solid var(--pjmm-line);
	border-left: 1px solid var(--pjmm-line);
	transform: translateX(-50%) rotate(45deg); /* centred on the physical left set by JS */
	z-index: 1;
}

.pjmm-bridge {
	position: fixed;
	z-index: 9998;
	display: none;
}

/* ---- header ------------------------------------------------------------- */

.pjmm-panel-head {
	display: flex;
	align-items: center;
	justify-content: flex-start; /* RTL: flex-start is the right (logical start) */
	margin-bottom: 14px;
}
.pjmm-hub-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 2px;
	font-size: 13px;
	font-weight: 600;
	color: var(--pjmm-navy);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: color 0.15s ease, border-color 0.15s ease;
}
.pjmm-hub-link::after {
	content: "\2190"; /* arrow pointing left = "forward" in RTL */
	font-size: 14px;
	line-height: 1;
	color: var(--pjmm-cyan);
}
.pjmm-hub-link:hover {
	color: #1B2D63;
	border-bottom-color: var(--pjmm-cyan);
}

/* ---- body: category column (right) + services pane ----------------------- */

.pjmm-body {
	display: flex;
	align-items: stretch;
	gap: 20px;
}

.pjmm-cats {
	flex: 0 0 29%;
	max-width: 29%;
	padding: 8px;
	background: var(--pjmm-pale);
	border-radius: 12px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.pjmm-cat-item {
	position: relative;
	display: block;
	width: 100%;
	margin: 0;
	padding: 10px 14px;
	text-align: start;
	font: inherit;
	color: inherit;
	text-decoration: none;
	background: transparent;
	border: 0;
	/* Always 3px wide (transparent when inactive) so activating a row never moves anything. */
	border-inline-start: 3px solid transparent;
	border-radius: 9px;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}
.pjmm-cat-item strong {
	display: block;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.6;
	color: var(--pjmm-navy);
	unicode-bidi: isolate; /* RTL paragraph with embedded English runs */
}
.pjmm-cat-item:hover {
	background: rgba(35, 58, 122, 0.05);
}
.pjmm-cat-item.pjmm-cat-active {
	background: var(--pjmm-cyan-soft);
	border-inline-start-color: var(--pjmm-cyan); /* narrow cyan marker on the right edge */
}
.pjmm-cat-link strong::after {
	content: "\2190";
	margin-inline-start: 6px;
	color: var(--pjmm-cyan);
}
.pjmm-cat-item:focus-visible,
.pjmm-service-link:focus-visible,
.pjmm-hub-link:focus-visible {
	outline: 2px solid var(--pjmm-cyan);
	outline-offset: 2px;
}
.pjmm-cat-item:focus-visible {
	outline-offset: -2px;
}

.pjmm-pane {
	flex: 1 1 0;
	min-width: 0;
	padding-block: 2px;
}
.pjmm-pane.pjmm-fade-in {
	animation: pjmm-fade 160ms ease;
}
@keyframes pjmm-fade {
	from { opacity: 0.35; }
	to { opacity: 1; }
}

.pjmm-pane-head {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 0 4px 12px;
	margin-bottom: 4px;
	border-bottom: 1px solid var(--pjmm-line);
}
.pjmm-pane-title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.6;
	color: var(--pjmm-navy);
	unicode-bidi: isolate;
}
.pjmm-pane-desc {
	font-size: 13px;
	line-height: 1.7;
	color: var(--pjmm-muted);
	unicode-bidi: isolate;
}

/* Clean rows / light tiles: no heavy card borders or shadows. The 1px border is
   always present (transparent) so hover changes colour only, never size. */
.pjmm-services {
	display: grid;
	/* at most 2 columns; one when the pane is narrow */
	grid-template-columns: repeat(auto-fit, minmax(max(220px, calc((100% - 12px) / 2)), 1fr));
	gap: 4px 12px;
	padding-top: 8px;
}
.pjmm-service-link {
	display: block;
	padding: 11px 14px;
	color: inherit;
	text-decoration: none;
	border: 1px solid transparent;
	border-radius: 10px;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}
.pjmm-service-link:hover {
	background: var(--pjmm-pale);
	border-color: rgba(41, 170, 225, 0.35);
}
.pjmm-service-link strong {
	display: block;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.6;
	color: var(--pjmm-navy);
	unicode-bidi: isolate;
}
.pjmm-service-link small {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin-top: 2px;
	font-size: 12.5px;
	font-weight: 400;
	line-height: 1.7;
	color: var(--pjmm-muted);
	unicode-bidi: isolate;
}

/* ---- contractual-services row (compact, distinct) --------------------------- */

.pjmm-contracts {
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid var(--pjmm-line);
}
.pjmm-contracts-row {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 2px 14px;
	padding: 9px 14px;
	background: var(--pjmm-pale);
	border: 1px solid var(--pjmm-line);
	border-inline-start: 3px solid var(--pjmm-cyan);
	border-radius: 10px;
}
.pjmm-contracts-row strong {
	display: inline;
	font-size: 13.5px;
}
.pjmm-contracts-row small {
	font-size: 12.5px;
	color: var(--pjmm-muted);
	unicode-bidi: isolate;
}
.pjmm-contracts-row:hover {
	background: #EDF4FA;
}
.pjmm-contracts-row.pjmm-cat-active {
	background: var(--pjmm-cyan-soft);
	border-color: rgba(41, 170, 225, 0.45);
	border-inline-start-color: var(--pjmm-cyan);
}

/* ---- motion preferences ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.pjmm-panel,
	.pjmm-cat-item,
	.pjmm-service-link,
	.pjmm-hub-link {
		transition: none;
	}
	.pjmm-pane.pjmm-fade-in {
		animation: none;
	}
	.pjmm-panel {
		transform: none;
	}
}

/* Mobile / tablet keeps the existing expandable menu; the floating panel never shows. */
@media (max-width: 1024px) {
	.pjmm-panel,
	.pjmm-bridge {
		display: none !important;
	}
}
