/* ── Global toast notification component ──────────────────────────────────────
   Toasts are injected by showToast() in client.js and rendered in
   the #toastContainer div from partials/footer.ejs.

   Usage (JS):
     showToast({ title: 'Lagret', sub: 'Innstillinger er oppdatert', type: 'success' })
     showToast({ title: 'Feil', sub: 'Prøv igjen', type: 'error' })

   Types: success | error | warning | info
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Container: top-right stack ─────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  pointer-events: none;
  width: 300px;
  max-width: calc(100vw - 2rem);
}

/* ── Toast card ─────────────────────────────────────────────────────────────── */

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 0.85rem;
  border-radius: 10px;
  background: var(--surface-1, #1e1e1e);
  border: 1px solid var(--border, rgba(255,255,255,0.09));
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45),
              0 2px  8px rgba(0, 0, 0, 0.25);
  pointer-events: all;
  animation: sk-toast-in 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
  overflow: hidden;
  position: relative;
}

/* ── Left accent bar ────────────────────────────────────────────────────────── */

.toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  border-radius: 10px 0 0 10px;
}

.toast.success::before { background: #4ade80; }
.toast.error::before   { background: #f87171; }
.toast.warning::before { background: #fbbf24; }
.toast.info::before    { background: #60a5fa; }

/* ── Icon ───────────────────────────────────────────────────────────────────── */

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
  line-height: 1;
}

.toast.success .toast-icon { color: #4ade80; }
.toast.error   .toast-icon { color: #f87171; }
.toast.warning .toast-icon { color: #fbbf24; }
.toast.info    .toast-icon { color: #60a5fa; }

/* ── Content area ───────────────────────────────────────────────────────────── */

.toast-body {
  flex: 1;
  min-width: 0;
  padding-left: 0.05rem;
}

.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text, #f1f1f1);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-sub {
  font-size: 0.775rem;
  color: var(--text-dim, #888);
  margin-top: 0.05rem;
  line-height: 1.2;
}

/* ── Close button ───────────────────────────────────────────────────────────── */

.toast-close {
  background: none;
  border: none;
  color: var(--text-dim, #888);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  margin-top: 1px;
  transition: color 0.15s;
}

.toast-close:hover { color: var(--text, #f1f1f1); }

/* ── Entrance animation ─────────────────────────────────────────────────────── */

@keyframes sk-toast-in {
  from { opacity: 0; transform: translateX(18px) scale(0.97); }
  to   { opacity: 1; transform: translateX(0)    scale(1); }
}

/* ── Mobile: stack from bottom-right ────────────────────────────────────────── */

@media (max-width: 480px) {
  .toast-container {
    top: auto;
    bottom: 1rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    max-width: 100%;
  }
}
