/**
 * Keep top bar + footer visible; only the main column body scrolls.
 * Velzon uses a fixed #page-topbar and fixed .navbar-menu; .main-content fills the viewport.
 */

html {
  height: 100%;
}

body.sudovisor-theme {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.sudovisor-theme #layout-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.sudovisor-theme .main-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 100vh;
  max-height: 100vh;
}

body.sudovisor-theme .main-content > .page-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Footer after .page-content (e.g. user/login, page--user). */
body.sudovisor-theme .main-content > footer.footer {
  flex-shrink: 0;
}

/* Footer inside .page-content (default page templates). */
body.sudovisor-theme .page-content > footer.footer {
  flex-shrink: 0;
}

/* Primary scroll region for standard pages. */
body.sudovisor-theme .page-content > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* Website detail pages: center the main content area like the reference layout. */
body.sudovisor-theme .page-content > .container-fluid.website-page-content {
  align-items: center;
}

body.sudovisor-theme .page-content > .container-fluid.website-page-content > .row,
body.sudovisor-theme .page-content > .container-fluid.website-page-content > .website-chat-wrapper {
  width: 100%;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
}

/* Neutralize Bootstrap negative-x utility on centered website wrapper. */
body.sudovisor-theme .page-content > .container-fluid.website-page-content > .website-chat-wrapper.mx-n4 {
  margin-left: auto !important;
  margin-right: auto !important;
}

/* OTP login: split fills page-content; main column scrolls on small viewports. */
body.sudovisor-theme .main-content > .page-content > .otp-login-page__split {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.sudovisor-theme .otp-login-page__main {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* Drupal admin toolbar: restore normal document scroll so tray/dropdowns work. */
body.sudovisor-theme.toolbar-fixed {
  overflow-y: auto;
  height: auto;
  min-height: 100%;
}

body.sudovisor-theme.toolbar-fixed #layout-wrapper {
  flex: none;
  min-height: 0;
  height: auto;
  overflow: visible;
}

body.sudovisor-theme.toolbar-fixed .main-content {
  min-height: 0;
  max-height: none;
  overflow: visible;
}

body.sudovisor-theme.toolbar-fixed .main-content > .page-content {
  overflow: visible;
}

body.sudovisor-theme.toolbar-fixed .page-content > .container-fluid {
  overflow: visible;
}

body.sudovisor-theme.toolbar-fixed .otp-login-page__main {
  overflow: visible;
}
