/**
 * Popup Manager - front-end styles (builds on Bootstrap 5 .modal)
 *
 * .modal-dialog is a full-viewport flex wrapper used for positioning;
 * .modal-content is the visible popup box.
 */

/* ---------- Layout / positioning ---------- */
.pm-modal .modal-dialog {
  display: flex;
  align-items: var(--pm-align-y, center);
  justify-content: var(--pm-align-x, center);
  width: 100%;
  max-width: none;
  min-height: 100%;
  margin: 0;
  pointer-events: none;
}

.pm-modal .modal-content {
  position: relative;
  top: var(--pm-shift-y, 0);
  left: var(--pm-shift-x, 0);
  flex: 0 1 auto;
  width: var(--pm-width, auto);
  max-width: 100%;
  height: var(--pm-height, auto);
  pointer-events: auto;
}

.pm-modal.pm-w-full .modal-content {
  flex-grow: 1;
}

/* Inherit the configured text colour inside the content */
.pm-modal .modal-body {
  color: inherit;
  overflow-y: auto;
}

/* Explicit heights: the body scrolls inside the box */
.pm-modal:not(.pm-h-auto) .modal-content {
  overflow: hidden;
}

/* Automatic height: box fits content, no inner scrolling */
.pm-modal.pm-h-auto .modal-body {
  overflow: visible;
}

/* Whole popup clickable */
.pm-modal.pm-linked .modal-content {
  cursor: pointer;
}

.pm-modal.pm-linked .modal-content:focus-visible {
  outline: 2px solid var(--bs-primary, #0d6efd);
  outline-offset: 2px;
}

/* Close (X) button */
.pm-modal .pm-close {
  position: absolute;
  top: .5rem;
  right: .5rem;
  z-index: 2;
}

/* ---------- Free background style ----------
 * No backdrop; the page stays scrollable and clickable everywhere
 * outside the popup box. No scrollbar on the popup when height is automatic.
 */
.pm-modal.pm-free {
  pointer-events: none;
  overflow: hidden;
}

.pm-modal.pm-free.pm-h-auto .modal-dialog,
.pm-modal.pm-free.pm-h-auto .modal-content,
.pm-modal.pm-free.pm-h-auto .modal-body {
  max-height: none;
  overflow: visible;
}

@media (prefers-reduced-motion: reduce) {
  .pm-modal.fade,
  .pm-modal.fade .modal-dialog {
    transition: none;
  }
}
