/* GDPR Cookie Suite – stili frontend.
   Tutti i colori/dimensioni provengono da variabili CSS impostate dal pannello:
   --gcs-bg, --gcs-text, --gcs-accent, --gcs-accent-text, --gcs-btn2, --gcs-radius, --gcs-font */

#gcs-root {
	position: fixed;
	inset: 0;
	z-index: 999999;
	pointer-events: none;
	font-size: var(--gcs-font, 15px);
	line-height: 1.5;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#gcs-root[hidden] { display: none; }

.gcs-overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 18, 25, 0.55);
	opacity: 0;
	transition: opacity .25s ease;
}
.gcs-has-overlay .gcs-overlay,
.gcs-prefs-open .gcs-overlay {
	opacity: 1;
	pointer-events: auto;
}
#gcs-root:not(.gcs-has-overlay):not(.gcs-prefs-open) .gcs-overlay { display: none; }

/* ---------- Banner ---------- */

.gcs-banner {
	position: absolute;
	pointer-events: auto;
	background: var(--gcs-bg, #fff);
	color: var(--gcs-text, #1f2430);
	border-radius: var(--gcs-radius, 12px);
	box-shadow: 0 8px 40px rgba(10, 15, 30, 0.18);
	padding: 22px 26px;
	max-width: 100%;
	animation: gcs-in .3s ease;
}
@keyframes gcs-in {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
	.gcs-banner, .gcs-overlay { animation: none; transition: none; }
}

/* Layout: barra a tutta larghezza */
.gcs-layout-bar .gcs-banner { left: 0; right: 0; border-radius: 0; }
.gcs-layout-bar.gcs-pos-bottom .gcs-banner { bottom: 0; }
.gcs-layout-bar.gcs-pos-top .gcs-banner { top: 0; }

/* Layout: box in un angolo */
.gcs-layout-box .gcs-banner { width: 420px; max-width: calc(100vw - 32px); }
.gcs-layout-box.gcs-pos-bottom-left .gcs-banner,
.gcs-layout-box.gcs-pos-bottom .gcs-banner { left: 16px; bottom: 16px; }
.gcs-layout-box.gcs-pos-bottom-right .gcs-banner { right: 16px; bottom: 16px; left: auto; }
.gcs-layout-box.gcs-pos-top .gcs-banner { left: 16px; top: 16px; }

/* Layout: modale centrale */
.gcs-layout-modal .gcs-banner {
	left: 50%; top: 50%;
	transform: translate(-50%, -50%);
	width: 520px;
	max-width: calc(100vw - 32px);
}

.gcs-logo { max-height: 34px; margin-bottom: 10px; display: block; }
.gcs-title { margin: 0 0 8px; font-size: 1.15em; font-weight: 700; color: inherit; }
.gcs-text { margin: 0 0 16px; }
.gcs-text a { color: var(--gcs-accent, #2e5aac); text-decoration: underline; }

.gcs-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
}
.gcs-btn {
	border: 0;
	cursor: pointer;
	padding: 11px 20px;
	font-size: 1em;
	font-weight: 600;
	border-radius: calc(var(--gcs-radius, 12px) * 0.7);
	transition: filter .15s ease;
}
.gcs-btn:hover { filter: brightness(0.94); }
.gcs-btn:focus-visible { outline: 3px solid var(--gcs-accent, #2e5aac); outline-offset: 2px; }
.gcs-btn-primary { background: var(--gcs-accent, #2e5aac); color: var(--gcs-accent-text, #fff); }
.gcs-btn-secondary { background: var(--gcs-btn2, #e8eaef); color: var(--gcs-text, #1f2430); }

/* Parità visiva Accetta/Rifiuta richiesta da diversi garanti: stessa dimensione. */
.gcs-actions .gcs-btn { min-width: 120px; }

/* ---------- Pannello preferenze ---------- */

.gcs-preferences {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: auto;
	padding: 16px;
}
.gcs-preferences[hidden] { display: none; }
.gcs-pref-inner {
	position: relative;
	background: var(--gcs-bg, #fff);
	color: var(--gcs-text, #1f2430);
	border-radius: var(--gcs-radius, 12px);
	box-shadow: 0 8px 40px rgba(10, 15, 30, 0.25);
	max-width: 640px;
	width: 100%;
	max-height: 86vh;
	overflow-y: auto;
	padding: 26px 28px;
}
.gcs-pref-inner h2 { margin: 0 0 6px; font-size: 1.2em; color: inherit; }
.gcs-close {
	position: absolute;
	top: 10px; right: 14px;
	border: 0; background: none;
	font-size: 26px;
	cursor: pointer;
	color: inherit;
	line-height: 1;
}

.gcs-category { border-top: 1px solid rgba(128, 128, 128, 0.25); padding: 14px 0; }
.gcs-category-head { display: flex; gap: 14px; align-items: flex-start; }
.gcs-category-head > div { flex: 1; }
.gcs-category-desc { margin: 4px 0 0; opacity: 0.8; font-size: 0.92em; }
.gcs-required {
	font-size: 0.78em;
	background: var(--gcs-btn2, #e8eaef);
	border-radius: 99px;
	padding: 2px 10px;
	margin-left: 6px;
	vertical-align: middle;
}
.gcs-expand {
	border: 0; background: none;
	color: var(--gcs-accent, #2e5aac);
	cursor: pointer;
	font-size: 0.9em;
	text-decoration: underline;
	white-space: nowrap;
}
.gcs-category-services { margin-top: 12px; padding-left: 58px; display: grid; gap: 12px; }
.gcs-category-services[hidden] { display: none; }
.gcs-service { font-size: 0.88em; background: rgba(128,128,128,0.07); border-radius: 8px; padding: 10px 12px; }
.gcs-service strong { display: block; }
.gcs-service span { opacity: 0.7; }
.gcs-service ul { margin: 6px 0 0; padding-left: 18px; }
.gcs-service a { color: var(--gcs-accent, #2e5aac); }

/* Switch */
.gcs-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; margin-top: 2px; }
.gcs-switch input { opacity: 0; width: 0; height: 0; }
.gcs-slider {
	position: absolute; inset: 0;
	background: #b9bec9;
	border-radius: 99px;
	transition: background .2s ease;
}
.gcs-slider::before {
	content: "";
	position: absolute;
	width: 18px; height: 18px;
	left: 3px; top: 3px;
	background: #fff;
	border-radius: 50%;
	transition: transform .2s ease;
}
.gcs-switch input:checked + .gcs-slider { background: var(--gcs-accent, #2e5aac); }
.gcs-switch input:checked + .gcs-slider::before { transform: translateX(20px); }
.gcs-switch input:disabled + .gcs-slider { opacity: 0.55; cursor: not-allowed; }
.gcs-switch input:focus-visible + .gcs-slider { outline: 3px solid var(--gcs-accent, #2e5aac); outline-offset: 2px; }

/* ---------- Placeholder contenuti bloccati ---------- */

.gcs-placeholder {
	background: repeating-linear-gradient(45deg, #f2f3f6, #f2f3f6 12px, #e9ebf0 12px, #e9ebf0 24px);
	border: 1px dashed #b9bec9;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 220px;
	text-align: center;
	padding: 20px;
}
.gcs-placeholder + iframe[data-gcs-src] { display: none; }
.gcs-placeholder-inner p { margin: 0 0 12px; color: #3a4150; font-size: 14px; }
.gcs-unlock-btn {
	border: 0;
	background: var(--gcs-accent, #2e5aac);
	color: var(--gcs-accent-text, #fff);
	padding: 10px 18px;
	border-radius: 8px;
	font-weight: 600;
	cursor: pointer;
}

/* ---------- Widget revoca ---------- */

/* Blindato contro il CSS dei temi (specificità da ID): i temi applicano ai
   button padding con content-box (che deforma il cerchio in ovale) e colori
   propri (che rendono invisibile l'icona in currentColor). Ogni proprietà
   sensibile è quindi fissata esplicitamente. */
button#gcs-revoke {
	position: fixed;
	bottom: 18px;
	z-index: 999998;
	box-sizing: border-box;
	width: 46px; height: 46px;
	min-width: 46px; min-height: 46px;
	max-width: 46px; max-height: 46px;
	padding: 0;
	margin: 0;
	border: 0;
	outline-offset: 2px;
	border-radius: 50%;
	background: var(--gcs-accent, #2e5aac);
	background-image: none;
	color: var(--gcs-accent-text, #fff);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	font-size: 0;
	text-indent: 0;
	text-transform: none;
	transform: none;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: 0 4px 16px rgba(10, 15, 30, 0.3);
}
button#gcs-revoke:hover { background: var(--gcs-accent, #2e5aac); filter: brightness(0.92); }
button#gcs-revoke[hidden] { display: none; }
button#gcs-revoke svg {
	display: block;
	width: 22px; height: 22px;
	max-width: none;
	flex: none;
}
/* L'icona non dipende da currentColor: colori espliciti che i temi non toccano. */
button#gcs-revoke .gcs-ring {
	fill: none;
	stroke: var(--gcs-accent-text, #fff);
	stroke-width: 2;
}
button#gcs-revoke .gcs-dot {
	fill: var(--gcs-accent-text, #fff);
	stroke: none;
}
.gcs-revoke-left { left: 18px; }
.gcs-revoke-right { right: 18px; }

/* ---------- Tema scuro ---------- */

.gcs-theme-dark .gcs-banner,
.gcs-theme-dark .gcs-pref-inner {
	--gcs-bg: #1c2230;
	--gcs-text: #eef1f7;
	--gcs-btn2: #313b4f;
	background: var(--gcs-bg);
	color: var(--gcs-text);
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
	.gcs-layout-box .gcs-banner,
	.gcs-layout-modal .gcs-banner { left: 8px; right: 8px; width: auto; transform: none; top: auto; bottom: 8px; }
	.gcs-actions { flex-direction: column-reverse; }
	.gcs-actions .gcs-btn { width: 100%; }
	.gcs-category-services { padding-left: 0; }
}

/* ---------- Tema automatico (segue il sistema del visitatore) ---------- */

@media (prefers-color-scheme: dark) {
	.gcs-theme-auto .gcs-banner,
	.gcs-theme-auto .gcs-pref-inner {
		--gcs-bg: #1c2230;
		--gcs-text: #eef1f7;
		--gcs-btn2: #313b4f;
		background: var(--gcs-bg);
		color: var(--gcs-text);
	}
}

/* ---------- ID consenso nel pannello preferenze ---------- */

.gcs-consent-id { margin: 14px 0 0; font-size: 0.82em; opacity: 0.7; }
.gcs-consent-id code { font-size: inherit; }

/* ---------- Link CCPA "Do Not Sell" (visitatori USA) ---------- */

.gcs-dns {
	position: fixed;
	bottom: 6px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 999997;
	font-size: 12px;
	color: #444;
	background: rgba(255, 255, 255, 0.92);
	padding: 3px 12px;
	border-radius: 99px;
	text-decoration: underline;
	box-shadow: 0 1px 6px rgba(10, 15, 30, 0.15);
}

/* X di chiusura del banner (Linee guida Garante: comando di pari evidenza
   che mantiene le impostazioni predefinite). Il banner è già un elemento
   posizionato (absolute nel wrapper fixed): la X vi si ancora direttamente,
   senza toccare la position del banner. */
.gcs-x {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 32px;
	height: 32px;
	border: 1px solid var(--gcs-border, rgba(128,128,128,.35));
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	opacity: .85;
}
.gcs-x:hover, .gcs-x:focus { opacity: 1; }
.gcs-layout-bar .gcs-x { top: 6px; right: 6px; }

/* Interruttore per singolo servizio (consenso granulare): stessa grafica
   degli interruttori di categoria, in formato ridotto. */
.gcs-service { position: relative; }
.gcs-service-toggle { float: right; margin-left: 12px; cursor: pointer; }
.gcs-switch-sm { width: 36px; height: 20px; margin-top: 0; }
.gcs-switch-sm .gcs-slider::before { width: 14px; height: 14px; left: 3px; top: 3px; }
.gcs-switch-sm input:checked + .gcs-slider::before { transform: translateX(16px); }

/* Attribuzione reCAPTCHA (richiesta dai termini Google quando il badge non è
   visibile perché lo script è rinviato all'interazione con i moduli) */
.gcs-recaptcha-note {
	position: fixed;
	right: 10px;
	bottom: 10px;
	z-index: 2147483000;
	background: rgba(255, 255, 255, 0.92);
	color: #444;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	padding: 4px 8px;
	font-size: 10px;
	line-height: 1.4;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.gcs-recaptcha-note a { color: #2e5aac; text-decoration: none; }
