/* ==========================================================================
   RASPA — Relação Água, Solo, Planta & Atmosfera
   styles.css — Estilos Oficiais Padrão Meso 7 (Suporte Completo Claro & Escuro)
   ========================================================================== */

:root {
  --primary-rgb: 16, 185, 129;
  --bg-dark: #090d16;
  --card-dark: rgba(15, 23, 42, 0.85);
  --border-dark: rgba(51, 65, 85, 0.6);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

html.dark body {
  background-color: #090d16;
  color: #f8fafc;
}

/* ==========================================================================
   TEMA CLARO COMPLETO (html:not(.dark))
   Sobrescreve as classes utilitárias escuras para visual solar limpo de alta nitidez
   ========================================================================== */
html:not(.dark) body {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

html:not(.dark) header,
html:not(.dark) aside,
html:not(.dark) #resultsDrawer,
html:not(.dark) .basemap-floating-widget {
  background-color: rgba(255, 255, 255, 0.96) !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html:not(.dark) .bg-slate-950,
html:not(.dark) .bg-slate-950\/90,
html:not(.dark) .bg-slate-950\/80,
html:not(.dark) .bg-slate-950\/60,
html:not(.dark) .bg-slate-950\/40 {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

html:not(.dark) .bg-slate-900,
html:not(.dark) .bg-slate-900\/95,
html:not(.dark) .bg-slate-900\/90,
html:not(.dark) .bg-slate-900\/80 {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
}

html:not(.dark) .bg-slate-800 {
  background-color: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

html:not(.dark) .border-slate-800,
html:not(.dark) .border-slate-800\/80,
html:not(.dark) .border-slate-700 {
  border-color: #cbd5e1 !important;
}

html:not(.dark) .text-white:not(.bg-emerald-600):not(.bg-amber-600):not([class*="from-emerald"]) {
  color: #0f172a !important;
}

html:not(.dark) .text-slate-100,
html:not(.dark) .text-slate-200,
html:not(.dark) .text-slate-300 {
  color: #1e293b !important;
}

html:not(.dark) .text-slate-400,
html:not(.dark) .text-slate-500 {
  color: #475569 !important;
}

html:not(.dark) .text-emerald-400 {
  color: #047857 !important;
}

html:not(.dark) .text-amber-400,
html:not(.dark) .text-amber-300 {
  color: #b45309 !important;
}

html:not(.dark) .text-sky-400 {
  color: #0369a1 !important;
}

html:not(.dark) .text-rose-400,
html:not(.dark) .text-rose-300 {
  color: #be123c !important;
}

html:not(.dark) .text-teal-400 {
  color: #0f766e !important;
}

html:not(.dark) .bg-emerald-950,
html:not(.dark) .bg-emerald-950\/80 {
  background-color: #d1fae5 !important;
  border-color: #6ee7b7 !important;
  color: #065f46 !important;
}

html:not(.dark) .bg-amber-950\/60 {
  background-color: #fef3c7 !important;
  border-color: #fcd34d !important;
  color: #92400e !important;
}

html:not(.dark) .bg-rose-950\/60,
html:not(.dark) .bg-rose-950\/80 {
  background-color: #ffe4e6 !important;
  border-color: #fda4af !important;
  color: #9f1239 !important;
}

html:not(.dark) .kpi-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04) !important;
}

html:not(.dark) .search-results-dropdown {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15) !important;
}

html:not(.dark) .search-item {
  color: #1e293b !important;
  border-bottom-color: #e2e8f0 !important;
}

html:not(.dark) .search-item:hover {
  background: #f1f5f9 !important;
  color: #059669 !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.15);
}
::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Leaflet Map Wrapper & Full Height Guarantee */
#mapWrapper {
  position: relative;
  flex: 1 1 0%;
  width: 100%;
  min-height: 260px;
  background-color: #0b1320;
}

#map {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* Cursor Crosshair Durante o Modo Desenho */
.drawing-active,
.drawing-active #map,
.drawing-active .leaflet-container,
.drawing-active .leaflet-interactive {
  cursor: crosshair !important;
}

/* Alças de Vértices Arrastáveis do Polígono */
.custom-vertex-handle {
  background: transparent;
  border: none;
}

.vertex-dot {
  width: 14px;
  height: 14px;
  background-color: #ffffff;
  border: 3px solid #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.85);
  cursor: grab;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.vertex-dot:hover {
  transform: scale(1.3);
  background-color: #10b981;
  border-color: #ffffff;
}

/* Rótulo Permanente do Nome do Talhão sobre o Polígono no Mapa */
.leaflet-tooltip.talhao-map-label {
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid #10b981;
  color: #ffffff;
  font-weight: 800;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* KPI Card Styles */
.kpi-card {
  border-radius: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(51, 65, 85, 0.45);
  background: rgba(15, 23, 42, 0.78);
  transition: all 0.2s ease;
}
.kpi-card:hover {
  border-color: rgba(16, 185, 129, 0.55);
  transform: translateY(-1px);
}

/* Autocomplete Dropdown */
.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 99999;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
}
.search-item {
  padding: 9px 12px;
  font-size: 0.80rem;
  color: #e2e8f0;
  cursor: pointer;
  border-bottom: 1px solid rgba(51, 65, 85, 0.35);
  transition: background 0.15s ease;
}
.search-item:hover {
  background: #1e293b;
  color: #10b981;
}

/* Dropzone Hover */
.drop-zone.dragover,
#dropZone.dragover {
  border-color: #10b981 !important;
  background-color: rgba(16, 185, 129, 0.12) !important;
}

/* Toast Notification */
#raspaToast {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Animation Pulse Dot */
@keyframes pulseGlow {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.pulse-badge {
  animation: pulseGlow 2s infinite;
}
