/* ==========================================================================
   Component: Toasts
   Description: Ephemeral notification messages
   ========================================================================== */

/* --- Fixed container --- */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 400px;
}

/* --- Base toast --- */
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background-color: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: toast-enter var(--duration-normal) var(--ease-spring);
}

/* --- Exit animation --- */
.toast--exiting {
  animation: toast-exit var(--duration-fast) var(--ease-in) forwards;
}

/* --- Icon --- */
.toast__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* --- Content area --- */
.toast__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
}

.toast__title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.toast__message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* --- Dismiss button --- */
.toast__dismiss {
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: var(--space-1);
}

.toast__dismiss:hover {
  color: var(--text-primary);
}

/* --- Status icon colors --- */
.toast--success .toast__icon {
  color: var(--status-success);
}

.toast--error .toast__icon {
  color: var(--status-error);
}

.toast--warning .toast__icon {
  color: var(--status-warning);
}

.toast--info .toast__icon {
  color: var(--status-info);
}

/* --- Animations --- */
@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-exit {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ==========================================================================
   .toast--save — Save Indicator (Pattern 03, LOCKED)
   ──────────────────────────────────────────────────────────────────────────
   Icon-only success circle that flashes briefly after a successful save.
   Lives in the same .toast-container as text toasts; stacks naturally if
   coexisting. Triggered by the save-toast Stimulus controller via the
   `hidden` attribute (display: none → flex re-runs the CSS animation).
   ========================================================================== */

.toast--save {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
  background-color: var(--status-success-bg);
  border: 1px solid color-mix(in srgb, var(--status-success) 35%, transparent);
  box-shadow: var(--shadow-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation:
    toast-enter var(--duration-normal) var(--ease-spring),
    save-pop 600ms var(--ease-spring) var(--duration-normal);
}

.toast--save .material-symbols-rounded {
  font-size: 24px;
  color: var(--status-success);
}

@keyframes save-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.18); }
  70%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}
