/**
 * FG Cookie Consent - stili frontend.
 * I colori sono controllati dalle variabili CSS generate dalle impostazioni.
 */

.fgcc-root,
.fgcc-floating,
.fgcc-placeholder {
	--fgcc-bg: #ffffff;
	--fgcc-text: #1f2328;
	--fgcc-muted: #5b6471;
	--fgcc-accent: #1a1a1a;
	--fgcc-accent-text: #ffffff;
	--fgcc-secondary-bg: #ffffff;
	--fgcc-secondary-text: #1f2328;
	--fgcc-border: #e2e5ea;
	--fgcc-link: #1a1a1a;
	--fgcc-overlay: rgba(15, 18, 23, 0.55);
	--fgcc-radius: 14px;
}

/* ------------------------------------------------------------------ */
/* Visibilità                                                          */
/* ------------------------------------------------------------------ */

.fgcc-root {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999999;
	font-family: inherit;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	/* Il contenitore copre lo schermo ma non intercetta i click:
	   la pagina resta navigabile finché non c'è una maschera. */
	pointer-events: none;
}

.fgcc-overlay,
.fgcc-banner,
.fgcc-prefs {
	pointer-events: auto;
}

html.fgcc-ask .fgcc-root,
.fgcc-root.fgcc-open {
	display: block;
}

.fgcc-root .fgcc-prefs {
	display: none;
}

.fgcc-root.fgcc-show-prefs .fgcc-banner {
	display: none;
}

.fgcc-root.fgcc-show-prefs .fgcc-prefs {
	display: flex;
}

.fgcc-root.fgcc-hidden {
	display: none !important;
}

.fgcc-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ */
/* Overlay                                                             */
/* ------------------------------------------------------------------ */

.fgcc-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: var(--fgcc-overlay);
	backdrop-filter: blur(2px);
	animation: fgcc-fade 0.25s ease;
}

/* La maschera compare solo se esplicitamente attivata nelle impostazioni. */
.fgcc-root.fgcc-has-overlay .fgcc-overlay {
	display: block;
}

.fgcc-root.fgcc-has-overlay.fgcc-pos-bar:not(.fgcc-show-prefs) .fgcc-overlay,
.fgcc-root.fgcc-has-overlay.fgcc-pos-corner-left:not(.fgcc-show-prefs) .fgcc-overlay,
.fgcc-root.fgcc-has-overlay.fgcc-pos-corner-right:not(.fgcc-show-prefs) .fgcc-overlay {
	display: none;
}

@keyframes fgcc-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes fgcc-rise {
	from { opacity: 0; transform: translateY(14px); }
	to { opacity: 1; transform: translateY(0); }
}

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

.fgcc-banner {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(560px, calc(100vw - 32px));
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	box-sizing: border-box;
	padding: 28px;
	background: var(--fgcc-bg);
	color: var(--fgcc-text);
	border-radius: var(--fgcc-radius);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
	animation: fgcc-rise 0.3s ease;
}

/* Box d'angolo: nessuna maschera, pagina navigabile. */
.fgcc-root.fgcc-pos-corner-left .fgcc-banner,
.fgcc-root.fgcc-pos-corner-right .fgcc-banner {
	top: auto;
	bottom: 20px;
	transform: none;
	width: min(400px, calc(100vw - 40px));
	padding: 22px 24px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	animation: fgcc-rise 0.32s ease;
}

.fgcc-root.fgcc-pos-corner-left .fgcc-banner {
	left: 20px;
	right: auto;
}

.fgcc-root.fgcc-pos-corner-right .fgcc-banner {
	right: 20px;
	left: auto;
}

/* In modalità angolo anche il pannello preferenze resta ancorato al lato,
   così non serve alcuna maschera per metterlo a fuoco. */
.fgcc-root.fgcc-pos-corner-left .fgcc-prefs,
.fgcc-root.fgcc-pos-corner-right .fgcc-prefs {
	top: auto;
	bottom: 20px;
	transform: none;
	width: min(430px, calc(100vw - 40px));
	max-height: min(78vh, 680px);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.fgcc-root.fgcc-pos-corner-left .fgcc-prefs {
	left: 20px;
	right: auto;
}

.fgcc-root.fgcc-pos-corner-right .fgcc-prefs {
	right: 20px;
	left: auto;
}

.fgcc-root.fgcc-pos-corner-left .fgcc-actions,
.fgcc-root.fgcc-pos-corner-right .fgcc-actions {
	gap: 8px;
}

/* Nel box d'angolo lo spazio è ridotto: i due pulsanti secondari
   condividono una riga, il principale occupa tutta la larghezza. */
.fgcc-root.fgcc-pos-corner-left .fgcc-btn,
.fgcc-root.fgcc-pos-corner-right .fgcc-btn {
	min-width: 0;
	flex: 1 1 0;
	padding: 10px 12px;
	font-size: 13.5px;
}

.fgcc-root.fgcc-pos-corner-left .fgcc-btn--primary,
.fgcc-root.fgcc-pos-corner-right .fgcc-btn--primary {
	flex: 1 1 100%;
	order: 3;
}

.fgcc-root.fgcc-pos-bar .fgcc-banner {
	left: 16px;
	right: 16px;
	bottom: 16px;
	top: auto;
	width: auto;
	max-width: none;
	transform: none;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 24px;
}

.fgcc-root.fgcc-pos-bar .fgcc-banner__title,
.fgcc-root.fgcc-pos-bar .fgcc-banner__text,
.fgcc-root.fgcc-pos-bar .fgcc-links {
	flex: 1 1 320px;
	margin: 0;
}

.fgcc-root.fgcc-pos-bar .fgcc-banner__title {
	flex-basis: 100%;
}

.fgcc-root.fgcc-pos-bar .fgcc-actions {
	margin-top: 0;
	flex: 0 1 auto;
}

.fgcc-banner__title {
	margin: 0 0 10px;
	font-size: 19px;
	font-weight: 700;
	color: var(--fgcc-text);
	line-height: 1.3;
}

.fgcc-banner__text {
	margin: 0 0 14px;
	font-size: 14.5px;
	color: var(--fgcc-muted);
}

.fgcc-links {
	margin: 0 0 18px;
	font-size: 13.5px;
}

.fgcc-link,
.fgcc-links a {
	color: var(--fgcc-link);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.fgcc-sep {
	color: var(--fgcc-muted);
	margin: 0 4px;
}

/* ------------------------------------------------------------------ */
/* Pulsanti                                                            */
/* ------------------------------------------------------------------ */

.fgcc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.fgcc-btn {
	flex: 1 1 auto;
	min-width: 130px;
	padding: 11px 18px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	border-radius: calc(var(--fgcc-radius) - 6px);
	border: 1px solid transparent;
	cursor: pointer;
	transition: opacity 0.18s ease, background-color 0.18s ease, transform 0.12s ease;
	text-align: center;
}

.fgcc-btn:hover {
	opacity: 0.86;
}

.fgcc-btn:active {
	transform: translateY(1px);
}

.fgcc-btn:focus-visible {
	outline: 2px solid var(--fgcc-accent);
	outline-offset: 2px;
}

.fgcc-btn--primary {
	background: var(--fgcc-accent);
	color: var(--fgcc-accent-text);
	border-color: var(--fgcc-accent);
}

.fgcc-btn--ghost {
	background: var(--fgcc-secondary-bg);
	color: var(--fgcc-secondary-text);
	border-color: var(--fgcc-border);
}

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

.fgcc-prefs {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(640px, calc(100vw - 32px));
	max-height: min(86vh, 760px);
	box-sizing: border-box;
	flex-direction: column;
	background: var(--fgcc-bg);
	color: var(--fgcc-text);
	border-radius: var(--fgcc-radius);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
	overflow: hidden;
	animation: fgcc-rise 0.3s ease;
}

.fgcc-prefs__head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 24px;
	border-bottom: 1px solid var(--fgcc-border);
}

.fgcc-prefs__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: var(--fgcc-text);
}

.fgcc-close {
	background: none;
	border: 0;
	font-size: 26px;
	line-height: 1;
	color: var(--fgcc-muted);
	cursor: pointer;
	padding: 0 4px;
}

.fgcc-prefs__body {
	flex: 1 1 auto;
	min-height: 0;
	padding: 20px 24px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.fgcc-prefs__intro {
	margin: 0 0 18px;
	font-size: 14px;
	color: var(--fgcc-muted);
}

.fgcc-prefs__foot {
	flex: 0 0 auto;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 16px 24px;
	border-top: 1px solid var(--fgcc-border);
	background: var(--fgcc-bg);
}

/* ------------------------------------------------------------------ */
/* Categorie                                                           */
/* ------------------------------------------------------------------ */

.fgcc-cat {
	padding: 14px 0;
	border-bottom: 1px solid var(--fgcc-border);
}

.fgcc-cat:last-of-type {
	border-bottom: 0;
}

.fgcc-cat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.fgcc-cat__title {
	font-size: 15px;
	font-weight: 700;
	color: var(--fgcc-text);
}

.fgcc-cat__desc {
	margin: 6px 0 0;
	font-size: 13.5px;
	color: var(--fgcc-muted);
}

.fgcc-cat__details {
	margin-top: 10px;
	font-size: 13px;
}

.fgcc-cat__details summary {
	cursor: pointer;
	color: var(--fgcc-link);
	list-style: none;
}

.fgcc-cat__details summary::-webkit-details-marker {
	display: none;
}

.fgcc-cat__details summary::before {
	content: "+ ";
	font-weight: 700;
}

.fgcc-cat__details[open] summary::before {
	content: "– ";
}

/* Switch */

.fgcc-switch {
	position: relative;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	cursor: pointer;
}

.fgcc-switch input {
	position: absolute;
	opacity: 0;
	width: 46px;
	height: 26px;
	margin: 0;
	cursor: pointer;
}

.fgcc-switch__ui {
	display: block;
	width: 46px;
	height: 26px;
	border-radius: 999px;
	background: var(--fgcc-border);
	transition: background-color 0.2s ease;
	position: relative;
}

.fgcc-switch__ui::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s ease;
}

.fgcc-switch input:checked + .fgcc-switch__ui {
	background: var(--fgcc-accent);
}

.fgcc-switch input:checked + .fgcc-switch__ui::after {
	transform: translateX(20px);
}

.fgcc-switch input:disabled + .fgcc-switch__ui {
	opacity: 0.5;
	cursor: not-allowed;
}

.fgcc-switch input:focus-visible + .fgcc-switch__ui {
	outline: 2px solid var(--fgcc-accent);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Tabelle cookie                                                      */
/* ------------------------------------------------------------------ */

.fgcc-table-wrap {
	overflow-x: auto;
	margin-top: 8px;
}

.fgcc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.fgcc-table th,
.fgcc-table td {
	text-align: left;
	padding: 7px 10px;
	border-bottom: 1px solid var(--fgcc-border);
	vertical-align: top;
}

.fgcc-table th {
	font-weight: 700;
	color: var(--fgcc-text);
	white-space: nowrap;
}

.fgcc-table td {
	color: var(--fgcc-muted);
}

.fgcc-table code {
	font-size: 12px;
	background: rgba(0, 0, 0, 0.05);
	padding: 1px 5px;
	border-radius: 4px;
	color: var(--fgcc-text);
	word-break: break-word;
}

.fgcc-policy-tables__title {
	margin-top: 28px;
}

/* ------------------------------------------------------------------ */
/* Pulsante flottante                                                  */
/* ------------------------------------------------------------------ */

.fgcc-floating {
	position: fixed;
	left: 18px;
	bottom: 18px;
	z-index: 999998;
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--fgcc-border);
	background: var(--fgcc-bg);
	color: var(--fgcc-text);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
	cursor: pointer;
	transition: transform 0.18s ease;
}

.fgcc-floating--right {
	left: auto;
	right: 18px;
}

.fgcc-floating:hover {
	transform: scale(1.06);
}

html.fgcc-ask .fgcc-floating {
	display: none;
}

button.fgcc-inline-link {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: var(--fgcc-link, currentColor);
	text-decoration: underline;
	cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* Segnaposto contenuti bloccati                                       */
/* ------------------------------------------------------------------ */

.fgcc-placeholder {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 180px;
	padding: 24px;
	box-sizing: border-box;
	background: #f4f5f7;
	border: 1px dashed var(--fgcc-border);
	border-radius: calc(var(--fgcc-radius) - 4px);
	text-align: center;
}

.fgcc-placeholder iframe {
	display: none;
}

.fgcc-placeholder.fgcc-unblocked {
	display: block;
	min-height: 0;
	padding: 0;
	background: none;
	border: 0;
}

.fgcc-placeholder.fgcc-unblocked .fgcc-placeholder__box {
	display: none;
}

.fgcc-placeholder.fgcc-unblocked iframe {
	display: block;
	max-width: 100%;
}

.fgcc-placeholder__title {
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 700;
	color: var(--fgcc-text);
}

.fgcc-placeholder__text {
	margin: 0 0 12px;
	font-size: 13.5px;
	color: var(--fgcc-muted);
	max-width: 420px;
}

.fgcc-placeholder__btn {
	padding: 9px 16px;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--fgcc-accent-text);
	background: var(--fgcc-accent);
	border: 0;
	border-radius: calc(var(--fgcc-radius) - 6px);
	cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 600px) {
	.fgcc-banner {
		padding: 22px 20px;
		width: calc(100vw - 20px);
		border-radius: var(--fgcc-radius);
	}

	.fgcc-root.fgcc-pos-bar .fgcc-banner,
	.fgcc-root.fgcc-pos-corner-left .fgcc-banner,
	.fgcc-root.fgcc-pos-corner-right .fgcc-banner,
	.fgcc-root.fgcc-pos-corner-left .fgcc-prefs,
	.fgcc-root.fgcc-pos-corner-right .fgcc-prefs {
		left: 10px;
		right: 10px;
		bottom: 10px;
		width: auto;
	}

	.fgcc-btn {
		flex: 1 1 100%;
	}

	.fgcc-root.fgcc-pos-corner-left .fgcc-btn,
	.fgcc-root.fgcc-pos-corner-right .fgcc-btn {
		flex: 1 1 100%;
	}

	.fgcc-prefs {
		width: calc(100vw - 20px);
		max-height: 90vh;
	}

	.fgcc-root.fgcc-pos-corner-left .fgcc-prefs,
	.fgcc-root.fgcc-pos-corner-right .fgcc-prefs {
		max-height: 86vh;
	}

	.fgcc-prefs__body,
	.fgcc-prefs__head,
	.fgcc-prefs__foot {
		padding-left: 18px;
		padding-right: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fgcc-banner,
	.fgcc-prefs,
	.fgcc-overlay {
		animation: none;
	}
}
