/* ==========================================================================
   Toast Notification System
   Floating, auto-dismissing notifications (replaces static message banners
   and the old top-right .notification-toast).
   ========================================================================== */

.toast-notify-container {
  position: fixed;
  bottom: var(--space-lg);
  left: var(--space-lg);
  z-index: 1080;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-sm);
  max-width: calc(100vw - (2 * var(--space-lg)));
  pointer-events: none;
}

.toast-notify {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  min-width: 280px;
  max-width: 420px;
  padding: var(--space-md);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  transform: translateX(-120%);
  opacity: 0;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
  pointer-events: auto;
  overflow: hidden;
  position: relative;
}

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

.toast-notify.hiding {
  transform: translateX(-120%);
  opacity: 0;
}

.toast-notify-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  margin-top: 1px;
}

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

.toast-notify-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2px 0;
  line-height: 1.3;
}

.toast-notify-message {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
  word-wrap: break-word;
}

.toast-notify-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  transition: var(--transition-fast);
  margin: -4px -4px -4px 0;
}

.toast-notify-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Duplicate counter badge, shown when the same toast is triggered again */
.toast-notify-count {
  display: none;
  margin-left: var(--space-xs);
  padding: 1px 7px;
  min-width: 20px;
  height: 18px;
  border-radius: 9px;
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  vertical-align: middle;
}

.toast-notify-count.visible {
  display: inline-block;
}

.toast-notify.pulse {
  animation: toast-notify-pulse 0.4s ease-out;
}

@keyframes toast-notify-pulse {
  0% { transform: translateX(0) scale(1); }
  50% { transform: translateX(0) scale(1.03); }
  100% { transform: translateX(0) scale(1); }
}

.toast-notify-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.3;
  transition: width linear;
}

.toast-notify-spinner {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: toast-notify-spin 0.8s linear infinite;
}

@keyframes toast-notify-spin {
  to { transform: rotate(360deg); }
}

/* Toast type colours */
.toast-notify.success .toast-notify-icon { background: var(--success-50); color: var(--success-600); }
.toast-notify.success .toast-notify-progress,
.toast-notify.success .toast-notify-count { background: var(--success-600); }

.toast-notify.error .toast-notify-icon { background: var(--danger-50); color: var(--danger-600); }
.toast-notify.error .toast-notify-progress,
.toast-notify.error .toast-notify-count { background: var(--danger-600); }

.toast-notify.warning .toast-notify-icon { background: var(--warning-50); color: var(--warning-600); }
.toast-notify.warning .toast-notify-progress,
.toast-notify.warning .toast-notify-count { background: var(--warning-600); }

.toast-notify.info .toast-notify-icon { background: var(--info-50); color: var(--info-600); }
.toast-notify.info .toast-notify-progress,
.toast-notify.info .toast-notify-count { background: var(--info-600); }

@media (max-width: 480px) {
  .toast-notify-container {
    bottom: var(--space-sm);
    left: var(--space-sm);
    right: var(--space-sm);
    max-width: none;
  }

  .toast-notify {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}
