:root { 
  --background-color: #ffffff; /* Background color for the entire website, including individual sections */
  --default-color: #3d4348; /* Default color used for the majority of the text content across the entire website */
  --heading-color: #3e5055; /* Color for headings, subheadings and title throughout the website */
  --accent-color: #57a427; /* Accent color that represents your brand on the website. It's used for buttons, links, and other elements that need to stand out */
  --surface-color: #ffffff; /* The surface color is used as a background of boxed elements within sections, such as cards, icon boxes, or other elements that require a visual separation from the global background. */
  --contrast-color: #ffffff; /* Contrast color for text, ensuring readability against backgrounds of accent, heading, or default colors. */
  --button-background-color: #006400; 
  --button-background-color-hover: #027202; 
  --border-button-background-color: #006400; 
}

#map { 
    width: 100%;
    height: 100vh;
    background: #f4f4f4;
}

/* Toolbar Flutuante */
#map-toolbar {
    position: absolute;
    top: 100px;
    right: 10px;
    z-index: 2000; /* Garante que fique acima do mapa */
    display: flex;
    flex-direction: column;
    background: white;
    padding: 5px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: all 0.3s ease; /* Animação suave */
    overflow: hidden;
    max-height: 800px; /* Altura máxima quando aberto */
}

/* Estado Recolhido */
#map-toolbar.collapsed {
    max-height: 40px; /* Altura apenas do primeiro botão (Toggle) + padding */
}

/* Esconde os botões quando recolhido, exceto o primeiro (Toggle) */
#map-toolbar.collapsed .map-toolbar-btn:not(#btn-toggle-toolbar) {
    opacity: 0;
    pointer-events: none;
}

/* Estilo dos Botões */
.map-toolbar-btn {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
    border: 1px solid #ebebeb;
    background: #fff;
    border-radius: 3px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #333;
    transition: all 0.2s;
}

.map-toolbar-btn:last-child {
    margin-bottom: 0;
}

.map-toolbar-btn:hover {
    background-color: #f0f0f0;
}

.map-toolbar-btn.active {
    background-color: var(--button-background-color);
    color: white;
    border-color: var(--border-button-background-color);
}

/* Botão de Toggle (o primeiro) */
#btn-toggle-toolbar {
    width: 32px;
    height: 32px;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 8px;
    font-weight: bold;
}

/* Estilo para o Texto inserido no mapa */
.custom-text-label {
    background: transparent;
    border: none;
    box-shadow: none;
    font-size: 14px;
    font-weight: bold;
    color: #000;
    text-shadow: 2px 2px 0px #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
    white-space: nowrap;
}


/* Legenda Flutuante */
#floating-legend {
    position: absolute;
    bottom: 30px; /* Ajuste conforme necessário */
    right: 10px;
    width: 250px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    z-index: 1000; /* Acima do mapa, abaixo do sidebar */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    transition: all 0.3s ease;
    max-height: 40px; /* Altura inicial (apenas cabeçalho) */
}

#floating-legend.expanded {
    max-height: 400px; /* Altura máxima quando aberto */
}

.legend-header {
    background-color: var(--button-background-color);
    color: white;
    padding: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 14px;
}

.legend-header:hover {
    background: var(--button-background-color-hover);
    
}

.legend-body {
    padding: 10px;
    overflow-y: auto;
    max-height: 350px;
    background: rgba(255, 255, 255, 0.95);
}

/* Estilo dos Grupos na Legenda */
.legend-group {
    margin-bottom: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
}

.legend-group-title {
    background: #f8f9fa;
    padding: 5px 8px;
    font-weight: bold;
    font-size: 12px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.legend-item {
    padding: 8px;
    text-align: center;
}

.legend-item img {
    max-width: 100%;
    border: 1px solid #ccc;
    padding: 2px;
    background: white;
}

.legend-layer-name {
    font-size: 11px;
    margin-bottom: 4px;
    display: block;
    color: #555;
}


/* --- ESTILO GERAL DO POPUP --- */

/* Aumenta a largura máxima do popup */
.leaflet-popup-content {
    min-width: 300px !important; /* Largura mínima garantida */
    max-width: 450px !important; /* Largura máxima expandida */
    width: auto !important;
    margin: 40px 15px 15px !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Fonte mais limpa */
    font-size: 13px;
    line-height: 1.5;
}

/* Arredonda mais as bordas e dá uma sombra suave */
.leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 3px 14px rgba(0,0,0,0.3) !important;
}

/* Estiliza o botão de fechar (X) */
.leaflet-popup-close-button {
    top: 8px !important;
    right: 8px !important;
    font-size: 25px !important;
    color: #555 !important;
    font-weight: bold;
}

.leaflet-popup-close-button:hover {
    color: #d9534f !important; /* Vermelho ao passar o mouse */
}

/* Título do Popup (se houver um h3 ou h4 dentro) */
.leaflet-popup-content h3, 
.leaflet-popup-content h4 {
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #007bff; /* Linha azul embaixo do título */
    color: #333;
    font-size: 16px;
    font-weight: 600;
}


/* --- ESTILO DA TABELA DENTRO DO POPUP --- */

.leaflet-popup-content table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    background-color: #fff;
}

/* Cabeçalho da tabela (se houver <th>) */
.leaflet-popup-content table th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    text-align: left;
    padding: 8px;
    border-bottom: 2px solid #dee2e6;
}

/* Células da tabela */
.leaflet-popup-content table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    color: #555;
    vertical-align: top; /* Alinha texto ao topo se for longo */
}

/* Efeito Zebra (linhas alternadas) para facilitar leitura */
.leaflet-popup-content table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Efeito Hover na linha (destaca onde o mouse está) */
.leaflet-popup-content table tr:hover {
    background-color: #f1f1f1;
}

/* Coluna da esquerda (Rótulos/Chaves) em negrito suave */
.leaflet-popup-content table td:first-child {
    font-weight: 600;
    color: #333;
    width: 40%; /* Define uma largura fixa para os rótulos */
    background-color: #fafafa; /* Leve destaque na coluna de chaves */
}