/*
 * Barra superior do HUB (substitui o menu lateral): faixa da marca (gradiente) + barra de menu
 * branca com as abas. Markup em app/Views/partials/_navbar.php, itens em partials/_menu.php.
 * Cores vêm de variáveis definidas em partials/_head.php (Configurações › Personalizar):
 *   --hub-topbar-from / --hub-topbar-to  gradiente da faixa da marca
 *   --hub-topbar-text                     texto/ícones da faixa
 *   --primary                             destaque da aba ativa e itens ativos
 */
.hub-header {
  position: relative;
  z-index: 1034;
  border-bottom: 0;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .08);
}
.hub-header.hub-header-sticky { position: sticky; top: 0; }

/* ---- Faixa da marca ---------------------------------------------------------------------- */
.hub-topbar {
  background: linear-gradient(90deg, var(--hub-topbar-from, #0d3c7a), var(--hub-topbar-to, #1e88e5));
  color: var(--hub-topbar-text, #fff);
}
.hub-topbar-inner {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 0 1.5rem;
  gap: .5rem;
}
.hub-brand {
  display: flex;
  align-items: center;
  color: inherit !important;
  font-size: 1.75rem;
  font-weight: 300;
  letter-spacing: .01em;
  white-space: nowrap;
  text-decoration: none !important;
}
.hub-brand-logo { display: flex; align-items: center; }
.hub-brand-logo img { display: block; max-height: 48px; max-width: 240px; width: auto; object-fit: contain; }
/* Logo colorida sobre a faixa azul: "crachá" com fundo (branco por padrão) para ficar legível */
.hub-brand-logo-fundo { padding: 5px 12px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.hub-brand-logo-fundo img { max-height: 40px; }
.hub-brand-sep {
  margin: 0 .9rem;
  font-size: 1.9rem;
  font-weight: 200;
  opacity: .55;
  transform: skewX(-12deg);
}
.hub-brand-section { font-weight: 600; font-size: 1.05rem; white-space: nowrap; }

.hub-topbar-actions { display: flex; align-items: center; margin-left: auto; gap: .25rem; }
.hub-topbar-actions > .nav-item { list-style: none; position: relative; }
.hub-topbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 42px;
  height: 42px;
  padding: 0 .6rem;
  border: 0;
  border-radius: .4rem;
  background: transparent;
  color: inherit !important;
  font-size: 1.15rem;
  cursor: pointer;
}
.hub-topbar-btn:hover, .hub-topbar-btn:focus { background: rgba(255, 255, 255, .14); outline: none; }
.hub-topbar-btn .navbar-badge { position: absolute; top: 4px; right: 2px; font-size: .6rem; padding: 2px 4px; }
.hub-topbar-divider { width: 1px; height: 28px; background: currentColor; opacity: .25; margin: 0 .4rem; }
.hub-user { font-size: .95rem; gap: .55rem; }
.hub-user img { width: 34px; height: 34px; object-fit: cover; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .6); }
.hub-user::after { margin-left: .35rem; } /* seta do dropdown */
.hub-menu-toggle { display: none; }

/* ---- Barra de menu ----------------------------------------------------------------------- */
.hub-menubar { background: #fff; border-bottom: 1px solid #e5e9f0; }
.hub-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  margin: 0;
  padding: 0 1.5rem;
  list-style: none;
  gap: .25rem;
}
.hub-menu-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  height: 100%;
  min-height: 56px;
  padding: 0 1rem;
  border-bottom: 3px solid transparent;
  color: #4a5568 !important;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none !important;
}
.hub-menu-link i { font-size: .95rem; opacity: .85; }
.hub-menu-link.dropdown-toggle::after { margin-left: .35rem; opacity: .6; }
.hub-menu-link:hover, .hub-menu-item.show > .hub-menu-link { color: var(--primary, #1976d2) !important; background: rgba(25, 118, 210, .04); }
.hub-menu-link.active { color: var(--primary, #1976d2) !important; border-bottom-color: var(--primary, #1976d2); }

/* Dropdown: uma coluna por seção (Módulos, Acesso & Rede...) */
.hub-menu-dropdown {
  margin-top: 0 !important;
  padding: .5rem 0;
  border: 1px solid #e5e9f0;
  border-top: 0;
  border-radius: 0 0 .5rem .5rem;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .12);
  min-width: 240px;
}
.hub-menu-dropdown.hub-mega { display: none; padding: .75rem .5rem; }
.hub-menu-dropdown.hub-mega.show { display: grid; grid-template-columns: repeat(var(--hub-cols, 2), minmax(200px, 1fr)); column-gap: .5rem; }
.hub-menu-section { min-width: 0; }
.hub-menu-section + .hub-menu-section { border-left: 1px solid #eef1f5; }
.hub-menu-dropdown .dropdown-header {
  padding: .4rem 1rem .3rem;
  text-align: left;
  color: #8a94a6;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.hub-menu-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem 1rem;
  color: #2d3748;
  font-size: .9rem;
  border-radius: .3rem;
}
.hub-menu-dropdown .dropdown-item i { width: 1.1rem; text-align: center; color: #8a94a6; }
.hub-menu-dropdown .dropdown-item:hover { background: #f1f5fb; }
.hub-menu-dropdown .dropdown-item.active,
.hub-menu-dropdown .dropdown-item.active i { background: transparent; color: var(--primary, #1976d2); font-weight: 600; }
.hub-menu-dropdown .dropdown-item.active { background: rgba(25, 118, 210, .08); }

/* ---- Telas menores: menu vira lista recolhível abaixo da faixa --------------------------- */
@media (max-width: 991.98px) {
  .hub-topbar-inner { padding: 0 .75rem; min-height: 56px; }
  .hub-brand { font-size: 1.35rem; }
  .hub-brand-logo img { max-height: 32px; max-width: 150px; }
  .hub-brand-logo-fundo { padding: 4px 8px; }
  .hub-brand-sep, .hub-brand-section { display: none; }
  .hub-menu-toggle { display: flex; }
  .hub-menubar .collapse:not(.show) { display: none; }
  .hub-menu { flex-direction: column; padding: .25rem 0 .5rem; gap: 0; }
  .hub-menu-link { min-height: 46px; padding: 0 1rem; border-bottom: 0; border-left: 3px solid transparent; }
  .hub-menu-link.active { border-left-color: var(--primary, #1976d2); }
  .hub-menu-dropdown, .hub-menu-dropdown.hub-mega.show {
    position: static !important;
    transform: none !important;
    display: none;
    border: 0;
    box-shadow: none;
    padding: 0 0 .5rem 1.25rem;
  }
  .hub-menu-dropdown.show, .hub-menu-dropdown.hub-mega.show { display: block; }
  .hub-menu-section + .hub-menu-section { border-left: 0; }
}
@media (max-width: 575.98px) {
  .hub-user span { display: none; }
}

/* ---- Modo escuro -------------------------------------------------------------------------- */
.dark-mode .hub-menubar { background: #343a40; border-bottom-color: #4b545c; }
.dark-mode .hub-menu-link { color: #dee2e6 !important; }
.dark-mode .hub-menu-dropdown { background: #343a40; border-color: #4b545c; }
.dark-mode .hub-menu-dropdown .dropdown-item { color: #dee2e6; }
.dark-mode .hub-menu-dropdown .dropdown-item:hover { background: #3f474e; }
.dark-mode .hub-menu-section + .hub-menu-section { border-left-color: #4b545c; }
