/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800&display=swap');

body {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Custom Marker Styles */
.leaflet-div-icon {
  background: transparent !important;
  border: none !important;
}

.custom-marker-wrapper {
  background: transparent !important;
  border: none !important;
}

.custom-marker {
  display: flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 11px;
  color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 2px solid white;
  user-select: none;
}

.custom-marker:hover, .custom-marker:active {
  transform: scale(1.25) translateY(-3px);
  z-index: 1000 !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Trạng thái 1: Đã chuẩn hóa / Đã thu thập (Xanh lá) */
.marker-collected {
  background: linear-gradient(135deg, #10b981, #059669);
}

/* Trạng thái 2: Chưa thu thập (Đỏ) */
.marker-pending {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* Trạng thái 3: Có tranh chấp / Cần xác minh (Vàng hổ phách) */
.marker-dispute {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1e293b !important;
  border-color: #fef08a !important;
  font-weight: 800;
}

.marker-highlight {
  transform: scale(1.3) translateY(-4px) !important;
  z-index: 1000 !important;
  border: 3px solid #38bdf8 !important;
  box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.6) !important;
}

/* Route Markers (Start & Destination) */
.route-start-pin {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 3px solid white;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  animation: pulse-start 1.8s infinite;
}

.route-dest-pin {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: white;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 3px solid white;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  animation: pulse-dest 1.8s infinite;
}

@keyframes pulse-start {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

@keyframes pulse-dest {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Measure Tool Markers & Tooltips */
.measure-vertex {
  width: 12px;
  height: 12px;
  background: #facc15;
  border: 2px solid #0f172a;
  border-radius: 50%;
  cursor: pointer;
}

.measure-tooltip {
  background: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  border: 1px solid #facc15;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.measure-tooltip::before {
  border-top-color: rgba(15, 23, 42, 0.95) !important;
}

.measure-segment-badge {
  background: rgba(15, 23, 42, 0.9);
  color: #fef08a;
  border: 1px solid rgba(250, 204, 21, 0.8);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  pointer-events: none;
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: 1rem !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.15) !important;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.5 !important;
}

.leaflet-popup-tip {
  background: white !important;
}

/* Custom Scrollbar */
::-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;
}

/* Tool buttons on map */
.map-floating-btn {
  background: white;
  color: #334155;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid #e2e8f0;
}

.map-floating-btn:hover {
  background: #f8fafc;
  color: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.2);
}

.map-floating-btn.active {
  background: #2563eb;
  color: white;
  border-color: #1d4ed8;
}

/* Pulse animation for GPS current position */
.gps-pulse {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0284c7;
  border: 3px solid white;
  box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7);
  animation: pulse-gps 1.6s infinite;
}

@keyframes pulse-gps {
  0% {
    box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.8);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(2, 132, 199, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(2, 132, 199, 0);
  }
}

/* In ấn Báo cáo (Print view) */
@media print {
  header, #map-wrapper, #side-panel, .map-floating-btn, #toast-container, .no-print, #mobile-bottom-nav, #mobile-parcel-sheet {
    display: none !important;
  }
  #report-print-container {
    display: block !important;
    position: static !important;
    width: 100% !important;
    background: white !important;
    color: black !important;
    padding: 20px !important;
  }
}

/* ================================================================= */
/* --- MOBILE FIRST REDESIGN: TỐI GIẢN - HIỆN ĐẠI - TRỰC QUAN --- */
/* ================================================================= */

:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* Tối ưu cảm ứng mobile */
* {
  -webkit-tap-highlight-color: transparent;
}

/* TRIỆT TIÊU TOÀN DIỆN NETLIFY FREE BADGE (TRÁNH CHE NÚT ĐỒNG BỘ & TIẾN ĐỘ) */
[data-netlify-badge],
.netlify-badge,
a[href*="netlify.com"],
iframe[src*="netlify"],
.netlify-banner,
div[style*="netlify"] {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  position: absolute !important;
  bottom: -9999px !important;
  left: -9999px !important;
}

/* Mobile Bottom Navigation Bar (Tỉ lệ vàng: 58px + safe area) */
#mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(58px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  box-shadow: 0 -8px 24px -2px rgba(0, 0, 0, 0.4);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
  position: relative;
}

.mobile-nav-item i {
  font-size: 17px;
  margin-bottom: 2px;
  transition: transform 0.2s;
}

.mobile-nav-item.active {
  color: #38bdf8;
}

.mobile-nav-item.active i {
  transform: translateY(-2px) scale(1.1);
  color: #38bdf8;
}

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

/* Central GPS Button on Mobile Bar */
.mobile-nav-gps-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: white !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.5);
  border: 3px solid rgba(15, 23, 42, 0.95);
  margin-top: -14px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-nav-gps-btn i {
  font-size: 18px !important;
  margin-bottom: 0 !important;
}

.mobile-nav-gps-btn:active {
  transform: scale(0.9) !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.7);
}

/* Mobile Bottom Sheet (Thẻ trượt thông tin lô đất từ đáy màn hình) */
#mobile-parcel-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 48;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 36px -4px rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  padding: 12px 16px calc(68px + var(--safe-bottom)) 16px;
  transform: translateY(110%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 80vh;
  overflow-y: auto;
}

#mobile-parcel-sheet.open {
  transform: translateY(0);
}

.sheet-handle-bar {
  width: 36px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 9999px;
  margin: 0 auto 10px auto;
  cursor: grab;
}

/* Mobile Touch Parcel Cards (Hardware GPU Accelerated) */
.mobile-parcel-card {
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, background 0.15s ease;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 0 110px;
  contain: layout style paint;
  transform: translateZ(0);
}

#mobile-card-list, #table-container {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  transform: translateZ(0);
}

.mobile-parcel-card:active {
  transform: scale(0.98);
  background: #f8fafc;
}

.mobile-parcel-card.active-card {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* Status badges */
.badge-status-collected {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-status-pending {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge-status-dispute {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Horizontal pill scroll filters for mobile */
.pill-filter-container {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.pill-filter-container::-webkit-scrollbar {
  display: none;
}

.pill-filter-btn {
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  transition: all 0.15s;
}

.pill-filter-btn.active {
  background: #2563eb;
  color: white;
  border-color: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  /* Map controls floating position */
  .map-floating-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 13px;
  }

  /* Side panel as full screen on mobile */
  #side-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(58px + var(--safe-bottom));
    width: 100% !important;
    height: auto !important;
    z-index: 45;
  }
}

/* ================================================================= */
/* --- CAMSCANNER & APPLE NOTES SCANNER UI STYLES --- */
/* ================================================================= */

.scanner-corner-handle {
  transition: transform 0.05s ease-out;
  cursor: grab;
  touch-action: none;
}

.scanner-corner-handle:hover circle:first-child,
.scanner-corner-handle:active circle:first-child {
  fill: rgba(59, 130, 246, 0.45);
  r: 26;
}

.scanner-corner-handle:active circle:last-child {
  fill: #1d4ed8;
  stroke: #ffffff;
  stroke-width: 4;
}

#scanner-canvas-wrapper {
  user-select: none;
  -webkit-user-select: none;
}

#scanner-loupe {
  transition: opacity 0.15s ease-out;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

.scanner-filter-btn {
  user-select: none;
  -webkit-user-select: none;
}

.scanner-filter-btn.active {
  background: rgba(37, 99, 235, 0.35) !important;
  border-color: #3b82f6 !important;
  color: #93c5fd !important;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

/* Mobile Safe Area & Modal sticky bottom styling */
:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 640px) {
  #modal-edit > div,
  #modal-pdf-scanner > div,
  #modal-report > div,
  #modal-import-excel > div,
  #modal-cloud-sync > div {
    max-height: calc(100dvh - 20px) !important;
  }
}



