/* ===================== Página do mapa (mobile-first) ===================== */
:root {
  --menu-bg: #FEFAF6;
  --menu-text: #2D5016;
  --paper: #fff;
  --ink: #0f1419;
  --radius: 16px;
  --altura-header: 84px;
  --altura-footer: 0px;

  /* largura do painel de layers para animar o botão junto */
  --painel-layers-w: min(88vw, 320px);
}

@media (min-width:960px) {
  :root {
    --painel-layers-w: 340px;
  }
}

/* Sem scroll: o mapa ocupa tudo entre header e (se existir) footer */
html, body.mapa-page {
  height: 100%;
}

body.mapa-page {
  margin: 0;
  overflow: hidden;
  padding-bottom: 0 !important;
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: #f5f7f6;
}

/* wrapper do mapa */
.mapa-wrapper {
  position: relative;
  height: calc(100svh - var(--altura-header, 60px) - var(--altura-footer, 0px));
  isolation: isolate;
}

.mapa-full {
  position: absolute;
  inset: 0;
}

/* Preloader acima do header */
.precarregamento {
  z-index: 10050 !important;
}

/* Botão Hamburguer (Layers) */
.btn-layers {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10030;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  color: var(--menu-text);
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .10);
  font-weight: 700;
  cursor: pointer;
  transition: left .22s ease;
}

/* quando o painel abre, o botão acompanha */
.mapa-wrapper.layers-aberto .btn-layers {
  left: calc(var(--painel-layers-w) + 10px);
}

/* Painel Layers (esquerda) — off-canvas */
.painel-layers {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--painel-layers-w);
  background: var(--paper);
  border-right: 1px solid #e5e7eb;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
  transform: translateX(-100%);
  transition: transform .22s ease, opacity .22s, visibility .22s;
  z-index: 10020;
  display: flex;
  flex-direction: column;

  /* fechado por padrão */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.painel-layers.aberto {
  transform: translateX(0);
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.painel-layers__topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #edf0f2;
}

.painel-layers__topo h2 {
  margin: 0;
  font-size: 20px;
  color: #111;
  display: flex;
  align-items: center;
  gap: 8px;
}

.painel-layers .fechar {
  border: 0;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: #111;
}

.busca {
  padding: 10px 14px;
}

.input-icon {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-icon i {
  color: #6b7280;
}

.input-icon input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font: inherit;
  outline: none;
}

.hint {
  color: #6b7280;
  font-size: 12px;
}

.grupos {
  /* Mantém o comportamento de scroll que configuramos antes */
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 6px 14px 120px 14px;
}

.grupo {
  margin-top: 10px;
}

.grupos::-webkit-scrollbar {
  width: 6px;
}

.grupos::-webkit-scrollbar-track {
  background: transparent;
}

.grupos::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 4px;
}

.grupo h3 {
  margin: 8px 0;
  font-size: 16px;
  color: #111;
}

.linha {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  user-select: none;
}

.linha .icone {
  color: #1f2937;
}

/* Painel Info (direita) — off-canvas, fechado por padrão */
.painel-info {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: min(92vw, 460px);
  background: var(--paper);
  border-left: 1px solid #e5e7eb;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
  transform: translateX(100%);
  transition: transform .22s ease, opacity .22s, visibility .22s;
  z-index: 10025;
  display: flex;
  flex-direction: column;

  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.painel-info.aberto {
  transform: translateX(0);
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.painel-info__topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #edf0f2;
}

.painel-info__topo h2 {
  margin: 0;
  font-size: 18px;
  color: #111;
}

.painel-info .fechar {
  border: 0;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: #111;
}

.painel-info__conteudo {
  padding: 12px 14px;
  overflow: auto;
  height: 100%;
}

/* Galeria simples (setas + img) */
.galeria {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px dashed #e5e7eb;
  border-radius: 12px;
  min-height: 180px;
  margin-bottom: 10px;
}

.galeria img {
  max-width: 100%;
  max-height: 280px;
  display: block;
}

.galeria .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(17, 24, 39, .55);
  color: #fff;
  cursor: pointer;
}

.galeria .prev {
  left: 6px;
}

.galeria .next {
  right: 6px;
}

.descricao {
  margin: 6px 0 14px;
  color: #374151;
}

/* Form */
.form-info fieldset {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  margin: 10px 0;
  background: #fff;
}

.form-info legend {
  padding: 0 6px;
  color: #0f172a;
  font-weight: 700;
}

.form-info label {
  display: block;
  font-size: 14px;
  margin: 6px 0;
  color: #111;
}

.form-info input, .form-info textarea {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  outline: none;
  background: #fff;
}

.form-info textarea {
  resize: vertical;
}

.acoes-form {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px;
}

.btn.pri {
  background: #8cc63e;
  color: #0f2d12;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn.sec {
  background: transparent;
  color: #111;
  border: 2px solid #e5e7eb;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

/* Sombra (fundo clicável) do off-canvas */
.offcanvas-shade {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 10015;
}

.offcanvas-shade.on {
  opacity: 1;
  pointer-events: auto;
}

/* Badge de coordenadas no rodapé do mapa */
.coords-rodape {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, .72);
  color: #fff;
  font-size: .9rem;
  padding: 6px 10px;
  border-radius: 8px;
  pointer-events: none;
  z-index: 10030;
  white-space: nowrap;
}


/*modal */
/* Fundo Escuro com Desfoque */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
  z-index: 99999 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
}

.modal-overlay.aberto {
  opacity: 1;
  visibility: visible;
}

/* O Cartão Branco */
.modal-card {
  background: #fff;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
  /* Para o border-radius funcionar na imagem */
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.aberto .modal-card {
  transform: translateY(0);
}

.btn-fechar {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.8);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  font-size: 1.2rem;
  color: #333;
  transition: background 0.2s;
  display: grid;
  place-items: center;
}

.btn-fechar:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Layout Interno */
.modal-content {
  display: flex;
  flex-direction: row;
  height: 100%;
  overflow-y: auto;
}

/* Imagem */
.modal-figure {
  flex: 1;
  min-height: 300px;
  margin: 0;
  background: #f0f2f5;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sem-foto {
  display: none;
  flex-direction: column;
  align-items: center;
  color: #9ca3af;
  gap: 10px;
}

/* Lado do Texto */
.modal-info {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
}

.badge-categoria {
  display: inline-block;
  padding: 4px 12px;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

#modalTitulo {
  font-family: 'Poppins', sans-serif;
  /* Assumindo sua fonte */
  font-size: 1.75rem;
  color: #111827;
  margin: 0 0 24px 0;
  line-height: 1.2;
}

/* Tabela de Atributos */
.tabela-dados {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.tabela-dados tr {
  border-bottom: 1px solid #e5e7eb;
}

.tabela-dados tr:last-child {
  border-bottom: none;
}

.tabela-dados th {
  text-align: left;
  padding: 12px 0;
  color: #6b7280;
  font-weight: 500;
  width: 40%;
}

.tabela-dados td {
  text-align: right;
  padding: 12px 0;
  color: #1f2937;
  font-weight: 600;
}

/* Mobile */
@media (max-width: 768px) {
  .modal-content {
    flex-direction: column;
  }

  .modal-figure {
    min-height: 250px;
    flex: none;
  }

  .modal-info {
    padding: 24px;
  }

  #modalTitulo {
    font-size: 1.5rem;
  }
}

/* Marcador Personalizado no Mapa */
.marker-peabiru {
  background: transparent;
  /* O container do Leaflet é transparente */
  border: none;
}

.marker-circle {
  width: 44px;
  /* Tamanho que chama atenção */
  height: 44px;
  background-color: #0056b3;
  /* Azul Forte */
  border: 3px solid #ffffff;
  /* Borda Branca */
  border-radius: 50%;
  /* Faz ficar redondo */
  display: flex;
  align-items: center;
  justify-content: center;

  /* Sombra para dar destaque sobre o mapa */
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);

  /* Cor e tamanho do ícone FontAwesome dentro */
  color: #ffffff;
  font-size: 20px;

  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Efeito ao passar o mouse sobre o marcador */
.marker-circle:hover {
  transform: scale(1.15);
  background-color: #004494;
  /* Azul um pouco mais escuro */
  z-index: 1000;
}

/* ============ CARROSSEL NO MODAL ============ */

.modal-figure {
  position: relative;
  /* Essencial para posicionar os botões */
  background: #000;
  /* Fundo preto fica melhor para fotos */
  overflow: hidden;
}

/* Esconde todas as imagens por padrão, o JS mostra a ativa */
.modal-figure img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Mostra a foto inteira sem cortar */
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Classe para a imagem visível */
.modal-figure img.ativa {
  display: block;
  opacity: 1;
}

/* Botões de Navegação (Setas) */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background 0.2s;
}

.carousel-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.carousel-btn.prev {
  left: 10px;
}

.carousel-btn.next {
  right: 10px;
}

/* Contador (1/3) */
.carousel-counter {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 10;
}

.linha-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px;
  border-radius: 8px;
  transition: background 0.2s;
}

.linha-wrapper:hover {
  background: #f3f4f6;
}

.linha-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-grow: 1;
  user-select: none;
}

.linha-label input {
  accent-color: #2D5016;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.linha-label span {
  font-size: 0.9rem;
  font-weight: 500;
  color: #1f2937;
}

.linha-downloads {
  display: flex;
  gap: 6px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #555;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-download:hover {
  background: #2D5016;
  color: #fff;
  border-color: #2D5016;
}

.btn-download i {
  margin-right: 3px;
}