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

/* Barra azul do topo */
#header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background-color: #003b73;
  color: #ffffff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 1000;
  font-size: 14px;
}

#header-subtitle {
  margin-left: 12px;
  font-size: 12px;
  opacity: 0.9;
}

#map {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Botões do topo (camadas / login) */
#layersButtonContainer {
  position: absolute;
  top: 8px;
  right: 20px;
  z-index: 1100;
}

#layersButtonContainer button {
  margin-left: 4px;
}

/* Painéis genéricos */
.panel {
  position: absolute;
  top: 40px;
  right: 20px;
  z-index: 1100;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #999;
  padding: 6px 8px;
  min-width: 150px;
  font-size: 12px;
}

.panel-title {
  font-weight: bold;
  margin-bottom: 4px;
}

.hidden {
  display: none;
}

/* Login */
#loginDialog {
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
}

/* Toolbar */
.toolbar {
  position: absolute;
  top: 70px;
  left: 40px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #999;
  padding: 6px;
  width: 210px;
  z-index: 1100;
  cursor: move;
  font-size: 12px;
}

.toolbar-title {
  font-weight: bold;
  margin-bottom: 4px;
}

.toolbar button,
.toolbar input,
.toolbar select {
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
}

.toolbar-section {
  margin-top: 6px;
}

.toolbar-section-title {
  margin-top: 6px;
  font-weight: bold;
  font-size: 11px;
}

/* sub-caixa da busca */
.toolbar-search-box {
  border: 1px solid #c9c9c9;
  background: rgba(245, 245, 245, 0.95);
  padding: 6px;
  margin-top: 4px;
}

/* botão ativo (azul) */
button.btn-active {
  background-color: #003b73;
  color: #fff;
}

/* Painel de nova feição */
#addFeaturePanel {
  top: 80px;
  left: 260px;
  min-width: 190px;
}

#addFeaturePanel button {
  width: 100%;
  margin-top: 4px;
}

/* Status */
.status-box {
  position: absolute;
  left: 8px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid #999;
  z-index: 1200;
}

#loginStatus {
  bottom: 40px;
}

#infoStatus {
  bottom: 8px;
}

/* Popup de atributos */
.popup {
  position: absolute;
  bottom: 80px;
  right: 20px;
  z-index: 1300;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #666;
  padding: 8px;
  min-width: 340px;
  max-width: 520px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.popup table {
  width: 100%;
  border-collapse: collapse;
}

.popup table td {
  border-bottom: 1px solid #ddd;
  padding: 2px 4px;
  font-size: 11px;
}

.popup input {
  width: 100%;
  box-sizing: border-box;
}

/* Resultados de busca */
#searchResultsPanel {
  position: absolute;
  top: 50px;
  right: 20px;
  width: 360px;
  max-height: 380px;
  overflow-y: auto;
  z-index: 1400;
  cursor: move;
}

.results-scroll {
  max-height: 310px;
  overflow-y: auto;
  padding: 4px;
}

.search-result-item {
  padding: 6px;
  border-bottom: 1px solid #ccc;
  font-size: 12px;
  cursor: pointer;
}

.search-result-item:hover {
  background-color: #e8f0ff;
}

#btnCloseSearchResults {
  font-size: 12px;
  padding: 2px 6px;
  margin-top: -2px;
}

/* Tooltips de medida */
.ol-tooltip {
  position: relative;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 8px;
  border-radius: 3px;
  white-space: nowrap;
  font-size: 11px;
}

.ol-tooltip-static {
  background: rgba(0, 0, 0, 0.7);
}

/* ============================================================
   LISTA DE CAMADAS (drag & drop)
============================================================ */
.layer-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0 0;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  border-bottom: 1px solid #e5e5e5;
  user-select: none;
}

.layer-item:last-child { border-bottom: none; }

.drag-handle {
  cursor: grab;
  font-size: 14px;
  line-height: 1;
  opacity: 0.8;
}

.layer-item.dragging { opacity: 0.5; }
