/* Dashboard filter + mobile shell overrides.
   Delivered as a plain file in public/ because the server cannot run an Encore build. */

/* Restore the AJAX search box inside Select2 dropdowns (it was globally hidden). */
.select2-drop .select2-search,
.select2-drop .select2-search input {
  display: block !important;
  pointer-events: auto !important;
  user-select: auto !important;
  -webkit-user-select: auto !important;
}

.select2-drop .select2-search input {
  color: #333 !important;
}

.select2-drop {
  max-width: calc(100vw - 24px);
}

.select2-results {
  max-height: min(220px, 32vh);
}

/* Filter popovers and their inputs on a phone. */
.box form .dropdown-menu,
.hw-filter-dropdown {
  min-width: 0 !important;
  width: min(92vw, 360px) !important;
  max-width: calc(100vw - 24px) !important;
}

.box form .dropdown-menu .custom-control-inline,
.box form .dropdown-menu .form-check-inline {
  flex-wrap: wrap;
  white-space: normal;
}

#sortable-select {
  width: 100% !important;
  max-width: 100%;
}

@media (max-width: 767.98px) {
  /* 16px stops iOS Safari from zooming the whole page on focus. */
  input,
  select,
  textarea,
  .select2-drop .select2-search input,
  .select2-search input {
    font-size: 16px !important;
  }

  #search-filters .form-group {
    margin-bottom: 0.75rem;
  }
}

/* Dashboard side navigation: bounded height, scrollable, with a tap-out backdrop. */
#dashboard-sidenav {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}

html[dir="rtl"] #dashboard-sidenav {
  left: auto;
  right: 0;
}

.hw-sidenav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99998;
}

/* Keyboard open: keep the focused field clear of fixed bottom controls. */
body.hw-keyboard-open {
  padding-bottom: var(--hw-kb-height, 0px);
}

body.hw-keyboard-open .material-scrolltop,
body.hw-keyboard-open .cookie-bar--bottom {
  display: none !important;
}

.header-main,
.header-main.sticky-top {
  z-index: 1040 !important;
}

.section-header {
  position: relative;
  z-index: 1035;
}

.header-main .dropdown-menu,
.section-header .dropdown-menu {
  z-index: 1050 !important;
}

@media (max-width: 767.98px) {
  .modal-dialog-scrollable .modal-body {
    max-height: calc(100dvh - 120px);
    overflow-y: auto;
  }
}
