/*
 * toast.css - Toast notification system
 * NutriCare
 */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  max-width: 350px;
  pointer-events: none;
}

.toast {
  position: relative;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
  overflow: hidden;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.toast-content {
  flex: 1;
  font-size: 0.95rem;
  color: #4b5563;
  padding-right: 1.5rem;
  line-height: 1.5;
}

.toast-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1rem;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.toast-close:hover { color: #4b5563; }

.toast-success { border-left: 4px solid #10b981; }
.toast-success .toast-icon { color: #10b981; }

.toast-error { border-left: 4px solid #ef4444; }
.toast-error .toast-icon { color: #ef4444; }

.toast-warning { border-left: 4px solid #f59e0b; }
.toast-warning .toast-icon { color: #f59e0b; }

.toast-info { border-left: 4px solid #3b82f6; }
.toast-info .toast-icon { color: #3b82f6; }

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: rgba(0, 0, 0, 0.1);
  width: 100%;
}

.toast-progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left;
  animation: toast-progress 3s linear forwards;
}

.toast-success .toast-progress-bar { background-color: #10b981; }
.toast-error .toast-progress-bar { background-color: #ef4444; }
.toast-warning .toast-progress-bar { background-color: #f59e0b; }
.toast-info .toast-progress-bar { background-color: #3b82f6; }

@keyframes toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@keyframes toastFadeIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastFadeOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

.toast.show { animation: toastFadeIn 0.3s forwards; }
.toast.hide { animation: toastFadeOut 0.3s forwards; }

@media (max-width: 576px) {
  .toast-container { bottom: 10px; right: 10px; left: 10px; max-width: none; }
  .toast { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .toast, .toast.show, .toast.hide, .toast-progress-bar {
    transition: none;
    animation: none;
  }
}
