/* =========================================================
   Toast notifications (toastr) — themed with base.css tokens.
   Markup produced by messenger.min.js:
     #toast-container.toast-<position>
       > div.toast.toast-<type>
           > button.toast-close-button.icon.icon-close
           > div.toast-title (optional)
           > div.toast-message
   Type colour comes from --toast-accent; icon from --toast-icon.
   ========================================================= */

#toast-container {
  position: fixed;
  z-index: 999999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-xl);
}
#toast-container * {
  box-sizing: border-box;
}

/* ---------- Positions ---------- */
.toast-top-center,
.toast-top-full-width {
  top: calc(env(safe-area-inset-top, 0px) + var(--space-lg));
  left: 0;
  right: 0;
}
.toast-bottom-center,
.toast-bottom-full-width {
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--space-lg));
  left: 0;
  right: 0;
}
.toast-top-left     { top: var(--space-lg);    left: 0;  align-items: flex-start !important; }
.toast-top-right    { top: var(--space-lg);    right: 0; align-items: flex-end !important; }
.toast-bottom-left  { bottom: var(--space-lg); left: 0;  align-items: flex-start !important; }
.toast-bottom-right { bottom: var(--space-lg); right: 0; align-items: flex-end !important; }

/* ---------- Toast card ---------- */
#toast-container > .toast {
  --toast-accent: var(--brand-primary);
  position: relative;
  pointer-events: auto;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  width: 100%;
  max-width: 480px;
  margin: 0;
  padding: var(--space-lg) var(--space-lg) var(--space-lg) var(--space-xl);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--toast-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(15, 23, 33, .18);
  color: var(--text-default);
  font-family: var(--font-base);
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
}
#toast-container > .toast:hover {
  box-shadow: 0 8px 32px rgba(15, 23, 33, .26);
}

/* Type icon */
#toast-container > .toast::before {
  content: "";
  order: 0;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-color: var(--toast-accent);
  -webkit-mask: var(--toast-icon) no-repeat center / contain;
  mask: var(--toast-icon) no-repeat center / contain;
}

.toast-title {
  order: 1;
  font-weight: 600;
}
.toast-message {
  order: 1;
  flex: 1;
  min-width: 0;
  padding-top: 1px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.toast-message a,
.toast-message label {
  color: var(--text-link);
}
.toast-message a:hover {
  text-decoration: underline;
}

/* Close button (icon mask comes from base.css .icon/.icon-close) */
#toast-container .toast-close-button {
  order: 2;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  padding: 0;
  border: 0;
  background-color: var(--text-muted);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
#toast-container .toast-close-button:hover,
#toast-container .toast-close-button:focus {
  background-color: var(--text-default);
  outline: none;
}

/* ---------- Types ---------- */
#toast-container > .toast-success {
  --toast-accent: var(--feedback-success);
  --toast-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z'/></svg>");
}
#toast-container > .toast-error {
  --toast-accent: var(--feedback-error);
  --toast-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z'/></svg>");
}
#toast-container > .toast-error .toast-message,
#toast-container > .toast-error .toast-title {
  color: var(--feedback-error);
}
#toast-container > .toast-warning {
  --toast-accent: var(--feedback-warning);
  --toast-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m40-120 440-760 440 760H40Zm440-120q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Z'/></svg>");
}
#toast-container > .toast-info {
  --toast-accent: var(--brand-primary);
  --toast-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z'/></svg>");
}

/* ---------- Progress bar (progressBar option) ---------- */
.toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background-color: var(--toast-accent);
  opacity: 0.5;
}

/* ---------- RTL ---------- */
#toast-container > .toast.rtl {
  direction: rtl;
  border-left-width: 1px;
  border-right: 4px solid var(--toast-accent);
}
