/* ============================================================
   TOAST — Ephemeral inline notifications for API validation
   errors, success confirmations, and warnings. Appears at the
   top of the current viewport, auto-dismisses after 5 seconds.

   PHILOSOPHY:
   The guest never leaves the workflow. Toast surfaces the error,
   the field stays focused, the guest corrects and resubmits.
   Guidance, not punishment.

   USAGE:
   <div class="toast toast--error" role="alert" aria-live="assertive">
     <svg class="toast-icon" viewBox="0 0 24 24">
       <use href="#icon-alert-circle"/>
     </svg>
     <span class="toast-message">Invalid card number</span>
     <button class="toast-dismiss" aria-label="Dismiss">
       <svg viewBox="0 0 24 24" width="16" height="16">
         <use href="#icon-x"/>
       </svg>
     </button>
   </div>

   VARIANTS:
   .toast--error    — API validation failures (red-toned)
   .toast--success  — Confirmed actions (green-toned)
   .toast--warning  — Caution / partial failures (warm orange)

   RULES:
   - Icon style is LINE-ART from sprite. No filled icons. No emojis.
   - Short, specific messages. "Invalid card number" not "An error occurred."
   - Auto-dismiss: 5s default. Error toasts stay until dismissed.
   - Max one toast visible at a time. New toast replaces previous.
   - border-radius: 0 — sharp corners, consistent with platform.
   - Never blue. Error uses --color-error. Warning uses --color-warning.
   ============================================================ */

/* ── Container ──
   Fixed to top of viewport, centered. z-index above page
   content but below modals.
   ── */
.toast-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 16px 16px 0;
  z-index: 900;                       /* Below modal (1000) */
  pointer-events: none;
}

/* ── Toast base ── */
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 0;                   /* Sharp corners */
  border: 1px solid transparent;
  box-shadow: var(--shadow-card-medium);
  font-family: var(--font-body);
  max-width: 480px;
  width: 100%;
  pointer-events: auto;
  animation: toast-in 0.3s ease forwards;
}

.toast.toast--exiting {
  animation: toast-out 0.25s ease forwards;
}

/* ── Error variant ── */
.toast--error {
  background: var(--color-error-bg);
  border-color: var(--color-error);
}
.toast--error .toast-icon {
  color: var(--color-error);
}
.toast--error .toast-message {
  color: var(--color-error);
}

/* ── Success variant ── */
.toast--success {
  background: var(--color-success-bg);
  border-color: var(--color-success);
}
.toast--success .toast-icon {
  color: var(--color-success);
}
.toast--success .toast-message {
  color: var(--color-text-primary);
}

/* ── Warning variant ── */
.toast--warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning);
}
.toast--warning .toast-icon {
  color: var(--color-warning);
}
.toast--warning .toast-message {
  color: var(--color-text-primary);
}

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

/* ── Message ── */
.toast-message {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

/* ── Dismiss button ── */
.toast-dismiss {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--color-text-light);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}
.toast-dismiss:hover {
  color: var(--color-text-primary);
}

/* ── Progress bar (auto-dismiss timer) ── */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0;
  animation: toast-timer 5s linear forwards;
}
.toast--error .toast-progress {
  background: var(--color-error);
}
.toast--success .toast-progress {
  background: var(--color-success);
}
.toast--warning .toast-progress {
  background: var(--color-warning);
}

/* ── Animations ── */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

@keyframes toast-timer {
  from { width: 100%; }
  to { width: 0%; }
}
