html, body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* Remove qualquer barra de rolagem global do sistema */
}

.cabecalho-sistema {
    position: relative;
    top: 0px;
    left:0px;
    height: 8dvh;
    width:100vw;
    background-color:#003371;
    color: white;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between; 
    z-index: 1000;
    box-shadow: 0 2px 5px  rgba(0, 0, 0, 0.5);
}

header h1 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 700;       
  color: #ffffff;
  margin: 0px;             
  font-size: 24px;
  line-height: 1.2;       /* Melhora o espaçamento caso o texto quebre em 2 linhas */
}

/* Crie uma regra específica para o botão 'i' no header */
.header-info-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  font-size: 16px;
  font-weight: bold;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  
  /* Garante que o botão nunca encolha ou seja esmagado */
  flex-shrink: 0; 
  /* Margem esquerda negativa opcional caso queira ele ainda mais colado no H1 */
  margin-left: -5px; 
}

.header-info-btn:hover {
  background-color: #ffffff;
  color: #003371;
  border-color: #ffffff;
}

.map {
    position: relative;
    height: 92dvh;
    width: 100vw;
    overflow: hidden;
    /* Desativa o zoom de pinça nativo e scrolls duplos do navegador */
    touch-action: none; 
    /* Evita seleções de texto acidentais ao arrastar o mapa */
    -webkit-user-select: none;
    user-select: none;
}

/* O botão de fechar (Posicionado no canto superior direito) */
.btn-toggle {
    position: absolute;
    top: 1px;
    right: 1px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    font-weight: bold;
    color: #727272;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-toggle:hover {
    background-color: #f0f0f0;
}


/* --- Container com o posicionamento --- */

#posicionamento {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background-color: rgb(255,255,255,0.95);
    padding: 20px 30px 0px 10px;
    border-radius: 5%;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

/* --- ESTADO FECHADO --- */

#posicionamento.fechada {
    min-width: unset;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%; /* Vira um botão redondo */
    background-color: rgb(255,255,255,0.85);/* Cor do botão quando fechado */
    overflow: hidden;
}

/* Esconde o conteúdo quando estiver fechada */
#posicionamento.fechada #posicionamento {
    display: none;
}

/* Reposiciona e estiliza o botão interno quando a legenda vira um botão */
#posicionamento.fechada .btn-toggle {
    position: static;
    width: 100%;
    height: 100%;
}

.popup-header {
  display: flex;
  justify-content: space-between; /* Empurra o texto para a esquerda e o X para a direita */
  align-items: center;            /* Alinha os dois verticalmente ao centro */
  margin-bottom: 10px;            /* Afasta o topo do conteúdo de baixo */
}

/* --- POP-UP --- */
.ol-popup {
  position: absolute;
  background-color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid gray; 
  bottom: 0;
  left: 50%;
  transform: translateX(-50%); 
  width: max-content;         /* Faz o popup se ajustar exatamente ao tamanho do texto/tabela */
  min-width: 200px;           /* Impede que ele fique espremido demais com conteúdos curtos */
  max-width: min(350px, calc(100vw - 32px));           /* Define um limite máximo para não virar uma "faixa" longa na tela */
  word-break: break-word;     /* Se houver um link ou texto muito grande sem espaço, ele quebra a linha */
  color: gray; 
  font-size: 14px;
}

.ol-popup h3 {
  margin: 0 20px 10px 20px; 
  text-align: center;
  font-size: 15px;
  font-weight: bold;
}

.ol-popup p {
  margin: 6px 0; 
  line-height: 1.3;
}

.ol-popup .popup-coordenada {
  margin: 0;
  font-size: 11px;
  opacity: 0.7; 
}

.ol-popup:after, .ol-popup:before {
  top: 100%;
  border: solid transparent;
  content: " ";
  height: 0;
  width: 0;
  position: absolute;
  pointer-events: none;
}

.ol-popup:after {
  border-top-color: white;
  border-width: 10px;
  left: 50%;
  margin-left: -10px;
}

.ol-popup:before {
  border-top-color: rgba(0,0,0,0.25);
  border-width: 12px;
  left: 50%;
  margin-left: -12px;
}

/* Painel Lateral */

/* Painel Lateral Estilo Drawer */
.painel-lateral {
    position: fixed;
    top: 8dvh;
    right: 0;
    height: 92dvh;
    width: 100vw;
    background-color: #f8f9fa;
    z-index: 2000;
    box-shadow: -2px 0 10px rgba(0,0,0,0.2);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

/* Quando estiver fechado, joga o painel para fora da tela à direita */
.painel-lateral.fechada {
    transform: translateX(100%);
}

/* Responsividade: Em telas maiores (Desktop), ele não precisa cobrir tudo */
@media (min-width: 768px) {
    .painel-lateral {
        width: 350px; 
    }
}

.painel-header {
    padding: 8px;
    background-color: #3399CC;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.painel-header h2 { margin: 0; font-size: 18px; }
#btn-fechar-painel { background: none; border: none; color: white; font-size: 28px; cursor: pointer; }

.painel-body {
    padding: 15px;
    overflow-y: auto; /* Permite scroll se tiver muitas camadas */
    flex: 1;
}

/* Estilização de cada linha de camada */
.item-camada-controle {
    background: #fff;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.item-camada-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 8px;
    cursor: pointer;
}

.item-camada-header input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.item-camada-legenda {
    padding-left: 28px;
}

.item-camada-legenda img {
    max-width: 100%;
    margin-top: 4px;
}

/* Botão flutuante para abrir */
.btn-flutuante-menu {
    position: fixed;
    top: 10dvh;
    right: 2px;
    z-index: 1000;
    background-color: #3399CC;
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    cursor: pointer;
}

/* ==========================================================================
   COMPONENTE: BARRA CANTO INFERIOR ESQUERDO
   ========================================================================== */
.webgis-statusbar {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px;
  background: white;
  opacity: 0.8;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  padding: 4px 10px;
  position: absolute;
  bottom: 22px;
  right: 4px;
  z-index: 999;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
  font-family: Arial, sans-serif;
  font-size: 10px !important; 
  color: rgb(46, 46, 46);
}

.webgis-statusbar .ol-scale-line,
.webgis-statusbar .ol-mouse-position {
  position: static !important; 
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
}

/* .webgis-statusbar .ol-scale-line-inner {
  border: 1px solid rgb(46, 46, 46)!important;
  border-top: none !important;
  color: rgb(46, 46, 46) !important;
  font-size: 10px !important;
  font-family: monospace !important;
  margin: 0 !important;
  text-align: center;
} */
/* 
#statusbar-coordenadas {
  display: flex;
  align-items: center;
} */

/* .webgis-statusbar .ol-mouse-position {
  font-family: monospace !important; 
  font-size: 10px !important;
  color: rgb(46, 46, 46) !important;
  white-space: nowrap;
} */

/* #statusbar-escala-num {
  font-family: monospace;
  font-weight: bold;
  border-left: 1px solid rgb(46, 46, 46); 
  padding-left: 12px;
  display: flex;
  align-items: center;
  white-space: nowrap;
} */

#statusbar-escala-grafica {
  font-family: monospace;
  /*border-left: 1px solid rgb(46, 46, 46); 
  padding-left: 12px;*/
  display: flex;
  align-items: center;
}

/* 1. O Botão Norte (Rotate) assume a primeira vaga abaixo do zoom */
.ol-touch .ol-rotate, .ol-rotate {
  top: 4.5em !important; 
  left: 0.5em !important;  
  right: auto !important; 
  position: absolute;
}

/* 2. O seu botão de centralizar vai para baixo do botão Norte */
.ol-control.ol-centralizar {
    top: 6.8em; /* Empurrado para baixo para dar espaço à bússola */
    left: 0.5em;
    position: absolute;
}

/* Mantém a estilização idêntica aos padrões do OpenLayers */
.ol-centralizar button {
    font-size: 1.14em;
    font-weight: 700;
    color: #333;
    background-color: rgba(255, 255, 255);
    border: none;
    border-radius: 2px;
    padding: 0;
    margin: 0;
    height: 1.375em;
    width: 1.375em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ol-centralizar button:hover {
    background-color: rgba(255, 255, 255, 1);
}

/* ==========================================================================
   QUADRO POP-UP (MODAL DE INICIALIZAÇÃO)
   ========================================================================== */

/* Fundo escurecido que cobre toda a tela */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6); /* Preto sutilmente transparente */
  z-index: 3000; /* Garante que fique acima de absolutamente tudo (Header, Mapas e Menus) */
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Escondido por padrão para animação do JS */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Classe ativada pelo JS para mostrar o pop-up */
.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* O cartão do quadro popup */
.modal-card {
  background-color: #ffffff;
  width: 90%;
  max-width: 350px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6); 
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Efeito de "subir" levemente quando aparece */
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal-card {
  transform: translateY(0);
}

/* Cabeçalho do Pop-up */
.modal-header {
  background-color: #3399CC; /* O mesmo azul padrão do sistema */
  color: #ffffff;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 20px;
  margin: 12px;
  font-weight: 600;
}

.modal-close-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.modal-close-btn:hover {
  opacity: 1;
}

/* Corpo do texto */
.modal-body {
  padding: 20px;
  margin: 20px;
  color: #333333;
  line-height: 1.6;
  font-size: 14px;
  text-align: justify;
}

.modal-body p {
  margin-bottom: 15px;
}

/* Lista de funcionalidades destacadas */
.modal-features {
  background-color: #eaf8ff; 
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 15px;
  border-left: 4px solid #3399CC;
}

.feature-item {
  margin-bottom: 8px;
  font-weight: 500;
}

.feature-item:last-child {
  margin-bottom: 0;
}

.modal-footer-text {
  font-size: 13px;
  color: #666666;
  font-style: italic;
}

/* Rodapé / Área do Botão */
.modal-actions {
  padding: 0 20px 20px 20px;
  display: flex;
  align-items: center;         /* Alinha verticalmente o checkbox e o botão */
  justify-content: space-between; /* Empurra o checkbox para a esquerda e o botão para a direita */
  gap: 15px;                   /* Garante um espaço mínimo se a tela for muito pequena */
}

.modal-btn-primary {
  background-color: #3399CC;
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.modal-btn-primary:hover {
  background-color: #eaf8ff;
  color: #3399CC;
}


/* Botão de informação integrado ao Header */
.header-info-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  font-size: 16px;
  font-weight: bold;
  width: 28px;
  height: 28px;
  border-radius: 50%; /* Perfeitamente redondo */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-left: 5px; /* Dá um pequeno recuo em relação ao h1 */
}

/* Efeito ao passar o mouse */
.header-info-btn:hover {
  background-color: #ffffff;
  color: #003371; /* Inverte as cores com o azul do header */
  border-color: #ffffff;
  transform: scale(1.05);
}

/* Alinhamento do "Não mostrar novamente" */
.dont-show-again-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: #555555;
  user-select: none;
  margin-top: 0; 
}

.dont-show-again-container input {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #3399CC; 
}

.dont-show-again-container label {
  cursor: pointer;
}
