/*
 * Global toast — Altruate
 */

.toast-host {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px calc(var(--tabbar-height, 84px) + 12px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: #ffffff;
  color: var(--color-text);
  box-shadow:
    0 0 0.5px rgb(66 71 76 / 32%),
    0 8px 24px rgb(66 71 76 / 10%),
    0 4px 40px #f5f5fe;
  pointer-events: auto;
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  transition:
    opacity 200ms ease,
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.is-visible {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.toast.is-leaving {
  transform: translateY(10px) scale(0.98);
  opacity: 0;
}

.toast__icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-top: 1px;
}

.toast__body {
  flex: 1 1 auto;
  min-width: 0;
}

.toast__message {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.toast__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -4px -6px -4px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-meta, #737478);
  cursor: pointer;
}

.toast__close:hover,
.toast__close:focus-visible {
  background: var(--color-section-bg, #f5f6fa);
  color: var(--color-text);
  outline: none;
}

.toast--error {
  border-color: rgb(226 76 76 / 28%);
  background: linear-gradient(180deg, #fff8f8 0%, #ffffff 72%);
}

.toast--error .toast__icon {
  color: var(--color-error, #e24c4c);
}

.toast--success {
  border-color: rgb(45 190 123 / 28%);
  background: linear-gradient(180deg, #f3fff8 0%, #ffffff 72%);
}

.toast--success .toast__icon {
  color: var(--color-accent-green, #2dbe7b);
}

.toast--notification {
  border-color: rgb(16 139 136 / 28%);
  background: linear-gradient(180deg, #f0fffb 0%, #ffffff 70%);
}

.toast--notification:hover {
  box-shadow:
    0 0 0.5px rgb(66 71 76 / 32%),
    0 10px 28px rgb(16 139 136 / 14%),
    0 4px 40px #f5f5fe;
}

.toast--info {
  border-color: rgb(16 139 136 / 24%);
  background: linear-gradient(180deg, #f4fffc 0%, #ffffff 72%);
}

.toast--info .toast__icon {
  color: var(--color-button, #108b88);
}

@media (min-width: 1280px) {
  .toast-host {
    align-items: flex-end;
    padding: 0 24px calc(24px + env(safe-area-inset-bottom, 0px));
  }
}

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

  .toast.is-visible,
  .toast.is-leaving {
    transform: none;
  }
}
