/* Feedback shared by the console and the Django admin: the busy button spinner (submit.js)
   and toasts (toast.js). They use the tokens from app.css, or from admin.css in the admin. */

.spin {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================================
   Toasts: bottom right, newest at the bottom, three at most (toast.js).
   ========================================================================= */

.toast-region {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  --tone: var(--brand);
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem 0.75rem 0.75rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--tone);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-menu);
  font-size: 14px;
  color: var(--text);
  pointer-events: auto;
  animation: toast-in 0.18s ease;
}
.toast > .icon {
  flex: 0 0 16px;
  margin-top: 2px;
  color: var(--tone);
}
.toast-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.toast-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: -2px -2px 0 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}
.toast-close:hover {
  background: var(--surface-muted);
  color: var(--text);
}
.toast-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.toast.is-success {
  --tone: var(--success);
}
.toast.is-warning {
  --tone: var(--warning);
}
.toast.is-error {
  --tone: var(--danger);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 639px) {
  .toast-region {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spin,
  .toast {
    animation: none;
  }
}
