/* Layout do header — busca à esquerda dos menus do usuário, tudo à direita */

#header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px 16px;
  justify-content: flex-start;
  min-height: auto;
  overflow: visible;
  position: relative;
  z-index: 200;
}

#branding {
  margin-right: auto;
  flex-shrink: 0;
}

#user-tools {
  float: none;
  margin: 0;
  flex-shrink: 0;
  order: 30;
  text-align: right;
}

/* Agrupa busca, métricas, LGPD e avisos numa única faixa horizontal */
.admin-header-cluster {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 8px 12px;
  order: 20;
}

.admin-nav-search {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.admin-nav-link {
  margin: 0;
  flex-shrink: 0;
  color: var(--header-link-color);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 300;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-nav-link:hover {
  text-decoration: underline;
}

.admin-nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.admin-header-icon-link {
  appearance: none;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--header-link-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  min-height: 32px;
  min-width: 32px;
  padding: 4px 8px;
  position: relative;
  text-decoration: none;
}

.admin-header-icon-link:hover,
.admin-header-icon-link:focus {
  color: var(--header-color);
  background: rgba(255, 255, 255, 0.08);
}

.admin-header-badge {
  background: #ffc107;
  border-radius: 4px;
  color: #212529;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.2;
  min-width: 1.5rem;
  padding: 2px 6px;
  position: absolute;
  right: -2px;
  top: -2px;
  text-align: center;
}

.admin-header-dropdown .dropdown-toggle::after {
  display: none;
}

.admin-header-dropdown {
  position: relative;
}

/* Oculto por padrão — o admin nativo não carrega Bootstrap CSS */
.admin-header-dropdown .dropdown-menu {
  background: var(--body-bg, #fff);
  border: 1px solid var(--hairline-color, rgba(0, 0, 0, 0.12));
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  color: var(--body-fg, #212529);
  display: none;
  margin: 0;
  max-height: min(70vh, 420px);
  min-width: 320px;
  overflow-y: auto;
  padding: 0.5rem 0;
  z-index: 9999;
}

.admin-header-dropdown .dropdown-menu.show {
  display: block;
}

.admin-header-avisos-menu {
  padding-bottom: 0;
}

.admin-header-avisos-menu .dropdown-header {
  color: var(--body-quiet-color, #6c757d);
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  text-align: center;
  white-space: normal;
}

.admin-header-dropdown .dropdown-divider {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin: 0.25rem 0;
}

.admin-header-dropdown .dropdown-item {
  background: transparent;
  border: 0;
  clear: both;
  color: var(--body-fg, #212529);
  display: block;
  font-size: 0.875rem;
  font-weight: 400;
  padding: 0.5rem 1rem;
  text-align: inherit;
  text-decoration: none;
  width: 100%;
}

.admin-header-dropdown .dropdown-item:hover,
.admin-header-dropdown .dropdown-item:focus {
  background: var(--selected-bg, #f1f3f5);
  color: var(--body-fg, #212529);
}

/* Dropdown usa cores do tema; sobrescreve links claros do #header */
#header .admin-header-dropdown .dropdown-menu,
#header .admin-header-dropdown .dropdown-menu a.dropdown-item,
#header .admin-header-dropdown .dropdown-menu .admin-header-aviso-assunto,
#header .admin-header-dropdown .dropdown-menu .dropdown-header {
  color: var(--body-fg, #212529);
}

#header .admin-header-dropdown .dropdown-menu .admin-header-aviso-mensagem {
  color: var(--body-medium-color, #495057);
}

#header .admin-header-dropdown .dropdown-menu .admin-header-aviso-date {
  color: var(--body-quiet-color, #6c757d);
}

#header .admin-header-dropdown .dropdown-menu .dropdown-footer {
  color: #0c4b33;
}

.admin-header-dropdown .dropdown-footer {
  color: #0c4b33;
}

.admin-header-aviso-item {
  line-height: 1.45;
  overflow: hidden;
  white-space: normal !important;
}

.admin-header-aviso-row {
  display: block;
  overflow: hidden;
}

.admin-header-aviso-icon {
  margin-right: 0.35rem;
  opacity: 0.85;
}

.admin-header-aviso-assunto {
  color: inherit;
  font-weight: 600;
}

.admin-header-aviso-mensagem {
  color: #495057;
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4;
  margin: 0.25rem 0 0 1.35rem;
}

.admin-header-aviso-date {
  color: #6c757d;
  float: right;
  font-size: 0.75rem;
  font-weight: 400;
  margin-left: 0.5rem;
  max-width: 45%;
  text-align: right;
  white-space: nowrap;
}

.admin-header-avisos-menu .dropdown-footer {
  font-weight: 600;
  padding: 0.5rem 1rem;
}

/* Modais Angular (position:fixed) — fora do fluxo do header */
.admin-base-app-modals {
  height: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 0;
}

.admin-base-app-modals .aviso-modal,
.admin-base-app-modals .modal {
  pointer-events: auto;
}

.visually-hidden {
  border: 0 !important;
  clip: rect(0, 0, 0, 0) !important;
  height: 1px !important;
  margin: -1px !important;
  overflow: hidden !important;
  padding: 0 !important;
  position: absolute !important;
  white-space: nowrap !important;
  width: 1px !important;
}

.admin-nav-search input[type="text"] {
  font-size: 0.8125rem;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.15);
  color: var(--header-color);
  line-height: normal;
  height: auto;
  min-width: 140px;
}

.admin-nav-search input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.admin-nav-search input[type="submit"] {
  appearance: none;
  background: var(--header-link-color);
  border: none;
  border-radius: 4px;
  color: var(--header-bg);
  cursor: pointer;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  text-transform: uppercase;
}

.admin-nav-search input[type="submit"]:hover {
  filter: brightness(1.1);
}

/* Dashboard: Bootstrap/AdminLTE não devem quebrar o header */
body.dashboard #header {
  line-height: normal;
  justify-content: flex-start;
}

body.dashboard #header a:link,
body.dashboard #header a:visited {
  color: var(--header-link-color);
}

body.dashboard #user-tools {
  font-size: 0.6875rem;
  font-weight: 300;
  text-transform: uppercase;
}

body.dashboard #user-tools a {
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  text-transform: uppercase;
}

body.dashboard .admin-nav-search input[type="text"] {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.15);
  color: var(--header-color);
}

/* Sidebar: rolagem sem barra visível */
#nav-sidebar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#nav-sidebar::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
