/**
 * Swapsy — Toastr overrides (opaque bar, modal-style ×, content-width center toasts + max width).
 * Loaded via ToastrAsset. Realtime inbox/dispute cards share the same token-backed toast surface.
 *
 * style.min.css adds FontAwesome :before icons on toasts — we remove them and use the shared toast surface.
 */

:root {
  --sw-toast-bg: var(--sw-token-color-ink-950);
  --sw-toast-card-bg: var(--sw-token-color-brand-dark);
  --sw-toast-color: var(--sw-token-color-text-on-dark);
  --sw-toast-message-color: var(--sw-token-color-text-on-dark);
  --sw-toast-card-message-color: var(--sw-token-color-text-on-dark);
  --sw-toast-border: var(--sw-token-color-white-18);
  --sw-toast-border-strong: var(--sw-token-color-white-78);
  --sw-toast-radius: calc(var(--sw-token-radius-sm, 10px) - var(--sw-token-space-2, 2px));
  --sw-toast-radius-mobile: calc(var(--sw-token-radius-sm, 10px) - var(--sw-token-space-2, 2px));
  --sw-toast-padding-y: var(--sw-token-space-10, 10px);
  --sw-toast-padding-x: var(--sw-token-space-14, 14px);
  --sw-toast-card-padding-y: var(--sw-token-space-8, 8px);
  --sw-toast-card-padding-x: var(--sw-token-space-12, 12px);
  --sw-toast-card-padding-bottom: var(--sw-token-space-10, 10px);
  --sw-toast-card-gap: var(--sw-token-space-10, 10px);
  --sw-toast-gutter: var(--sw-token-space-16, 16px);
  --sw-toast-bottom-offset: var(--sw-token-space-20, 20px);
  --sw-toast-gap: var(--sw-token-space-8, 8px);
  --sw-toast-row-gap: var(--sw-token-space-6, 6px);
  --sw-toast-motion-clearance: var(--sw-token-space-32, 32px);
  --sw-toast-font-size: var(--sw-token-font-size-14, 14px);
  --sw-toast-font-weight: calc(var(--sw-token-font-weight-regular, 400) - 100);
  --sw-toast-card-font-size: var(--sw-token-font-size-14, 14px);
  --sw-toast-font-weight-title: var(--sw-token-font-weight-semibold, 600);
  --sw-toast-close-size: var(--sw-token-size-24, 24px);
  --sw-toast-close-size-mobile: var(--sw-token-size-28, 28px);
  --sw-toast-close-font-size: var(--sw-token-font-size-22, 22px);
  --sw-toast-close-font-size-mobile: var(--sw-token-font-size-24, 24px);
  --sw-toast-width-max: 240px;
  --sw-toast-realtime-width-max: 40rem;
  --sw-toast-height-max-mobile: 100px;
  --sw-toast-realtime-height-max-mobile: 140px;
  --sw-toast-shadow: 0 8px 24px var(--sw-token-color-ink-950-24, var(--sw-token-color-slate-900-22));
  --sw-toast-shadow-hover: 0 8px 24px var(--sw-token-color-ink-950-24, var(--sw-token-color-slate-900-22));
  --sw-toast-card-shadow: 0 14px 44px var(--sw-token-color-ink-950-24, var(--sw-token-color-slate-900-28)), 0 0 0 1px var(--sw-token-color-ink-950-08, var(--sw-token-color-black-06));
  --sw-toast-card-shadow-hover: 0 16px 48px var(--sw-token-color-ink-950-24, var(--sw-token-color-slate-900-34)), 0 0 0 1px var(--sw-token-color-white-18, var(--sw-token-color-white-12));
  --sw-toast-focus-ring: 0 0 0 2px var(--sw-token-color-white-78, var(--sw-token-color-white-45));
}

html.sw-theme-dark,
html[data-sw-theme="dark"],
body.sw-theme-dark,
body[data-sw-theme="dark"],
.sw-theme-dark {
  --sw-toast-bg: var(--sw-token-color-surface-150, #3a4545);
  --sw-toast-card-bg: var(--sw-token-color-surface-100, #252d2d);
  --sw-toast-color: var(--sw-token-color-text-900, #e3eaea);
  --sw-toast-message-color: var(--sw-token-color-text-900, #e3eaea);
  --sw-toast-card-message-color: var(--sw-token-color-text-700, #b6c1c1);
  --sw-toast-border: var(--sw-token-color-border-300, #536363);
  --sw-toast-border-strong: var(--sw-token-color-brand-light, #49ddf0);
  --sw-toast-shadow: 0 16px 44px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--sw-token-color-border-300, #536363);
  --sw-toast-shadow-hover: 0 18px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--sw-token-color-border-400, #7a8e8e);
  --sw-toast-card-shadow: 0 18px 54px rgba(0, 0, 0, 0.52), 0 0 0 1px var(--sw-token-color-border-300, #536363);
  --sw-toast-card-shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.58), 0 0 0 1px var(--sw-token-color-border-400, #7a8e8e);
  --sw-toast-focus-ring: 0 0 0 2px var(--sw-token-color-brand-light, #49ddf0);
}

#toast-container > div.toast,
#toast-container > div.toast-info,
#toast-container > div.toast-success,
#toast-container > div.toast-error,
#toast-container > div.toast-warning {
  background-color: var(--sw-toast-bg) !important;
  background-image: none !important;
  color: var(--sw-toast-color) !important;
  border-radius: var(--sw-toast-radius) !important;
}

/* Remove FA star/check/etc. from global Toastr custom block in style.min.css */
#toast-container > .toast:before,
#toast-container > .toast-info:before,
#toast-container > .toast-success:before,
#toast-container > .toast-warning:before,
#toast-container > .toast-error:before {
  content: none !important;
  display: none !important;
}

#toast-container .toast-title {
  color: var(--sw-toast-color) !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

#toast-container .toast-message {
  color: var(--sw-toast-message-color) !important;
  font-size: var(--sw-toast-font-size) !important;
  line-height: 1.35 !important;
}

#toast-container > div.toast:not(.swapsy-staff-notify-toast) .toast-title,
#toast-container > div.toast:not(.swapsy-staff-notify-toast) .toast-message {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  font-weight: var(--sw-toast-font-weight) !important;
  text-align: center !important;
}

#toast-container .toast-message:empty {
  display: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

#toast-container .toast-progress {
  display: none !important;
  opacity: 0 !important;
  height: 0 !important;
}

#toast-container > div.toast {
  opacity: 1 !important;
  -ms-filter: none !important;
  filter: none !important;
  box-shadow: var(--sw-toast-shadow) !important;
  padding: var(--sw-toast-padding-y) var(--sw-toast-padding-x) !important;
  background-position: left center !important;
}

/* Short-lived confirmation feedback must not block the action directly beneath it. */
#toast-container > div.toast.sw-toast--passthrough {
  pointer-events: none !important;
}

body #toast-container > div.toast:not(.swapsy-staff-notify-toast) {
  padding: var(--sw-toast-padding-y) var(--sw-toast-padding-x) !important;
}

#toast-container > div:hover {
  opacity: 1 !important;
  box-shadow: var(--sw-toast-shadow-hover) !important;
}

#toast-container > div.toast:not(.swapsy-staff-notify-toast):hover {
  cursor: default !important;
}

#toast-container.toast-bottom-center > div:not(.swapsy-staff-notify-toast),
#toast-container.toast-top-center > div:not(.swapsy-staff-notify-toast) {
  width: fit-content !important;
  max-width: min(var(--sw-toast-width-max), calc(100vw - (var(--sw-toast-gutter) * 2))) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  text-align: center !important;
}

/*
 * Realtime user inbox / dispute parent toasts — match backend staff console card layout
 * (see backend/web/css/backend.css `.swapsy-staff-notify-toast`).
 */
#toast-container > .toast.swapsy-staff-notify-toast:before {
  content: none !important;
  display: none !important;
}

#toast-container.toast-bottom-center > .toast.swapsy-staff-notify-toast {
  max-width: min(var(--sw-toast-realtime-width-max), calc(100vw - (var(--sw-toast-gutter) * 2)));
  width: 100%;
  padding: var(--sw-toast-card-padding-y) var(--sw-toast-card-padding-x) var(--sw-toast-card-padding-bottom) var(--sw-toast-card-padding-x) !important;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  column-gap: var(--sw-toast-gap);
  row-gap: var(--sw-toast-row-gap);
  background: var(--sw-toast-card-bg) !important;
  background-image: none !important;
  color: var(--sw-toast-color) !important;
  border: 1px solid var(--sw-toast-border);
  border-radius: var(--sw-toast-radius);
  box-shadow: var(--sw-toast-card-shadow);
  opacity: 1 !important;
  cursor: default !important;
}

#toast-container > .toast.swapsy-staff-notify-toast:hover {
  cursor: default !important;
  box-shadow: var(--sw-toast-card-shadow-hover) !important;
  opacity: 1 !important;
}

#toast-container > .toast.swapsy-staff-notify-toast .toast-title {
  order: 1;
  flex: 1 1 0;
  min-width: 0;
  color: var(--sw-toast-color) !important;
  font-weight: var(--sw-toast-font-weight-title);
  font-size: var(--sw-toast-card-font-size);
  line-height: 1.3;
  margin: 0;
  padding: 0;
  align-self: center;
}

#toast-container > .toast.swapsy-staff-notify-toast .toast-message {
  order: 3;
  flex: 1 1 100%;
  padding: 0 !important;
  margin: 0;
  color: inherit !important;
  align-self: stretch;
}

#toast-container > .toast.swapsy-staff-notify-toast .toast-close-button {
  order: 2;
  position: static;
  float: none;
  margin: 0;
  padding: 0;
  z-index: 2;
  flex: 0 0 auto;
  align-self: center;
  width: var(--sw-toast-close-size);
  height: var(--sw-toast-close-size);
  min-width: var(--sw-toast-close-size);
  min-height: var(--sw-toast-close-size);
  font-size: var(--sw-toast-close-font-size);
  font-weight: var(--sw-token-font-weight-medium, 500);
  line-height: 1;
  color: var(--sw-toast-color) !important;
  text-shadow: none !important;
  opacity: 0.75;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--sw-token-color-transparent);
  border-radius: var(--sw-token-radius-full, 50%);
  box-sizing: border-box;
  -webkit-tap-highlight-color: var(--sw-token-color-transparent);
  transition: background-color 0.15s ease, opacity 0.15s ease;
  transform: none !important;
  top: auto !important;
  right: auto !important;
}

#toast-container > .toast.swapsy-staff-notify-toast .toast-close-button > .fa-xmark,
#toast-container > .toast.swapsy-staff-notify-toast .toast-close-button > .fa-times {
  font-size: 0.7em;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#toast-container > .toast.swapsy-staff-notify-toast .toast-close-button:hover,
#toast-container > .toast.swapsy-staff-notify-toast .toast-close-button:focus {
  opacity: 1;
  background-color: var(--sw-token-color-white-18, var(--sw-token-color-white-15));
  outline: none;
}

#toast-container > .toast.swapsy-staff-notify-toast .toast-close-button:focus-visible {
  opacity: 1;
  background-color: var(--sw-token-color-white-18, var(--sw-token-color-white-15));
  box-shadow: var(--sw-toast-focus-ring);
}

#toast-container > .toast.swapsy-staff-notify-toast .toast-close-button:active {
  background-color: var(--sw-token-color-white-18, var(--sw-token-color-white-22));
}

#toast-container > .toast.swapsy-staff-notify-toast .toast-progress {
  order: 10;
  opacity: 0.5;
  background-color: var(--sw-toast-border-strong) !important;
}

.swapsy-staff-notify {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--sw-toast-card-gap);
  min-width: 0;
  width: 100%;
}

#toast-container > .toast.swapsy-staff-notify-toast .swapsy-staff-notify__preview {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  font-size: var(--sw-toast-card-font-size);
  line-height: 1.35;
  color: var(--sw-toast-card-message-color);
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.swapsy-staff-notify__actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  margin: 0 0 0 auto;
  gap: var(--sw-toast-gap);
}

#toast-container > .toast.swapsy-staff-notify-toast a.btn.swapsy-staff-notify__btn,
#toast-container > .toast.swapsy-staff-notify-toast button.btn.swapsy-staff-notify__btn {
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-size: var(--sw-toast-card-font-size);
  line-height: 1.2;
  padding-top: var(--sw-token-space-4, 4px) !important;
  padding-bottom: var(--sw-token-space-4, 4px) !important;
  white-space: nowrap;
  color: var(--sw-toast-color) !important;
  border-color: var(--sw-toast-border-strong) !important;
  background: var(--sw-token-color-transparent) !important;
}

#toast-container > .toast.swapsy-staff-notify-toast a.btn.swapsy-staff-notify__btn:hover,
#toast-container > .toast.swapsy-staff-notify-toast a.btn.swapsy-staff-notify__btn:focus,
#toast-container > .toast.swapsy-staff-notify-toast button.btn.swapsy-staff-notify__btn:hover,
#toast-container > .toast.swapsy-staff-notify-toast button.btn.swapsy-staff-notify__btn:focus {
  color: var(--sw-toast-color) !important;
  background: var(--sw-token-color-white-18) !important;
  border-color: var(--sw-toast-color) !important;
}

.swapsy-staff-notify__btn {
  margin-right: 0;
}

@media (min-width: 1100px) {
  body #toast-container.toast-bottom-center {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 var(--sw-toast-gutter) var(--sw-toast-bottom-offset) !important;
    box-sizing: border-box !important;
  }
}

/* Mobile/PWA: fill the toast row while keeping normal horizontal gutters and safe-area spacing. */
@media (max-width: 767px) {
  #toast-container > div {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-height: var(--sw-toast-height-max-mobile);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--sw-toast-radius-mobile) !important;
    box-sizing: border-box;
  }

  #toast-container.toast-bottom-center > div:not(.swapsy-staff-notify-toast),
  #toast-container.toast-top-center > div:not(.swapsy-staff-notify-toast) {
    width: 100% !important;
    max-width: 100% !important;
  }

  #toast-container.toast-bottom-center,
  #toast-container.toast-top-center,
  #toast-container.toast-top-full-width,
  #toast-container.toast-bottom-full-width {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    padding-left: max(var(--sw-toast-gutter), env(safe-area-inset-left, 0px)) !important;
    padding-right: max(var(--sw-toast-gutter), env(safe-area-inset-right, 0px)) !important;
    box-sizing: border-box !important;
  }

  #toast-container.toast-top-center,
  #toast-container.toast-top-full-width,
  #toast-container.toast-bottom-full-width {
    padding-top: var(--sw-toast-gutter) !important;
  }

  #toast-container.toast-bottom-center {
    bottom: 0;
  }

  #toast-container > div.toast.swapsy-staff-notify-toast {
    max-height: var(--sw-toast-realtime-height-max-mobile);
  }

  #toast-container > div.toast:not(.swapsy-staff-notify-toast) button.toast-close-button.close,
  #toast-container > div.toast:not(.swapsy-staff-notify-toast) button.close.toast-close-button {
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: var(--sw-toast-gap) !important;
    width: var(--sw-toast-close-size-mobile) !important;
    height: var(--sw-toast-close-size-mobile) !important;
    min-width: var(--sw-toast-close-size-mobile) !important;
    min-height: var(--sw-toast-close-size-mobile) !important;
    font-size: var(--sw-toast-close-font-size-mobile) !important;
  }

  #toast-container > div.toast.swapsy-staff-notify-toast button.toast-close-button.close,
  #toast-container > div.toast.swapsy-staff-notify-toast button.close.toast-close-button {
    width: var(--sw-toast-close-size-mobile) !important;
    height: var(--sw-toast-close-size-mobile) !important;
    min-width: var(--sw-toast-close-size-mobile) !important;
    min-height: var(--sw-toast-close-size-mobile) !important;
    font-size: var(--sw-toast-close-font-size-mobile) !important;
  }
}

@media (max-width: 1099px) {
  /* Bottom toasts use the full row but keep horizontal gutters and bottom safe-area clearance. */
  body #toast-container.toast-bottom-center {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    padding-top: 0 !important;
    padding-left: max(var(--sw-toast-gutter), env(safe-area-inset-left, 0px)) !important;
    padding-right: max(var(--sw-toast-gutter), env(safe-area-inset-right, 0px)) !important;
    padding-bottom: max(var(--sw-toast-gutter), env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
  }

  #toast-container.toast-bottom-center > .toast.swapsy-staff-notify-toast {
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: var(--sw-toast-radius-mobile) !important;
    box-sizing: border-box !important;
    align-content: flex-start;
  }

  #toast-container > .toast.swapsy-staff-notify-toast .toast-message {
    flex: 1 1 100%;
  }
}
