/*
 * Dialogs and toasts, shared by the admin and the public site.
 * Replaces the browser's alert() and confirm(). See public/js/modal.js.
 *
 * Self-contained: it depends on neither Tailwind nor admin.css, so it looks
 * the same wherever it is loaded.
 */

:root {
  --pm-ink:        #16191c;
  --pm-text:       #4a5154;
  --pm-line:       #e3e6e2;
  --pm-green:      #14513c;
  --pm-green-dark: #0d3628;
  --pm-green-tint: #eef4f1;
  --pm-red:        #b42318;
  --pm-red-dark:   #912018;
  --pm-red-tint:   #fef3f2;
  --pm-amber:      #9a6700;
  --pm-amber-tint: #fff8e6;
  --pm-blue:       #1f5f8b;
  --pm-blue-tint:  #eef5fa;
}

/* ------------------------------------------------------------ dialog */

dialog.pm-dialog {
  width: min(440px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: var(--pm-text);
  font-family: Montserrat, system-ui, sans-serif;
  box-shadow: 0 24px 64px -16px rgba(22, 25, 28, .35), 0 2px 6px rgba(22, 25, 28, .08);
  overflow: auto;
}

dialog.pm-dialog::backdrop {
  background: rgba(22, 25, 28, .45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* Entrance. Played only when the visitor has not asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  dialog.pm-dialog[open] { animation: pm-in .18s cubic-bezier(.2, .8, .3, 1); }
  dialog.pm-dialog[open]::backdrop { animation: pm-fade .18s ease-out; }
  dialog.pm-dialog.is-closing { animation: pm-out .12s ease-in forwards; }
  dialog.pm-dialog.is-closing::backdrop { animation: pm-fade .12s ease-in reverse forwards; }
}
@keyframes pm-in   { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes pm-out  { to   { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes pm-fade { from { opacity: 0; } }

.pm-body { display: flex; gap: 1rem; padding: 1.5rem 1.5rem 1.25rem; }

.pm-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
}
.pm-icon .material-symbols-outlined { font-size: 24px; }

.pm-danger  .pm-icon { background: var(--pm-red-tint);   color: var(--pm-red); }
.pm-warning .pm-icon { background: var(--pm-amber-tint); color: var(--pm-amber); }
.pm-success .pm-icon { background: var(--pm-green-tint); color: var(--pm-green); }
.pm-info    .pm-icon { background: var(--pm-blue-tint);  color: var(--pm-blue); }

.pm-title {
  margin: .45rem 0 0;
  font-size: 1.05rem; font-weight: 700; line-height: 1.35;
  color: var(--pm-ink);
  overflow-wrap: anywhere;
}
.pm-message {
  margin: .4rem 0 0;
  font-size: .9rem; line-height: 1.55;
  overflow-wrap: anywhere;
}
.pm-message:empty { display: none; }

.pm-actions {
  display: flex; flex-direction: row-reverse; flex-wrap: wrap; gap: .5rem;
  padding: 1rem 1.5rem;
  background: #fafbf9;
  border-top: 1px solid var(--pm-line);
}

.pm-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 96px; height: 40px; padding: 0 1.1rem;
  border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.pm-btn:focus-visible { outline: 2px solid var(--pm-green); outline-offset: 2px; }

.pm-btn-primary { background: var(--pm-green); color: #fff; }
.pm-btn-primary:hover { background: var(--pm-green-dark); }
.pm-danger .pm-btn-primary { background: var(--pm-red); }
.pm-danger .pm-btn-primary:hover { background: var(--pm-red-dark); }
.pm-danger .pm-btn-primary:focus-visible { outline-color: var(--pm-red); }

.pm-btn-secondary { background: #fff; color: var(--pm-ink); border-color: #d4d8d3; }
.pm-btn-secondary:hover { background: #f4f5f3; }

/* On a phone the buttons stack full width, primary on top, within thumb reach. */
@media (max-width: 480px) {
  .pm-body { padding: 1.25rem 1.25rem 1rem; }
  .pm-actions { flex-direction: column; padding: 1rem 1.25rem; }
  .pm-btn { width: 100%; height: 44px; }
}

/* ------------------------------------------------------------ toasts */

/* Top right, not bottom: the bottom edge is where the sticky Save bar and
   each row's delete button sit, and a toast there lands on top of them.
   A page can push it below its own header with --pm-toast-top. */
.pm-toasts {
  position: fixed; z-index: 1000;
  right: 1rem; top: var(--pm-toast-top, 1rem);
  display: flex; flex-direction: column; gap: .5rem;
  width: min(380px, calc(100vw - 2rem));
  pointer-events: none;
}
@media (max-width: 480px) {
  .pm-toasts { left: 1rem; right: 1rem; width: auto; }
}

.pm-toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .85rem .75rem .85rem 1rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--pm-line);
  border-left-width: 4px;
  box-shadow: 0 12px 32px -12px rgba(22, 25, 28, .28);
  font-family: Montserrat, system-ui, sans-serif;
  font-size: .875rem; line-height: 1.45; font-weight: 500;
  color: var(--pm-ink);
}
.pm-toast .material-symbols-outlined { font-size: 20px; flex-shrink: 0; margin-top: -1px; }
.pm-toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pm-toast-close {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin: -3px 0 -3px 0;
  border: 0; border-radius: 6px; background: transparent;
  color: #8a918c; cursor: pointer;
}
.pm-toast-close:hover { background: #f1f2ef; color: var(--pm-ink); }
.pm-toast-close .material-symbols-outlined { font-size: 18px; margin: 0; }

.pm-toast.pm-success { border-left-color: var(--pm-green); }
.pm-toast.pm-success > .material-symbols-outlined { color: var(--pm-green); }
.pm-toast.pm-danger  { border-left-color: var(--pm-red); }
.pm-toast.pm-danger  > .material-symbols-outlined { color: var(--pm-red); }
.pm-toast.pm-warning { border-left-color: #d99a2b; }
.pm-toast.pm-warning > .material-symbols-outlined { color: var(--pm-amber); }
.pm-toast.pm-info    { border-left-color: var(--pm-blue); }
.pm-toast.pm-info    > .material-symbols-outlined { color: var(--pm-blue); }

@media (prefers-reduced-motion: no-preference) {
  .pm-toast { animation: pm-toast-in .22s cubic-bezier(.2, .8, .3, 1); }
  .pm-toast.is-leaving { animation: pm-toast-out .18s ease-in forwards; }
}
@keyframes pm-toast-in  { from { opacity: 0; transform: translateY(-10px); } }
@keyframes pm-toast-out { to   { opacity: 0; transform: translateX(16px); } }
