/**
 * Floating toasts for Django contrib.messages (and VMToast.show).
 * Fixed positioning — no document flow / layout shift.
 */

.vm-toast-stack {
  position: fixed;
  z-index: 10050;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 0.5rem;
  width: min(22.5rem, calc(100vw - 1.5rem));
  max-width: 100%;
  pointer-events: none;
  box-sizing: border-box;
}

body.vm-account-shell .vm-toast-stack {
  bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 900px) {
  body.vm-account-shell .vm-toast-stack {
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    left: auto;
    right: 1.25rem;
    transform: none;
    align-items: flex-end;
  }
}

.vm-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 0.85rem 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 20, 26, 0.94);
  color: #f4f6f8;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(0.65rem) scale(0.98);
  animation: vm-toast-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.vm-toast.is-leaving {
  animation: vm-toast-out 0.22s ease forwards;
}

@keyframes vm-toast-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes vm-toast-out {
  to {
    opacity: 0;
    transform: translateY(0.35rem) scale(0.96);
  }
}

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

  .vm-toast.is-leaving {
    animation: none;
    opacity: 0;
  }
}

.vm-toast__text {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.vm-toast__dismiss {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin: -0.15rem -0.25rem 0 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(244, 246, 248, 0.72);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.vm-toast__dismiss:hover,
.vm-toast__dismiss:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
}

.vm-toast--success {
  border-color: rgba(134, 239, 172, 0.35);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(134, 239, 172, 0.12) inset;
}

.vm-toast--error {
  border-color: rgba(248, 113, 113, 0.4);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(248, 113, 113, 0.14) inset;
}

.vm-toast--warning {
  border-color: rgba(212, 192, 154, 0.45);
}

.vm-toast--info {
  border-color: rgba(147, 197, 253, 0.35);
}

/* Legacy inline alerts: hide if any remain inside main flow */
.main-content > .messages-container {
  display: none !important;
}
