/* ==========================================================================
   GeoSAF - Estilos Customizados & UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Poppins:wght@500;600;700;800&display=swap');

:root {
  --primary-emerald: #1B5E20;
  --primary-light: #2E7D32;
  --primary-accent: #4CAF50;
  --primary-soft: #E8F5E9;
  --brand-navy: #0B3B6E;
  --sidebar-width: 240px;
  --header-height: 56px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1E293B;
  background-color: #F8FAFC;
  overflow: hidden;
}

h1, h2, h3, h4, .brand-font {
  font-family: 'Poppins', 'Inter', sans-serif;
}

/* Scrollbar customizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #F1F5F9;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* Sidebar Styles */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-radius: 0.5rem;
  color: #475569;
  font-weight: 500;
  font-size: 0.885rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.sidebar-link:hover {
  background-color: #F1F5F9;
  color: #0F172A;
}

.sidebar-link.active {
  background-color: #E8F5E9;
  color: #1B5E20;
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 4px;
  background-color: #2E7D32;
  border-radius: 0 4px 4px 0;
}

/* Badge Beta */
.badge-beta {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 9999px;
  background-color: #FEF3C7;
  color: #B45309;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Map Dock Action Bar */
.map-dock {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 990;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.dock-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.15rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1E293B;
  transition: all 0.2s ease;
  border-right: 1px solid #E2E8F0;
}
.dock-btn:last-child {
  border-right: none;
}
.dock-btn:hover {
  background-color: #F8FAFC;
  color: #1B5E20;
}

/* Leaflet Map Full View */
#agroMap {
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: #E2E8F0;
  z-index: 10;
}

/* Leaflet Tooltip & Popups */
.custom-leaflet-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid #E2E8F0;
}

.custom-leaflet-popup .leaflet-popup-content {
  margin: 0;
  line-height: 1.4;
}

.leaflet-tooltip-agro {
  background-color: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.leaflet-tooltip-agro::before {
  border-top-color: rgba(15, 23, 42, 0.85);
}

/* Location Polygon Labels on Map */
.polygon-center-label {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #0F172A;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  text-align: center;
}

/* Kanban Board Columns */
.kanban-col {
  background-color: #F1F5F9;
  border-radius: 0.75rem;
  min-height: 500px;
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}

.kanban-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: grab;
}
.kanban-card:active {
  cursor: grabbing;
}
.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

/* Glassmorphism modal */
.modal-backdrop {
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.animate-fade-in {
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Print Styles for Caderno de Campo */
@media print {
  body * {
    visibility: hidden;
  }
  #printableCadernoCampo, #printableCadernoCampo * {
    visibility: visible;
  }
  #printableCadernoCampo {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 20px;
    background: white;
    color: black;
  }
  .no-print {
    display: none !important;
  }
}

/* Photo Navigation Spaces (Sidebar Visual Gateway) */
.photo-nav-slot {
  position: relative;
  overflow: hidden;
  border-radius: 0.85rem;
  border: 1px solid #E2E8F0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.25s ease;
}

.photo-nav-slot:hover {
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.12);
  border-color: #CBD5E1;
}

.photo-nav-slot img.slot-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.photo-nav-slot:hover img.slot-bg {
  transform: scale(1.05);
}

.slot-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.2) 0%, rgba(15, 23, 42, 0.75) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.65rem;
  transition: background 0.2s ease;
}

.photo-nav-slot:hover .slot-overlay {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.15) 0%, rgba(15, 23, 42, 0.85) 100%);
}

.slot-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: rgba(255, 255, 255, 0.92);
  color: #0F172A;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
}

.slot-action-btn:hover {
  background-color: #FFFFFF;
  color: #1B5E20;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.slot-action-btn.active {
  background-color: #1B5E20;
  color: #FFFFFF;
}

.slot-action-btn.active i {
  color: #86EFAC !important;
}

/* Top Agroecology Header Bar */
.top-agro-bar {
  background-color: #2D4A22;
  background-image: linear-gradient(135deg, #2D4A22 0%, #1E3717 100%);
  color: #FFFFFF;
}

.top-cultivar-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: #E2E8F0;
  padding: 0.35rem 0.65rem;
  border-radius: 0.4rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.top-cultivar-link:hover {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.12);
  border-bottom-color: #86EFAC;
}

/* ==========================================================================
   MOBILE NATIVE PWA & iOS / ANDROID STYLES
   ========================================================================== */
@supports (padding: max(0px)) {
  body {
    padding-left: min(0vmin, env(safe-area-inset-left));
    padding-right: min(0vmin, env(safe-area-inset-right));
  }
}

/* Barra de Navegação Inferior Nativa para Celular (iOS & Android) */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 950;
  background: rgba(15, 38, 18, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(74, 222, 128, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-top: 6px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #94A3B8;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
  flex: 1;
  max-width: 75px;
}

.mobile-nav-item:active {
  transform: scale(0.92);
}

.mobile-nav-item.active {
  color: #4ADE80;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.15);
}

.mobile-nav-item.active i {
  color: #4ADE80 !important;
  transform: translateY(-1px);
}

/* Botão Flutuante de Câmera Rápida de Campo no Celular */
.mobile-fab-camera {
  position: relative;
  top: -12px;
  background: linear-gradient(135deg, #16A34A 0%, #15803D 100%);
  color: white;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.45), 0 2px 4px rgba(0,0,0,0.2);
  border: 3px solid #0F2612;
  transition: all 0.2s ease;
}

.mobile-fab-camera:active {
  transform: scale(0.92);
}

/* Indicador de Status Offline */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: #DC2626;
  color: white;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Otimização de toque em botões para dispositivos móveis */
button, a, input, select, textarea {
  touch-action: manipulation;
}

@media (max-width: 768px) {
  #mapSection, #moduleContainer {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }
  
  .map-dock {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  }
}


