/* Shared toast component (pkg/toast). Uses only the design tokens already
   declared identically in both portals' moonshot.css (--success, --error,
   --warning, --info, --surface, --text, --border, --z-toast, --sp-*,
   --radius, --font-sans), so it renders correctly in light and dark theme
   without any portal-specific override. */

/* Positioned once; holds the two live regions (status, alert) stacked so
   they never overlap even when both have a toast visible at once. */
.mstoast-root {
  position: fixed;
  top: var(--sp-4, 16px);
  right: var(--sp-4, 16px);
  z-index: var(--z-toast, 9999);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2, 8px);
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none; /* the root itself must not block clicks below it */
}

.mstoast-stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2, 8px);
}

.mstoast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2, 8px);
  padding: var(--sp-3, 12px) var(--sp-4, 16px);
  border-radius: var(--radius, 6px);
  border: 1px solid var(--border, #2a2e3a);
  border-left: 3px solid var(--info, #3b82f6);
  background: var(--surface, #1a1d27);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  font-family: var(--font-sans, Inter, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  overflow-wrap: anywhere;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: auto;
}

.mstoast--show {
  opacity: 1;
  transform: translateY(0);
}

.mstoast__icon {
  flex: none;
  font-weight: 700;
  line-height: 1.4;
}

.mstoast__msg {
  flex: 1;
  color: var(--text, #e1e4ea);
}

.mstoast__close {
  flex: none;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted, #878d9c);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 var(--sp-2, 8px);
}

.mstoast__close:hover,
.mstoast__close:focus-visible {
  color: var(--text, #e1e4ea);
}

.mstoast__close:focus-visible {
  outline: 2px solid var(--info, #3b82f6);
  outline-offset: 2px;
}

.mstoast--success { border-left-color: var(--success, #22c55e); }
.mstoast--error   { border-left-color: var(--error, #ef4444); }
.mstoast--warning { border-left-color: var(--warning, #f59e0b); }
.mstoast--info    { border-left-color: var(--info, #3b82f6); }

.mstoast--success .mstoast__icon { color: var(--success, #22c55e); }
.mstoast--error   .mstoast__icon { color: var(--error, #ef4444); }
.mstoast--warning .mstoast__icon { color: var(--warning, #f59e0b); }
.mstoast--info    .mstoast__icon { color: var(--info, #3b82f6); }

@media (prefers-reduced-motion: reduce) {
  .mstoast {
    transition: opacity 1ms linear;
    transform: none;
  }
}
