/* ==========================================================================
   Notificări (toast) — mesajele de succes / eroare / avertisment / info.

   Înlocuiesc Lobibox, care era încărcat global doar pentru asta. Randarea se face
   din js/main.js (_generateAlert), a cărei semnătură a rămas neschimbată — toate
   cele ~274 de apeluri din aplicație merg mai departe fără modificări.

   Încărcat global din base.html.twig și din pagina de login (care nu extinde base).
   ========================================================================== */

.cf-toasts {
	position: fixed;
	top: 16px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	width: 420px;
	max-width: calc(100vw - 32px);
	/* Peste modalele Bootstrap (1055) și peste backdrop: un mesaj de eroare apărut
	   în timpul unui modal TREBUIE să fie vizibil. Vechiul cod „rezolva” asta
	   ștergând notificările la deschiderea modalului — adică ascundea problema. */
	z-index: 1090;
	pointer-events: none;
}

.cf-toast {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 12px;
	width: 100%;
	padding: 14px 14px 14px 16px;
	background: #fff;
	border: 1px solid var(--cf-line, #e2e8ee);
	border-left: 3px solid var(--cf-toast-accent);
	border-radius: 10px;
	box-shadow: 0 4px 6px rgba(16, 40, 60, .04), 0 12px 32px rgba(16, 40, 60, .14);
	overflow: hidden;
	pointer-events: auto;
	/* Notificările apar sus-centrat, deci intrarea coboară de sus, nu dinspre lateral. */
	animation: cf-toast-in .22s cubic-bezier(.16, 1, .3, 1);
}

/* Ieșirea e pusă din JS, ca elementul să se scoată din DOM abia la final. */
.cf-toast--out {
	animation: cf-toast-out .18s ease forwards;
}

@keyframes cf-toast-in {
	from { opacity: 0; transform: translateY(-16px); }
	to   { opacity: 1; transform: translateY(0); }
}
@keyframes cf-toast-out {
	from { opacity: 1; transform: translateY(0); max-height: 200px; }
	to   { opacity: 0; transform: translateY(-12px); max-height: 0; margin-top: -10px; }
}

/* ---------- Variante ---------- */
.cf-toast--success { --cf-toast-accent: #4b7d19; --cf-toast-soft: #eaf4e1; }
.cf-toast--error   { --cf-toast-accent: #c0392b; --cf-toast-soft: #fdecec; }
.cf-toast--warning { --cf-toast-accent: #b8860b; --cf-toast-soft: #fdf3e3; }
.cf-toast--info    { --cf-toast-accent: #134a6d; --cf-toast-soft: #e9f0f5; }

.cf-toast__icon {
	display: grid;
	place-items: center;
	flex: 0 0 30px;
	width: 30px;
	height: 30px;
	border-radius: 8px;
	background: var(--cf-toast-soft);
	color: var(--cf-toast-accent);
	font-size: 13px;
}

.cf-toast__body {
	flex: 1 1 auto;
	min-width: 0;
}
.cf-toast__title {
	display: block;
	margin-bottom: 2px;
	font-size: 13px;
	font-weight: 700;
	color: #14293a;
	line-height: 1.35;
}
.cf-toast__message {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 12.5px;
	line-height: 1.5;
	color: #5b6c79;
	word-break: break-word;
}
/* Mai multe erori de câmp într-un singur mesaj: listă, nu un paragraf lipit. */
.cf-toast__message li { position: relative; padding-left: 12px; }
.cf-toast__message li + li { margin-top: 3px; }
.cf-toast__message li::before {
	content: "";
	position: absolute;
	top: 8px;
	left: 0;
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: #c3ced7;
}
.cf-toast__message li:only-child { padding-left: 0; }
.cf-toast__message li:only-child::before { display: none; }

.cf-toast__close {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: #b9c5cf;
	font-size: 11px;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}
.cf-toast__close:hover { background: #f1f4f7; color: #5b6c79; }

/* Bara de timp: arată cât mai stă mesajul. Se oprește la hover (clasă din JS),
   ca utilizatorul să poată citi un mesaj lung fără să fugă. */
.cf-toast__progress {
	position: absolute;
	left: 0;
	bottom: 0;
	height: 2px;
	width: 100%;
	background: var(--cf-toast-accent);
	opacity: .35;
	transform-origin: left center;
	animation: cf-toast-progress linear forwards;
}
.cf-toast--paused .cf-toast__progress { animation-play-state: paused; }

@keyframes cf-toast-progress {
	from { transform: scaleX(1); }
	to   { transform: scaleX(0); }
}

/* Mesajele persistente (erori) n-au bară de timp: rămân până le închizi. */
.cf-toast--sticky .cf-toast__progress { display: none; }

@media (max-width: 575.98px) {
	.cf-toasts {
		top: 10px;
		width: calc(100vw - 24px);
	}
}

/* Respectă preferința de sistem „mai puțină mișcare”. */
@media (prefers-reduced-motion: reduce) {
	.cf-toast,
	.cf-toast--out,
	.cf-toast__progress { animation: none; }
}
