/* Success, error, warning and progress messages for the whole site (rendered by toast() in Includes/scripts.php). */

.pg-toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 4000;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 32px));
  pointer-events: none;
}

.pg-toast {
  --pg-toast-accent: #1a72ad;
  --pg-toast-soft: #e6f0fa;
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 28px;
  gap: 12px;
  align-items: start;
  padding: 14px 12px 16px 14px;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-left: 4px solid var(--pg-toast-accent);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .16);
  color: #182230;
  font-family: Inter, Manrope, Arial, sans-serif;
  pointer-events: auto;
  animation: pg-toast-in .22s ease-out both;
}
.pg-toast.is-leaving { animation: pg-toast-out .2s ease-in both; }

.pg-toast--success { --pg-toast-accent: #247a3d; --pg-toast-soft: #dcefe2; }
.pg-toast--error { --pg-toast-accent: #a23b32; --pg-toast-soft: #f9e9e7; }
.pg-toast--warning { --pg-toast-accent: #9a6700; --pg-toast-soft: #fff4d8; }
.pg-toast--info, .pg-toast--loading { --pg-toast-accent: #1a72ad; --pg-toast-soft: #e6f0fa; }

.pg-toast__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--pg-toast-soft);
  color: var(--pg-toast-accent);
  font-size: 15px;
}
.pg-toast__body { min-width: 0; padding-top: 1px; }
.pg-toast__title { display: block; margin: 0 0 2px; color: #182230; font-size: 14px; font-weight: 800; line-height: 1.3; }
.pg-toast__message { margin: 0; color: #344054; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-line; }
.pg-toast__action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid var(--pg-toast-accent);
  border-radius: 6px;
  background: #fff;
  color: var(--pg-toast-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  text-transform: none;
  cursor: pointer;
}
.pg-toast__action:hover { background: var(--pg-toast-soft); }
.pg-toast__close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #667085;
  font-size: 14px;
  cursor: pointer;
}
.pg-toast__close:hover, .pg-toast__close:focus-visible { background: #f2f4f7; color: #182230; }
.pg-toast__bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--pg-toast-accent);
  opacity: .55;
  transform-origin: left center;
  animation: pg-toast-bar linear forwards;
}
.pg-toast:hover .pg-toast__bar { animation-play-state: paused; }

@keyframes pg-toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pg-toast-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes pg-toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (max-width: 560px) {
  .pg-toast-stack { top: 10px; right: 10px; left: 10px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .pg-toast, .pg-toast.is-leaving { animation: none; }
}

/* Confirm / prompt dialogs (pgConfirm, pgPrompt in Includes/scripts.php) */
.pg-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 4100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(16, 24, 40, .45);
  animation: pg-dialog-fade .16s ease-out both;
}
.pg-dialog-backdrop.is-leaving { animation: pg-dialog-fade .16s ease-in reverse both; }
.pg-dialog {
  --pg-dialog-accent: #1a72ad;
  --pg-dialog-soft: #e6f0fa;
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 20px 20px 16px;
  border-top: 4px solid var(--pg-dialog-accent);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .28);
  color: #182230;
  font-family: Inter, Manrope, Arial, sans-serif;
  animation: pg-toast-in .18s ease-out both;
}
.pg-dialog--danger { --pg-dialog-accent: #a23b32; --pg-dialog-soft: #f9e9e7; }
.pg-dialog--warning { --pg-dialog-accent: #9a6700; --pg-dialog-soft: #fff4d8; }
.pg-dialog__head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pg-dialog__icon {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--pg-dialog-soft);
  color: var(--pg-dialog-accent);
  font-size: 15px;
}
.pg-dialog__title { margin: 0; color: #182230; font-size: 17px; font-weight: 800; line-height: 1.3; text-transform: none; letter-spacing: 0; }
.pg-dialog__message { margin: 0 0 12px; color: #344054; font-size: 14px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.pg-dialog__details { display: grid; gap: 0; margin: 0 0 14px; padding: 4px 12px; border-radius: 8px; background: #f5f8fb; }
.pg-dialog__details div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #e4e9f1; font-size: 13px; }
.pg-dialog__details div:last-child { border-bottom: 0; }
.pg-dialog__details dt { color: #667085; font-weight: 700; }
.pg-dialog__details dd { margin: 0; color: #182230; font-weight: 800; text-align: right; overflow-wrap: anywhere; }
.pg-dialog__field { display: grid; gap: 6px; margin: 0 0 14px; }
.pg-dialog__field > span { color: #344054; font-size: 13px; font-weight: 800; }
.pg-dialog__field input, .pg-dialog__field textarea {
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #cbd6e2;
  border-radius: 6px;
  background: #fff;
  color: #182230;
  font: inherit;
  font-size: 14px;
  box-sizing: border-box;
}
.pg-dialog__field textarea { resize: vertical; }
.pg-dialog__field input:focus, .pg-dialog__field textarea:focus { border-color: #1a72ad; outline: 3px solid rgba(26, 114, 173, .18); }
.pg-dialog__field [aria-invalid="true"] { border-color: #a23b32; }
.pg-dialog__error { color: #a23b32; font-size: 12px; font-weight: 800; }
.pg-dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pg-dialog__button {
  min-height: 40px;
  margin: 0;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: none;
  cursor: pointer;
}
.pg-dialog__button:focus-visible { outline: 3px solid rgba(26, 114, 173, .35); outline-offset: 2px; }
.pg-dialog__button--cancel { border-color: #cbd6e2; background: #fff; color: #344054; }
.pg-dialog__button--cancel:hover { background: #f2f4f7; }
.pg-dialog__button--primary { background: #1a72ad; color: #fff; }
.pg-dialog__button--primary:hover { background: #145f91; }
.pg-dialog__button--danger { background: #a23b32; color: #fff; }
.pg-dialog__button--danger:hover { background: #8a3029; }
.pg-dialog__button--warning { background: #9a6700; color: #fff; }
.pg-dialog__button--warning:hover { background: #7f5500; }
@keyframes pg-dialog-fade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 480px) {
  .pg-dialog__actions { flex-direction: column-reverse; }
  .pg-dialog__button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .pg-dialog-backdrop, .pg-dialog-backdrop.is-leaving, .pg-dialog { animation: none; }
}
