/*
	Cookie consent "light" di Atelier.
	Vedi .docs/COOKIE_CONSENT.md per l'architettura completa.
*/

#cc-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.55);
	z-index: 100000;
	display: none;
	justify-content: center;
	align-items: center;
	padding: 1rem;
	box-sizing: border-box;
}

#cc-panel {
	position: relative;
	background-color: #fff;
	color: #333;
	width: 42rem;
	max-width: 95%;
	max-height: 90vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	border-radius: 0.6rem;
	box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.35);
	padding: 2rem;
	box-sizing: border-box;
	font-family: "Roboto", Arial, Helvetica, sans-serif;
	font-size: 1rem;
	line-height: 1.5;
}

/* #cc-main/#cc-settings: uno solo alla volta è "flex" (l'altro "none", via JS), il
   visibile riempie tutta l'altezza disponibile del panel. Dentro, solo il testo/le
   scelte (contenuto variabile) scorrono internamente: titolo e pulsanti restano
   sempre visibili, così il popup non supera mai l'altezza dello schermo. */
#cc-main, #cc-settings {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
}

#cc-main-text, #cc-choices {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
}

#cc-settings > p {
	flex-shrink: 0;
	margin: 0 0 0.8rem 0;
	font-size: 0.9rem;
	color: #555;
}

#cc-close {
	position: absolute;
	top: 0.8rem;
	right: 0.8rem;
	width: 2.2rem;
	height: 2.2rem;
	border: none;
	background: transparent;
	font-size: 1.6rem;
	line-height: 1;
	color: #888;
	cursor: pointer;
}
#cc-close:hover { color: #333; }

#cc-main h2,
#cc-settings h3 {
	flex-shrink: 0;
	margin: 0 0 1rem 0;
	padding-right: 2rem;
	font-size: 1.3rem;
	color: #222;
}

#cc-main-text p {
	margin: 0 0 0.8rem 0;
	font-size: 0.9rem;
	color: #555;
}
#cc-main-text p a,
#cc-settings p a,
.cc-choice-text p a {
	color: #0056b3;
	text-decoration: underline;
}

/* Pulsanti Accetta/Rifiuta a PARI dignità grafica (stessa dimensione, stesso peso visivo,
   cambia solo il colore). Non è consentito rendere il rifiuto visivamente secondario
   rispetto all'accettazione (linee guida Garante Privacy 2021) — vale solo per questi due,
   "Personalizza" è una terza azione (di servizio) e può restare più piccola.
   justify-content:space-between con Rifiuta(order:1)/Personalizza(order:2)/Accetta(order:3)
   centra Personalizza tra i due, senza doverlo raggruppare a fianco di uno dei due. */
.cc-buttons {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.6rem;
	margin-top: 1.5rem;
	flex-shrink: 0;
}
.cc-buttons-settings { justify-content: space-between; }

.cc-btn {
	flex: 0 0 auto;
	min-width: 9rem;
	padding: 0.8rem 1.2rem;
	border: none;
	border-radius: 0.35rem;
	font-size: 1rem;
	line-height: 1.2;
	cursor: pointer;
	text-align: center;
	transition: opacity 0.15s ease;
}
.cc-btn:hover { opacity: 0.85; }

.cc-btn-primary {
	background-color: #0056b3;
	color: #fff;
	order: 3;
}
.cc-btn-secondary {
	background-color: #6c757d;
	color: #fff;
	order: 1;
}
.cc-btn-link {
	flex: 0 0 auto;
	background: transparent;
	border: none;
	color: #0056b3;
	text-decoration: underline;
	font-size: 0.9rem;
	cursor: pointer;
	padding: 0.8rem 0.4rem;
	order: 2;
}
/* "Personalizza" (e "Torna indietro" nel pannello di dettaglio, stesso stile): azione
   terziaria, volutamente più piccola (circa metà) e grigia — centrata tra Rifiuta e
   Accetta grazie a justify-content:space-between su .cc-buttons. */
.cc-btn-tertiary {
	order: 2;
	flex: 0 0 auto;
	background-color: #d9d9d9;
	color: #444;
	border: none;
	border-radius: 0.35rem;
	padding: 0.4rem 0.9rem;
	font-size: 0.85rem;
	line-height: 1.2;
	cursor: pointer;
	transition: opacity 0.15s ease;
}
.cc-btn-tertiary:hover { opacity: 0.85; }

#cc-choices { margin-top: 1rem; }

.cc-choice {
	display: flex;
	align-items: flex-start;
	gap: 1rem;
	padding: 0.8rem 0;
	border-bottom: 1px solid #eee;
}
.cc-choice:last-child { border-bottom: none; }

.cc-choice-text strong { display: block; margin-bottom: 0.2rem; font-size: 0.95rem; }
.cc-choice-text p { margin: 0; font-size: 0.85rem; color: #555; }

.cc-switch {
	position: relative;
	display: inline-block;
	width: 2.8rem;
	height: 1.5rem;
	flex-shrink: 0;
	margin-top: 0.1rem;
}
.cc-switch input { opacity: 0; width: 0; height: 0; }
.cc-slider {
	position: absolute;
	cursor: pointer;
	top: 0; left: 0; right: 0; bottom: 0;
	background-color: #ccc;
	border-radius: 3rem;
	transition: 0.2s;
}
.cc-slider::before {
	position: absolute;
	content: "";
	height: 1.1rem;
	width: 1.1rem;
	left: 0.2rem;
	bottom: 0.2rem;
	background-color: #fff;
	border-radius: 50%;
	transition: 0.2s;
}
.cc-switch input:checked + .cc-slider { background-color: #2e7d32; }
.cc-switch input:checked + .cc-slider::before { transform: translateX(1.3rem); }

#cc-icon {
	position: fixed;
	bottom: 1.5rem;
	left: 1.5rem;
	width: 3.2rem;
	height: 3.2rem;
	background-color: #0056b3;
	color: #fff;
	border-radius: 50%;
	display: none;
	justify-content: center;
	align-items: center;
	cursor: pointer;
	z-index: 99999;
	box-shadow: 0 0.2rem 0.6rem rgba(0, 0, 0, 0.3);
	font-size: 1.8rem;
}
#cc-icon:hover { background-color: #09a30c; }

@media (max-width: 480px) {
	#cc-panel { padding: 1.4rem; }
	.cc-buttons { flex-direction: column; align-items: stretch; justify-content: flex-start; }
	.cc-btn { width: 100%; }
	.cc-btn-link { order: 2; text-align: center; width: 100%; }
	.cc-btn-tertiary { width: 100%; }
}
