/* CCP Ricerca Professionisti – overlay (loaded only where the shortcode is used).
 * Selectors are anchored on #ccprp-overlay so theme / Elementor styles cannot leak in.
 */

/* ---------- Page scroll lock ---------- */
html.ccprp-locked,
html.ccprp-locked body { overflow: hidden !important; }

/* ---------- Overlay shell ---------- */
#ccprp-overlay {
	--ccprp-acc: #f5a219;
	--ccprp-blue: #2c4ebf;
	--ccprp-muted: #a9b3d6;
	--ccprp-dim: #8892ba;
	--ccprp-soft: #dce3ff;
	--ccprp-line: rgba(255, 255, 255, .1);
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	flex-direction: column;
	height: 100%;
	height: 100dvh;
	/* Solid: a translucent layer let page elements ghost through, and blur is costly on phones. */
	background: #0f152e;
	color: #fff;
	font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 16px;
	line-height: 1.4;
	text-align: left;
	opacity: 0;
	transition: opacity .25s ease;
}
#ccprp-overlay[hidden] { display: none !important; }
#ccprp-overlay.is-open { opacity: 1; }
#ccprp-overlay:focus { outline: none; } /* the dialog itself takes focus on touch screens */
#ccprp-overlay *,
#ccprp-overlay *::before,
#ccprp-overlay *::after { box-sizing: border-box; }
#ccprp-overlay [hidden] { display: none !important; }

/* Neutralise theme/Elementor styles on the elements we use. */
#ccprp-overlay button,
#ccprp-overlay input,
#ccprp-overlay a,
#ccprp-overlay p,
#ccprp-overlay ul,
#ccprp-overlay li,
#ccprp-overlay label,
#ccprp-overlay kbd,
#ccprp-overlay mark {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	min-height: 0;
	width: auto;
	max-width: none;
}
#ccprp-overlay ul { list-style: none; }
#ccprp-overlay button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
#ccprp-overlay button:focus,
#ccprp-overlay a:focus,
#ccprp-overlay input:focus { outline: none; }
#ccprp-overlay button:focus-visible,
#ccprp-overlay a:focus-visible { outline: 2px solid var(--ccprp-acc); outline-offset: 3px; }
#ccprp-overlay svg { display: block; flex: none; }

/* ---------- Top bar ---------- */
#ccprp-overlay .ccprp__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 24px 56px;
}
#ccprp-overlay img.ccprp__logo {
	display: block;
	width: auto;
	height: 52px;
	max-width: 220px;
	margin: 0;
	border: 0;
	object-fit: contain;
}
#ccprp-overlay .ccprp__brand {
	display: flex;
	flex-direction: column;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.05;
}
#ccprp-overlay .ccprp__brand-accent { color: #8fa6ff; }
#ccprp-overlay .ccprp__close-wrap { display: flex; align-items: center; gap: 14px; }
#ccprp-overlay .ccprp__close {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border: 1.5px solid rgba(255, 255, 255, .18);
	border-radius: 50%;
	color: #fff;
	transition: background-color .15s ease;
}
#ccprp-overlay .ccprp__close:hover { background: rgba(255, 255, 255, .08); }
#ccprp-overlay .ccprp__kbd {
	display: inline-grid;
	place-items: center;
	min-width: 28px;
	height: 26px;
	padding: 0 7px;
	border: 1px solid rgba(255, 255, 255, .2);
	border-bottom-width: 2px;
	border-radius: 7px;
	font-size: 12px;
	font-weight: 500;
	color: var(--ccprp-soft);
}

/* ---------- Search field ---------- */
#ccprp-overlay .ccprp__body {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 1080px;
	margin: 0 auto;
	padding: 16px 56px 0;
	transform: translateY(16px);
	transition: transform .45s cubic-bezier(.2, .7, .2, 1);
}
#ccprp-overlay.is-open .ccprp__body { transform: none; }
#ccprp-overlay .ccprp__label {
	display: block;
	margin-bottom: 12px;
	font-size: 14px;
	color: var(--ccprp-muted);
}
#ccprp-overlay .ccprp__field {
	position: relative;
	display: flex;
	align-items: center;
	gap: 16px;
	padding-bottom: 16px;
	border-bottom: 2px solid rgba(255, 255, 255, .14);
}
#ccprp-overlay .ccprp__field::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -2px;
	width: 0;
	height: 2px;
	background: var(--ccprp-acc);
	transition: width .4s ease;
}
#ccprp-overlay .ccprp__field:focus-within::after { width: 100%; }
#ccprp-overlay .ccprp__field > svg { width: 28px; height: 28px; stroke-width: 1.8; }
#ccprp-overlay input.ccprp__input {
	flex: 1;
	min-width: 0;
	height: auto;
	padding: 0;
	border: 0;
	outline: 0;
	background: none;
	color: #fff;
	font-size: 40px;
	font-weight: 300;
	line-height: 1.2;
	letter-spacing: -.015em;
	caret-color: var(--ccprp-acc);
	-webkit-appearance: none;
	appearance: none;
}
#ccprp-overlay input.ccprp__input::placeholder { color: rgba(255, 255, 255, .3); opacity: 1; }
#ccprp-overlay .ccprp__clear {
	flex: none;
	height: 40px;
	padding: 0 18px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .08);
	color: var(--ccprp-soft);
	font-size: 14px;
	font-weight: 500;
}
#ccprp-overlay .ccprp__clear:hover { background: rgba(255, 255, 255, .14); }

/* ---------- Sectors + results (desktop) ---------- */
#ccprp-overlay .ccprp__main {
	flex: 1;
	min-height: 0;
	display: grid;
	grid-template-columns: 240px minmax(0, 1fr);
	gap: 56px;
	margin-top: 40px;
}
#ccprp-overlay .ccprp__sectors { display: flex; flex-direction: column; min-width: 0; }
#ccprp-overlay .ccprp__sectors-title { padding: 0 16px 10px; font-size: 13px; color: var(--ccprp-dim); }
#ccprp-overlay .ccprp__sector-list { display: flex; flex-direction: column; gap: 4px; }
#ccprp-overlay .ccprp__sec {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 46px;
	padding: 0 16px;
	border-radius: 12px;
	color: var(--ccprp-muted);
	font-size: 15px;
	font-weight: 500;
	text-align: left;
	white-space: nowrap;
	transition: background-color .15s ease, color .15s ease;
}
#ccprp-overlay .ccprp__sec:hover { color: #fff; background: rgba(255, 255, 255, .05); }
#ccprp-overlay .ccprp__sec[aria-pressed="true"] { color: #fff; background: rgba(255, 255, 255, .09); }
#ccprp-overlay .ccprp__sec-n {
	margin-left: auto;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	color: var(--ccprp-dim);
}
#ccprp-overlay .ccprp__sec[aria-pressed="true"] .ccprp__sec-n { color: #fff; }
#ccprp-overlay .ccprp__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #fff; }

#ccprp-overlay .ccprp__results { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
#ccprp-overlay .ccprp__count { padding: 0 18px 12px; font-size: 13px; color: var(--ccprp-dim); }
#ccprp-overlay .ccprp__list {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 0 8px 16px 0;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
#ccprp-overlay .ccprp__list > li { flex: none; }
#ccprp-overlay a.ccprp__row {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 12px 18px;
	border-radius: 16px;
	color: #fff;
}
#ccprp-overlay li.is-active > a.ccprp__row { background: var(--ccprp-blue); }
#ccprp-overlay .ccprp__mono {
	flex: none;
	display: grid;
	place-items: center;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .02em;
	background: rgba(255, 255, 255, .12);
	color: #fff;
}
#ccprp-overlay li.is-active .ccprp__mono { background: rgba(255, 255, 255, .18); color: #fff; }
#ccprp-overlay .ccprp__rt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#ccprp-overlay .ccprp__name { font-size: 19px; font-weight: 500; line-height: 1.3; }
#ccprp-overlay .ccprp__ttl { margin-right: 6px; font-size: 15px; font-weight: 400; color: var(--ccprp-muted); }
#ccprp-overlay .ccprp__role { font-size: 14px; color: var(--ccprp-muted); }
#ccprp-overlay li.is-active .ccprp__ttl,
#ccprp-overlay li.is-active .ccprp__role { color: var(--ccprp-soft); }
#ccprp-overlay mark { background: none; color: var(--ccprp-acc); padding: 0; }
#ccprp-overlay li.is-active mark {
	color: #fff;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 5px;
}
#ccprp-overlay .ccprp__go {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
	font-size: 13px;
	color: var(--ccprp-soft);
	opacity: 0;
	transition: opacity .15s ease;
}
#ccprp-overlay li.is-active .ccprp__go { opacity: 1; }

/* Sector colours */
#ccprp-overlay .ccprp__dot[data-s="psicologi"] { background: #8fa6ff; }
#ccprp-overlay .ccprp__dot[data-s="psichiatri"] { background: #f5a219; }
#ccprp-overlay .ccprp__dot[data-s="logopedia"] { background: #f49ac1; }
#ccprp-overlay .ccprp__dot[data-s="nutrizione"] { background: #6bd6ae; }
#ccprp-overlay .ccprp__mono[data-s="psicologi"] { background: rgba(143, 166, 255, .15); color: #b4c3ff; }
#ccprp-overlay .ccprp__mono[data-s="psichiatri"] { background: rgba(245, 162, 25, .15); color: #f7bc5a; }
#ccprp-overlay .ccprp__mono[data-s="logopedia"] { background: rgba(244, 154, 193, .15); color: #f7b3d2; }
#ccprp-overlay .ccprp__mono[data-s="nutrizione"] { background: rgba(107, 214, 174, .15); color: #86e3c1; }
#ccprp-overlay li.is-active .ccprp__mono[data-s] { background: rgba(255, 255, 255, .18); color: #fff; }

/* ---------- Opening a profile (after a click) ---------- */
#ccprp-overlay .ccprp__mono { position: relative; }
#ccprp-overlay .ccprp__ring {
	position: absolute;
	top: -5px;
	left: -5px;
	width: calc(100% + 10px);
	height: calc(100% + 10px);
	color: var(--ccprp-acc);
	animation: ccprp-spin .9s linear infinite;
}
@keyframes ccprp-spin { to { transform: rotate(360deg); } }
#ccprp-overlay li.is-loading > a.ccprp__row { background: var(--ccprp-blue); }
#ccprp-overlay li.is-loading .ccprp__mono[data-s] { background: rgba(255, 255, 255, .18); color: #fff; }
#ccprp-overlay li.is-loading .ccprp__ttl { color: var(--ccprp-soft); }
#ccprp-overlay li.is-loading mark {
	color: #fff;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 5px;
}
#ccprp-overlay li.is-loading .ccprp__role,
#ccprp-overlay li.is-loading .ccprp__go { display: none; }
#ccprp-overlay .ccprp__status { font-size: 14px; font-weight: 500; color: #fff; }
/* Everything else steps back and cannot be clicked while the page loads. */
#ccprp-overlay.is-busy .ccprp__list > li:not(.is-loading),
#ccprp-overlay.is-busy .ccprp__sectors,
#ccprp-overlay.is-busy .ccprp__clear {
	opacity: .35;
	pointer-events: none;
	transition: opacity .2s ease;
}
#ccprp-overlay.is-busy .ccprp__sectors { opacity: .4; }
#ccprp-overlay .ccprp__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Empty state */
#ccprp-overlay .ccprp__empty { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 36px 18px; }
#ccprp-overlay .ccprp__empty-title { font-size: 26px; font-weight: 500; }
#ccprp-overlay .ccprp__empty-text { max-width: 46ch; font-size: 16px; line-height: 1.6; color: var(--ccprp-muted); }
#ccprp-overlay .ccprp__reset {
	height: 48px;
	padding: 0 24px;
	border-radius: 999px;
	background: #fff;
	color: #0f152e;
	font-size: 15px;
	font-weight: 500;
}
#ccprp-overlay .ccprp__reset:hover { background: var(--ccprp-soft); }

/* ---------- Footer ---------- */
#ccprp-overlay .ccprp__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 56px;
	border-top: 1px solid rgba(255, 255, 255, .08);
	font-size: 13px;
	color: var(--ccprp-muted);
}
#ccprp-overlay .ccprp__hints { display: flex; align-items: center; gap: 22px; }
#ccprp-overlay .ccprp__hints > span { display: flex; align-items: center; gap: 8px; }
#ccprp-overlay .ccprp__help { display: flex; align-items: center; gap: 12px; margin-left: auto; }
#ccprp-overlay a.ccprp__call {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	height: 44px;
	padding: 0 20px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .08);
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	transition: background-color .15s ease;
}
#ccprp-overlay a.ccprp__call:hover { background: rgba(255, 255, 255, .14); }
#ccprp-overlay .ccprp__call-short { display: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1023px) {
	#ccprp-overlay .ccprp__desk { display: none !important; }
	#ccprp-overlay .ccprp__top { padding: 20px 32px; }
	#ccprp-overlay img.ccprp__logo { height: 44px; }
	#ccprp-overlay .ccprp__body { padding: 16px 32px 0; }
	/* Tablet uses the phone sizes for field and chips: more room for the list. */
	#ccprp-overlay .ccprp__field { gap: 12px; padding-bottom: 12px; }
	#ccprp-overlay .ccprp__field > svg { width: 24px; height: 24px; stroke-width: 1.9; }
	#ccprp-overlay input.ccprp__input { font-size: 28px; line-height: 1.2; letter-spacing: -.01em; }
	#ccprp-overlay .ccprp__clear { height: 36px; padding: 0 14px; font-size: 13px; }
	#ccprp-overlay .ccprp__main { display: flex; flex-direction: column; gap: 0; margin-top: 18px; }
	#ccprp-overlay .ccprp__sectors-title { display: none; }
	/* One swipeable row of chips (tablet and phone): keeps the list visible. */
	#ccprp-overlay .ccprp__sectors { min-width: 0; }
	#ccprp-overlay .ccprp__sector-list {
		flex-direction: row;
		flex-wrap: nowrap;
		gap: 8px;
		margin: 0 -32px;
		padding: 0 56px 4px 32px;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
		/* Fade on the right edge says "there is more, swipe". */
		-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
		mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
	}
	#ccprp-overlay .ccprp__sector-list::-webkit-scrollbar { display: none; }
	#ccprp-overlay .ccprp__sec { flex: none; }
	#ccprp-overlay .ccprp__sec {
		width: auto;
		gap: 8px;
		min-height: 40px;
		padding: 0 14px;
		font-size: 14px;
		border: 1px solid rgba(255, 255, 255, .16);
		border-radius: 999px;
	}
	#ccprp-overlay .ccprp__sec:hover { background: none; border-color: rgba(255, 255, 255, .3); }
	#ccprp-overlay .ccprp__sec[aria-pressed="true"] { background: #fff; border-color: #fff; color: #0f152e; }
	#ccprp-overlay .ccprp__sec[aria-pressed="true"] .ccprp__sec-n { color: #0f152e; opacity: .7; }
	#ccprp-overlay .ccprp__sec[aria-pressed="true"] .ccprp__dot[data-s="all"] { background: #0f152e; }
	#ccprp-overlay .ccprp__dot[data-s="all"] { background: var(--ccprp-muted); }
	#ccprp-overlay .ccprp__sec-n { margin-left: 0; font-size: 12px; }
	#ccprp-overlay .ccprp__dot { width: 7px; height: 7px; }
	#ccprp-overlay .ccprp__count { padding: 14px 14px 8px; font-size: 12px; }
	#ccprp-overlay .ccprp__list {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		/* max-content rows: without it the grid squeezes every row to fit the box. */
		grid-auto-rows: max-content;
		align-content: start;
		gap: 4px 12px;
		padding: 0 0 16px;
	}
	#ccprp-overlay a.ccprp__row { gap: 16px; padding: 12px 14px; }
	#ccprp-overlay .ccprp__mono { width: 48px; height: 48px; font-size: 14px; }
	#ccprp-overlay .ccprp__name { font-size: 17px; }
	#ccprp-overlay .ccprp__ttl { font-size: 14px; margin-right: 5px; }
	#ccprp-overlay .ccprp__go { display: none; }
	#ccprp-overlay .ccprp__foot { padding: 16px 32px max(24px, calc(env(safe-area-inset-bottom) + 12px)); font-size: 14px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 639px) {
	#ccprp-overlay .ccprp__top { padding: 12px 20px; }
	#ccprp-overlay img.ccprp__logo { height: 36px; }
	#ccprp-overlay .ccprp__brand { font-size: 13px; }
	#ccprp-overlay .ccprp__close { width: 44px; height: 44px; }
	#ccprp-overlay .ccprp__body { padding: 14px 0 0; }
	#ccprp-overlay .ccprp__label { margin: 0 20px 10px; font-size: 14px; }
	#ccprp-overlay .ccprp__field { margin: 0 20px; gap: 10px; padding-bottom: 12px; }
	#ccprp-overlay .ccprp__field > svg { width: 20px; height: 20px; stroke-width: 2; }
	#ccprp-overlay input.ccprp__input { font-size: 22px; line-height: 1.25; letter-spacing: 0; }
	#ccprp-overlay .ccprp__clear { height: 32px; padding: 0 12px; font-size: 13px; }
	#ccprp-overlay .ccprp__main { margin-top: 18px; }
	#ccprp-overlay .ccprp__sector-list {
		gap: 8px;
		margin: 0;
		padding: 0 36px 4px 20px;
		-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
		mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
	}
	#ccprp-overlay .ccprp__sec { flex: none; gap: 8px; min-height: 40px; padding: 0 14px; font-size: 14px; }
	#ccprp-overlay .ccprp__sec-n { font-size: 12px; }
	#ccprp-overlay .ccprp__dot { width: 7px; height: 7px; }
	#ccprp-overlay .ccprp__count { padding: 14px 20px 8px; font-size: 12px; }
	#ccprp-overlay .ccprp__list { display: flex; flex-direction: column; gap: 0; padding: 0 8px 12px; }
	#ccprp-overlay a.ccprp__row { gap: 14px; padding: 11px 12px; border-radius: 14px; }
	#ccprp-overlay .ccprp__mono { width: 42px; height: 42px; font-size: 13px; }
	#ccprp-overlay .ccprp__name { font-size: 16px; }
	#ccprp-overlay .ccprp__ttl { font-size: 13px; }
	#ccprp-overlay .ccprp__role { font-size: 13px; }
	#ccprp-overlay .ccprp__status { font-size: 13px; }
	#ccprp-overlay .ccprp__empty { padding: 28px 20px; gap: 12px; }
	#ccprp-overlay .ccprp__empty-title { font-size: 21px; }
	#ccprp-overlay .ccprp__empty-text { font-size: 15px; }
	#ccprp-overlay .ccprp__foot { padding: 12px 20px max(16px, calc(env(safe-area-inset-bottom) + 8px)); }
	#ccprp-overlay .ccprp__help { width: 100%; margin: 0; }
	#ccprp-overlay .ccprp__help > span { display: none; }
	#ccprp-overlay a.ccprp__call { width: 100%; height: 52px; font-size: 15px; }
	#ccprp-overlay .ccprp__call-long { display: none; }
	#ccprp-overlay .ccprp__call-short { display: inline; }
}

/* Touch screens never show keyboard hints. */
@media (hover: none) {
	#ccprp-overlay .ccprp__desk { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
	#ccprp-overlay,
	#ccprp-overlay .ccprp__body,
	#ccprp-overlay .ccprp__field::after { transition: none; }
	#ccprp-overlay .ccprp__ring { animation: none; }
}
