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

   The sidebar is fixed to the left edge, below the brand stripe. 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.
   Colours come from the tokens in alitiq-brand.css. */

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

.menu {
  position: fixed;
  top: var(--stripe-height);
  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: var(--alitiq-white);
  border-right: 1px solid var(--alitiq-border);
  width: 64px; /* collapsed width (icons only) */
  font-size: 15px;
}

/* 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, aligned with the app header */
.sidebar-header {
  display: flex;
  align-items: center;
  height: var(--app-header-height);
  flex-shrink: 0;
  border-bottom: 1px solid var(--alitiq-border);
}

/* 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: var(--alitiq-black);
  cursor: pointer;
}

.sidebar-toggle:hover {
  background-color: var(--alitiq-soft-green);
}

/* navigation lists */
.menu__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
}

/* 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: var(--alitiq-body);
  font-weight: 600;
  padding: 10px 0;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}

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

#mainContainer.sidebar-expanded .sidebar-toggle {
  justify-content: flex-start;
  padding: 12px 22px;
}

.menu__link:hover {
  background-color: var(--alitiq-soft-green);
  text-decoration: none;
  color: var(--alitiq-black);
}

.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;
}
