/* ==========================================================================
   NSRL POP-UPS — toast + confirm dialog (site-wide)
   Path: assets/common/css/shared/popups.css
   Script: assets/common/js/popups.js (NsrlToast, NsrlDialog)
   ========================================================================== */

:root {
  --nsrl-p-ink: #1e293b;
  --nsrl-p-focus: #111827;
  --nsrl-p-danger: #b42318;
  --nsrl-p-neutral: #f1f3f4;
  --nsrl-p-neutral-hover: #e8eaec;
}

/* ==========================================================================
   Confirm dialog (NsrlDialog.confirm) — replaces the browser's window.confirm
   ========================================================================== */
/* Above every module's own pop-up (Billing 999999, User Management 2147483647 = the top level). Equal levels: the
   dialog and toasts are added to the page last, so they still land on top. */
.nsrl-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .45);
  opacity: 0;
  transition: opacity .15s ease;
}
.nsrl-dialog-backdrop.is-open { opacity: 1; }

.nsrl-dialog {
  width: 100%;
  max-width: 420px;
  padding: 22px 22px 18px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px -12px rgba(15, 23, 42, .35);
  font-family: var(--nsrl-font, "DM Sans", sans-serif);
  transform: translateY(8px) scale(.98);
  transition: transform .15s ease;
}
.nsrl-dialog-backdrop.is-open .nsrl-dialog { transform: none; }

.nsrl-dialog__title { margin: 0 0 6px; font-size: 17px; font-weight: 700; color: #111827; }
.nsrl-dialog__msg   { margin: 0 0 20px; font-size: 14px; line-height: 1.5; color: #475569; }
.nsrl-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }

.nsrl-dialog__btn {
  padding: 9px 18px;
  border: 2px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.nsrl-dialog__btn:focus-visible { outline: none; border-color: var(--nsrl-p-focus); }
.nsrl-dialog__btn--cancel { background: var(--nsrl-p-neutral); color: var(--nsrl-p-ink); }
.nsrl-dialog__btn--cancel:hover { background: var(--nsrl-p-neutral-hover); }
.nsrl-dialog__btn--confirm { background: #64dde3; color: #053b3e; }
.nsrl-dialog__btn--confirm:hover { background: #4ecfd5; }
.nsrl-dialog__btn--confirm.is-danger { background: var(--nsrl-p-danger); color: #fff; }
.nsrl-dialog__btn--confirm.is-danger:hover { background: #912018; }

/* Icon above the title (NsrlDialog.save, NsrlDialog.success) */
.nsrl-dialog__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 0 14px;
  border-radius: 12px;
  background: rgba(8, 127, 135, .1);
  color: #087f87;
}
.nsrl-dialog__icon svg { display: block; }

/* Success dialog: centred, one button */
.nsrl-dialog--success { max-width: 380px; padding: 28px 24px 20px; text-align: center; }
.nsrl-dialog--success .nsrl-dialog__icon--check {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(27, 127, 76, .12);
  color: #1b7f4c;
}
.nsrl-dialog--success .nsrl-dialog__title { font-size: 18px; }
.nsrl-dialog--success .nsrl-dialog__msg { margin-bottom: 18px; }
.nsrl-dialog--success .nsrl-dialog__actions { justify-content: center; }
.nsrl-dialog--success .nsrl-dialog__btn { min-width: 120px; }
.nsrl-dialog__hint { margin: 12px 0 0; font-size: 12px; color: #64748b; }
.nsrl-dialog__tick { stroke-dasharray: 30; stroke-dashoffset: 30; }
.nsrl-dialog-backdrop.is-open .nsrl-dialog__tick { animation: nsrl-dialog-tick 420ms 120ms cubic-bezier(.22, 1, .36, 1) forwards; }
@keyframes nsrl-dialog-tick { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .nsrl-dialog__tick { stroke-dashoffset: 0; }
  .nsrl-dialog-backdrop.is-open .nsrl-dialog__tick { animation: none; }
}


/* ==========================================================================
   Toast (NsrlToast) — soft gradient edge instead of a hard coloured bar
   ========================================================================== */
.nsrl-toast-host {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 360px;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}
.nsrl-toast {
  --nsrl-t-accent: #10b981;
  --nsrl-t-tint: rgba(16, 185, 129, .20);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--nsrl-t-tint) 0%, rgba(255,255,255,0) 55%), #fff;
  box-shadow: 0 10px 30px -8px rgba(15, 23, 42, .25), 0 2px 6px rgba(15, 23, 42, .06);
  font-family: var(--nsrl-font, "DM Sans", sans-serif);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity .2s ease, transform .2s ease;
}
.nsrl-toast.is-open { opacity: 1; transform: none; }
.nsrl-toast--error { --nsrl-t-accent: var(--nsrl-p-danger); --nsrl-t-tint: rgba(180, 35, 24, .16); }
.nsrl-toast--info  { --nsrl-t-accent: #0e7490; --nsrl-t-tint: rgba(14, 116, 144, .16); }

.nsrl-toast__icon {
  flex: 0 0 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--nsrl-t-accent);
}
.nsrl-toast__body { flex: 1 1 auto; min-width: 0; }
.nsrl-toast__title { font-size: 14.5px; font-weight: 700; color: #1f2937; }
.nsrl-toast__msg { margin-top: 2px; font-size: 13px; line-height: 1.4; color: #6b7280; word-wrap: break-word; }
.nsrl-toast__close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
}
.nsrl-toast__close:hover { background: #f3f4f6; color: #374151; }

@media (max-width: 480px) { .nsrl-toast-host { top: 12px; right: 12px; left: 12px; width: auto; } }
