/* W4IT Cookie Consent - banner */

/* Valori di default: i colori scelti nel pannello arrivano da uno stile inline aggiunto dopo questo file. */
.w4cc,
.w4cc-placeholder,
.w4cc-preferences-link,
.w4cc-cookie-list {
	--w4cc-bg: #ffffff;
	--w4cc-text: #1d2327;
	--w4cc-primary: #1e5bd8;
	--w4cc-btn-text: #ffffff;
	--w4cc-radius: 8px;
	--w4cc-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.w4cc {
	font-size: 15px;
	line-height: 1.5;
}

.w4cc [hidden] {
	display: none !important;
}

.w4cc *,
.w4cc *::before,
.w4cc *::after {
	box-sizing: border-box;
}

/*
 * Reset dei pulsanti. I temi stilizzano spesso "button" con selettori più specifici
 * (button[type="button"], .entry-content button...): il prefisso #w4cc-root batte
 * quasi tutte queste regole. Per questo ogni regola sui pulsanti del banner è
 * prefissata con #w4cc-root, altrimenti verrebbe annullata da questo reset.
 */
#w4cc-root button {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.w4cc-banner,
.w4cc-prefs {
	position: fixed;
	z-index: 2147483640;
	background: var(--w4cc-bg);
	color: var(--w4cc-text);
	box-shadow: var(--w4cc-shadow);
	font-family: inherit;
}

#w4cc-root .w4cc-title {
	margin: 0 0 0.4em;
	padding: 0;
	font-size: 1.15em;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
	text-transform: none;
	letter-spacing: normal;
}

.w4cc-text {
	margin: 0;
	font-size: 0.95em;
}

.w4cc-text a,
.w4cc-policy-link {
	color: inherit;
	text-decoration: underline;
}

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

.w4cc-banner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 32px;
	padding: 24px 56px 24px 24px;
}

.w4cc-banner__body {
	flex: 1 1 420px;
	min-width: 0;
}

.w4cc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	flex: 0 1 auto;
}

.w4cc--layout-bar .w4cc-banner {
	left: 0;
	right: 0;
}

.w4cc--layout-bar.w4cc--pos-bottom .w4cc-banner {
	bottom: 0;
}

.w4cc--layout-bar.w4cc--pos-top .w4cc-banner {
	top: 0;
}

.w4cc--layout-box .w4cc-banner {
	flex-direction: column;
	align-items: stretch;
	width: 420px;
	max-width: calc(100vw - 32px);
	border-radius: var(--w4cc-radius);
	bottom: 16px;
}

.w4cc--layout-box .w4cc-banner__body {
	flex: none;
}

.w4cc--layout-box.w4cc--pos-bottom-left .w4cc-banner,
.w4cc--layout-box.w4cc--pos-bottom .w4cc-banner {
	left: 16px;
}

.w4cc--layout-box.w4cc--pos-bottom-right .w4cc-banner {
	right: 16px;
}

.w4cc--layout-box.w4cc--pos-top .w4cc-banner {
	top: 16px;
	bottom: auto;
	left: 16px;
}

.w4cc--layout-modal .w4cc-banner {
	flex-direction: column;
	align-items: stretch;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 560px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 32px);
	overflow: auto;
	border-radius: var(--w4cc-radius);
}

.w4cc--layout-modal .w4cc-banner__body {
	flex: none;
}

#w4cc-root.w4cc--layout-box .w4cc-actions .w4cc-btn,
#w4cc-root.w4cc--layout-modal .w4cc-actions .w4cc-btn {
	flex: 1 1 0;
}

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

#w4cc-root .w4cc-btn,
.w4cc-placeholder .w4cc-btn,
.w4cc-preferences-link.w4cc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin: 0;
	padding: 10px 20px;
	border: 2px solid var(--w4cc-primary) !important;
	border-radius: var(--w4cc-radius) !important;
	box-shadow: none !important;
	text-shadow: none !important;
	font-family: inherit;
	font-size: 0.95em;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-align: center;
	cursor: pointer;
	white-space: nowrap;
	transition: filter 0.15s ease;
}

/* Accetta e Rifiuta hanno volutamente lo stesso stile (pari evidenza, Garante 2021). */
#w4cc-root .w4cc-btn--primary,
.w4cc-placeholder .w4cc-btn--primary,
.w4cc-preferences-link.w4cc-btn--primary {
	background: var(--w4cc-primary) !important;
	color: var(--w4cc-btn-text) !important;
}

#w4cc-root .w4cc-btn--secondary {
	background: transparent !important;
	color: var(--w4cc-text) !important;
}

#w4cc-root .w4cc-btn:hover,
.w4cc-placeholder .w4cc-btn:hover,
.w4cc-preferences-link.w4cc-btn:hover {
	filter: brightness(1.08);
}

#w4cc-root .w4cc-btn:focus-visible,
#w4cc-root .w4cc-close:focus-visible,
#w4cc-root .w4cc-reopen:focus-visible,
.w4cc-placeholder .w4cc-btn:focus-visible,
.w4cc-switch input:focus-visible + .w4cc-switch__slider,
.w4cc-cat__cookies summary:focus-visible {
	outline: 3px solid var(--w4cc-primary);
	outline-offset: 2px;
}

#w4cc-root .w4cc-close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0 !important;
	border-radius: 50%;
	background: transparent !important;
	color: inherit !important;
	box-shadow: none !important;
}

#w4cc-root .w4cc-close:hover {
	background: rgba(127, 127, 127, 0.15) !important;
}

#w4cc-root .w4cc-close svg,
#w4cc-root .w4cc-reopen svg {
	display: block;
	flex: none;
}

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

.w4cc-overlay {
	position: fixed;
	inset: 0;
	z-index: 2147483639;
	background: rgba(0, 0, 0, 0.5);
}

.w4cc-prefs {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	width: 640px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 32px);
	border-radius: var(--w4cc-radius);
	outline: none;
}

.w4cc-prefs__header {
	position: relative;
	padding: 20px 64px 12px 24px;
	border-bottom: 1px solid rgba(127, 127, 127, 0.25);
}

#w4cc-root .w4cc-prefs__header .w4cc-title {
	margin: 0;
}

.w4cc-prefs__body {
	padding: 16px 24px;
	overflow-y: auto;
}

.w4cc-prefs__footer {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 16px 24px;
	border-top: 1px solid rgba(127, 127, 127, 0.25);
}

#w4cc-root .w4cc-prefs__footer .w4cc-btn {
	flex: 1 1 0;
}

.w4cc-cat {
	padding: 14px 0;
	border-bottom: 1px solid rgba(127, 127, 127, 0.18);
}

.w4cc-cat:last-child {
	border-bottom: 0;
}

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

.w4cc-cat__title {
	font-weight: 700;
}

.w4cc-cat__desc {
	margin: 6px 0 0;
	font-size: 0.9em;
	opacity: 0.85;
}

.w4cc-badge {
	font-size: 0.8em;
	font-weight: 600;
	color: var(--w4cc-primary);
	white-space: nowrap;
}

.w4cc-cat__cookies {
	margin-top: 8px;
	font-size: 0.85em;
}

.w4cc-cat__cookies summary {
	cursor: pointer;
	color: var(--w4cc-primary);
	font-weight: 600;
}

.w4cc-cat__cookies ul {
	margin: 8px 0 0;
	padding: 0 0 0 18px;
}

.w4cc-cat__cookies li {
	margin-bottom: 6px;
}

.w4cc-muted {
	opacity: 0.7;
}

/* ---------- Switch ---------- */

.w4cc-switch {
	position: relative;
	display: inline-block;
	flex: none;
	width: 48px;
	height: 28px;
	margin: 0;
}

#w4cc-root .w4cc-switch input {
	position: absolute;
	inset: 0;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
	z-index: 1;
	appearance: none;
}

.w4cc-switch__slider {
	position: absolute;
	inset: 0;
	border-radius: 28px;
	background: #8c8f94;
	transition: background 0.2s ease;
}

.w4cc-switch__slider::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	transition: transform 0.2s ease;
}

.w4cc-switch input:checked + .w4cc-switch__slider {
	background: var(--w4cc-primary);
}

.w4cc-switch input:checked + .w4cc-switch__slider::before {
	transform: translateX(20px);
}

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

#w4cc-root .w4cc-reopen {
	position: fixed;
	bottom: 16px;
	z-index: 2147483630;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0 !important;
	border-radius: 50%;
	background: var(--w4cc-primary) !important;
	color: var(--w4cc-btn-text) !important;
	box-shadow: var(--w4cc-shadow) !important;
}

#w4cc-root .w4cc-reopen--left {
	left: 16px;
}

#w4cc-root .w4cc-reopen--right {
	right: 16px;
}

/* ---------- Segnaposto per iframe bloccati ---------- */

.w4cc-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	width: 100%;
	min-height: 200px;
	padding: 24px;
	border-radius: 8px;
	background: #f0f0f1;
	color: #1d2327;
	text-align: center;
	font-size: 0.95em;
}

.w4cc-placeholder p {
	margin: 0;
	max-width: 480px;
}

/* ---------- Shortcode: link preferenze e tabella cookie ---------- */

.w4cc-preferences-link {
	cursor: pointer;
}

.w4cc-cookie-table {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 1.5em;
	font-size: 0.92em;
}

.w4cc-cookie-table th,
.w4cc-cookie-table td {
	padding: 8px 10px;
	border: 1px solid rgba(127, 127, 127, 0.3);
	text-align: left;
	vertical-align: top;
}

/* Colori espliciti e protetti: molti temi impostano un proprio colore (es. bianco) sui th. */
.w4cc-cookie-list table.w4cc-cookie-table thead th {
	background: var(--w4cc-primary) !important;
	color: var(--w4cc-btn-text) !important;
	border-color: var(--w4cc-primary) !important;
	font-weight: 700;
}

.w4cc-cookie-table code {
	word-break: break-all;
}

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

@media (max-width: 640px) {
	.w4cc-banner {
		padding: 20px 16px 16px;
		max-height: 85vh;
		overflow-y: auto;
	}

	.w4cc--layout-box .w4cc-banner,
	.w4cc--layout-box.w4cc--pos-bottom-right .w4cc-banner,
	.w4cc--layout-box.w4cc--pos-top .w4cc-banner {
		left: 8px;
		right: 8px;
		bottom: 8px;
		top: auto;
		width: auto;
		max-width: none;
	}

	.w4cc-banner__body {
		flex-basis: 100%;
		padding-right: 32px;
	}

	.w4cc-actions,
	.w4cc-prefs__footer {
		flex-direction: column;
		width: 100%;
	}

	#w4cc-root .w4cc-actions .w4cc-btn,
	#w4cc-root .w4cc-prefs__footer .w4cc-btn {
		flex: none;
		width: 100%;
		white-space: normal;
	}

	.w4cc-cookie-table thead {
		display: none;
	}

	.w4cc-cookie-table tr {
		display: block;
		margin-bottom: 12px;
		border: 1px solid rgba(127, 127, 127, 0.3);
	}

	.w4cc-cookie-table td {
		display: block;
		border: 0;
		border-bottom: 1px solid rgba(127, 127, 127, 0.15);
	}

	.w4cc-cookie-table td::before {
		content: attr(data-label);
		display: block;
		font-weight: 700;
		font-size: 0.85em;
	}
}

@media (prefers-reduced-motion: reduce) {
	.w4cc-switch__slider,
	.w4cc-switch__slider::before,
	#w4cc-root .w4cc-btn {
		transition: none;
	}
}
