/* Smooth scrolling */
html, #landing-page-view {
  scroll-behavior: smooth;
}

/* Suporte a Viewport Dinâmico Mobile (100dvh) e Prevenção de Rolagem Dupla */
html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Área útil do WebGIS Main Workspace */
.webgis-main-container {
  height: calc(100vh - 5rem);
  height: calc(100dvh - 5rem);
}

@media (min-width: 640px) {
  .webgis-main-container {
    height: calc(100vh - 6rem);
    height: calc(100dvh - 6rem);
  }
}

/* Gavetas / Drawers Responsivos para WebGIS em Mobile e Tablets */
@media (max-width: 1023px) {
  .webgis-drawer-left {
    position: fixed !important;
    top: 5rem !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 85% !important;
    max-width: 380px !important;
    z-index: 1040 !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease !important;
    box-shadow: none !important;
  }
  .webgis-drawer-left.drawer-open {
    transform: translateX(0) !important;
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.8) !important;
  }

  .webgis-drawer-right {
    position: fixed !important;
    top: 5rem !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 88% !important;
    max-width: 420px !important;
    z-index: 1040 !important;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease !important;
    box-shadow: none !important;
  }
  .webgis-drawer-right.drawer-open {
    transform: translateX(0) !important;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.8) !important;
  }
}

/* Backdrop escuro para fechar gavetas ao tocar fora */
#webgis-drawer-backdrop {
  z-index: 1030 !important;
}

/* Alvo de Toque Acessível (Mobile First: Min 44x44px em Botões de Toque) */
@media (max-width: 768px) {
  .touch-target-min {
    min-height: 44px !important;
    min-width: 44px !important;
  }
  .leaflet-control-zoom a {
    width: 44px !important;
    height: 44px !important;
    line-height: 42px !important;
    font-size: 20px !important;
  }
}

/* Silky Smooth Page Transitions for Multi-Page Landing View */
.landing-page-content {
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.landing-page-content.page-enter {
  opacity: 0 !important;
  transform: translateY(12px) !important;
}
.landing-page-content.page-active {
  opacity: 1 !important;
  transform: translateY(0) !important;
}
.landing-page-content.page-exit {
  opacity: 0 !important;
  transform: translateY(-8px) !important;
}

/* Custom scrollbars for sidebars */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(51, 65, 85, 0.7);
  border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.85);
}

/* Leaflet Dark Theme Overrides */
.leaflet-container {
  background-color: #020617 !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}

.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.95) !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.95) !important;
}

/* Posicionamento do controle de zoom no canto superior esquerdo abaixo do botão de enquadrar área */
.leaflet-top.leaflet-left {
  top: 68px !important;
  left: 16px !important;
  z-index: 1000 !important;
  pointer-events: auto !important;
}

.leaflet-control-zoom {
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 10px !important;
  overflow: hidden;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5) !important;
  margin: 0 !important;
  display: block !important;
}

.leaflet-control-zoom a {
  background-color: rgba(15, 23, 42, 0.85) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  color: #e2e8f0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 30px !important;
  font-size: 16px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
}

.leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
  background-color: #10B981 !important;
  color: #FFFFFF !important;
}

/* Tooltip / Label de vértices da Régua de Medição - Verde Esmeralda ASE */
.measure-vertex-label {
  background: rgba(15, 23, 42, 0.95) !important;
  border: 1px solid #10B981 !important;
  color: #f8fafc !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 2px 7px !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6) !important;
  white-space: nowrap !important;
}
.measure-vertex-label::before {
  border-top-color: #10B981 !important;
}
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 2px 7px !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6) !important;
  white-space: nowrap !important;
}
.measure-vertex-label::before {
  border-top-color: rgba(0, 160, 255, 0.9) !important;
}

/* Simbologia da Camada de Raio de Análise: Contorno sólido vermelho e preenchimento com hachura vermelha */
.leaflet-buffer-hatch path,
path.leaflet-buffer-hatch {
  stroke: #ef4444 !important;
  stroke-width: 2.5px !important;
  stroke-opacity: 1 !important;
  stroke-dasharray: none !important;
  fill: url(#red-hatch) !important;
  fill-opacity: 1 !important;
}

/* Swatch com hachura vermelha para legenda e botões */
.hatch-swatch-red {
  background: repeating-linear-gradient(45deg, rgba(239, 68, 68, 0.25), rgba(239, 68, 68, 0.25) 2px, #ef4444 2px, #ef4444 3.5px) !important;
  border: 1.5px solid #ef4444 !important;
}

/* Custom Map Photo Markers */
.photo-marker-pin {
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  background: #f59e0b;
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  font-weight: 800;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
  transition: transform 0.15s ease;
}

.photo-marker-pin:hover {
  transform: scale(1.18);
}

/* Efeitos visuais desativados (sem halo/glow) */
.fx-glow-ciano,
.fx-glow-esmeralda,
.fx-glow-roxo,
.fx-glow-duplo,
.fx-rim-light {
  filter: none !important;
}
.container-glass {
  background: rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  border-radius: 14px !important;
  padding: 6px 12px !important;
}
.container-badge-branco {
  background: #ffffff !important;
  border-radius: 12px !important;
  padding: 6px 12px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35) !important;
}
.container-spotlight {
  background: radial-gradient(circle, rgba(0, 148, 232, 0.3) 0%, rgba(35, 64, 102, 0.5) 65%, transparent 100%) !important;
  border: 1px solid rgba(0, 148, 232, 0.3) !important;
  border-radius: 14px !important;
  padding: 6px 12px !important;
}

/* Print Styles for Technical Report */
@media print {
  body * {
    visibility: hidden;
  }
  #modal-report,
  #printable-report-area,
  #printable-report-area * {
    visibility: visible;
  }
  #modal-report {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: white !important;
    padding: 0 !important;
  }
  #printable-report-area {
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 16px !important;
  }
  .no-print {
    display: none !important;
  }
}

/* Number input for buffer radius: breathing room between numbers and spin buttons */
[data-buffer-input] {
  padding-right: 6px !important;
}
[data-buffer-input]::-webkit-inner-spin-button,
[data-buffer-input]::-webkit-outer-spin-button {
  margin-left: 8px !important;
  cursor: pointer;
  opacity: 0.85;
}
[data-buffer-input]::-webkit-inner-spin-button:hover,
[data-buffer-input]::-webkit-outer-spin-button:hover {
  opacity: 1;
}

/* Camada Cartográfica: Terras Indígenas (FUNAI) em Roxo no Mapa */
.funai-wms-layer,
.leaflet-tile-pane img.funai-wms-layer,
img.funai-wms-layer {
  filter: hue-rotate(155deg) saturate(1.4) brightness(0.95) !important;
}

/* ==================== SAAS NAVBAR MENU & LINKS (LANDING PAGE) ==================== */
/* 1. Links de Navegação */
.nav-saas-item {
  font-size: 14.5px !important;
  font-weight: 500 !important;
  letter-spacing: -0.01em !important;
  color: rgba(255, 255, 255, 0.7) !important;
  padding: 0 14px !important;
  height: 38px !important;
  min-height: 38px !important;
  border-radius: 8px !important;
  position: relative !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}

.nav-saas-item:hover {
  color: #FFFFFF !important;
  background: rgba(255, 255, 255, 0.06) !important;
  transform: translateY(-1px) !important;
}

.nav-saas-item.active {
  color: #FFFFFF !important;
  font-weight: 600 !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12) !important;
}

/* 2. Destaque para Área do Cliente (Pill Discreto) */
.nav-client-pill {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  padding: 0 14px !important;
  height: 38px !important;
  min-height: 38px !important;
  border-radius: 20px !important;
  color: #F8FAFC !important;
  font-weight: 500 !important;
  font-size: 13.5px !important;
  letter-spacing: -0.01em !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}

.nav-client-pill:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  color: #FFFFFF !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.25) !important;
}

.nav-client-pill.active {
  background: rgba(14, 165, 233, 0.2) !important;
  border-color: rgba(14, 165, 233, 0.6) !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.35) !important;
}

/* ==================== SAAS HIGH-TECH MODERN BUTTON SYSTEM (PÁGINAS) ==================== */
/* 1. Botão Primary */
.btn-panorama-page,
.btn-saas-primary {
  background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 16px -2px rgba(14, 165, 233, 0.35) !important;
  border-radius: 9px !important; /* 8px a 10px: solidez corporativa */
  font-weight: 600 !important; /* semibold */
  letter-spacing: -0.01em !important;
  color: #FFFFFF !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, border-color 0.2s ease !important;
  cursor: pointer !important;
  text-decoration: none !important;
}

.btn-panorama-page:hover,
.btn-saas-primary:hover {
  transform: translateY(-1px) !important;
  filter: brightness(1.08) !important;
  box-shadow: 0 6px 20px -2px rgba(14, 165, 233, 0.45) !important;
}

.btn-panorama-page:active,
.btn-saas-primary:active {
  transform: translateY(0) scale(0.985) !important;
  filter: brightness(0.98) !important;
}

/* 2. Botão Secondary / Transparente */
.btn-panorama-page-secondary,
.btn-saas-secondary {
  background: rgba(255, 255, 255, 0.05) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 9px !important; /* 8px a 10px */
  font-weight: 500 !important; /* medium */
  letter-spacing: -0.01em !important;
  color: #F8FAFC !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease !important;
  cursor: pointer !important;
  text-decoration: none !important;
}

.btn-panorama-page-secondary:hover,
.btn-saas-secondary:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  color: #FFFFFF !important;
  transform: translateY(-1px) !important;
}

.btn-panorama-page-secondary:active,
.btn-saas-secondary:active {
  transform: translateY(0) scale(0.985) !important;
}

/* ==================== ASE WEBGIS DESIGN SYSTEM (ESMERALDA CORPORATIVO) ==================== */

/* 1. Cores da Interface: Painéis Laterais, Modais e Barras Flutuantes */
.bg-ase-panel {
  background-color: #0F172A !important;
}

.bg-ase-card {
  background-color: #1E293B !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.bg-ase-floating {
  background-color: rgba(15, 23, 42, 0.85) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* 2. Botões de Ação Principal (CTAs de destaque: "Aprovar Estudo", "Analisar Todas") */
.btn-ase-primary {
  background-color: #10B981 !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25) !important;
  border-radius: 0.5rem !important; /* rounded-lg */
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.375rem !important;
  text-decoration: none !important;
}

.btn-ase-primary:hover {
  background-color: #059669 !important;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35) !important;
  transform: translateY(-1px) !important;
}

.btn-ase-primary:active {
  transform: translateY(0) scale(0.985) !important;
}

/* 3. Botões Secundários e de Ferramentas */
.btn-ase-secondary,
.btn-ase-tool {
  background-color: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #F1F5F9 !important;
  border-radius: 0.5rem !important; /* rounded-lg */
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
}

.btn-ase-secondary:hover,
.btn-ase-tool:hover {
  background-color: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #FFFFFF !important;
}

.btn-ase-secondary:active,
.btn-ase-tool:active {
  transform: scale(0.98) !important;
}

/* 4. Estado Selecionado/Ativo (Ferramentas de Medição/Desenho no mapa) */
.tool-active,
.btn-ase-tool.tool-active,
.btn-ase-tool-active {
  background-color: #10B981 !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

.tool-active i,
.tool-active svg,
.btn-ase-tool.tool-active i,
.btn-ase-tool.tool-active svg,
.btn-ase-tool-active i,
.btn-ase-tool-active svg {
  color: #FFFFFF !important;
  stroke: #FFFFFF !important;
}

/* 5. Seletor de Mapa Base (Fundo): Satélite HD & Topográfico */
.basemap-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #94A3B8 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 6px 8px !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
}

.basemap-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #F1F5F9 !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.basemap-btn.active {
  background: #10B981 !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  border: 1px solid #10B981 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
}
