/* ===================================================================
   BABA Cosmetics - modern left sidebar
   Loaded from layouts/head-css.php, after app.min.css so it wins.

   Two things this fixes on top of the look:
     1. the theme sets white-space: nowrap on menu links, so the long
        report names in this app were clipped at the sidebar edge;
     2. nothing separated a menu group from its items at a glance.

   Everything is driven off the theme's own --ct-* variables so the
   light and dark skins both keep working.
   =================================================================== */

:root {
  --ct-leftbar-width: 236px;

  /* smaller, denser menu */
  --ct-menu-item-font-size: 0.78rem;
  --ct-menu-item-padding-y: 6px;
  --ct-menu-item-padding-x: 10px;

  --nba-accent: #3e60d5;
  --nba-accent-soft: rgba(62, 96, 213, 0.10);
  --nba-accent-softer: rgba(62, 96, 213, 0.06);
  --nba-divider: rgba(0, 0, 0, 0.06);
}

/* the theme flips these on the dark skin */
html[data-bs-theme="dark"] {
  --nba-accent: #7f9cf5;
  --nba-accent-soft: rgba(127, 156, 245, 0.14);
  --nba-accent-softer: rgba(127, 156, 245, 0.07);
  --nba-divider: rgba(255, 255, 255, 0.07);
}

/* ---------------- shell ---------------- */
.leftside-menu {
  border-right: 1px solid var(--nba-divider);
  box-shadow: 1px 0 16px rgba(15, 23, 42, 0.05);
}

.leftside-menu .logo {
  padding: 6px 0;
}

.leftbar-user {
  padding: 10px 20px 12px;
  border-bottom: 1px solid var(--nba-divider);
  margin-bottom: 6px;
}

/* ---------------- menu filter ---------------- */
.nba-menu-filter {
  padding: 8px 12px 6px;
}

.nba-menu-filter .nba-filter-wrap {
  position: relative;
}

.nba-menu-filter i {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0.45;
  pointer-events: none;
}

.nba-menu-filter input {
  width: 100%;
  font-size: 0.75rem;
  padding: 5px 24px 5px 27px;
  border-radius: 7px;
  border: 1px solid var(--nba-divider);
  background-color: var(--nba-accent-softer);
  color: var(--ct-menu-item-color);
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.nba-menu-filter input:focus {
  border-color: var(--nba-accent);
  background-color: transparent;
}

.nba-menu-filter input::placeholder {
  opacity: 0.55;
}

.nba-filter-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  line-height: 1;
  opacity: 0.4;
  cursor: pointer;
  display: none;
  background: none;
  border: 0;
  padding: 2px 3px;
  color: inherit;
}

.nba-filter-clear:hover { opacity: 0.85; }
.nba-menu-filter.has-text .nba-filter-clear { display: block; }

.nba-no-match {
  display: none;
  padding: 10px 18px;
  font-size: 0.73rem;
  opacity: 0.6;
}

/* ---------------- group rows ---------------- */
.side-nav .side-nav-link,
.side-nav .side-nav-second-level .side-nav-item .side-nav-link,
.side-nav .side-nav-second-level .side-nav-item a {
  /* long report names must wrap instead of being clipped */
  white-space: normal !important;
  word-break: break-word;
  line-height: 1.35;
  border-radius: 7px;
  margin: 1px 8px;
  width: calc(100% - 16px);
  display: flex;
  align-items: center;
  gap: 9px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.side-nav > .side-nav-item > .side-nav-link {
  font-weight: 600;
  letter-spacing: 0.2px;
}

.side-nav .side-nav-link > i {
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.8;
}

.side-nav .side-nav-link > span:not(.menu-arrow) {
  flex: 1 1 auto;
  min-width: 0;
}

.side-nav .side-nav-link:hover,
.side-nav .side-nav-link:focus {
  background-color: var(--nba-accent-soft);
  color: var(--nba-accent);
}

.side-nav .side-nav-link:hover > i {
  opacity: 1;
}

/* group that is currently open */
.side-nav > .side-nav-item > a[aria-expanded="true"] {
  background-color: var(--nba-accent-softer);
  color: var(--nba-accent);
}

/* ---------------- the arrow ---------------- */
.side-nav .side-nav-link .menu-arrow {
  position: static;
  flex-shrink: 0;
  transform: none;
  transition: transform 0.18s ease;
  opacity: 0.5;
}

.side-nav .side-nav-item > a[aria-expanded="true"] > span.menu-arrow {
  transform: rotate(90deg);
  opacity: 0.9;
}

/* ---------------- second level ---------------- */
.side-nav-second-level {
  padding-left: 0;
  margin: 2px 0 6px;
  position: relative;
}

/* the rail that ties a group's items together */
.side-nav-second-level::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 2px;
  bottom: 2px;
  width: 1px;
  background-color: var(--nba-divider);
}

/* the theme ships .side-nav-second-level .side-nav-item .side-nav-link,
   which outranks a plain `li` selector, so match that weight or the
   padding below is silently dropped and the dot lands on the text */
.side-nav .side-nav-second-level .side-nav-item .side-nav-link,
.side-nav .side-nav-second-level .side-nav-item a {
  padding: 5px 10px 5px 28px;
  font-size: 0.745rem;
  font-weight: 400;
  position: relative;
  margin-left: 8px;
  width: calc(100% - 16px);
}

/* small dot per item - reads cleaner than repeating one icon 100 times */
.side-nav .side-nav-second-level .side-nav-item .side-nav-link::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background-color: currentColor;
  opacity: 0.3;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.side-nav .side-nav-second-level .side-nav-item .side-nav-link:hover::before {
  opacity: 0.9;
  transform: scale(1.25);
}

/* ---------------- active page ---------------- */
/* app.min.js adds .active to the matching link and .menuitem-active to
   its <li>, then opens the parent collapse */
/* matches the weight of the second level rule above, otherwise the bold
   is dropped on exactly the item that needs it */
.side-nav .side-nav-link.active,
.side-nav .menuitem-active > .side-nav-link,
.side-nav .side-nav-second-level .side-nav-item .side-nav-link.active,
.side-nav .side-nav-second-level .menuitem-active > .side-nav-link {
  background-color: var(--nba-accent-soft);
  color: var(--nba-accent);
  font-weight: 600;
}

.side-nav .side-nav-second-level .side-nav-item .side-nav-link.active::before {
  opacity: 1;
  transform: scale(1.35);
}

/* accent bar on top level rows only - on a sub item it would collide with
   the vertical rail drawn by .side-nav-second-level::before */
.side-nav > .side-nav-item > .side-nav-link.active::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background-color: var(--nba-accent);
}

.side-nav .side-nav-link {
  position: relative;
}

/* ---------------- scrollbar ---------------- */
#leftside-menu-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 130, 150, 0.35) transparent;
}

#leftside-menu-container::-webkit-scrollbar {
  width: 5px;
}

#leftside-menu-container::-webkit-scrollbar-track {
  background: transparent;
}

#leftside-menu-container::-webkit-scrollbar-thumb {
  background-color: rgba(120, 130, 150, 0.35);
  border-radius: 6px;
}

#leftside-menu-container::-webkit-scrollbar-thumb:hover {
  background-color: rgba(120, 130, 150, 0.6);
}

/* ---------------- condensed / icon-only mode ----------------
   when the sidebar collapses to icons the flex layout above would
   left align them, so re-centre and hide the text */
.sidebar-enable .side-nav .side-nav-link,
html[data-sidenav-size="condensed"] .side-nav > .side-nav-item > .side-nav-link {
  justify-content: center;
}

html[data-sidenav-size="condensed"] .side-nav > .side-nav-item > .side-nav-link.active::after {
  display: none;
}

html[data-sidenav-size="condensed"] .nba-menu-filter {
  display: none;
}
