/* ==========================================================================
   Avvisi in basso a destra.

   Foglio a sé perché serve sia alle pagine di accesso sia all'area personale,
   che hanno fogli di stile separati.
   ========================================================================== */
.alerts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  width: min(360px, calc(100vw - 40px));
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 14px 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted-2);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(31, 41, 51, 0.16);
  animation: alert-in 0.22s ease-out both;
}

.alert--ok     { border-left-color: var(--primary); }
.alert--errore { border-left-color: var(--danger); }
.alert--info   { border-left-color: var(--accent); }

.alert__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  background: var(--muted-2);
}
.alert--ok .alert__mark     { background: var(--primary); }
.alert--errore .alert__mark { background: var(--danger); }
.alert--info .alert__mark   { background: var(--accent); }

.alert__text {
  flex: 1;
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-2);
}

.alert__close {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--muted-2);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.alert__close:hover { color: var(--ink-2); background: var(--bg); }

/* Uscita: la classe la mette il JS, e il nodo sparisce a transizione finita. */
.alert.is-leaving {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes alert-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .alert { animation: none; }
  .alert.is-leaving { transition: none; }
}

@media (max-width: 900px) {
  /* Sopra la barra di navigazione in basso, che altrimenti li copre. */
  .alerts { right: 12px; left: 12px; bottom: 92px; width: auto; }
}
