

/* Painel lateral (sidebar) */
#sidebar-results{
    position: fixed;
    top: 0;
    right: -380px; /* Começa escondido fora da tela */
    width: 350px;
    height: 100%;
    background-color: white;
    box-shadow: -2px 0 8px rgba(0,0,0,0.2);
    z-index: 2000; /* Garante que fique sobre o mapa */
    transition: right 0.4s ease-in-out; /* Animação de deslize */
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#sidebar-results.active {
    right: 0;
}

.close-sidebar-btn {
    position: absolute;
    top: 10px;
    left: 10px;
}

/* Classe para mostrar o painel */
#sidebar-results.open {
    right: 0; /* Desliza para a posição visível */
}

/* Botão para fechar o painel */
#sidebar-results-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 12px;
    font-weight: bold;
    color: #555;
    background: none;
    border: none;
    cursor: pointer;
}

#sidebar-results-close-btn:hover {
    color: #000;
}

/* Estilos para o conteúdo do painel */
#sidebar-results-content h3 {
    margin-top: 20px;
    color: #333;
}

#sidebar-results-content p {
    color: #666;
    line-height: 1.6;
}

/* Indicador de carregamento inicial */
#loading-indicator {
    display: none;
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #888;
}

#sidebar-results input,
#sidebar-results select {
    font-size: 0.9rem;
}

#sidebar-results .btn i {
    margin-right: 4px;
}


/****** DIV PESQUISA DE LICENÇAS *****/


#licenca-results {
    max-height: 360px !important;
    height: 360px !important;
    overflow-y: auto;
}

#licenca-results li {
  cursor: pointer;
}

#licenca-results li:hover {
  background: #f5f5f5;
}

/* export dropdown item hover */
.export-item:hover {
  background:#f0f0f0;
}


/* ── LayerManager redesenhado ────────────────────────────────── */

/* Barra de controles globais */
.lm-global-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    padding: 6px 4px 10px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.lm-global-left, .lm-global-right { display: flex; gap: 4px; }
.lm-btn {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: .72rem; font-weight: 500;
    padding: 3px 9px;
    border: 1px solid var(--border, #d1d5db);
    border-radius: 6px;
    background: var(--surface, #fff);
    color: var(--muted, #6b7280);
    cursor: pointer;
    transition: background .12s, color .12s;
}
.lm-btn:hover { background: var(--surface-2, #f3f4f6); color: var(--fg, #111); }
.lm-btn-check { border-color: var(--brand-500, #5e7257); color: var(--brand-500, #5e7257); }
.lm-btn-check:hover { background: rgba(94,114,87,.08); }

/* Grupos */
#layerGroupsContainer { margin-top: 4px; }

.lm-group { border: none; background: transparent; margin-bottom: 4px; }

.lm-group-header { }

.lm-group-btn {
    display: flex; align-items: center;
    width: 100%; text-align: left;
    padding: 7px 8px;
    background: var(--surface-2, #f3f4f6);
    border: none; border-radius: 8px;
    color: var(--fg, #111);
    font-size: .78rem; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase;
    cursor: pointer;
    transition: background .12s;
    box-shadow: none !important;
}
.lm-group-btn::after { display: none !important; }
.lm-group-btn:hover { background: var(--surface-3, #e5e7eb); }
.lm-group-btn.collapsed { background: transparent; color: var(--muted, #6b7280); font-weight: 600; }
.lm-group-btn.collapsed:hover { background: var(--surface-2, #f3f4f6); }
.lm-group-icon { color: var(--brand-500, #5e7257); font-size: .85rem; }
.lm-group-btn.collapsed .lm-group-icon { color: var(--muted, #9ca3af); }

/* Corpo do grupo */
.lm-group .accordion-body { padding: 4px 0 6px; }

/* Linha de camada */
.lm-row {
    padding: 5px 8px 5px 4px;
    border-radius: 6px;
    margin-bottom: 2px;
    border-left: 3px solid transparent;
    transition: background .1s, border-color .1s;
}
.lm-row:hover { background: var(--surface-2, #f9fafb); }
.lm-row--on {
    border-left-color: var(--brand-500, #5e7257);
    background: rgba(94,114,87,.04);
}

.lm-row-main {
    display: flex; align-items: center; gap: 8px;
}
.lm-layer-check { flex-shrink: 0; cursor: pointer; accent-color: var(--brand-500, #5e7257); }
.lm-layer-name  { font-size: .83rem; color: var(--fg, #111); cursor: pointer; user-select: none; flex: 1; }

/* Controles (opacidade + legenda) — visíveis só quando ativa */
.lm-row-controls { display: none; margin: 6px 0 2px 20px; }
.lm-row--on .lm-row-controls { display: block; }

.lm-opacity-wrap {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 6px;
}
.lm-op-label { font-size: .7rem; color: var(--muted, #6b7280); white-space: nowrap; min-width: 52px; }
.lm-opacity-range {
    flex: 1; height: 3px; cursor: pointer;
    accent-color: var(--brand-500, #5e7257);
}
.lm-op-value { font-size: .7rem; color: var(--muted, #6b7280); min-width: 30px; text-align: right; }

.lm-legend-wrap { margin-top: 2px; }
.lm-legend-label { font-size: .68rem; color: var(--muted, #9ca3af); text-transform: uppercase; letter-spacing: .06em; }
.lm-legend-img {
    display: block; max-width: 100%;
    margin-top: 3px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 4px; padding: 2px;
    background: #fff;
}


/* --- Estilos da Legenda Flutuante Simplificada --- */

/* A imagem da legenda agora age como um ícone */
.legend-icon-small {
    max-height: 30px; /* Altura máxima para parecer um ícone */
    max-width: 40px;  /* Largura máxima */
    margin-right: 10px; /* Espaço entre ícone e texto */
    object-fit: contain; /* Garante que a imagem não distorça */
    vertical-align: middle;
}

/* Texto da legenda */
.legend-text-small {
    font-size: 0.85rem; /* Texto um pouco menor */
    font-weight: 500;
    color: #333;
    line-height: 1.2;
}

/* Ajuste do container da legenda flutuante para ficar mais compacto */
#floating-legend .card-body {
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
}


/* ==========================================================================
   ESTILOS DE IMPRESSÃO (NATIVO)
   ========================================================================== */
@media print {
    /* 1. Configuração da Página PDF */
    @page {
        size: A4 landscape; /* Força orientação paisagem */
        margin: 0;          /* Remove margens do navegador */
    }

    /* 2. Esconder TUDO que não seja o layout de impressão */
    body * {
        visibility: hidden;
    }

    /* 3. Mostrar e Posicionar o Container de Impressão */
    #print-layout-container, 
    #print-layout-container * {
        visibility: visible;
    }

    #print-layout-container {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 999999 !important;
        background: white !important;
        display: flex !important; /* Garante que o flexbox funcione */
    }

    /* 4. Ajustes Específicos para o Mapa dentro da Impressão */
    /* Aqui está o segredo: movemos o mapa REAL para dentro do layout na hora da impressão */
    #map-for-print {
        width: 100% !important;
        height: 100% !important;
        position: relative !important;
        visibility: visible !important;
    }
    
    #map-for-print .leaflet-control-container {
        display: none !important; /* Esconde botões de zoom na impressão */
    }
    
    #map-for-print .leaflet-pane, 
    #map-for-print .leaflet-tile, 
    #map-for-print .leaflet-marker-icon, 
    #map-for-print .leaflet-popup-content-wrapper, 
    #map-for-print .leaflet-overlay-pane svg {
        visibility: visible !important; /* Garante que os tiles e vetores apareçam */
    }
}
/* ==========================================================================
   LAYOUT DE IMPRESSÃO (PRINT LAYOUT)
   ========================================================================== */

/* Container Principal (Folha A4) */
#print-layout-container {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 297mm;
    height: 210mm;
    background: white;
    z-index: -1;
    padding: 10mm;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

/* Área do Mapa */
#print-map-image {
    flex: 1;
    border: 1px solid #000;
    border-bottom: none; /* Remove borda inferior para colar no rodapé */
    background-color: #f8f9fa;
    background-size: cover;
    background-position: center;
    margin-bottom: 0;
}

/* Rodapé Geral */
.print-footer {
    height: 60mm;
    display: flex;
    flex-direction: column;
    border: 1px solid #000;
}

/* Linha do Título (Topo do Rodapé) */
.print-header-row {
    height: 10mm;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #000;
}

#print-map-title {
    margin: 0;
    font-size: 15px;
    color: #000;
    font-weight: bold;
    text-transform: uppercase;
}

/* Container das 4 Colunas */
.print-columns-container {
    flex: 1;
    display: flex;
    height: 50mm; /* Garante altura fixa para o conteúdo */
    overflow: hidden;
}

/* Estilos Comuns das Colunas */
.print-col {
    padding: 5px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid transparent; /* Mantém alinhamento */
}

/* Títulos das Seções (Legenda, Info Técnica) */
.print-section-title {
    margin: 0 0 5px 0;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
}

/* --- COLUNA 1: LEGENDA --- */
.print-col-legend {
    flex: 2;
}

#print-legend-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-content: flex-start;
    overflow: hidden;
}

/* --- COLUNA 2: NORTE E ESCALAS --- */
.print-col-scale {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;     
    justify-content: center; 
    gap: 8px;                
}

#print-north {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0; 
}

.print-north-arrow {
    height: 50px; 
    width: auto;
    object-fit: contain;
}

.print-info-divider {
    width: 80%;
    margin: 0; 
    border-top: 1px solid #ccc;
}

.print-scale-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
}

#print-scale-value {
    font-size: 10px;
    font-weight: bold;
    margin-bottom: 2px;
}

/* Escala Gráfica Customizada */
.print-scale-graphic-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#print-scale-bar-container {
    width: 100px; /* Será sobrescrito pelo JS */
    position: relative;
    height: 15px;
}

.print-scale-bar {
    display: flex;
    height: 6px;
    border: 1px solid black;
    width: 100%;
}

.scale-segment-black {
    flex: 1;
    background: black;
}

.scale-segment-white {
    flex: 1;
    background: white;
}

.print-scale-label {
    position: absolute;
    top: 8px;
    font-size: 8px;
    font-weight: bold;
}

.label-start { left: 0; transform: translateX(-50%); }
.label-mid   { left: 50%; transform: translateX(-50%); }
.label-end   { right: 0; transform: translateX(50%); }


/* --- COLUNA 3: INFO TÉCNICA --- */
.print-col-info {
    flex: 1;
    font-size: 8px;
    line-height: 1.4;
}

.print-info-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centraliza verticalmente */
    align-items: center;     /* Centraliza horizontalmente */
    text-align: center;
}

.print-info-divider {
    width: 80%;
    margin: 8px 0;
    border-top: 1px solid #ccc;
}

/* --- COLUNA 4: LOGO E AVISO --- */
.print-col-logo {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.print-logo-wrapper {
    flex: 1; /* Ocupa todo o espaço disponível acima do texto */
    display: flex;
    align-items: center; /* Centraliza verticalmente */
    justify-content: center; /* Centraliza horizontalmente */
}

.print-logo-img {
    height: 50px; /* Tamanho do logo */
    object-fit: contain;
}

.print-legal-text {
    font-size: 7px;
    text-align: justify;
    line-height: 1.2;
    color: #333;
    margin-bottom: 10px; /* Descola da borda inferior */
    padding: 0 5px;
}






