/* ERP Toast notifications – top-right, non-blocking, no overlay. */

.erp-toast-container {
  --erp-toast-gap: 12px;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 380px;
  max-width: calc(100vw - 32px);
  pointer-events: none; /* never block the UI underneath */
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.erp-toast {
  --erp-accent: #2563eb;
  --erp-tint: #eff6ff;
  --erp-border: #dbeafe;
  --erp-icon-bg: rgba(37, 99, 235, 0.12);

  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  max-height: 400px;
  margin-bottom: var(--erp-toast-gap);
  padding: 14px 12px 14px 14px;
  overflow: hidden;
  color: #1f2937;
  background: linear-gradient(0deg, var(--erp-tint), var(--erp-tint)), #fff;
  border: 1px solid var(--erp-border);
  border-left: 4px solid var(--erp-accent);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(32px);
  transition:
    opacity 0.28s ease,
    transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
    max-height 0.28s ease,
    margin-bottom 0.28s ease;
  will-change: transform, opacity;
}

.erp-toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.erp-toast.is-leaving {
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
}

.erp-toast--success {
  --erp-accent: #16a34a;
  --erp-tint: #f0fdf4;
  --erp-border: #bbf7d0;
  --erp-icon-bg: rgba(22, 163, 74, 0.14);
}

.erp-toast--error {
  --erp-accent: #dc2626;
  --erp-tint: #fef2f2;
  --erp-border: #fecaca;
  --erp-icon-bg: rgba(220, 38, 38, 0.12);
}

.erp-toast--warning {
  --erp-accent: #d97706;
  --erp-tint: #fffbeb;
  --erp-border: #fde68a;
  --erp-icon-bg: rgba(217, 119, 6, 0.14);
}

.erp-toast--info {
  --erp-accent: #2563eb;
  --erp-tint: #eff6ff;
  --erp-border: #bfdbfe;
  --erp-icon-bg: rgba(37, 99, 235, 0.12);
}

.erp-toast__icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--erp-accent);
  background: var(--erp-icon-bg);
  border-radius: 50%;
}

.erp-toast__body {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 2px;
}

.erp-toast__title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: #111827;
  overflow-wrap: anywhere;
}

.erp-toast__message {
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.5;
  color: #374151;
  white-space: pre-line; /* keeps server-side line breaks */
  overflow-wrap: anywhere; /* long words / URLs / ids wrap */
  word-break: break-word;
}

.erp-toast__title:only-child {
  margin: 0;
  font-weight: 500;
  color: #1f2937;
}

.erp-toast__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  color: #6b7280;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.erp-toast__close:hover,
.erp-toast__close:focus-visible {
  color: #111827;
  background: rgba(15, 23, 42, 0.07);
  outline: none;
}

.erp-toast__close:focus-visible {
  box-shadow: 0 0 0 2px var(--erp-accent);
}

.erp-toast__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--erp-accent);
  opacity: 0.35;
  transform-origin: left center;
  animation-name: erp-toast-progress;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.erp-toast.is-paused .erp-toast__progress {
  animation-play-state: paused;
}

@keyframes erp-toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Tablets / phones: use the full width, keep a safe gap from the edges. */
@media (max-width: 575.98px) {
  .erp-toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    align-items: stretch;
  }

  .erp-toast {
    padding: 12px 10px 12px 12px;
    border-radius: 12px;
    transform: translateY(-16px);
  }

  .erp-toast.is-visible {
    transform: translateY(0);
  }

  .erp-toast.is-leaving {
    transform: translateY(-12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .erp-toast {
    transition: opacity 0.01s linear;
    transform: none !important;
  }

  .erp-toast__progress {
    animation: none;
  }
}
