/* ============================================================
 * Sidebar de navegação ESX — substitui o menu horizontal do topo
 * por uma lateral colapsável, estilo produto SaaS moderno
 * (referência: plugin "Dashboard Pro" / dashglpi, inspecionado
 * ao vivo em 19/08/2026).
 *
 * Só ativa em telas largas (>=1200px, mesmo breakpoint que o menu
 * nativo do GLPI já usa pra colapsar em hamburguer via
 * navbar-expand-xl) — em telas menores o comportamento nativo do
 * GLPI (hamburguer) continua 100% intacto, sem risco de quebrar
 * mobile. A sidebar em si é construída em JS (sidebar.js) a partir
 * do menu que o GLPI já renderiza, então nunca fica desatualizada
 * em relação aos módulos/permissões reais do usuário logado.
 * ============================================================ */

:root {
  --esx-sidebar-w: 250px;
  --esx-sidebar-w-collapsed: 68px;
}

#esx-sidebar {
  display: none;
}

@media (min-width: 1200px) {
  body.esx-has-sidebar .page {
    padding-left: var(--esx-sidebar-w);
    transition: padding-left .18s ease;
  }
  body.esx-has-sidebar.esx-sidebar-collapsed .page {
    padding-left: var(--esx-sidebar-w-collapsed);
  }

  /* esconde o menu horizontal original (agora duplicado na sidebar);
     mantém o resto da topbar (logo, busca, notificações, usuário). */
  body.esx-has-sidebar header.topbar ul.navbar-nav:not(.user-menu) {
    display: none !important;
  }

  #esx-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--esx-sidebar-w);
    background: var(--esx-navy-900, #01081b);
    border-right: 1px solid var(--esx-navy-border, #263056);
    z-index: 1030;
    transition: width .18s ease;
    overflow: hidden;
  }
  body.esx-sidebar-collapsed #esx-sidebar {
    width: var(--esx-sidebar-w-collapsed);
  }
}

.esx-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  padding: .9rem .9rem .7rem;
  border-bottom: 1px solid var(--esx-navy-border, #263056);
  flex-shrink: 0;
}
.esx-sidebar-header .esx-brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}
.esx-sidebar-header .esx-brand-dot {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--esx-gold-400, #ffea3b), var(--esx-gold-600, #c98a1d));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1200;
  font-weight: 800;
  font-size: .8rem;
}
.esx-sidebar-header .esx-brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
body.esx-sidebar-collapsed .esx-sidebar-header .esx-brand-text {
  display: none;
}

.esx-sidebar-toggle {
  background: transparent;
  border: none;
  color: #9aa4c0;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s ease, color .12s ease, transform .18s ease;
}
.esx-sidebar-toggle:hover {
  background: rgba(253, 202, 57, .12);
  color: var(--esx-gold-400, #ffea3b);
}
body.esx-sidebar-collapsed .esx-sidebar-toggle {
  transform: rotate(180deg);
}

.esx-sidebar-nav {
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .6rem .5rem;
}
.esx-sidebar-nav::-webkit-scrollbar {
  width: 6px;
}
.esx-sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--esx-navy-border, #263056);
  border-radius: 3px;
}

.esx-sidebar-pinned {
  text-decoration: none;
  margin-bottom: .5rem;
  border-bottom: 1px solid var(--esx-navy-border, #263056);
  padding-bottom: .75rem !important;
}

.esx-sidebar-group {
  margin-bottom: .15rem;
}

.esx-sidebar-cat {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .65rem;
  background: transparent;
  border: none;
  color: #c7cde0;
  padding: .55rem .6rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.esx-sidebar-cat:hover {
  background: rgba(253, 202, 57, .08);
  color: #fff;
}
.esx-sidebar-cat.active {
  background: rgba(253, 202, 57, .14);
  color: var(--esx-gold-400, #ffea3b);
}
.esx-sidebar-cat i.ti:first-child {
  font-size: 1.1rem;
  min-width: 20px;
  text-align: center;
}
.esx-sidebar-cat .esx-cat-label {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.esx-sidebar-cat .esx-chevron {
  font-size: .85rem;
  transition: transform .15s ease;
  opacity: .6;
  flex-shrink: 0;
}
.esx-sidebar-cat[aria-expanded="true"] .esx-chevron {
  transform: rotate(180deg);
}
body.esx-sidebar-collapsed .esx-sidebar-cat .esx-cat-label,
body.esx-sidebar-collapsed .esx-sidebar-cat .esx-chevron {
  display: none;
}
body.esx-sidebar-collapsed .esx-sidebar-cat {
  justify-content: center;
}

.esx-sidebar-submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height .18s ease;
  padding-left: 1.9rem;
}
.esx-sidebar-group.open .esx-sidebar-submenu {
  max-height: 700px;
}
body.esx-sidebar-collapsed .esx-sidebar-submenu {
  display: none;
}

.esx-sidebar-submenu a {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .4rem .5rem;
  margin: .1rem 0;
  border-radius: 6px;
  color: #9aa4c0;
  font-size: .8rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.esx-sidebar-submenu a:hover {
  background: rgba(253, 202, 57, .08);
  color: #fff;
}
.esx-sidebar-submenu a.active {
  background: rgba(253, 202, 57, .16);
  color: var(--esx-gold-400, #ffea3b);
  font-weight: 600;
}
.esx-sidebar-submenu a i.ti {
  font-size: .95rem;
  min-width: 16px;
  opacity: .8;
  text-align: center;
}

.esx-sidebar-footer {
  border-top: 1px solid var(--esx-navy-border, #263056);
  padding: .7rem .6rem;
  flex-shrink: 0;
  color: #c7cde0;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.esx-sidebar-collapsed .esx-sidebar-footer {
  text-align: center;
  font-size: 0;
}

/* esconde o botão de busca fuzzy nativo (Ctrl+Alt+G) que sobrava
   solto na topbar, fora da <ul> que já era escondida acima */
@media (min-width: 1200px) {
  body.esx-has-sidebar header.topbar #navbar-menu > span {
    display: none !important;
  }
}
