/* ===================== RESET & BASE ===================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0F1823;
  color: #ffffff;
}

/* ===================== CONTAINER LAYOUT ===================== */
#app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

#sidebar {
  width: 280px;
  height: 100vh;
  background: #0F1823;
  border-right: 1px solid #2D3E52;
  overflow-y: auto;
  padding: 15px;
  z-index: 999;
}

#map {
  flex: 1;
  height: 100vh;
  width: 94.5vw;
}

/* ===================== PAINEL HEADER ===================== */
.panel-header {
  margin-bottom: 1px;
  padding-bottom: 15px;
  border-bottom: 1px solid #2D3E52;
}

.panel-header h1 {
  font-size: 14px;
  color: #ffffff;
  margin-bottom: 5px;
  font-weight: 600;
  text-transform: uppercase;
}

.panel-header p {
  font-size: 12px;
  color: #9CA3AF;
  font-weight: 400;
}

/* ===================== CONTROLES ===================== */
.control-group {
  margin-bottom: 18px;
}

.control-group label {
  font-family: Roboto, sans-serif;
  display: block;
  font-size: 11px;
  font-weight: 100;
  color: #4A9EFF;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.control-group select,
.control-group input[type="text"],
.control-group input[type="date"],
.control-group input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  background: #303539;
  border: 1px solid #2D3E52;
  color: #E8EAED;
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.2s ease;
}

.control-group select:hover,
.control-group input:hover {
  border-color: #4A9EFF;
  background: #303539;
}

.control-group select:focus,
.control-group input:focus {
  outline: none;
  border-color: #4A9EFF;
  background: #303539;
  box-shadow: 0 0 8px rgba(74, 158, 255, 0.2);
}

/* ===================== BOTÕES ===================== */
.btn {
  width: 100%;
  padding: 10px 15px;
  margin: 0px 0;
  background: #4A9EFF;
  color: #0F1823;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:hover {
  background: #3B8FFF;
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn.secondary {
  background: transparent;
  color: #4A9EFF;
  border: 1px solid #4A9EFF;
}

.btn.secondary:hover {
  background: #4A9EFF;
  color: #0F1823;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===================== STATUS ===================== */
.status-box {
  background: #303539;
  border: 1px solid #0075ff;
  border-radius: 4px;
  padding: 10px;
  margin: 15px 0;
  font-size: 11px;
  color: #9CA3AF;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Roboto', sans-serif;
  line-height: 1.5;
}

.status-box.success {
  border-color: #10B981;
  color: #10B981;
}

.status-box.error {
  border-color: #EF4444;
  color: #EF4444;
}

.status-box.warning {
  border-color: #F59E0B;
  color: #F59E0B;
}

/* ===================== SLIDER ===================== */
input[type="range"] {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #2D3E52;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #4A9EFF;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(74, 158, 255, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #4A9EFF;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(74, 158, 255, 0.4);
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #3B8FFF;
  box-shadow: 0 2px 8px rgba(74, 158, 255, 0.6);
}

/* ===================== SCROLLBAR ===================== */
#sidebar::-webkit-scrollbar {
  width: 8px;
}

#sidebar::-webkit-scrollbar-track {
  background: #1A2A47;
}

#sidebar::-webkit-scrollbar-thumb {
  background: #2D3E52;
  border-radius: 4px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
  background: #4A9EFF;
}

/* ===================== NOTIFICAÇÃO ===================== */
.notification {
  position: fixed;
  bottom-right: 10px;
  background: #1A2A47;
  color: #E8EAED;
  padding: 12px 16px;
  border-radius: 6px;
  border-left: 4px solid #4A9EFF;
  font-size: 13px;
  z-index: 9999;
  animation: slideIn 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.layer-search-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6000;
}

.layer-search-modal.hidden {
  display: none;
}

.layer-search-card {
  background: #101827;
  color: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  width: 640px;
  /* antes ~420px, agora mais largo */
  max-width: 95vw;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.layer-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr) 110px;
  column-gap: 8px;
  align-items: end;
  margin-bottom: 4px;
}

.ls-col {
  display: flex;
  flex-direction: column;
}

.ls-col-query {
  flex: 1.4;
}

.ls-col-layer {
  flex: 1;
}

.ls-col-button {
  display: flex;
  flex-direction: column;
  align-items: end;
}

.ls-col-button .btn {
  align-items: end;
}

/* esconde o label da coluna do botão, mas mantém o espaço para alinhar */
.ls-col-button label {
  margin: 0;
  padding: 0;
  height: 0;
  overflow: hidden;
}

/* labels */
.ls-col label {
  font-size: 0.8rem;
  margin-bottom: 2px;
}

/* inputs/selects com a mesma altura */
.ls-col .form-control {
  height: 32px;
  font-size: 0.85rem;
  padding: 4px 6px;
}

/* botão com a mesma altura dos inputs */
.ls-col-button .btn-block {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-size: 0.8rem;
}

.layer-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.layer-search-header h3 {
  font-size: 1.05rem;
  margin: 0;
}

.layer-search-header .close-btn {
  background: transparent;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
}

.layer-search-header .close-btn:hover {
  color: #fff;
}

.layer-search-body .form-group label {
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.layer-search-body .form-control {
  background: #303539;
  border: 1px solid #0077ff;
  color: #E8EAED;
  border-radius: 4px;
  height: 30px;
  font-size: 13px;
  padding: 3px 10px;
  font-family: inherit;
}

/* Cor do placeholder do campo de busca em camadas */
#layerSearchQuery::placeholder {
  color: #bdbaba;
  opacity: 1;
  /* garante que não fique desbotado em alguns browsers */
}

/* Prefixos opcionais para compatibilidade extra */
#layerSearchQuery::-webkit-input-placeholder {
  color: #bdbaba;
}

#layerSearchQuery:-ms-input-placeholder {
  color: #bdbaba;
}

.layer-search-body .form-control select:hover,
.layer-search-body .form-control input:hover {
  border-color: #4A9EFF;
  background: #303539;
}

.layer-search-results {
  max-height: 260px;
  overflow-y: auto;
  margin-top: 4px;
}

.layer-search-result-item {
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  border: 1px solid transparent;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.02);
}

.layer-search-result-item:hover {
  background: rgba(74, 158, 255, 0.15);
  border-color: #4A9EFF;
}

.layer-search-result-title {
  font-weight: 600;
  color: #E5E7EB;
}

.layer-search-result-sub {
  color: #9CA3AF;
}

.layer-search-results {
  max-height: 260px;
  overflow-y: auto;
  margin-top: 4px;
}

/* Scrollbar WebKit (Chrome, Edge, Safari) */
.layer-search-results::-webkit-scrollbar {
  width: 8px;
}

.form-control:focus {
  color: #E5E7EB;
}


.layer-search-results::-webkit-scrollbar-track {
  background: #111827;
  /* mesma base do card */
}

.layer-search-results::-webkit-scrollbar-thumb {
  background-color: #374151;
  /* cinza escuro */
  border-radius: 4px;
  border: 1px solid #111827;
}

.layer-search-results::-webkit-scrollbar-thumb:hover {
  background-color: #4B5563;
}

/* Scrollbar Firefox */
.layer-search-results {
  scrollbar-width: thin;
  scrollbar-color: #374151 #111827;
}

/* layout do item de resultado */
.ls-result-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* base do thumbnail */
.ls-geom-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020617;
  position: relative;
  overflow: hidden;
}

/* polígono: forma de talhão estilizada */
.ls-geom-poligono,
.ls-geom-polígono {
  border: none;
  /* sem borda quadrada */
}

.ls-geom-poligono::before,
.ls-geom-polígono::before {
  content: '';
  position: absolute;
  inset: 5px 4px 6px 4px;
  /* controla “margem” do talhão */
  border: 2px solid #10B981;
  /* verde da área */
  border-radius: 4px;
  transform: skewX(-10deg) rotate(-4deg);
  /* deixa a forma “torta”, tipo gleba */
  background: rgba(16, 185, 129, 0.08);
  /* leve fill */
}

/* ponto: caixinha com ícone da camada */
.ls-geom-ponto {
  border: 2px solid rgba(249, 115, 22, 0.9);
}

/* linha: “faixa” no meio da caixinha */
.ls-geom-linha {
  border-radius: 6px;
  border: 2px solid #60A5FA;
  background: transparent;
  position: relative;
}

.ls-geom-linha::before {
  content: '';
  position: absolute;
  left: 5px;
  right: 5px;
  top: 50%;
  height: 3px;
  background: #60A5FA;
  transform: translateY(-50%);
}

.ls-result-text {
  flex: 1;
}

/* Deixar o título "Resultado da Busca" bem visível nos popups do Leaflet */
.leaflet-popup-content h6 {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 0.9rem;
  color: #111827;
  /* quase branco */
}

/* Se quiser reforçar o <b> dentro do h6 também */
.leaflet-popup-content h6 b {
  color: #111827;
}

.leaflet-popup-content-wrapper {
  font-family: 'Roboto', sans-serif;
  font-size: 10px;
}

.layer-search-result-item.layer-search-result-selected {
  background: rgba(250, 204, 21, 0.18);
  border-color: #facc15;
}

.leaflet-popup-content {
  font-size: 1.5em;
}

/* Animação do botão BUSCAR da busca em camadas */
#layerSearchBtn.loading #layerSearchBtnIcon {
  animation: spin 1s linear infinite;
}

/* Garante que, fora do loading, não fica nenhum resquício de animação */
#layerSearchBtn:not(.loading) #layerSearchBtnIcon {
  animation: none;
}

/* Painel Sentinel-1 reutiliza o estilo do settings-panel */
#s1-change-panel {
  /* se quiser uma largura um pouco menor ou maior que o padrão, ajuste aqui */
  /* width: 320px; */
}

/* Animação spinner no botão "Gerar Mapa" */
#s1GenerateBtn.loading #s1GenerateIcon {
  animation: spin 1s linear infinite;
}

/* ===================== FIRE POPUP ===================== */
.fire-popup-container .leaflet-popup-content-wrapper {
  background: #1a1f2e;
  border: 1px solid rgba(255, 107, 53, 0.3);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: #E8EAED;
  padding: 0;
}

.fire-popup-container .leaflet-popup-tip {
  background: #1a1f2e;
  border: 1px solid rgba(255, 107, 53, 0.3);
}

.fire-popup-container .leaflet-popup-content {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.fire-popup {
  min-width: 240px;
}

.fire-popup-header {
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(189, 0, 38, 0.1));
  border-bottom: 1px solid rgba(255, 107, 53, 0.2);
  border-radius: 9px 9px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: #FF6B35;
}

.fire-popup-body {
  padding: 10px 14px 12px;
}

.fire-popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.fire-popup-row:last-child {
  border-bottom: none;
}

.fire-popup-label {
  font-size: 11px;
  color: #9CA3AF;
  display: flex;
  align-items: center;
  gap: 5px;
}

.fire-popup-label i {
  font-size: 10px;
  color: #FF6B35;
  width: 14px;
  text-align: center;
}

.fire-popup-value {
  font-size: 12px;
  color: #E8EAED;
  font-weight: 500;
  text-align: right;
}

/* Fire panel position override */
#fire-panel {
  max-height: 101vh;
  overflow-y: auto;
}

/* Spinner animation for fire search button */
#fireSearchBtn.loading #fireSearchIcon {
  animation: spin 1s linear infinite;
}

/* Quick button active state */
.fire-quick-btn.active {
  background: rgba(255, 107, 53, 0.3) !important;
  border-color: #FF6B35 !important;
  color: #FF6B35 !important;
}