/* ========================================
   Fix: Terceira linha quebra para nova linha
   ======================================== */

.br-header {
  flex-wrap: wrap !important;
  padding-bottom: 0 !important;
}

.header-bottom {
  padding-bottom: 12px !important;
}

.header-nav-section {
  width: 100% !important;
  flex-basis: 100% !important;
  background-color: #FFFFFF;
}

/* ========================================
   Fix: Busca full-width em todos os modos
   ======================================== */

/* Quando a busca está ativa, ela deve ocupar toda a largura horizontal disponível.
   O form e br-input precisam crescer para ocupar 100% do espaço disponível.
   Funciona tanto em modo large (mobile/tablet) quanto compact (desktop após scroll). */
.br-header .header-search.active form {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: none !important;
}

.br-header .header-search.active .br-input {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: none !important;
}

/* ========================================
   Logo IQ - Responsivo
   ======================================== */

.header-nav-section .logo-iq {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

@media (max-width: 991px) {
  .header-nav-section .logo-iq {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 575px) {
  .header-nav-section .logo-iq {
    width: 36px;
    height: 36px;
  }
  
  /* Esconde subtítulo em mobile muito pequeno */
  .header-nav-section .text-sm {
    display: none;
  }
}

/* ========================================
   Menu Horizontal (Desktop)
   ======================================== */

/* Forçar display correto do menu horizontal em desktop (≥1200px) */
@media (min-width: 1200px) {
  .header-navigation.d-none.d-xl-flex {
    display: flex !important;
  }
  
  .header-navigation-mobile.d-xl-none {
    display: none !important;
  }
}

/* Forçar display correto do menu mobile em tablet/mobile (<1200px) */
@media (max-width: 1199px) {
  .header-navigation.d-none.d-xl-flex {
    display: none !important;
  }
  
  .header-navigation-mobile.d-xl-none {
    display: block !important;
  }
}

.header-navigation ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.header-navigation li {
  margin: 0;
}

.header-navigation a {
  color: var(--color, #333);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--surface-rounder-sm, 4px);
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.header-navigation a:hover {
  background-color: var(--hover, rgba(0, 0, 0, 0.05));
}

.header-navigation a.active,
.header-navigation a.current,
.header-navigation li.current a,
.header-navigation li.active a {
  font-weight: 600;
  color: var(--interactive, #1351B4);
  border-bottom: 2px solid var(--interactive, #1351B4);
}

/* Badge de Alerta (Estático via CSS) */
.header-navigation a.menu-item-alertas,
.header-navigation a[href*="Alertas"] {
  position: relative;
}

.header-navigation a.menu-item-alertas::after,
.header-navigation a[href*="Alertas"]::after {
  content: '';
  position: absolute;
  top: 0px;
  right: -1px;
  width: 8px;
  height: 8px;
  background-color: #E52207;
  border-radius: 50%;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ========================================
   Dropdown Mobile (estilo Acesso Rápido)
   ======================================== */

/* Container do dropdown mobile */
.header-nav-section .header-navigation-mobile {
  position: relative;
}

/* Lista dropdown - alinhada à direita */
.header-nav-section .header-navigation-mobile .br-list {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  left: auto;
  min-width: 280px;
  background: var(--background, #fff);
  border: 1px solid var(--color-secondary-04, #ddd);
  border-radius: var(--surface-rounder-sm, 4px);
  box-shadow: var(--surface-shadow-md, 0 4px 16px rgba(0,0,0,0.1));
  z-index: 100;
  max-height: 400px;
  overflow-y: auto;
}

/* Mostrar dropdown quando ativo */
.header-nav-section .header-navigation-mobile .br-list.active {
  display: block;
}

/* Header do dropdown */
.header-nav-section .header-navigation-mobile .br-list .header {
  padding: 1rem 1rem 0.5rem;
  border-bottom: 1px solid var(--color-secondary-04, #ddd);
  margin-bottom: 0.5rem;
}

.header-nav-section .header-navigation-mobile .br-list .header .title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-secondary-07, #888);
  text-transform: uppercase;
}

/* Lista de links */
.header-nav-section .header-navigation-mobile .br-list ul {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
}

.header-nav-section .header-navigation-mobile .br-list li {
  margin: 0;
}

/* Links do dropdown */
.header-nav-section .header-navigation-mobile .br-list a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--interactive, #1351B4);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--surface-rounder-sm, 4px);
  transition: background-color 0.2s ease;
}

.header-nav-section .header-navigation-mobile .br-list a:hover,
.header-nav-section .header-navigation-mobile .br-list a.active,
.header-nav-section .header-navigation-mobile .br-list a.current,
.header-nav-section .header-navigation-mobile .br-list li.current a,
.header-nav-section .header-navigation-mobile .br-list li.active a {
  background-color: var(--hover, rgba(0, 0, 0, 0.05));
  font-weight: 600;
}

/* Badge de alerta no dropdown mobile */
.header-nav-section .header-navigation-mobile .br-list a.menu-item-alertas,
.header-nav-section .header-navigation-mobile .br-list a[href*="Alertas"] {
  position: relative;
  padding-right: 2.5rem; /* Espaço para o badge */
}

.header-nav-section .header-navigation-mobile .br-list a.menu-item-alertas::after,
.header-nav-section .header-navigation-mobile .br-list a[href*="Alertas"]::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background-color: #E52207;
  border-radius: 50%;
  animation: pulse-badge 2s infinite;
}

/* ========================================
   Utilitários Adicionais
   ======================================== */

/* Gap para navegação (fallback para navegadores mais antigos) */
@supports not (gap: 1rem) {
  .header-navigation ul > * + * {
    margin-left: 1.5rem;
  }
}

/* Screen reader only - para label acessível */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}



body .body-wrapper .body-innerwrapper {
  overflow-x: clip;
  overflow-y: visible;
}

/* Desktop/Tablet: Logo maior (48px altura) */
@media (min-width: 576px) {
  .br-header .header-logo img {
    height: 48px !important;
    max-height: 48px !important;
    width: auto;
  }
}

/* Mobile: Logo média (40px altura) */
@media (max-width: 575px) {
  .br-header .header-logo img {
    height: 40px !important;
    max-height: 40px !important;
    width: auto;
  }
}

/* Compact mode: Logo reduzida mas legível (32px altura) */
.br-header.compact .header-logo img {
  height: 32px !important;
  max-height: 32px !important;
  width: auto;
}

/* Sticky: Mantém transição suave do GovBR-DS */
.br-header[data-sticky] .header-logo img {
  transition: all 0.15s ease;
}

/* ========================================
   Alerta de login indisponível — flutuante
   ======================================== */

#login-unavailable-alert {
  position: fixed;
  top: 72px;
  right: 1.5rem;
  z-index: 5000;
  max-width: 420px;
  width: calc(100vw - 3rem);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
  border-radius: var(--surface-rounder-sm, 4px);
  margin-bottom: 0;
}

/* ========================================
   Cookiebar — modo expandido como modal centralizado
   ======================================== */

/* Overlay escuro atrás do modal expandido */
.br-cookiebar:not(.default)::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  z-index: -1;
}

/* Modal centralizado em vez de fullscreen */
.br-cookiebar:not(.default) {
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%);
  width: min(600px, calc(100vw - 2rem));
  border-radius: var(--surface-rounder-md, 8px);
  overflow: hidden;
}

/* Limitar altura do wrapper e sobrescrever o height inline calculado pelo JS */
.br-cookiebar:not(.default) .wrapper {
  max-height: min(80vh, 720px) !important;
  height: auto !important;
  overflow-y: auto !important;
}

/* ========================================
   Botão de Contraste — estado ativo
   ======================================== */

/* Indicador visual quando o contraste/inversão está ativo */
#btn-contraste.is-active {
  background-color: var(--color-primary-darken-02, #1351b4) !important;
  color: #fff !important;
}

#btn-contraste.is-active i {
  color: #fff !important;
}

