/*
 * One look for every SweetAlert2 dialog on the site (Swal.fire): white rounded
 * card, blue pill buttons, the same icon colours everywhere. Loaded from
 * _header.php, so no page needs its own popup styles.
 *
 * Selectors use :where(...) to keep specificity at one class: the few
 * dialogs with their own design (.rz-soon, .rza-done) and the toast
 * (.rz-toast) still win. Button colours use !important because callers pass
 * confirmButtonColor / cancelButtonColor / denyButtonColor inline, in a dozen
 * different colours; those are ignored on purpose. A red confirmButtonColor is
 * still honoured as "this action is destructive".
 */
:root {
  --rz-pop-ink: #16212c;
  --rz-pop-muted: #5f6d7b;
  --rz-pop-line: #dfe6ee;
  --rz-pop-primary: #0091ff;
  --rz-pop-primary-dark: #0a7fe0;
  --rz-pop-danger: #d92d20;
  --rz-pop-danger-dark: #b42318;
}

.swal2-container.swal2-backdrop-show:not(.swal2-toast) { background: rgba(15, 27, 38, 0.55); }

/* ---------- Card ---------- */
.swal2-popup:where(:not(.swal2-toast)) {
  width: min(460px, calc(100vw - 32px));
  padding: 30px 26px 24px;
  border-radius: 24px;
  background: #fff;
  color: var(--rz-pop-ink);
  box-shadow: 0 30px 70px -20px rgba(3, 68, 106, 0.45);
  font-family: inherit;
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-title {
  margin: 0;
  padding: 0;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--rz-pop-ink);
  overflow-wrap: anywhere;
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-html-container {
  margin: 8px 0 0;
  padding: 0;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--rz-pop-muted);
  overflow-wrap: anywhere;
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-html-container :where(b, strong) { color: var(--rz-pop-ink); }
:where(.swal2-popup:not(.swal2-toast)) .swal2-html-container :where(a) { font-weight: 600; color: var(--rz-pop-primary-dark); }

/* ---------- Icon ---------- */
:where(.swal2-popup:not(.swal2-toast)) .swal2-icon {
  margin: 4px auto 18px;
  font-size: 0.8em;                 /* icons are sized in em: 64px */
  box-shadow: 0 0 0 9px var(--rz-pop-icon-soft, transparent);
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-icon.swal2-info,
:where(.swal2-popup:not(.swal2-toast)) .swal2-icon.swal2-question {
  --rz-pop-icon-soft: #e6f3ff;
  border-color: var(--rz-pop-primary);
  color: var(--rz-pop-primary);
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-icon.swal2-warning {
  --rz-pop-icon-soft: #fdf1d3;
  border-color: #e0940f;
  color: #c27803;
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-icon.swal2-error {
  --rz-pop-icon-soft: #fde4e1;
  border-color: var(--rz-pop-danger);
  color: var(--rz-pop-danger);
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-icon.swal2-error [class^="swal2-x-mark-line"] { background-color: var(--rz-pop-danger); }

:where(.swal2-popup:not(.swal2-toast)) .swal2-icon.swal2-success {
  --rz-pop-icon-soft: #d6f5e8;
  border-color: #12b981;
  color: #0e9f6e;
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-icon.swal2-success [class^="swal2-success-line"] { background-color: #12b981; }
:where(.swal2-popup:not(.swal2-toast)) .swal2-icon.swal2-success .swal2-success-ring { border-color: rgba(18, 185, 129, 0.3); }

/* Pictures used in place of an icon (iconHtml: '<img …>') */
:where(.swal2-popup:not(.swal2-toast)) .swal2-icon:has(img) { border: 0; box-shadow: none; }
:where(.swal2-popup:not(.swal2-toast)) .swal2-icon img { max-width: 100%; max-height: 100%; }
:where(.swal2-popup:not(.swal2-toast)) .swal2-image { margin: 4px auto 16px; border-radius: 14px; }

/* ---------- Buttons ---------- */
:where(.swal2-popup:not(.swal2-toast)) .swal2-actions {
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 22px 0 0;
  padding: 0;
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-styled {
  flex: 1 1 130px;
  width: auto;
  min-height: 48px;
  margin: 0;
  padding: 10px 18px;
  border: 1px solid var(--rz-pop-line);
  border-radius: 999px;
  background: #fff !important;
  color: var(--rz-pop-ink) !important;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-styled:hover {
  border-color: #b8d9f5;
  background-image: none;
  color: #03446a !important;
  transform: translateY(-1px);
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-styled:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0, 145, 255, 0.25); }

/* The main action */
:where(.swal2-popup:not(.swal2-toast)) .swal2-styled.swal2-confirm {
  border-color: var(--rz-pop-primary);
  background: var(--rz-pop-primary) !important;
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(0, 145, 255, 0.3);
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-styled.swal2-confirm:hover {
  border-color: var(--rz-pop-primary-dark);
  background: var(--rz-pop-primary-dark) !important;
  color: #fff !important;
}

/* Destructive main action: .rz-danger, or a red confirmButtonColor from the caller */
:where(.swal2-popup:not(.swal2-toast)) .swal2-styled.swal2-confirm:is(.rz-danger, [style*="#d33" i], [style*="#9c1c20" i], [style*="221, 51, 51"], [style*="156, 28, 32"]) {
  border-color: var(--rz-pop-danger);
  background: var(--rz-pop-danger) !important;
  box-shadow: 0 10px 22px rgba(217, 45, 32, 0.28);
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-styled.swal2-confirm:is(.rz-danger, [style*="#d33" i], [style*="#9c1c20" i], [style*="221, 51, 51"], [style*="156, 28, 32"]):hover {
  border-color: var(--rz-pop-danger-dark);
  background: var(--rz-pop-danger-dark) !important;
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-styled:disabled { opacity: 0.55; cursor: default; transform: none; }
:where(.swal2-popup:not(.swal2-toast)) .swal2-loader { border-color: var(--rz-pop-primary) transparent var(--rz-pop-primary) transparent; }

/* ---------- Close button ---------- */
:where(.swal2-popup:not(.swal2-toast)) .swal2-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  margin: 0;
  border-radius: 50%;
  font-size: 1.7rem;
  color: #8a97a5;
  transition: background-color 0.15s ease, color 0.15s ease;
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-close:hover { background: #f1f5f9; color: var(--rz-pop-ink); }
:where(.swal2-popup:not(.swal2-toast)) .swal2-close:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0, 145, 255, 0.25); }

/* ---------- Form fields inside a dialog ---------- */
:where(.swal2-popup:not(.swal2-toast)) :is(.swal2-input, .swal2-textarea, .swal2-select) {
  box-sizing: border-box;
  width: 100%;
  margin: 14px 0 0;
  padding: 0 14px;
  border: 1px solid var(--rz-pop-line);
  border-radius: 12px;
  background: #fff;
  color: var(--rz-pop-ink);
  font-size: 0.95rem;
  box-shadow: none;
}

:where(.swal2-popup:not(.swal2-toast)) :is(.swal2-input, .swal2-select) { height: 46px; }
:where(.swal2-popup:not(.swal2-toast)) .swal2-textarea { min-height: 110px; padding: 10px 14px; }

:where(.swal2-popup:not(.swal2-toast)) :is(.swal2-input, .swal2-textarea, .swal2-select):focus {
  border-color: var(--rz-pop-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 145, 255, 0.18);
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-input-label { margin-top: 14px; font-size: 0.9rem; font-weight: 600; color: var(--rz-pop-ink); }

:where(.swal2-popup:not(.swal2-toast)) .swal2-validation-message {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fde4e1;
  color: #7a1710;
  font-size: 0.9rem;
  font-weight: 500;
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-validation-message::before { background-color: var(--rz-pop-danger); }

/* ---------- Footer, timer ---------- */
:where(.swal2-popup:not(.swal2-toast)) .swal2-footer {
  margin: 18px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--rz-pop-line);
  font-size: 0.88rem;
  color: var(--rz-pop-muted);
}

:where(.swal2-popup:not(.swal2-toast)) .swal2-timer-progress-bar { background: var(--rz-pop-primary); opacity: 0.7; }

@media (max-width: 420px) {
  .swal2-popup:where(:not(.swal2-toast)) { padding: 26px 18px 20px; border-radius: 20px; }
  :where(.swal2-popup:not(.swal2-toast)) .swal2-title { font-size: 1.3rem; }
  :where(.swal2-popup:not(.swal2-toast)) .swal2-styled { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  :where(.swal2-popup:not(.swal2-toast)) .swal2-styled { transition: none; }
}
