/* ==========================================================================
   EasyRender — Shared Toast Notification (see static/js/toast.js)
   ==========================================================================
   ONE stylesheet for every toast in the admin dashboard, customer portal,
   org portal and docs editor. It replaces per-page copies that each raised
   z-index to beat the last one (200 / 999 / 2000 / 9999 / 99999) instead of
   fixing the overlap. The fix here is structural, not a bigger number:

   - The container clears the mobile bottom nav bar by its measured height
     plus the safe-area inset, instead of sitting on top of it.
   - Colours are solid, not a low-opacity tint over whatever is underneath —
     org.css had already found that a 10%-opacity toast over a data table
     reads as two overlapping things, not a notification.
   - One z-index (10050), picked once: above every overlay this codebase
     defines (.confirm-modal-overlay is the highest at 10000), not an
     escalating guess.
   ========================================================================== */

.ezr-toast-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 10050;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

/* The mobile bottom nav (.portal-bottom-nav, portal_redesign.css) is fixed
   at ~10px + the safe-area inset and is roughly 70px tall. A toast at the
   default offset would render on top of it, covering its buttons — the
   exact "confirmation overlaps the UI" complaint. Clear it structurally
   instead of outrunning it with a higher z-index. */
@media (max-width: 768px) {
  body.page-portal.has-bottom-nav .ezr-toast-container {
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }
}

/* With the portal sidebar showing, centre on the content beside it, not on
   the whole window: centred on the window, the popup sat 126px left of the
   cards above it (owner, 2026-10-05). The sidebar hides at 768px and below
   (portal_redesign.css), where the window centre is right again. */
@media (min-width: 769px) {
  body.page-portal.portal-layout-active .ezr-toast-container {
    left: calc(50% + var(--pr-sidebar-w, 252px) / 2);
    width: min(420px, calc(100vw - var(--pr-sidebar-w, 252px) - 32px));
  }
}

.ezr-toast {
  pointer-events: auto;
  box-sizing: border-box;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Plus Jakarta Sans", sans-serif;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(8px);
  animation: ezr-toast-in 0.2s ease forwards;
}

.ezr-toast-hide {
  animation: ezr-toast-out 0.2s ease forwards;
}

/* Solid backgrounds, not a translucent tint over the page — legible over a
   data table, a form, or another toast stacked behind it. */
.ezr-toast-success {
  background: #103a26;
  border-color: #1f7a4c;
  color: #d7f7e4;
}

.ezr-toast-error {
  background: #3a1414;
  border-color: #8a2b2b;
  color: #fde2e2;
}

.ezr-toast-info {
  background: #142238;
  border-color: #2c4a7c;
  color: #dbe7fb;
}

.ezr-toast-warning {
  background: #332a10;
  border-color: #6b5518;
  color: #f5d98b;
}

@keyframes ezr-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* This file is loaded on pages that never load portal_redesign.css or
   org.css (the admin dashboard's base.html does not), so it cannot rely on
   either sheet's universal `*` reduced-motion rule and carries its own. */
@media (prefers-reduced-motion: reduce) {
  .ezr-toast,
  .ezr-toast-hide {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
