/* Toasts: short messages that slide in at the top right. Reusable: put .ez_toast inside .ez_toasts (the #notice-area
   region in the shell). Colour: .ez_toast--success|info|warning|danger. Sticky or self-closing: data-ez-sticky. */
.ez_toasts {
  position: fixed;
  inset-block-start: 4.75rem; /* below the top bar, which holds the account menu */
  inset-inline-end: var(--ez-space-4);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--ez-space-2);
  width: min(26rem, calc(100vw - 2 * var(--ez-space-4)));
  pointer-events: none; /* the empty region must not block clicks beneath it */
}

.ez_toast {
  --ez-toast-accent: var(--ez-color-on-info-container);

  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--ez-space-3);
  overflow: hidden;
  padding: var(--ez-space-3) var(--ez-space-3) var(--ez-space-3) var(--ez-space-4);
  background: var(--ez-color-surface);
  color: var(--ez-color-text-primary);
  border: 1px solid var(--ez-color-border);
  border-inline-start: 0.25rem solid var(--ez-toast-accent);
  border-radius: var(--ez-radius-md);
  box-shadow: var(--ez-shadow-lg);
  pointer-events: auto;
  animation: ez-toast-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ez_toast--success { --ez-toast-accent: var(--ez-color-success); }
.ez_toast--warning { --ez-toast-accent: var(--ez-color-on-warning-container); }
.ez_toast--danger { --ez-toast-accent: var(--ez-color-danger); }

.ez_toast__icon {
  display: inline-flex;
  flex: none;
  color: var(--ez-toast-accent);
}

.ez_toast__icon .ez_icon { inline-size: 1.375rem; block-size: 1.375rem; }

.ez_toast__body { flex: 1; min-width: 0; }
.ez_toast__title { font-weight: var(--ez-font-weight-medium); }
.ez_toast__message { margin-block-start: 0.125rem; color: var(--ez-color-text-muted); overflow-wrap: anywhere; }

.ez_toast__close {
  display: inline-flex;
  flex: none;
  padding: 0.25rem;
  background: none;
  border: 0;
  border-radius: var(--ez-radius-sm);
  color: var(--ez-color-text-muted);
  cursor: pointer;
}
.ez_toast__close .ez_icon { inline-size: 1rem; block-size: 1rem; }
.ez_toast__close:hover, .ez_toast__close:focus-visible { background: var(--ez-color-surface-container-high); color: var(--ez-color-text-primary); }

/* The shrinking bar shows how long a self-closing toast has left; JS sets --ez-toast-ms. */
.ez_toast__timer {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  height: 0.1875rem;
  background: var(--ez-toast-accent);
  opacity: 0.45;
  transform-origin: left;
  display: none;
}
.ez_toast[data-ez-timed] .ez_toast__timer { display: block; animation: ez-toast-timer var(--ez-toast-ms, 6000ms) linear forwards; }
.ez_toast[data-ez-timed]:hover .ez_toast__timer { animation-play-state: paused; }

.ez_toast--leaving { animation: ez-toast-out 220ms ease-in forwards; }

@keyframes ez-toast-in {
  from { opacity: 0; transform: translateX(1.5rem); }
  to { opacity: 1; transform: none; }
}
@keyframes ez-toast-out {
  to { opacity: 0; transform: translateX(110%); }
}
@keyframes ez-toast-timer {
  to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .ez_toast, .ez_toast--leaving { animation-duration: 1ms; }
  .ez_toast[data-ez-timed] .ez_toast__timer { animation: none; }
}

@media print { .ez_toasts { display: none; } }
