/* ============================================================
   IMPORTS E FONTES
============================================================ */
@import url(../../css/bootstrap.min.css);
@import url(config.css);

html {
  overflow-y: scroll;
}

body, html {
  font-family: 'Roboto', sans-serif;
}

body {
  position: relative; /* Necessário para posicionamentos absolutos corretos */
}

/* ============================================================
   CABEÇALHO / MENU SUPERIOR
============================================================ */
#header {
  position: fixed;
  width: 100%;
  background-color: #fff;
  transition: background ease-out 0.2s;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.6);
  z-index: 99999;
}

#header .container img {
  max-width: 50px;
  max-height: 50px;
  width: auto;
  height: auto;
}

#header .navbar-collapse {
  width: auto;
}

#header .nav-link {
  text-transform: uppercase;
  font-weight: 500;
  padding-left: 0;
  padding-right: 0;
  color: var(--azul-escuro);
  border-bottom: solid 4px transparent;
  transition: color 0.2s, border-color 0.2s;
}

#header .nav-link:hover {
  border-bottom: solid 4px var(--azul-claro);
  color: var(--azul-claro);
}

/* ============================================================
   💡 MELHORIA — ALINHAMENTO GERAL DOS ÍCONES E TEXTOS
============================================================ */
.navbar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 6px; /* espaço entre ícone e texto */
}

.navbar-nav .nav-link i {
  font-size: 1.2rem;
}

.menu-text {
  font-size: 0.95rem;
  white-space: nowrap;
}

/* MENU MOBILE — ÍCONES HORIZONTAIS */
body.mobile .navbar-nav {
  display: flex;
  flex-direction: row;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

body.mobile .navbar .nav-item {
  width: auto;
}

body.mobile .navbar-nav .nav-link {
  width: auto;
  justify-content: center;
  padding: 10px;
}

/* Esconde texto no mobile */
body.mobile .navbar .menu-text {
  display: none !important;
}

/* Ícones maiores no mobile */
body.mobile .navbar .nav-link i,
body.mobile .btn.btn-default.btn-m i {
  font-size: 1.6rem;
}

/* ============================================================
   DROPDOWN MOBILE — LARGURA AUTOMÁTICA PELO CONTEÚDO
============================================================ */
body.mobile .navbar .dropdown {
  position: relative;
}

body.mobile .navbar .dropdown-menu {
  position: absolute !important;
  top: 100%;
  left: 0;
  width: auto;               /* 🔴 remove largura fixa */
  min-width: max-content;    /* 🔑 cresce conforme texto */
  max-width: 95vw;           /* 🔒 não ultrapassa tela */
  white-space: nowrap;       /* 🔑 impede quebra */
  box-sizing: border-box;
  border-radius: 0;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  background-color: #fff;
  overflow-x: auto;          /* segurança */
  z-index: 3000;
}

/* Itens do submenu */
body.mobile .navbar .dropdown-menu .dropdown-item {
  white-space: nowrap;       /* texto inteiro */
  word-break: normal;
  line-height: 1.3;
}

/* Controle de abertura */
body.mobile .navbar .dropdown-menu {
  display: none;
}

body.mobile .navbar .dropdown.show > .dropdown-menu {
  display: block;
}



/* Animação suave para abrir dropdown */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Abre dropdown ao clicar (ou foco) */
body.mobile .navbar .dropdown:focus-within > .dropdown-menu,
body.mobile .navbar .dropdown:active > .dropdown-menu,
body.mobile .navbar .dropdown.show > .dropdown-menu {
  display: block !important;
}

/* ============================================================
   CORPO PRINCIPAL
============================================================ */
#corpo {
  width: 100%;
  padding-top: 80px;
  padding-bottom: 30px;
}

#corpo .titulo2 {
  color: var(--azul-escuro);
}

/* ============================================================
   IMAGENS E CONTAINERS
============================================================ */
#corpo .container img {
  max-width: 500px;
  max-height: 500px;
  width: 100%;
  height: 100%;
}

/* ============================================================
   MEDIA QUERIES
============================================================ */
@media (max-width: 575.98px) {
  #header .navbar-collapse {
    width: 100%;
  }

  #corpo .container img {
    max-width: 570px;
    max-height: 570px;
    width: 100%;
    height: 100%;
  }
}

@media (min-width: 576px) and (max-width: 1080.98px) {
  #header .navbar-collapse {
    width: 100%;
  }

  #corpo .container {
    min-width: 100%;
  }

  #corpo .container img {
    max-width: 500px;
    max-height: 500px;
    width: 100%;
    height: 100%;
  }

  #corpo .container .texto-corpo {
    font-size: 10px;
  }
}

/* ============================================================
   DESKTOP (>= 992px)
============================================================ */
@media (min-width: 992px) {
  #header .nav-link {
    margin-left: 15px;
    margin-right: 15px;
  }

  /* Texto visível no desktop */
  .navbar .menu-text {
    display: inline;
  }
}

/* ============================================================
   MOBILE (< 992px)
============================================================ */
@media (max-width: 991.98px) {

  /* Menu principal em ícones horizontais */
  .navbar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .navbar-nav .nav-item {
    width: auto;
  }

  .navbar-nav .nav-link {
    justify-content: center;
    padding: 10px;
  }

  /* Esconde texto no menu principal */
  .navbar .menu-text {
    display: none !important;
  }

  /* Ícones maiores no mobile */
  .navbar-nav .nav-link i {
    font-size: 1.6rem;
  }

  /* Dropdown mobile — evita texto estourar */
  .navbar .dropdown-menu {
    width: 100%;
    max-width: 100%;
  }

  .navbar .dropdown-menu .dropdown-item {
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
  }
}

@media (max-width: 991.98px) {

  /* Dropdown mobile — container */
  .navbar .dropdown-menu {
    position: static !important; /* 🔴 chave da correção */
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Itens do submenu */
  .navbar .dropdown-menu .dropdown-item {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
  }

}


/* IMPRESSÃO */
@media print {
  .no-print {
    display: none !important;
  }
}

/* ============================================================
   ELEMENTOS DIVERSOS
============================================================ */
.hiddenRow {
  padding: 0 4px !important;
  background-color: #f5f5f5 !important;
  font-size: 13px;
}

.modal {
  overflow-y: auto !important;
}

.modal-open {
  overflow: auto !important;
  overflow-x: hidden !important;
  padding-right: 0 !important;
}

input[type="file"] {
  display: none;
}

.custom-file-upload {
  border: 1px solid #ccc;
  display: inline-block;
  padding: 6px 12px;
  cursor: pointer;
}

.spinner-wrapper {
  background-color: #000080;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s;
}

.spinner-border {
  height: 60px;
  width: 60px;
}

#corpo_impressao {
  width: 100%;
}

/* ============================================================
   AUTOCOMPLETE / SEARCHBAR
============================================================ */
#lista_resultado li {
  padding: 2px 10px;
  cursor: pointer;
  transition: background-color 0.2s;
}

#lista_resultado li.highlight {
  background-color: #e5e5e5;
}

#lista_resultado li:hover {
  background-color: #ccc;
}

#search_bar_for {
  position: absolute;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 9999;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

#search_bar_for li {
  padding: 8px;
  cursor: pointer;
}

#search_bar_for li.highlight {
  background-color: #bde4ff;
}

input.autocomplete:focus {
  outline: none;
  box-shadow: 0 0 5px #3b82f6;
}

.search_bar_for li {
  padding: 8px;
  cursor: pointer;
}

.search_bar_for li.highlight {
  background-color: #007bff;
  color: #fff;
}
