/* TOOYO Toast — keep in sync with admin-tooyo/css/admin.css (.tooyo-toast*) */
/* —— Animate UI toast (TooyoToast) — see SHARED-UI-ELEMENTS.md —— */
.tooyo-toast-viewport {
  --toast-ease-exit: cubic-bezier(0.33, 0.17, 0.67, 0.5);
  --toast-pad-bottom: max(1.15rem, env(safe-area-inset-bottom, 0px));
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  pointer-events: none;
  padding: 0 1rem var(--toast-pad-bottom);
  background: transparent;
}

/* White strip at the physical bottom edge — Safari samples this, not the red toast. */
.tooyo-toast-chrome-guard {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--toast-pad-bottom);
  background: #ffffff;
  pointer-events: none;
  z-index: 0;
}

body.admin-app .tooyo-toast-viewport {
  --toast-pad-bottom: calc(var(--bottom-nav-h, 3.75rem) + var(--safe-b, 0px) + 0.85rem);
}

.tooyo-toast {
  pointer-events: auto;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 0.55rem;
  width: min(26rem, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 0.75rem 0.7rem 0.75rem 0.95rem;
  border-radius: 1.15rem;
  background: var(--ink);
  color: #fff;
  font-family: var(--font, "Onest", system-ui, sans-serif);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 28px rgba(17, 17, 17, 0.18);
  opacity: 0;
  transform: translateY(110%) scale(0.96);
  filter: blur(4px);
  transform-origin: 50% 100%;
  transition:
    opacity 0.2s var(--toast-ease-exit),
    transform 0.52s cubic-bezier(0.22, 1.2, 0.36, 1),
    filter 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    margin 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity, filter;
}

.tooyo-toast.is-in {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.tooyo-toast.is-out {
  opacity: 0;
  transform: translateY(110%) scale(0.96);
  filter: blur(4px);
  transition:
    opacity 0.2s var(--toast-ease-exit),
    transform 0.2s var(--toast-ease-exit),
    filter 0.2s var(--toast-ease-exit);
}

.tooyo-toast.is-behind {
  margin-bottom: -0.55rem;
  transform: translateY(0) scale(calc(1 - (var(--toast-index, 0) * 0.05)));
  opacity: 0.92;
}

.tooyo-toast.is-behind .tooyo-toast-body,
.tooyo-toast.is-behind .tooyo-toast-icon {
  opacity: 0.35;
  transition: opacity 0.2s ease-out;
}

.tooyo-toast--error {
  background: var(--danger, #b42318);
}

.tooyo-toast--warning {
  background: #8a5a00;
}

.tooyo-toast--success,
.tooyo-toast--info,
.tooyo-toast--default,
.tooyo-toast--loading {
  background: var(--ink, #171717);
}

.tooyo-toast-icon {
  display: inline-flex;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.05rem;
  color: inherit;
  opacity: 0;
  transform: scale(0.5);
  filter: blur(2px);
  transition:
    opacity 0.25s ease-out,
    transform 0.35s cubic-bezier(0.22, 1.4, 0.36, 1),
    filter 0.3s ease-out;
}

.tooyo-toast.is-in.is-icon-live .tooyo-toast-icon {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
  transition-delay: 0.2s;
}

.tooyo-toast-icon-svg {
  display: block;
}

.tooyo-toast-x-a,
.tooyo-toast-x-b,
.tooyo-toast-check {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
}

.tooyo-toast.is-in.is-icon-live .tooyo-toast-x-a,
.tooyo-toast.is-in.is-icon-live .tooyo-toast-x-b,
.tooyo-toast.is-in.is-icon-live .tooyo-toast-check {
  animation: tooyo-toast-draw 0.3s ease-out 0.22s forwards;
}

.tooyo-toast.is-in.is-icon-live.tooyo-toast--error .tooyo-toast-icon-svg--error {
  animation: tooyo-toast-shake 0.4s ease-out 0.4s both;
}

.tooyo-toast.is-in.is-icon-live.tooyo-toast--loading .tooyo-toast-icon-svg--loading {
  animation: tooyo-toast-spin 0.85s linear infinite;
  transform-origin: 50% 50%;
}

.tooyo-toast-body {
  min-width: 0;
}

.tooyo-toast-title {
  margin: 0;
  text-wrap: pretty;
}

.tooyo-toast-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  margin: -0.15rem -0.1rem 0 0;
  padding: 0.2rem;
  width: 1.55rem;
  height: 1.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.72;
  flex: 0 0 auto;
}

.tooyo-toast-close:hover,
.tooyo-toast-close:focus-visible {
  opacity: 1;
  outline: none;
  background: rgba(255, 255, 255, 0.12);
}

.tooyo-toast-close svg {
  display: block;
  width: 0.95rem;
  height: 0.95rem;
}

@keyframes tooyo-toast-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes tooyo-toast-shake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-3px);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(1px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes tooyo-toast-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tooyo-toast {
    transition: opacity 0.2s ease, filter 0.2s ease !important;
    transform: none !important;
  }
  .tooyo-toast.is-in,
  .tooyo-toast.is-out,
  .tooyo-toast.is-behind {
    transform: none !important;
  }
  .tooyo-toast-icon {
    transition: opacity 0.2s ease, filter 0.2s ease !important;
    transform: none !important;
  }
  .tooyo-toast.is-in.is-icon-live .tooyo-toast-x-a,
  .tooyo-toast.is-in.is-icon-live .tooyo-toast-x-b,
  .tooyo-toast.is-in.is-icon-live .tooyo-toast-check,
  .tooyo-toast.is-in.is-icon-live.tooyo-toast--error .tooyo-toast-icon-svg--error,
  .tooyo-toast.is-in.is-icon-live.tooyo-toast--loading .tooyo-toast-icon-svg--loading {
    animation: none !important;
    stroke-dashoffset: 0;
  }
}
