/* ==========================================================================
   CER Privacy & Consent – interfaccia (v1.1)
   Identità del sito: Poppins (testo), Montserrat (titoli), verde CER #1B9C85, navy #0F172A.
   Il verde dei pulsanti è #13705F (tonalità più scura del brand) per il contrasto AA con il bianco.

   ISOLAMENTO DAL TEMA: Astra applica a tutti i <button> padding 17px 40px e sfondo verde
   in hover/focus. Tutta l'interfaccia vive in #cer-pc-root: il reset con selettore ID
   (specificità 1-0-x) prevale sulle regole del tema senza usare !important.
   ========================================================================== */

#cer-pc-root,
.cer-pc-ph {
	--cer-accent: #13705F;
	--cer-accent-hover: #0F5C4E;
	--cer-brand: #1B9C85;
	--cer-ink: #0F172A;
	--cer-text: #334155;
	--cer-muted: #475569;
	--cer-line: #E2E8F0;
	--cer-soft: #F5F8F7;
	--cer-mint: #EDF6EE;
	--cer-mint2: #D4F3D7;
	--cer-radius: 18px;
	--cer-font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	--cer-font-head: 'Montserrat', 'Poppins', system-ui, sans-serif;
	--cer-shadow: 0 24px 60px -12px rgba(15, 23, 42, .35), 0 2px 6px rgba(15, 23, 42, .06);
}

/* ---------- Reset ---------- */
#cer-pc-root,
#cer-pc-root *,
#cer-pc-root *::before,
#cer-pc-root *::after { box-sizing: border-box; }

#cer-pc-root {
	font-family: var(--cer-font);
	font-size: 15px;
	line-height: 1.55;
	color: var(--cer-text);
	-webkit-font-smoothing: antialiased;
}
#cer-pc-root p,
#cer-pc-root label { margin: 0; padding: 0; font: inherit; color: inherit; letter-spacing: normal; text-transform: none; }
#cer-pc-root button {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	font-family: var(--cer-font);
	-webkit-tap-highlight-color: transparent;
}
#cer-pc-root button:focus-visible,
#cer-pc-root a:focus-visible,
#cer-pc-root input:focus-visible + .cer-pc-track {
	outline: 3px solid var(--cer-brand);
	outline-offset: 2px;
}
#cer-pc-root .cer-pc-svg {
	display: block;
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;
}
#cer-pc-root .cer-pc-link { color: var(--cer-accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; font-weight: 500; }
#cer-pc-root .cer-pc-link:hover { color: var(--cer-accent-hover); }

/* ---------- Elementi comuni ---------- */
#cer-pc-root .cer-pc-tile {
	display: inline-flex; align-items: center; justify-content: center;
	width: 44px; height: 44px; flex: 0 0 auto;
	border-radius: 13px;
	background: var(--cer-mint); color: var(--cer-accent);
}
#cer-pc-root .cer-pc-tile .cer-pc-svg { width: 22px; height: 22px; }
#cer-pc-root .cer-pc-tile-sm { width: 36px; height: 36px; border-radius: 10px; }
#cer-pc-root .cer-pc-tile-sm .cer-pc-svg { width: 18px; height: 18px; }

#cer-pc-root .cer-pc-title { font-family: var(--cer-font-head); font-weight: 700; font-size: 17px; line-height: 1.3; color: var(--cer-ink); letter-spacing: -.01em; }
#cer-pc-root .cer-pc-sub { font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--cer-accent); margin-top: 2px; }
#cer-pc-root .cer-pc-text { font-size: 14.5px; line-height: 1.6; color: var(--cer-text); }
#cer-pc-root .cer-pc-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13.5px; }
#cer-pc-root .cer-pc-dot { color: #94A3B8; }

/* Pulsante chiusura */
#cer-pc-root .cer-pc-x {
	display: inline-flex; align-items: center; justify-content: center;
	width: 40px; height: 40px; flex: 0 0 auto;
	border-radius: 50%;
	background: transparent; color: var(--cer-muted);
	transition: background-color .15s, color .15s;
}
#cer-pc-root .cer-pc-x:hover { background: #F1F5F9; color: var(--cer-ink); }
#cer-pc-root .cer-pc-x .cer-pc-svg { width: 20px; height: 20px; stroke-width: 2.2; }

/* Pulsanti */
#cer-pc-root .cer-pc-btn,
.cer-pc-ph.cer-pc-ph .cer-pc-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 46px; min-width: 128px;
	padding: 11px 20px;
	border-radius: 12px;
	border: 2px solid var(--cer-accent);
	font-family: var(--cer-font); font-size: 15px; font-weight: 600; line-height: 1.2;
	text-align: center; white-space: nowrap; text-transform: none; letter-spacing: 0;
	transition: background-color .16s, border-color .16s, color .16s, box-shadow .16s;
}
#cer-pc-root .cer-pc-btn-primary,
.cer-pc-ph.cer-pc-ph .cer-pc-btn-primary { background: var(--cer-accent); color: #fff; }
#cer-pc-root .cer-pc-btn-primary:hover,
.cer-pc-ph.cer-pc-ph .cer-pc-btn-primary:hover { background: var(--cer-accent-hover); border-color: var(--cer-accent-hover); color: #fff; box-shadow: 0 6px 16px -6px rgba(19, 112, 95, .6); }
#cer-pc-root .cer-pc-btn-ghost { background: #fff; color: var(--cer-accent); }
#cer-pc-root .cer-pc-btn-ghost:hover { background: var(--cer-mint); color: var(--cer-accent-hover); }
#cer-pc-root .cer-pc-btn .cer-pc-svg { width: 18px; height: 18px; }

/* ==========================================================================
   Banner
   ========================================================================== */
#cer-pc-root .cer-pc-banner {
	position: fixed; z-index: 2147483000;
	left: 16px; right: 16px;
	max-width: 1120px; margin: 0 auto;
	display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px 32px;
	padding: 22px 28px 22px 24px;
	background: #fff;
	border: 1px solid var(--cer-line);
	border-radius: var(--cer-radius);
	box-shadow: var(--cer-shadow);
}
/* Posizione: in alto (predefinita, come il vecchio banner Iubenda) o in basso */
#cer-pc-root .cer-pc-banner--top { top: 16px; animation: cer-pc-down .3s cubic-bezier(.2, .8, .2, 1); }
#cer-pc-root .cer-pc-banner--bottom { bottom: 16px; animation: cer-pc-up .28s cubic-bezier(.2, .8, .2, 1); }
/* Barra di amministrazione WordPress (visibile solo agli utenti collegati) */
.admin-bar #cer-pc-root .cer-pc-banner--top { top: 48px; }
#cer-pc-root .cer-pc-banner::before {
	content: ""; position: absolute; left: 24px; right: 24px; top: -1px; height: 4px;
	border-radius: 0 0 4px 4px; background: var(--cer-brand);
}
#cer-pc-root .cer-pc-banner > .cer-pc-x { position: absolute; top: 10px; right: 10px; }
#cer-pc-root .cer-pc-banner-main { display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
#cer-pc-root .cer-pc-banner-body { display: grid; gap: 6px; min-width: 0; padding-right: 36px; }
#cer-pc-root .cer-pc-banner .cer-pc-text { max-width: 70ch; }
#cer-pc-root .cer-pc-actions { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; }
#cer-pc-root .cer-pc-btn-customize { min-width: 0; }

@keyframes cer-pc-down { from { transform: translateY(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cer-pc-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cer-pc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cer-pc-pop { from { transform: translateY(12px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 1024px) {
	#cer-pc-root .cer-pc-banner { grid-template-columns: 1fr; }
	#cer-pc-root .cer-pc-actions { justify-content: flex-end; }
}
@media (max-width: 640px) {
	#cer-pc-root .cer-pc-banner {
		left: 8px; right: 8px;
		padding: 20px 16px 16px; gap: 16px;
		max-height: calc(100vh - 16px); overflow-y: auto;
	}
	#cer-pc-root .cer-pc-banner--top { top: 8px; }
	#cer-pc-root .cer-pc-banner--bottom { bottom: 8px; }
	#cer-pc-root .cer-pc-banner-main .cer-pc-tile { display: none; }
	#cer-pc-root .cer-pc-banner-body { padding-right: 40px; }
	#cer-pc-root .cer-pc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
	#cer-pc-root .cer-pc-actions .cer-pc-btn { min-width: 0; width: 100%; }
	#cer-pc-root .cer-pc-actions .cer-pc-btn-customize { grid-column: 1 / -1; order: 3; border-color: var(--cer-line); }
}

/* ==========================================================================
   Pannello preferenze
   ========================================================================== */
html.cer-pc-lock, html.cer-pc-lock body { overflow: hidden !important; }

#cer-pc-root .cer-pc-overlay {
	position: fixed; inset: 0; z-index: 2147483001;
	display: flex; align-items: center; justify-content: center;
	padding: 24px;
	background: rgba(15, 23, 42, .58);
	-webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
	animation: cer-pc-fade .18s ease-out;
}
#cer-pc-root .cer-pc-dialog {
	display: flex; flex-direction: column;
	width: 100%; max-width: 620px; max-height: calc(100vh - 48px);
	background: #fff;
	border-radius: 22px;
	box-shadow: var(--cer-shadow);
	overflow: hidden;
	animation: cer-pc-pop .22s cubic-bezier(.2, .8, .2, 1);
}
#cer-pc-root .cer-pc-dhead {
	display: flex; align-items: center; gap: 14px;
	padding: 20px 20px 18px 24px;
	border-bottom: 1px solid var(--cer-line);
	background: linear-gradient(180deg, var(--cer-mint) 0%, #fff 100%);
	position: relative;
}
#cer-pc-root .cer-pc-dhead::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--cer-brand); }
#cer-pc-root .cer-pc-dhead .cer-pc-tile { background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
#cer-pc-root .cer-pc-dhead-text { flex: 1 1 auto; min-width: 0; }
#cer-pc-root .cer-pc-dhead .cer-pc-title { font-size: 19px; }

#cer-pc-root .cer-pc-dbody {
	flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
	padding: 20px 24px 8px;
	display: grid; gap: 16px; align-content: start;
}
#cer-pc-root .cer-pc-cats { display: grid; gap: 12px; }

#cer-pc-root .cer-pc-cat {
	padding: 16px 18px;
	border: 1px solid var(--cer-line);
	border-radius: 14px;
	background: #fff;
	transition: border-color .15s, background-color .15s;
}
#cer-pc-root .cer-pc-cat:has(input:checked) { border-color: #9AD9C9; background: #FAFDFC; }
#cer-pc-root .cer-pc-cat.is-locked { background: var(--cer-soft); }
#cer-pc-root .cer-pc-cat-head { display: flex; align-items: center; gap: 12px; }
#cer-pc-root .cer-pc-cat.is-locked .cer-pc-tile { background: #fff; }
#cer-pc-root .cer-pc-cat-title {
	flex: 1 1 auto; min-width: 0;
	font-family: var(--cer-font-head); font-weight: 700; font-size: 15px; line-height: 1.35; color: var(--cer-ink);
	cursor: pointer;
}
#cer-pc-root .cer-pc-cat.is-locked .cer-pc-cat-title { cursor: default; }
#cer-pc-root .cer-pc-cat-desc { margin-top: 10px; font-size: 13.8px; line-height: 1.6; color: var(--cer-text); }
#cer-pc-root .cer-pc-cat-prov { margin-top: 8px; font-size: 12.8px; color: var(--cer-muted); }
#cer-pc-root .cer-pc-cat-prov span { font-weight: 600; color: var(--cer-ink); }

#cer-pc-root .cer-pc-always {
	display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
	padding: 6px 11px; border-radius: 999px;
	background: var(--cer-mint2); color: #0F5C4E;
	font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
#cer-pc-root .cer-pc-always .cer-pc-svg { width: 14px; height: 14px; stroke-width: 2.6; }

/* Interruttore: area di tocco 52×32, stato indicato da posizione, colore e spunta */
#cer-pc-root .cer-pc-switch { position: relative; display: inline-flex; flex: 0 0 auto; width: 52px; height: 32px; }
#cer-pc-root .cer-pc-switch input {
	position: absolute; inset: 0; z-index: 1;
	width: 100%; height: 100%; margin: 0; padding: 0;
	opacity: 0; cursor: pointer;
	-webkit-appearance: none; appearance: none; border: 0; background: none; box-shadow: none;
}
#cer-pc-root .cer-pc-track {
	position: relative; display: block; width: 52px; height: 32px;
	border-radius: 999px; background: #CBD5E1;
	transition: background-color .18s;
}
#cer-pc-root .cer-pc-thumb {
	position: absolute; top: 3px; left: 3px;
	display: flex; align-items: center; justify-content: center;
	width: 26px; height: 26px; border-radius: 50%;
	background: #fff; color: var(--cer-accent);
	box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
	transition: transform .18s cubic-bezier(.2, .8, .2, 1);
}
#cer-pc-root .cer-pc-thumb .cer-pc-svg { width: 14px; height: 14px; stroke-width: 3; opacity: 0; transition: opacity .15s; }
#cer-pc-root .cer-pc-switch input:hover + .cer-pc-track { background: #B6C2D1; }
#cer-pc-root .cer-pc-switch input:checked + .cer-pc-track { background: var(--cer-accent); }
#cer-pc-root .cer-pc-switch input:checked + .cer-pc-track .cer-pc-thumb { transform: translateX(20px); }
#cer-pc-root .cer-pc-switch input:checked + .cer-pc-track .cer-pc-thumb .cer-pc-svg { opacity: 1; }

#cer-pc-root .cer-pc-dmeta { display: grid; gap: 6px; padding: 4px 2px 12px; }
#cer-pc-root .cer-pc-id { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: 12px; color: var(--cer-muted); }
#cer-pc-root .cer-pc-id code { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; background: #F1F5F9; color: var(--cer-text); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

#cer-pc-root .cer-pc-dfoot {
	display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
	padding: 16px 24px 20px;
	border-top: 1px solid var(--cer-line);
	background: #fff;
}
#cer-pc-root .cer-pc-dfoot .cer-pc-btn { min-width: 0; width: 100%; }

@media (max-width: 782px) {
	.admin-bar #cer-pc-root .cer-pc-banner--top { top: 54px; }
}
@media (max-width: 640px) {
	#cer-pc-root .cer-pc-overlay { align-items: flex-end; padding: 0; }
	#cer-pc-root .cer-pc-dialog {
		max-width: none; max-height: 92vh;
		border-radius: 22px 22px 0 0;
		animation: cer-pc-up .26s cubic-bezier(.2, .8, .2, 1);
	}
	#cer-pc-root .cer-pc-dhead { padding: 18px 12px 16px 18px; }
	#cer-pc-root .cer-pc-dbody { padding: 16px 16px 4px; }
	#cer-pc-root .cer-pc-cat { padding: 14px; }
	#cer-pc-root .cer-pc-dfoot { grid-template-columns: 1fr; gap: 8px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
	#cer-pc-root .cer-pc-o1 { order: 1; }
	#cer-pc-root .cer-pc-o2 { order: 2; }
	#cer-pc-root .cer-pc-o3 { order: 3; }
}

/* ==========================================================================
   Pulsante flottante "Preferenze cookie"
   ========================================================================== */
#cer-pc-root .cer-pc-float {
	position: fixed; left: 16px; bottom: 16px; z-index: 2147482999;
	display: flex; align-items: center; justify-content: center;
	width: 48px; height: 48px; border-radius: 50%;
	background: #fff; color: var(--cer-accent);
	border: 1px solid var(--cer-line);
	box-shadow: 0 8px 24px -8px rgba(15, 23, 42, .35);
	transition: transform .16s, box-shadow .16s, color .16s;
}
#cer-pc-root .cer-pc-float:hover { transform: translateY(-2px); color: var(--cer-accent-hover); box-shadow: 0 12px 28px -8px rgba(15, 23, 42, .4); }
#cer-pc-root .cer-pc-float .cer-pc-svg { width: 24px; height: 24px; }

/* ==========================================================================
   Chat: pulsante e richiesta di attivazione
   ========================================================================== */
#cer-pc-root .cer-pc-chat {
	position: fixed; right: 16px; bottom: 16px; z-index: 2147482998;
	display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}
#cer-pc-root .cer-pc-chat-btn {
	display: flex; align-items: center; justify-content: center;
	width: 58px; height: 58px; border-radius: 50%;
	background: var(--cer-accent); color: #fff;
	box-shadow: 0 10px 26px -8px rgba(19, 112, 95, .7);
	transition: transform .16s, background-color .16s;
}
#cer-pc-root .cer-pc-chat-btn:hover { background: var(--cer-accent-hover); transform: translateY(-2px); }
#cer-pc-root .cer-pc-chat-btn .cer-pc-svg { width: 27px; height: 27px; }
#cer-pc-root .cer-pc-chat-pop {
	width: min(360px, calc(100vw - 32px));
	display: grid; gap: 12px;
	padding: 16px 16px 14px 18px;
	background: #fff;
	border: 1px solid var(--cer-line);
	border-radius: var(--cer-radius);
	box-shadow: var(--cer-shadow);
	animation: cer-pc-pop .2s cubic-bezier(.2, .8, .2, 1);
}
#cer-pc-root .cer-pc-chat-pop[hidden] { display: none; }
#cer-pc-root .cer-pc-chat-head { display: flex; align-items: center; gap: 10px; }
#cer-pc-root .cer-pc-chat-head .cer-pc-title { flex: 1 1 auto; font-size: 16px; }
#cer-pc-root .cer-pc-chat-head .cer-pc-x { width: 36px; height: 36px; margin: -4px -4px -4px 0; }
#cer-pc-root .cer-pc-chat-pop .cer-pc-text { font-size: 13.8px; }
#cer-pc-root .cer-pc-chat-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#cer-pc-root .cer-pc-chat-actions .cer-pc-btn { min-width: 0; width: 100%; padding: 10px 12px; }
#cer-pc-root .cer-pc-chat-pop .cer-pc-links { font-size: 12.8px; }

/* ==========================================================================
   Segnaposto contenuti bloccati (mappe, video) – dentro il contenuto pagina
   ========================================================================== */
.cer-pc-ph.cer-pc-ph {
	display: flex; align-items: center; justify-content: center;
	width: 100%; margin: 0; padding: 28px 20px;
	font-family: var(--cer-font); color: var(--cer-text); text-align: center; line-height: 1.55;
	background:
		radial-gradient(circle at 1px 1px, rgba(27, 156, 133, .14) 1px, transparent 0) 0 0 / 18px 18px,
		var(--cer-soft);
	border: 1px solid var(--cer-line);
	border-radius: var(--cer-radius);
	box-sizing: border-box;
}
.cer-pc-ph.cer-pc-ph * { box-sizing: border-box; }
.cer-pc-ph.cer-pc-ph .cer-pc-ph-inner {
	max-width: 460px; display: flex; flex-direction: column; align-items: center; gap: 10px;
	padding: 24px; background: #fff; border: 1px solid var(--cer-line); border-radius: 16px;
	box-shadow: 0 12px 30px -16px rgba(15, 23, 42, .3);
}
.cer-pc-ph.cer-pc-ph .cer-pc-ph-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; background: var(--cer-mint); color: var(--cer-accent); }
.cer-pc-ph.cer-pc-ph .cer-pc-svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cer-pc-ph.cer-pc-ph p { margin: 0; padding: 0; }
.cer-pc-ph.cer-pc-ph .cer-pc-ph-title { font-family: var(--cer-font-head); font-weight: 700; font-size: 16px; color: var(--cer-ink); }
.cer-pc-ph.cer-pc-ph .cer-pc-ph-text { font-size: 14px; color: var(--cer-text); }
.cer-pc-ph.cer-pc-ph .cer-pc-ph-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 16px; margin-top: 6px; }
.cer-pc-ph.cer-pc-ph button { all: unset; box-sizing: border-box; cursor: pointer; }
.cer-pc-ph.cer-pc-ph button:focus-visible, .cer-pc-ph.cer-pc-ph a:focus-visible { outline: 3px solid var(--cer-brand); outline-offset: 2px; }
.cer-pc-ph.cer-pc-ph .cer-pc-link { color: var(--cer-accent); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; font-weight: 500; }

/* ---------- Accessibilità e stampa ---------- */
@media (prefers-reduced-motion: reduce) {
	#cer-pc-root *, #cer-pc-root *::before, #cer-pc-root *::after, .cer-pc-ph * { animation: none !important; transition: none !important; }
}
@media print { #cer-pc-root { display: none !important; } }
