/* ============================================================================
   Map Interface & GIS Layout Styling (MapLibre GL JS integration)
   ============================================================================ */

.map-view-layout {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
}

/* Map Container */
.map-canvas-container {
  flex: 1;
  height: 100%;
  position: relative;
  background-color: #e2e8f0;
}

#map {
  width: 100%;
  height: 100%;
}

/* Floating Map Overlay Controls */
.map-floating-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  gap: 10px;
  max-width: 540px;
}

.village-search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.village-search-input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background-color: #ffffff;
  box-shadow: var(--shadow-md);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.village-search-input:focus {
  border-color: var(--primary-600);
}

.search-icon-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}

.search-results-dropdown {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  background-color: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
  max-height: 260px;
  overflow-y: auto;
  display: none;
  z-index: 50;
}

.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-result-item:hover {
  background-color: var(--primary-50);
}

.search-result-item .name {
  font-weight: 600;
  font-size: 13px;
}

.search-result-item .subtext {
  font-size: 11px;
  color: var(--text-muted);
}

/* Floating Layer & Filter Toggle Pills */
.map-filter-pills {
  position: absolute;
  top: 68px;
  left: 14px;
  z-index: 20;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  max-width: calc(100% - 28px);
}

.filter-pill {
  background-color: #ffffff;
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  background-color: #f1f5f9;
}

.filter-pill.active {
  background-color: var(--primary-700);
  color: #ffffff;
  border-color: var(--primary-700);
}

/* GPS Button Floating */
.map-gps-btn {
  position: absolute;
  bottom: 80px;
  right: 14px;
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--primary-700);
  font-size: 18px;
}

.map-gps-btn:hover {
  background-color: var(--primary-50);
}

/* Map Legend */
.map-legend-card {
  position: absolute;
  bottom: 20px;
  left: 14px;
  z-index: 20;
  background-color: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  box-shadow: var(--shadow-md);
  font-size: 11px;
}

.map-legend-title {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-weight: 500;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* Side Desktop Intelligence Panel */
.desktop-side-panel {
  display: none;
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  z-index: 30;
  box-shadow: var(--shadow-lg);
  flex-direction: column;
}

@media (min-width: 992px) {
  .desktop-side-panel {
    display: flex;
  }
}

/* Mobile Bottom Sheet Drawer */
.mobile-bottom-sheet {
  position: absolute;
  bottom: var(--bottom-nav-height);
  left: 0;
  right: 0;
  background-color: var(--bg-surface);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border-top: 1px solid var(--border-subtle);
  z-index: 500;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  transform: translateY(105%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@media (min-width: 992px) {
  .mobile-bottom-sheet {
    display: none !important;
  }
}

.sheet-handle-bar {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 8px 0;
  cursor: grab;
}

.sheet-handle-pill {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background-color: var(--border-strong);
}

.sheet-content-scroll {
  overflow-y: auto;
  padding: 0 16px 20px 16px;
  flex: 1;
}

/* Facility Pin styling for MapLibre HTML Markers */
.facility-map-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  border: 2px solid #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.facility-map-marker:hover {
  transform: scale(1.25);
  z-index: 1000;
}
