/* Sonner-style toasts — top-right, bundui toast2 / 21st pattern */

.toast-container {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top, 0px));
  right: 1.25rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 2rem));
}

.sonner-toast {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem 0.75rem;
  width: min(360px, calc(100vw - 2rem));
  padding: 0.7rem 0.75rem 0.7rem 0.7rem;
  border-radius: 0.85rem;
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.4);
  color: #fff;
  overflow: hidden;
  transform: translateY(-10px) scale(0.97);
  opacity: 0;
  animation: sonnerInTop 0.38s cubic-bezier(0.21, 0.98, 0.6, 1.01) forwards;
}

.sonner-toast--compact {
  width: auto;
  min-width: min(280px, calc(100vw - 2rem));
  max-width: min(360px, calc(100vw - 2rem));
  padding: 0.55rem 0.5rem 0.55rem 0.55rem;
  border-radius: 0.75rem;
}

.sonner-toast.is-leaving {
  animation: sonnerOutTop 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes sonnerInTop {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sonnerOutTop {
  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
}

.sonner-toast__icon {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.sonner-toast--compact .sonner-toast__icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.45rem;
}

.sonner-toast--success .sonner-toast__icon {
  background: rgba(248, 113, 113, 0.15);
  color: #fee2e2;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.sonner-toast--error .sonner-toast__icon {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.sonner-toast--info .sonner-toast__icon {
  background: rgba(96, 165, 250, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.sonner-toast__body {
  min-width: 0;
}

.sonner-toast__title {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.sonner-toast--compact .sonner-toast__title {
  font-size: 0.8125rem;
  white-space: nowrap;
}

.sonner-toast__desc {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.52);
  font-weight: 500;
}

.sonner-toast__close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.38);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 0.35rem;
  transition: color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.sonner-toast__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 480px) {
  .toast-container {
    right: 0.75rem;
    left: auto;
    top: max(0.65rem, env(safe-area-inset-top, 0px));
    align-items: flex-end;
  }

  .sonner-toast,
  .sonner-toast--compact {
    width: min(100%, calc(100vw - 1.5rem));
    max-width: none;
  }

  .sonner-toast--compact .sonner-toast__title {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sonner-toast {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
