/**
 * Toast and undo-toast, styled once.
 *
 * The undo toast was styled three times: `.undo-toast` in assistent and in
 * Library, and `.attendance-move-toast` in Personal Monitoring — where the
 * name is a leftover from the one screen it was written for, months before it
 * became the app-wide pattern. Same layout, same drain animation, three
 * keyframe names.
 *
 * Consolidated on the assistent/Library geometry (bottom-centre) because two
 * of three used it and a centred toast is harder to miss than a corner one.
 * Personal Monitoring's toasts move from the bottom-right corner to the
 * bottom centre as a result.
 *
 * Requires tokens.css for --sc-*.
 */

.sc-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(8px);
  z-index: 1300;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid var(--sc-border);
  border-left: 3px solid var(--sc-ink);
  border-radius: var(--sc-radius-sm);
  background: var(--sc-surface-elevated);
  color: var(--sc-text);
  box-shadow: var(--sc-shadow-lg);
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--sc-transition-base), transform var(--sc-transition-base);
}

.sc-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.sc-toast.error {
  border-left-color: var(--sc-critical);
}

.sc-undo-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 1301;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 16px;
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius-md);
  background: var(--sc-surface-elevated);
  color: var(--sc-text);
  box-shadow: var(--sc-shadow-lg);
  font-size: 0.875rem;
  overflow: hidden;
}

.sc-undo-toast-text {
  flex: 1 1 auto;
  min-width: 0;
}

.sc-undo-toast-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 5px 12px;
  border: 1px solid var(--sc-border-strong);
  border-radius: var(--sc-radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.sc-undo-toast-btn:hover:not(:disabled) {
  border-color: var(--sc-accent);
  color: var(--sc-accent);
}

.sc-undo-toast-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.sc-undo-toast-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--sc-accent);
  transform-origin: left center;
  animation: sc-undo-drain linear forwards;
}

@keyframes sc-undo-drain {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .sc-toast {
    transition: none;
  }
  .sc-undo-toast-bar {
    animation: none;
  }
}
