/*
 * Toast notifications (public/js/toast.js). Uses the Concrete Rust tokens when the page defines
 * them (public/css/concrete-rust.css, resources/css/app.css) and falls back to the same values.
 */
.toast-region {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  --toast-accent: var(--primary, #0a0a0a);
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px 12px 16px 16px;
  background: var(--popover, #d4d4d4);
  color: var(--foreground, #1c1c1c);
  border: 1px solid var(--border, #8c8c8c);
  border-radius: calc(var(--radius, 0.4rem) + 4px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.08);
  font-family: var(--font-sans, 'Montserrat', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--toast-accent);
}
.toast.is-visible { opacity: 1; transform: none; }
.toast.is-leaving { opacity: 0; transform: translateX(16px); }

.toast--success { --toast-accent: #3e9a8f; }
.toast--error { --toast-accent: var(--destructive, #e8001b); }
.toast--warning { --toast-accent: var(--secondary, #dc5f00); }
.toast--info { --toast-accent: var(--primary, #0a0a0a); }

.toast__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: none;
}
.toast--success .toast__icon { background: var(--accent, #8fd1c9); color: #0a0a0a; }
.toast--error .toast__icon { background: var(--destructive, #e8001b); color: #ffffff; }
.toast--warning .toast__icon { background: var(--secondary, #dc5f00); color: #ffffff; }
.toast--info .toast__icon { background: var(--primary, #0a0a0a); color: #ffffff; }

.toast__body { min-width: 0; padding-top: 3px; }
.toast__title { margin: 0; font-weight: 700; color: var(--foreground, #1c1c1c); }
.toast__title:empty { display: none; }
.toast__message { margin: 2px 0 0; color: var(--muted-foreground, #4a4a4a); overflow-wrap: anywhere; }
.toast__list { margin: 4px 0 0; padding-left: 18px; color: var(--muted-foreground, #4a4a4a); }
.toast__list li + li { margin-top: 2px; }

.toast__close {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius, 0.4rem);
  background: transparent;
  color: var(--muted-foreground, #4a4a4a);
  cursor: pointer;
}
.toast__close:hover { background: rgba(0, 0, 0, 0.07); color: var(--foreground, #1c1c1c); }
.toast__close:focus-visible { outline: 2px solid var(--secondary, #dc5f00); outline-offset: 1px; }

.toast__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--toast-accent);
  opacity: 0.55;
  transform-origin: left center;
  animation-name: toast-progress;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
.toast:hover .toast__progress,
.toast:focus-within .toast__progress { animation-play-state: paused; }

@keyframes toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (max-width: 575.98px) {
  .toast-region { top: 12px; left: 12px; right: 12px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast.is-leaving { transition: none; transform: none; }
}
