.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 340px;
  max-width: 440px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-inner {
  display: flex;
  align-items: center; /* Changed from flex-start to center for better alignment */
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 
              0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, background-color 0.2s ease;
}

.toast-inner:hover {
  background: rgba(28, 28, 28, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Left Accent Stripe */
.toast-inner::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: currentColor;
}

.toast-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-icon svg {
  width: 100%;
  height: 100%;
}

.toast-message {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
  margin: 0;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0.25rem;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: currentColor;
  opacity: 0.6;
  width: 100%;
  transform-origin: left;
}

/* TYPE SPECIFIC STYLES */
.toast-success {
  color: #4ade80; /* Vibrant emerald */
}

.toast-error {
  color: #f87171; /* Vibrant red */
}

.toast-notice {
  color: #60a5fa; /* Vibrant blue */
}

.toast-warning {
  color: #fbbf24; /* Vibrant amber */
}

/* Override toast-inner background for types if needed, 
   but we stay dark for consistent glassmorphism */
.toast-success.toast-inner {
  border-left-color: #4ade80;
}

.toast-error.toast-inner {
  border-left-color: #f87171;
}

.toast-notice.toast-inner {
  border-left-color: #60a5fa;
}

.toast-warning.toast-inner {
  border-left-color: #fbbf24;
}

/* Animation improvements */
@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(20px) scale(0.95);
  }
}

.toast-enter {
  animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast-exit {
  animation: toastOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Transitions for custom classes (Stimulus) */
.toast-hidden {
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  pointer-events: none;
}

.toast-shown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}


@media (max-width: 640px) {
  .toast-container {
    top: auto;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    width: auto;
  }

  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
  
  .opacity-0.translate-x-full {
    transform: translateY(20px) scale(0.95) !important;
  }
}

