/* ===== Collapsible left sidebar =====

   The sidebar is fixed to the left edge. Its width (and the label visibility)
   is driven by a `sidebar-expanded` / `sidebar-collapsed` class set on
   `#mainContainer` from a dcc.Store via clientside callbacks. The main content
   (`#mainContainer`, see styles.css) shifts its left margin to match, so the
   sidebar never overlaps the content. */

ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.menu {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease-in-out;
}

.menu--left {
  background: #62bcbe;
  width: 64px; /* collapsed width (icons only) */
  font-size: 16px;
}

/* On every page except the overview hub the sidebar is appended into a
   dbc.Row (via base_grid_container). Bootstrap's `.row > *` rule would then
   add 12px horizontal padding to the fixed-width, border-box sidebar,
   shrinking the nav links so the hover highlight no longer spans the full
   row. Neutralise it here so the sidebar owns its box however it is embedded. */
#sidebar {
  padding: 0;
}

/* expanded state (class lives on #mainContainer, the sidebar is a descendant) */
#mainContainer.sidebar-expanded .menu--left {
  width: 236px;
}

/* header holding the collapse/expand toggle */
.sidebar-header {
  display: flex;
  align-items: center;
  height: 56px;
  flex-shrink: 0;
}

/* mirror .menu__link so the burger icon lines up with the nav item icons */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 12px 0;
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background-color: #4d9596;
}

/* navigation lists */
.menu__nav {
  display: flex;
  flex-direction: column;
}

/* pins the logout list to the bottom of the sidebar */
.menu__nav--bottom {
  margin-top: auto;
  padding-bottom: 12px;
}

.menu__item {
  width: 100%;
}

.menu__link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  padding: 12px 0;
  text-decoration: none;
  white-space: nowrap;
}

/* when expanded, icons + labels left-align with a comfortable side padding */
#mainContainer.sidebar-expanded .menu__link,
#mainContainer.sidebar-expanded .sidebar-toggle {
  justify-content: flex-start;
  padding: 12px 20px;
}

.menu__link:hover {
  background-color: #4d9596;
  text-decoration: none;
  color: white;
}

.menu__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* labels are hidden while collapsed and revealed once expanded */
.menu_text {
  margin-left: 14px;
  display: none;
}

#mainContainer.sidebar-expanded .menu_text {
  display: inline-block;
}
