/**
 * Global Scroll Restoration Styles
 * Ensures scrolling is always available unless a modal is explicitly open
 */

/* Default: Always allow scrolling on body and html */
html,
body {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Only lock scroll when a modal is actually open */
body.modal-open,
html.modal-open {
  overflow: hidden !important;
}

/* Bootstrap modal backdrop should not affect scrolling */
.modal-backdrop {
  z-index: 1040;
}

/* Lobibox modal handling */
body.lobibox-open {
  overflow: hidden !important;
}

/* Ensure scrollbars are visible */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

/* Prevent position:fixed on body that locks scroll */
body.modal-fixed-wrapper {
  position: static !important;
}

/* Ensure page content is scrollable */
html.page-fixed-scroll {
  position: static !important;
  overflow: auto !important;
}

/* Override any inline fixed positioning */
.page-locked-scroll {
  position: static !important;
}

/* Ensure modals work correctly */
.modal {
  z-index: 1050;
}

.modal.show {
  overflow-y: auto;
  overflow-x: hidden;
}

/* Dropdown and other popups should not lock scroll */
.dropdown-menu,
.popover,
.tooltip {
  position: absolute !important;
}

/* TreeView and nested components */
.tree-view,
.treeview {
  overflow: auto !important;
}

/* Details panels and side panels */
.detail-panel,
.side-panel,
.sidebar-panel {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Analytics and dashboard screens */
.analytics-screen,
.dashboard-screen {
  overflow: auto !important;
}

/* Tables should always be scrollable */
.datatable-container,
.table-container,
[role="grid"] {
  overflow: auto !important;
}

/* Ensure no scroll lock on pagination */
.pagination-container,
.paginator {
  overflow: visible !important;
}

/* Print window should not be affected */
@media print {
  html,
  body {
    overflow: auto !important;
  }
}
