/* Banner e preferenze cookie: palette dark/gold coerente con il tema EJDB. */

.ejdb-cc-banner,
.ejdb-cc-overlay {
	--cc-gold: #fbc02d;
	--cc-gold-light: #ffe27a;
	--cc-card: #0d1626;
	--cc-card-top: #1a2a44;
	--cc-border: rgba(255, 255, 255, 0.14);
	--cc-muted: rgba(255, 255, 255, 0.72);
	font-family: inherit;
	color: #ffffff;
}

.ejdb-cc-banner[hidden],
.ejdb-cc-overlay[hidden] {
	display: none !important;
}

/* Banner in basso: non blocca la pagina (nessun cookie wall) */
.ejdb-cc-banner {
	position: fixed;
	z-index: 1080;
	left: 1rem;
	right: 1rem;
	bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
	max-width: 1040px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 1rem 2rem;
	padding: 1.25rem 3rem 1.25rem 1.5rem;
	max-height: calc(100vh - 2rem);
	overflow-y: auto;
	background: linear-gradient(180deg, var(--cc-card-top) 0%, var(--cc-card) 100%);
	border: 1px solid var(--cc-border);
	border-top: 2px solid var(--cc-gold);
	border-radius: 14px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
	animation: ejdbCcIn 0.35s ease-out;
}

@keyframes ejdbCcIn {
	from { opacity: 0; transform: translateY(16px); }
	to { opacity: 1; transform: none; }
}

.ejdb-cc-body h2 {
	margin: 0 0 0.4rem;
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--cc-gold);
}
.ejdb-cc-body p {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.55;
	color: var(--cc-muted);
}
.ejdb-cc-body a {
	color: var(--cc-gold-light);
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}
.ejdb-cc-body a:hover {
	color: #ffffff;
}

.ejdb-cc-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.6rem;
}

.ejdb-cc-btn {
	appearance: none;
	min-width: 8.5rem;
	padding: 0.65rem 1.1rem;
	border-radius: 999px;
	border: 1px solid transparent;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ejdb-cc-btn:hover {
	transform: translateY(-1px);
}
/* "Accetta" e "Rifiuta" hanno stessa dimensione e stesso peso visivo */
.ejdb-cc-btn--primary {
	background: var(--cc-gold);
	border-color: var(--cc-gold);
	color: #1a1204;
}
.ejdb-cc-btn--primary:hover {
	background: var(--cc-gold-light);
	border-color: var(--cc-gold-light);
}
.ejdb-cc-btn--secondary {
	background: #ffffff;
	border-color: #ffffff;
	color: #0a0f1e;
}
.ejdb-cc-btn--secondary:hover {
	background: #e6ecf7;
	border-color: #e6ecf7;
}
.ejdb-cc-btn--ghost {
	background: transparent;
	border-color: var(--cc-border);
	color: #ffffff;
}
.ejdb-cc-btn--ghost:hover {
	border-color: var(--cc-gold);
	color: var(--cc-gold-light);
}

.ejdb-cc-btn:focus-visible,
.ejdb-cc-close:focus-visible,
.ejdb-cc-body a:focus-visible,
.ejdb-cc-switch input:focus-visible + .ejdb-cc-slider {
	outline: 3px solid var(--cc-gold-light);
	outline-offset: 2px;
}

.ejdb-cc-close {
	position: absolute;
	top: 0.6rem;
	right: 0.7rem;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--cc-muted);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}
.ejdb-cc-close:hover {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.1);
}

/* Pannello preferenze */
.ejdb-cc-overlay {
	position: fixed;
	inset: 0;
	z-index: 1090;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(4, 8, 16, 0.78);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}
.ejdb-cc-modal {
	position: relative;
	width: 100%;
	max-width: 640px;
	max-height: calc(100vh - 2rem);
	overflow-y: auto;
	padding: 1.75rem 1.75rem 1.5rem;
	background: linear-gradient(180deg, var(--cc-card-top) 0%, var(--cc-card) 100%);
	border: 1px solid var(--cc-border);
	border-top: 2px solid var(--cc-gold);
	border-radius: 14px;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
	animation: ejdbCcIn 0.25s ease-out;
}
.ejdb-cc-modal h2 {
	margin: 0 2rem 0.5rem 0;
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--cc-gold);
}
.ejdb-cc-intro {
	margin: 0 0 1rem;
	font-size: 0.875rem;
	line-height: 1.55;
	color: var(--cc-muted);
}
.ejdb-cc-cat {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1.25rem;
	padding: 1rem 0;
	border-top: 1px solid var(--cc-border);
}
.ejdb-cc-cat:last-of-type {
	margin-bottom: 1rem;
	border-bottom: 1px solid var(--cc-border);
}
.ejdb-cc-cat h3 {
	margin: 0 0 0.25rem;
	font-size: 1rem;
	font-weight: 700;
	color: #ffffff;
}
.ejdb-cc-cat p {
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.5;
	color: var(--cc-muted);
}
.ejdb-cc-always {
	flex: none;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	border: 1px solid rgba(251, 192, 45, 0.45);
	background: rgba(251, 192, 45, 0.1);
	color: var(--cc-gold-light);
	font-size: 0.75rem;
	font-weight: 700;
	white-space: nowrap;
}
.ejdb-cc-modal .ejdb-cc-actions {
	justify-content: flex-end;
}
.ejdb-cc-cat + .ejdb-cc-actions {
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid var(--cc-border);
}

/* Interruttore */
.ejdb-cc-switch {
	position: relative;
	flex: none;
	display: inline-block;
	width: 3rem;
	height: 1.65rem;
	margin: 0;
	cursor: pointer;
}
.ejdb-cc-switch input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}
.ejdb-cc-slider {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.22);
	border: 1px solid var(--cc-border);
	transition: background-color 0.2s ease;
	pointer-events: none;
}
.ejdb-cc-slider::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 0.2rem;
	width: 1.15rem;
	height: 1.15rem;
	margin-top: -0.575rem;
	border-radius: 50%;
	background: #ffffff;
	transition: transform 0.2s ease;
}
.ejdb-cc-switch input:checked + .ejdb-cc-slider {
	background: var(--cc-gold);
	border-color: var(--cc-gold);
}
.ejdb-cc-switch input:checked + .ejdb-cc-slider::before {
	transform: translateX(1.32rem);
	background: #1a1204;
}

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

html.ejdb-cc-lock {
	overflow: hidden;
}

@media (max-width: 800px) {
	.ejdb-cc-banner {
		grid-template-columns: minmax(0, 1fr);
		left: 0.5rem;
		right: 0.5rem;
		bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
		padding: 1rem 2.75rem 1rem 1rem;
		max-height: 78vh;
	}
	.ejdb-cc-actions {
		display: grid;
		grid-template-columns: 1fr 1fr;
	}
	.ejdb-cc-actions .ejdb-cc-btn--ghost {
		grid-column: 1 / -1;
		order: 3;
	}
	.ejdb-cc-btn {
		min-width: 0;
		width: 100%;
	}
	.ejdb-cc-modal {
		padding: 1.25rem 1rem 1rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ejdb-cc-banner,
	.ejdb-cc-modal {
		animation: none;
	}
	.ejdb-cc-btn,
	.ejdb-cc-slider,
	.ejdb-cc-slider::before {
		transition: none;
	}
}
