/* Toast — flyktige notifikasjoner som dukker opp nede til høyre.
 *
 * Erstatter `alert()`-kall i hele kodebasen — bedre UX, blokkerer ikke
 * interaksjon med siden, fjerner seg selv automatisk. Brukes via
 * window.Toast.ok(msg) / window.Toast.feil(msg) / window.Toast.info(msg).
 *
 * Detaljer i docs/05-frontend.md §10.4.
 */

.toast-container {
  position: fixed;
  bottom: var(--avstand-4);
  right: var(--avstand-4);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--avstand-2);
  pointer-events: none;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--avstand-2);
  padding: var(--avstand-3) var(--avstand-4);
  background: var(--farge-tekst);
  color: var(--farge-bakgrunn);
  border-radius: var(--radius-stor);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  font-size: var(--font-base);
  line-height: 1.4;
  animation: toast-inn 0.18s ease-out;
  border-left: 3px solid var(--farge-tekst-svak);
}

.toast--ok   { border-left-color: var(--farge-ok); }
.toast--feil { border-left-color: var(--farge-feil); }
.toast--info { border-left-color: var(--farge-primary); }

.toast__ikon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.toast--ok .toast__ikon   { color: var(--farge-ok); }
.toast--feil .toast__ikon { color: var(--farge-feil); }
.toast--info .toast__ikon { color: var(--farge-primary); }

.toast__melding {
  flex: 1;
  word-break: break-word;
}

.toast__lukk {
  flex: none;
  background: transparent;
  border: 0;
  color: inherit;
  opacity: 0.6;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.toast__lukk:hover { opacity: 1; }

.toast.toast--lukker {
  animation: toast-ut 0.16s ease-out forwards;
}

@keyframes toast-inn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-ut {
  to { opacity: 0; transform: translateY(8px); }
}
