/* ========================= */
/* Toast                     */
/* ========================= */
.toast-container {
  position: fixed;
  top: 72px; /* leave room for navbar height */
  right: 1.5rem; /* margin from right edge */
  z-index: 2000; /* above content, below modals */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  pointer-events: none; /* allow clicks to pass through */
}

/* Base toast style */
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-left: 6px solid #03a9f4; /* default left stripe */
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  min-width: 300px;
  max-width: 420px;
  padding: 0.9rem 1.2rem;
  position: relative;
  opacity: 0.97;
  transform: translateY(0);
  animation: toastSlideIn 0.45s ease-out;
  transition: transform 0.35s ease, opacity 0.3s ease;
  pointer-events: auto; /* allow interaction with close button */
}

.toast-container .toast.showing,
.toast-container .toast.show {
  opacity: 1;
  transform: translateX(0);
}
.toast-container .toast.hide {
  opacity: 0;
  transform: translateX(15px);
}

/* Smooth stacking (each toast pushes down the previous one) */
.toast-container .toast {
  margin-top: 0;
  margin-bottom: 0.25rem;
  will-change: transform, opacity;
}

.toast-container .toast:nth-child(2) {
  animation-delay: 0.1s;
}
.toast-container .toast:nth-child(3) {
  animation-delay: 0.2s;
}
.toast-container .toast:nth-child(4) {
  animation-delay: 0.3s;
}

/* Exit transition for manual close */
.toast.hide {
  animation: toastSlideOut 0.3s ease forwards;
}

.toast-body {
  flex-grow: 1;
  font-size: 0.95rem;
  font-weight: 500;
  color: #333;
  padding-right: 2rem;
}

.toast .btn-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.75;
}
.toast .btn-close:hover {
  opacity: 1;
}

/* Stripe colors */
.toast-success {
  border-left-color: #28a745;
}
.toast-info {
  border-left-color: #03a9f4;
}
.toast-warning {
  border-left-color: #ffc107;
}
.toast-danger {
  border-left-color: #dc3545;
}

/* Animation */
/* Initial entry animation (slide in from right + fade) */
@keyframes toastSlideIn {
  0% {
    opacity: 0;
    transform: translateX(25px) translateY(-10px);
  }
  60% {
    opacity: 1;
    transform: translateX(0) translateY(3px);
  }
  100% {
    opacity: 1;
    transform: translateX(0) translateY(0);
  }
}

/* Subtle exit animation (fade out + slight shift) */
@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(10px);
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .toast {
    background-color: #2b2b3d;
    border: 1px solid #444;
  }
  .toast-body { color: #f1f1f1; }
}

@media (max-width: 576px) {
  .toast-container {
    top: 70px;
    right: 0.5rem;
    left: auto;
    width: calc(100% - 1rem);
    align-items: stretch; /* so toasts expand full width on small screens */
  }
  .toast {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .toast-container {
    top: 68px;
  }
}