/**
 * CTX Consent — stiluri.
 *
 * Culorile trec prin variabile, ca să poată fi aliniate la temă dintr-un
 * singur loc, fără a atinge restul regulilor.
 */

:root {
	--ctx-consent-bg: #ffffff;
	--ctx-consent-fg: #1d2327;
	--ctx-consent-muted: #5b6470;
	--ctx-consent-border: #d8dde3;
	--ctx-consent-accent: #115cfa;
	--ctx-consent-accent-fg: #ffffff;
	--ctx-consent-radius: 6px;
}

/* --------------------------------------------------------------- bannerul */

.ctx-consent[hidden],
.ctx-consent-reopen[hidden] {
	display: none;
}

.ctx-consent {
	position: fixed;
	inset: auto 0 0 0;
	z-index: 99999;
	display: flex;
	justify-content: center;
	padding: 1rem;
	background: rgba( 15, 20, 26, 0.45 );
}

@supports ( backdrop-filter: blur( 2px ) ) {
	.ctx-consent {
		inset: 0;
		align-items: flex-end;
		backdrop-filter: blur( 2px );
	}
}

.ctx-consent__dialog {
	width: 100%;
	max-width: 42rem;
	max-height: calc( 100vh - 2rem );
	overflow-y: auto;
	padding: 1.5rem;
	border-radius: var( --ctx-consent-radius );
	background: var( --ctx-consent-bg );
	color: var( --ctx-consent-fg );
	box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.25 );
	font-size: 0.95rem;
	line-height: 1.5;
}

.ctx-consent__title {
	margin: 0 0 0.5rem;
	font-size: 1.1rem;
	line-height: 1.3;
}

.ctx-consent__body {
	margin: 0 0 1rem;
	color: var( --ctx-consent-muted );
}

/*
 * Cele trei butoane au aceeași lățime și aceeași greutate vizuală: refuzul
 * trebuie să fie la fel de ușor ca acceptul, nu ascuns într-un submeniu.
 * `flex: 1 1 0` le forțează egale indiferent de lungimea textului.
 */
.ctx-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.ctx-consent__btn {
	flex: 1 1 0;
	min-width: 9rem;
	padding: 0.7rem 1rem;
	border: 1px solid var( --ctx-consent-border );
	border-radius: var( --ctx-consent-radius );
	background: var( --ctx-consent-bg );
	color: var( --ctx-consent-fg );
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}

/*
 * Acceptul și refuzul primesc exact același tratament vizual, nu doar aceeași
 * lățime. Cerința legală e ca refuzul să fie la fel de ușor ca acceptul, iar un
 * buton colorat lângă unul palid înclină alegerea chiar dacă dimensiunile
 * coincid. „Vezi preferințele" și „Salvează preferințele" sunt acțiuni de
 * navigare, deci rămân secundare — altfel ar exista două butoane primare
 * concurente în același ecran.
 */
.ctx-consent__btn--accept,
.ctx-consent__btn--deny {
	border-color: var( --ctx-consent-accent );
	background: var( --ctx-consent-accent );
	color: var( --ctx-consent-accent-fg );
}

.ctx-consent__btn:hover,
.ctx-consent__btn:focus-visible {
	filter: brightness( 0.95 );
}

.ctx-consent__btn:focus-visible,
.ctx-consent__switch input:focus-visible + .ctx-consent__switch-ui {
	outline: 2px solid var( --ctx-consent-accent );
	outline-offset: 2px;
}

.ctx-consent__links {
	margin: 0.85rem 0 0;
	font-size: 0.85rem;
}

.ctx-consent__links a {
	color: var( --ctx-consent-muted );
}

/* ------------------------------------------------------ panoul de preferințe */

.ctx-consent__prefs {
	margin: 0 0 1rem;
	border-top: 1px solid var( --ctx-consent-border );
}

.ctx-consent__pref {
	padding: 0.85rem 0;
	border-bottom: 1px solid var( --ctx-consent-border );
}

.ctx-consent__pref-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.ctx-consent__switch {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	cursor: pointer;
}

.ctx-consent__switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.ctx-consent__switch-ui {
	position: relative;
	flex: none;
	width: 2.4rem;
	height: 1.35rem;
	border-radius: 1rem;
	background: #c4cad2;
}

.ctx-consent__switch-ui::after {
	content: '';
	position: absolute;
	top: 0.175rem;
	left: 0.175rem;
	width: 1rem;
	height: 1rem;
	border-radius: 50%;
	background: #ffffff;
}

.ctx-consent__switch input:checked + .ctx-consent__switch-ui {
	background: var( --ctx-consent-accent );
}

.ctx-consent__switch input:checked + .ctx-consent__switch-ui::after {
	left: auto;
	right: 0.175rem;
}

.ctx-consent__switch input:disabled + .ctx-consent__switch-ui {
	background: #9aa3ad;
	cursor: not-allowed;
}

/*
 * Un comutator blocat pe „pornit" trebuie să arate pornit. Regula de mai sus,
 * aplicată singură, îl făcea gri — adică vizual identic cu unul oprit, exact
 * pe categoria despre care îi spunem vizitatorului că e mereu activă.
 */
.ctx-consent__switch input:checked:disabled + .ctx-consent__switch-ui {
	background: var( --ctx-consent-accent );
	opacity: 0.5;
}

.ctx-consent__pref-label {
	font-weight: 600;
}

.ctx-consent__always {
	flex: none;
	font-size: 0.8rem;
	color: var( --ctx-consent-muted );
}

.ctx-consent__pref-desc {
	margin: 0.4rem 0 0;
	font-size: 0.85rem;
	color: var( --ctx-consent-muted );
}

@media ( prefers-reduced-motion: no-preference ) {
	.ctx-consent__switch-ui,
	.ctx-consent__switch-ui::after {
		transition: background 140ms ease, left 140ms ease, right 140ms ease;
	}
}

/* -------------------------------------------- redeschiderea setărilor */

.ctx-consent-reopen {
	position: fixed;
	left: 1rem;
	bottom: 1rem;
	z-index: 9999;
	padding: 0.45rem 0.8rem;
	border: 1px solid var( --ctx-consent-border );
	border-radius: var( --ctx-consent-radius );
	background: var( --ctx-consent-bg );
	color: var( --ctx-consent-muted );
	font: inherit;
	font-size: 0.8rem;
	cursor: pointer;
	opacity: 0.85;
}

.ctx-consent-reopen:hover,
.ctx-consent-reopen:focus-visible {
	opacity: 1;
}

/*
 * Pe ecrane mici, bannerul ajungea la 95% din ecran: trei butoane pe câte un
 * rând întreg, plus descrierile celor trei categorii. Aici îl aducem sub trei
 * sferturi din înălțime, ținem acceptul și refuzul pe același rând și lipim
 * bara de acțiuni de baza panoului, ca alegerea să fie mereu la un deget
 * distanță indiferent cât derulezi prin explicații.
 */
@media ( max-width: 640px ) {
	.ctx-consent {
		padding: 0.75rem;
	}

	.ctx-consent__dialog {
		max-height: 72vh;
		padding: 1.15rem;
		font-size: 0.9rem;
	}

	.ctx-consent__title {
		font-size: 1.05rem;
	}

	.ctx-consent__body {
		margin-bottom: 0.75rem;
		font-size: 0.85rem;
	}

	.ctx-consent__prefs {
		margin-bottom: 0.5rem;
	}

	.ctx-consent__pref {
		padding: 0.6rem 0;
	}

	.ctx-consent__pref-desc {
		margin-top: 0.3rem;
		font-size: 0.8rem;
	}

	.ctx-consent__actions {
		position: sticky;
		bottom: 0;
		padding: 0.6rem 0 0.15rem;
		background: var( --ctx-consent-bg );
		box-shadow: 0 -10px 12px -10px rgba( 0, 0, 0, 0.22 );
	}

	.ctx-consent__btn {
		min-width: 0;
		flex-basis: calc( 50% - 0.25rem );
		padding: 0.6rem 0.75rem;
	}

	/* Salvarea trece pe rândul ei: e o a treia acțiune, nu una simetrică. */
	.ctx-consent__btn--save {
		flex-basis: 100%;
	}

	.ctx-consent__links {
		margin-top: 0.5rem;
		font-size: 0.8rem;
	}

	.ctx-consent-reopen {
		font-size: 0.75rem;
	}
}

/* ------------------------------------- tabelul din politica de cookie-uri */

.ctx-consent-table__group {
	margin: 2rem 0 0.4rem;
}

.ctx-consent-table__intro {
	margin: 0 0 1rem;
	color: var( --ctx-consent-muted );
}

.ctx-consent-service {
	margin: 0 0 1.5rem;
}

.ctx-consent-service__name {
	margin: 0 0 0.25rem;
}

.ctx-consent-service__meta,
.ctx-consent-service__note {
	margin: 0 0 0.6rem;
	font-size: 0.9rem;
	color: var( --ctx-consent-muted );
}

/* Tabelele largi derulează în containerul lor, nu duc pagina pe orizontală. */
.ctx-consent-table__scroll {
	overflow-x: auto;
}

.ctx-consent-cookies {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.ctx-consent-cookies th,
.ctx-consent-cookies td {
	padding: 0.55rem 0.7rem;
	border-bottom: 1px solid var( --ctx-consent-border );
	text-align: left;
	vertical-align: top;
}

.ctx-consent-cookies th {
	white-space: nowrap;
	font-weight: 600;
}

.ctx-consent-cookies td:nth-child( 1 ),
.ctx-consent-cookies td:nth-child( 2 ) {
	white-space: nowrap;
}

.ctx-consent-cookies code {
	font-size: 0.85em;
	word-break: break-all;
}

/* ---------------------------------------------- click-to-load peste servicii */

.ctx-consent-blocked {
	position: relative;
	min-height: 260px;
	background: #eef1f4;
}

.ctx-consent-placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 1.5rem;
	text-align: center;
	background: #eef1f4;
	color: var(--ctx-consent-fg);
}

.ctx-consent-placeholder__title {
	margin: 0;
	font-weight: 600;
}

.ctx-consent-placeholder__body {
	margin: 0;
	max-width: 42ch;
	font-size: 0.9rem;
	line-height: 1.45;
	color: var(--ctx-consent-muted);
}

.ctx-consent-placeholder__button {
	margin-top: 0.35rem;
	padding: 0.6rem 1.25rem;
	border: 0;
	border-radius: var(--ctx-consent-radius);
	background: var(--ctx-consent-accent);
	color: var(--ctx-consent-accent-fg);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.ctx-consent-placeholder__button:hover,
.ctx-consent-placeholder__button:focus-visible {
	filter: brightness( 0.92 );
}

@media ( prefers-reduced-motion: no-preference ) {
	.ctx-consent-placeholder__button {
		transition: filter 120ms ease;
	}
}
