/* Toast Notification System */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10001; /* Higher than loading overlay (9999) and dialog (10000) */
  max-width: 400px;
  pointer-events: none;
}

@media screen and (prefers-reduced-motion: reduce) {
  .toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    padding: 16px 20px;
    position: relative;
    pointer-events: auto;
    transform: translateX(100%);
    transition: none;
    opacity: 0;
    border-left: 4px solid;
    min-width: 300px;
    max-width: 400px;
  }
}

.toast {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 10px;
  padding: 16px 20px;
  position: relative;
  pointer-events: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  opacity: 0;
  border-left: 4px solid;
  min-width: 300px;
  max-width: 400px;
}

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

.toast.hide {
  transform: translateX(100%);
  opacity: 0;
}

/* Toast Types */
.toast.toast-success {
  border-left-color: #28a745;
  background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
}

.toast.toast-success .toast-icon {
  color: #28a745;
}

.toast.toast-error {
  border-left-color: #dc3545;
  background: linear-gradient(135deg, #fff8f8 0%, #ffe8e8 100%);
}

.toast.toast-error .toast-icon {
  color: #dc3545;
}

.toast.toast-info {
  border-left-color: #17a2b8;
  background: linear-gradient(135deg, #f8fbff 0%, #e8f4ff 100%);
}

.toast.toast-info .toast-icon {
  color: #17a2b8;
}

.toast.toast-warning {
  border-left-color: #ffc107;
  background: linear-gradient(135deg, #fffef8 0%, #fff8e8 100%);
}

.toast.toast-warning .toast-icon {
  color: #ffc107;
}

/* Toast Content */
.toast-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-message {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 4px 0;
  color: #333;
  text-transform: capitalize;
}

.toast-text {
  font-size: 13px;
  margin: 0;
  color: #666;
  line-height: 1.4;
}

/* Close Button */
@media screen and (prefers-reduced-motion: reduce) {
  .toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    margin-left: 8px;
    flex-shrink: 0;
    transition: none;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.toast-close {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  margin-left: 8px;
  flex-shrink: 0;
  transition: color 0.2s ease;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  color: #666;
}

/* Progress Bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

@media screen and (prefers-reduced-motion: reduce) {
  .toast-progress-bar {
    height: 100%;
    background: currentColor;
    transition: none;
    opacity: 0.7;
  }
}

.toast-progress-bar {
  height: 100%;
  background: currentColor;
  transition: width linear;
  opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 768px) {
  .toast-container {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }
}

/* Animation Keyframes */
@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Accessibility */
.toast[role="alert"] {
  outline: none;
}

.toast-close:focus {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}
