/* MAYAN V1.2.11 - Product popup position correction.
 * Overrides an old Rev12 rule that top-aligned every product modal.
 * A consistent safe gap is left around the window without hiding its controls.
 * Only applies to the actual Rev16 popup, not product cards or other dialogs.
 */
#productModal .modal-dialog.m16-dialog {
  --mayan-modal-gap: clamp(30px, 6vh, 58px);
  display: flex !important;
  align-items: center !important;
  min-height: calc(100vh - var(--mayan-modal-gap) - var(--mayan-modal-gap)) !important;
  min-height: calc(100dvh - var(--mayan-modal-gap) - var(--mayan-modal-gap)) !important;
  margin: var(--mayan-modal-gap) auto !important;
}
#productModal .modal-dialog.m16-dialog > .modal-content.m16-modal {
  width: 100%;
  max-height: calc(100vh - var(--mayan-modal-gap) - var(--mayan-modal-gap)) !important;
  max-height: calc(100dvh - var(--mayan-modal-gap) - var(--mayan-modal-gap)) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}
/* On narrow screens the dialog is still inset from top and bottom.
   Longer details scroll inside the window so the close/order buttons remain usable. */
@media (max-width: 750px) {
  #productModal .modal-dialog.m16-dialog {
    --mayan-modal-gap: max(22px, env(safe-area-inset-top, 0px));
    max-width: calc(100% - 22px) !important;
  }
}
@media (max-height: 610px) {
  #productModal .modal-dialog.m16-dialog {
    --mayan-modal-gap: max(16px, env(safe-area-inset-top, 0px));
  }
}
