/*
 * ResultPro Postgraduate Universal Viewport Fit v205
 *
 * Loaded last by postgraduate.middleware on every /postgraduate/ HTML page.
 * Covers landing, Student, Lecturer, Back Office, Public Admin,
 * authentication, application, payment, report and settings pages.
 */

@media screen {
  html,
  body {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    overflow-x: clip !important;
  }

  body {
    zoom: 100% !important;
    transform: none !important;
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  :where(
    .pg-page-shell,
    .pgfix-shell,
    .rp-student-page-shell,
    .pg-public-shell,
    .pgpub-shell,
    .pg-pay-shell,
    .pg-login-shell,
    .pg-otp-shell
  ) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    overflow-x: clip !important;
  }

  :where(
    .pg-content-area,
    .pgfix-content,
    .rp-student-content-wrap,
    .pg-public-main,
    .pg-public-content,
    .pgpub-main,
    .pgpub-content,
    .pg-pay-main,
    .pg-pay-content,
    main
  ) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  :where(
    .pg-content-area,
    .pgfix-content,
    .rp-student-content-wrap,
    .pg-public-main,
    .pg-public-content,
    .pgpub-main,
    .pgpub-content,
    .pg-pay-main,
    .pg-pay-content,
    main
  ) > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  :where(
    .card,
    .panel,
    .modal,
    .modal-dialog,
    .pgfix-card,
    .pg-public-card,
    .pg-settings-shell,
    .pg-register-page,
    .pg-filter-shell
  ) {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  fieldset,
  form,
  input,
  select,
  textarea,
  button {
    min-width: 0;
    max-width: 100%;
  }

  img,
  video,
  canvas,
  iframe {
    max-width: 100% !important;
  }

  pre {
    max-width: 100% !important;
    overflow-x: auto !important;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  :where(
    .table-responsive,
    [class*="table-wrap"],
    [class*="table-wrapper"],
    [class*="table-container"],
    [class*="data-table"]
  ) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  :where(
    .pg-landing-header,
    .rp-student-futa-header,
    .rp-student-topnav,
    .pgfix-header,
    .pgfix-nav,
    .pg-public-header,
    .pg-public-nav,
    .pgpub-header,
    .pg-pay-header,
    .pg-pay-nav
  ) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
  }
}

/* True responsive phone pages use their compact header and fixed bottom nav. */
@media screen and (max-width: 760px) {
  body.pg-fixed-header-ui {
    padding-top: 0 !important;
  }

  body.pg-fixed-header-ui :where(
    .rp-student-futa-header,
    .rp-student-topnav,
    .pg-public-header,
    .pg-public-nav,
    .pg-pay-header,
    .pg-pay-nav
  ) {
    display: none !important;
    position: static !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
  }

  :where(
    .pg-content-area,
    .pgfix-content,
    .rp-student-content-wrap,
    .pg-public-main,
    .pg-public-content,
    .pgpub-main,
    .pgpub-content,
    .pg-pay-main,
    .pg-pay-content,
    main
  ) {
    padding-left: clamp(10px, 3vw, 18px) !important;
    padding-right: clamp(10px, 3vw, 18px) !important;
  }

  .pg-mobile-app-header,
  .pg-mobile-bottom-nav {
    max-width: 100% !important;
  }
}

/*
 * Lecturer phones intentionally show the complete desktop navigation on a
 * 1024px virtual canvas. The browser fits that canvas to the physical screen.
 * This branch also removes the fixed-header spacer that caused the visible gap.
 */
@media screen and (max-device-width: 760px) {
  html.pg-mobile-desktop-fit,
  html.pg-mobile-desktop-fit body,
  html.pg-mobile-desktop-fit .pgfix-shell {
    width: 1024px !important;
    min-width: 1024px !important;
    max-width: 1024px !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow-x: hidden !important;
  }

  html.pg-mobile-desktop-fit body.pg-fixed-header-ui {
    padding-top: 0 !important;
  }

  html.pg-mobile-desktop-fit body.pg-fixed-header-ui .pgfix-header,
  html.pg-mobile-desktop-fit body.pg-fixed-header-ui .pglect-public-header {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
  }

  html.pg-mobile-desktop-fit body.pg-fixed-header-ui #pgLecturerSubmenuNav,
  html.pg-mobile-desktop-fit body.pg-fixed-header-ui .pglect-public-nav {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    transform: none !important;
  }

  html.pg-mobile-desktop-fit .pgfix-content,
  html.pg-mobile-desktop-fit .pgfix-messages {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
}

@media print {
  html,
  body {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: visible !important;
    zoom: 100% !important;
    transform: none !important;
  }
}
