/* ============================================================
   Toasts — fixed top-end transient notifications.

   Driven by `Alpine.store('toasts')`. The container lives outside
   the main layout so toasts float above every other surface.
   ============================================================ */

.toast-container {
  position: fixed;
  top: 16px;
  inset-inline-end: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  pointer-events: none;     /* container itself doesn't intercept clicks */
}

.toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  min-width: 280px;
  animation: toast-in 200ms cubic-bezier(.4,0,.2,1);
}

/* Left accent rail — color encodes the toast type. */
.toast::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 3px;
  border-start-start-radius: 8px;
  border-end-start-radius: 8px;
  background: var(--text-tertiary);
}
.toast-success::before { background: var(--positive); }
.toast-error::before   { background: var(--danger);   }
.toast-warning::before { background: var(--warning);  }
.toast-info::before    { background: var(--accent);   }

.toast-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}
.toast-success .toast-icon { color: var(--positive); }
.toast-error   .toast-icon { color: var(--danger);   }
.toast-warning .toast-icon { color: var(--warning);  }
.toast-info    .toast-icon { color: var(--accent);   }

.toast-body { flex: 1; min-width: 0; }
.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.toast-msg {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-top: 2px;
  /* Allow line breaks but trim huge messages. */
  word-break: break-word;
}

/* Multi-line variant — used by validation toasts that show every
   failing field at once. Bullets so the user sees each item is a
   separate gap to fix. */
.toast-msg-list {
  list-style: disc;
  margin: 4px 0 0;
  padding-inline-start: 18px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  word-break: break-word;
  /* Cap height + scroll if the user managed to break many fields
     at once — keep the toast from filling the viewport. */
  max-height: 220px;
  overflow-y: auto;
}
.toast-msg-list li + li { margin-top: 3px; }

.toast-x {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
}
.toast-x:hover { background: var(--bg-hover); color: var(--text-primary); }

@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
