/* ── Toast ─────────────────────────────────────────────────────── */

/* Stack container — anchors and orders the whole toast queue. column-reverse so the
   newest (unshifted to the front of the toasts[] array, appended last to the DOM)
   lands closest to the anchor edge and pushes older toasts away from it. */
.sg-toast-region {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

/* Desktop: anchored bottom-right, toasts slide in/out from the right */
@media (min-width: 1280px) {
  .sg-toast-region {
    bottom: 56px;
    left: auto;
    right: 56px;
    transform: none;
    align-items: flex-end;
  }
}

/* Base state: hidden and offset. JS mounts the element here, paints one frame,
   then adds .sg-toast--visible to trigger the CSS transition (no @keyframes flash). */
.sg-toast {
  opacity: 0;
  transform: translateY(calc(100% + 12px));
  pointer-events: none;
  transition: opacity 400ms ease, transform 400ms ease;
  display: flex;
  align-items: flex-start;
  width: min(485px, calc(100vw - 32px));
  min-width: 220px;
  border-radius: 10px;
  font-family: var(--s2a-font-family-adobe-clean), var(--body-font-family);
  font-size: var(--s2a-font-size-sm);
  color: var(--s2a-color-content-knockout, #fff);
  box-shadow: 0 4px 20px rgb(0 0 0 / 20%);
  overflow: hidden;
}

.sg-toast--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (min-width: 1280px) {
  .sg-toast {
    transform: translateX(calc(100% + 56px));
  }

  .sg-toast--visible {
    transform: translateX(0);
  }
}

.sg-toast--informative { background: var(--s2a-color-blue-900, #3b63fb); }
.sg-toast--positive    { background: #05834e; }
.sg-toast--negative    { background: var(--s2a-color-background-utility-error, #d73220); }
.sg-toast--neutral     { background: var(--s2a-color-gray-700, #505050); }

.sg-toast__icon-wrap {
  align-items: flex-start;
  display: flex;
  flex-shrink: 0;
  padding: 18px 0 18px 16px;
}

/* flex-wrap: the message and CTA share one line when the card's content fits (it hugs
   its content up to max-width, so this stays compact); once they don't fit together,
   the CTA wraps to its own line — right-aligned, natural width, not a full-width row. */
.sg-toast__body {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  column-gap: 12px;
  row-gap: 8px;
  min-width: 0;
  padding: 10px 16px 10px 8px;
}

.sg-toast--neutral .sg-toast__body {
  padding-left: 16px;
}

/* Padded to the same 36px total height as .sg-toast__cta (2px border + 7px*2 padding +
   18px line-height) so a single-line message and the CTA share a common line height —
   without this they'd size to their own natural heights and the CTA (taller) would push
   .sg-toast__body's box taller than the icon/close columns, misaligning them vertically. */
.sg-toast__msg {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: var(--s2a-font-weight-adobe-clean-regular);
  line-height: 18px;
  padding: 9px 0;
  overflow-wrap: break-word;
}

.sg-toast__close {
  align-items: center;
  align-self: flex-start;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--s2a-color-content-knockout, #fff);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  height: 32px;
  justify-content: center;
  margin: 12px 8px 12px 0;
  padding: 0;
  width: 32px;
}

.sg-toast__close:hover {
  background: var(--s2a-color-transparent-white-12, rgb(255 255 255 / 12%));
}

.sg-toast__cta {
  align-items: center;
  background: transparent;
  border: 2px solid var(--s2a-color-transparent-white-16, rgb(255 255 255 / 16%));
  border-radius: 16px;
  color: var(--s2a-color-content-knockout, #fff);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  font-family: inherit;
  font-size: var(--s2a-font-size-sm);
  font-weight: var(--s2a-font-weight-adobe-clean-bold);
  justify-content: center;
  line-height: 18px;
  min-width: 72px;
  padding: 7px 16px;
  text-decoration: none;
  white-space: nowrap;
}

.sg-toast__cta:hover {
  background: var(--s2a-color-transparent-white-12, rgb(255 255 255 / 12%));
  text-decoration: none;
}
