/*
 * CrewCRM admin overrides. Loaded after style.css (see add_admin_assets()
 * in application/helpers/assets_helper.php).
 */

/* Main sidebar and the Setup menu panel that opens over it: both stay on
   screen and scroll on their own when taller than the window. Layering:
   header (99) > Setup panel (98) > main sidebar (97). */
#menu.sidebar,
#setup-menu-wrapper.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  /* main.js (mainWrapperHeightFix) sets an inline min-height of the whole
     document, which would make the panel taller than the window and stop
     it from scrolling on its own. */
  min-height: 0 !important;
}

#menu.sidebar {
  z-index: 97;
}

#setup-menu-wrapper.sidebar {
  z-index: 98;
}

#menu.sidebar::-webkit-scrollbar,
#setup-menu-wrapper.sidebar::-webkit-scrollbar {
  width: 6px;
}

#menu.sidebar::-webkit-scrollbar-thumb,
#setup-menu-wrapper.sidebar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

#menu.sidebar::-webkit-scrollbar-track,
#setup-menu-wrapper.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

/* Settings page menu (General, Finance, ...): stays in view while the
   settings form scrolls, with its own scroll bar when it is taller than the
   window. Desktop widths only; on small screens it stacks above the form. */
@media (min-width: 992px) {
  .settings-layout {
    display: flex;
    align-items: flex-start;
  }

  .settings-layout::before,
  .settings-layout::after {
    display: none;
  }

  .settings-layout > .settings-menu-col {
    position: sticky;
    top: 15px;
    max-height: calc(100vh - 30px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
  }

  .settings-layout > .settings-menu-col::-webkit-scrollbar {
    width: 6px;
  }

  .settings-layout > .settings-menu-col::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
  }
}
