/* @Digits toast — side notifications */

.atd-toast-host {
  --atd-toast-bg: #0f172a;
  --atd-toast-fg: #f8fafc;
  --atd-toast-muted: #94a3b8;
  --atd-toast-success: #34d399;
  --atd-toast-error: #fb7185;
  --atd-toast-info: #7dd3fc;
  --atd-toast-warning: #fbbf24;
  --atd-toast-radius: 14px;
  --atd-toast-shadow: 0 10px 40px rgba(15, 23, 42, 0.28), 0 2px 8px rgba(15, 23, 42, 0.16);

  position: fixed;
  z-index: 100000;
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  inset-inline-end: max(1.25rem, env(safe-area-inset-inline-end, 0px));
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 10px;
  width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
  font-family: inherit;
}

.atd-toast {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border-radius: var(--atd-toast-radius);
  background: var(--atd-toast-bg);
  color: var(--atd-toast-fg);
  box-shadow: var(--atd-toast-shadow);
  overflow: hidden;
  isolation: isolate;
  transform: translate3d(0, 12px, 0);
  opacity: 0;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}

.atd-toast.is-in {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.atd-toast.is-out {
  transform: translate3d(0, 8px, 0);
  opacity: 0;
}

.atd-toast::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 3px;
  background: var(--atd-toast-accent, var(--atd-toast-info));
}

.atd-toast--success {
  --atd-toast-accent: var(--atd-toast-success);
}

.atd-toast--error {
  --atd-toast-accent: var(--atd-toast-error);
}

.atd-toast--info {
  --atd-toast-accent: var(--atd-toast-info);
}

.atd-toast--warning {
  --atd-toast-accent: var(--atd-toast-warning);
}

.atd-toast__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--atd-toast-accent) 18%, transparent);
  color: var(--atd-toast-accent);
  flex-shrink: 0;
}

.atd-toast__icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

.atd-toast__body {
  min-width: 0;
  padding-top: 3px;
}

.atd-toast__title {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--atd-toast-muted);
}

.atd-toast__msg {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--atd-toast-fg);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.atd-toast__msg ul {
  margin: 0;
  padding-inline-start: 1.1em;
}

.atd-toast__msg li + li {
  margin-top: 4px;
}

.atd-toast__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--atd-toast-muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.atd-toast__close:hover,
.atd-toast__close:focus-visible {
  background: rgba(248, 250, 252, 0.08);
  color: var(--atd-toast-fg);
  outline: none;
}

.atd-toast__close svg {
  width: 14px;
  height: 14px;
}

.atd-toast__progress {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 2px;
  background: rgba(248, 250, 252, 0.08);
}

.atd-toast__progress > span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--atd-toast-accent);
  transform-origin: left center;
  transform: scaleX(1);
  animation-name: atd-toast-progress;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

[dir='rtl'] .atd-toast__progress > span {
  transform-origin: right center;
}

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

@media (prefers-reduced-motion: reduce) {
  .atd-toast {
    transition: opacity 0.15s ease;
    transform: none;
  }

  .atd-toast__progress > span {
    animation: none;
    opacity: 0.35;
  }
}
