/* toasts.css — iOS notification-banner-style flash messages.
 *
 * Replaces the saturated tinted-background flashes (bg-{emerald,
 * sky}-50 etc.) that clashed with the Apple-HIG primitives the
 * rest of the app uses. Reference: an iOS push that drops from
 * the top with a soft spring, lingers, can be dismissed.
 *
 * Visual language:
 *   * Near-white (light) / near-black (dark) background with
 *     `backdrop-filter: saturate(180%) blur(20px)`.
 *   * Hairline border + soft layered shadow.
 *   * 3px wide colored accent stripe on the left edge — green
 *     / amber / red for success / warn / error. **Stripe only,
 *     not a full tinted background** (CLAUDE.md "no traffic-
 *     light pills" rule).
 *   * 32×32 logo (school logo from SchoolSettings or the
 *     Syncc mark fallback) with 8px corner radius — matches
 *     the iOS app-icon shape.
 *   * Drops in from the top with a 350ms spring; auto-dismiss
 *     5 s success / 8 s info / sticky on errors.
 *
 * Brand tokens (`--brand-*`) auto-swap in dark mode via the
 * `.dark` scope from `brand.css`.
 */

.toast-stack {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  /* Mobile: full-width minus 16 px margins, top + safe-area inset. */
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: 16px;
  right: 16px;
}

@media (min-width: 640px) {
  .toast-stack {
    /* Desktop: max-width 420 px, top-right with 16 px margin. */
    top: 16px;
    right: 16px;
    left: auto;
    width: 420px;
  }
}

.toast {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--brand-line-lt);
  color: var(--brand-ink);
  box-shadow:
    0 4px 12px -4px rgba(10, 22, 40, 0.06),
    0 12px 32px -16px rgba(10, 22, 40, 0.20);
  overflow: hidden;
  animation: toast-in 350ms cubic-bezier(0.32, 0.72, 0, 1);
}
.dark .toast {
  background: rgba(20, 28, 44, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 4px 12px -4px rgba(0, 0, 0, 0.30),
    0 12px 32px -16px rgba(0, 0, 0, 0.55);
}

/* 3 px accent stripe on the left edge. Stripe only — never a
 * full tinted background. */
.toast::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 7px;
  width: 3px;
  border-radius: 2px;
  background: var(--brand-teal-bright, #25D6AD);
}
.toast-success::before { background: #10B981; }
.toast-info::before,
.toast-message::before { background: #0EA5E9; }
.toast-warning::before { background: #F59E0B; }
.toast-error::before,
.toast-danger::before  { background: #EF4444; }

.toast-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-paper-2);
  overflow: hidden;
}
.toast-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}
/* Wordmark fallback: small Syncc mark when no school logo. */
.toast-logo svg { width: 18px; height: 18px; color: var(--brand-teal-dark); }
.dark .toast-logo svg { color: var(--brand-teal-bright); }

.toast-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toast-title {
  font: 600 13px/1.3 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--brand-ink);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.toast-stamp {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--brand-ink-3);
}
.toast-message {
  font: 400 13.5px/1.4 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--brand-ink-2);
  word-break: break-word;
}

.toast-close {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--brand-ink-3);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toast-close:hover {
  background: rgba(10, 22, 40, 0.06);
  color: var(--brand-ink);
}
.dark .toast-close:hover {
  background: rgba(255, 255, 255, 0.06);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

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