html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    height: 80px;
    background-color: #333;
    color: white;
    display: flex;
    align-items: stretch;
    padding: 0px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.header-logo-wrapper {
    width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-right: 1px solid #555;
    box-sizing: border-box;
}

.logo {
    width: 115px;
    height: 75px;
    background-color: #6f7070;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo h3 {
    margin: 0;
    color: #ccc;
    font-size: 1.2em;
}

.header-content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.header-title-row {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #555;
    box-sizing: border-box;
}

.header-title-row h2 {
    margin: 0;
    font-size: 28px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-menu-row {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 10px;
}

#header-main-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}

#header-main-menu li {
    display: flex;
    align-items: center;
    position: relative; /* Adicionado: Essencial para o posicionamento do submenu */
}

#header-main-menu li:not(:last-child) a {
    border-right: 1px solid #888;
}

#header-main-menu li a {
    display: block;
    padding: 5px 15px;
    text-decoration: none;
    color: #fff;
    transition: background-color 0.3s ease, color 0.3s ease;
    white-space: nowrap;
    font-size: 0.9em;
}

#header-main-menu li a:hover {
    background-color: #555;
    color: #ffd700;
}

.header-menu-row {
    flex-grow: 1;
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.map-toolbox {
    display: grid;
    grid-template-columns: repeat(auto-fit, 30px); /* 40px é o tamanho mínimo do ícone */
    gap: 8px; /* Espaçamento entre os ícones */
    padding: 8px;
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-bottom: 15px;
    justify-content: start;
}

.tool-item {
    display: flex;
    flex-direction: column; /* Para texto abaixo do ícone, se quiser */
    align-items: center;
    justify-content: center;
	width: 35px;
	height: 35px;
    background-color: #383838;
    border: 1px solid #212121;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tool-item.active {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.5);
}

.tool-item:hover {
    background-color: #555555;
    border-color: #383838;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/*
#toggle-sidebar-btn {
    background-color: #555;
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.2em;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    margin-left: 20px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#toggle-sidebar-btn:hover {
    background-color: #777;
}

#toggle-sidebar-btn .icon {
    display: inline-block;
    vertical-align: middle;
}
*/

/* NOVO: Estilos para o Submenu */
#header-main-menu .submenu {
    display: none; /* Oculta o submenu por padrão */
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #444;
    border: 1px solid #555;
    border-top: none;
    min-width: 150px;
    z-index: 1000;
    flex-direction: column;
	flex-shrink: 0;
}

#header-main-menu .submenu li a {
    display: block; /* Adicionado: faz o link se comportar como um bloco */
    padding: 10px 15px; /* Ajuste o padding para dar mais espaço, se quiser */
    border-right: none;
    border-bottom: 1px solid #555;
    /* Remover a linha abaixo se você já tiver uma regra para .submenu li a */
    width: 100%;
    box-sizing: border-box; /* Garante que o padding não aumente a largura total */
}

#header-main-menu .submenu li:last-child a {
    border-bottom: none;
}

#header-main-menu li.active .submenu {
    display: flex; /* Exibe o submenu quando o item pai tem a classe 'active' */
}

.header-right-side {
    flex-grow: 1; /* Faz este div ocupar todo o espaço restante */
    display: flex;
    justify-content: flex-end; /* Alinha o conteúdo à direita */
    align-items: center; /* Adicionado para alinhar verticalmente */
    gap: 3px; /* Opcional: Adiciona espaço entre os elementos filhos */
}

.container {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
    flex-direction: row;
}

#sidebar {
    width: 400px;
    min-width: 0px;
    max-width: 700px;
    background-color: #f0f0f0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    flex-shrink: 0;
    order: 2;
    transition: width 0.3s ease-in-out;
    white-space: normal;
}

#sidebar.hidden {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0;
    border-right: none;
    pointer-events: none;
    flex-shrink: 0;
}

#sidebar-resizer {
    width: 8px;
    height: 100%;
    background-color: #ccc;
    position: absolute;
    left: 0;
    top: 0;
    cursor: ew-resize;
    z-index: 10;
}

#sidebar-dynamic-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 15px;
    box-sizing: border-box;
}

#sidebar h3 {
    height: 30px;
    line-height: 30px;
    margin: 0;
    color: #000;
    border-bottom: 1px solid #555;
    padding: 0 15px;
    box-sizing: border-box;
    flex-shrink: 0;
}

#main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    order: 1;
    overflow: hidden;
}

#map {
    flex-grow: 1;
    min-height: 0;
    width: 100%;
    background-color: #eee;
}

/* Estilos para o controle de atribuição do Leaflet */
.leaflet-bottom.leaflet-left {
    left: 0;
    right: auto;
}

.leaflet-control-attribution {
    text-align: left;
    padding-left: 10px;
    padding-bottom: 5px;
}

.leaflet-control-container .leaflet-bottom {
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    width: 100%;
    padding: 0;
}

.leaflet-bottom {
    left: 0;
    right: auto;
}

.leaflet-bottom .leaflet-control {
    margin-left: 10px;
}