/* Base */
body,
html {
  height: 100%;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* Utility spacing (small subset) */
.mt-1 {
  margin-top: 6px;
}
.mt-2 {
  margin-top: 10px;
}
.mt-3 {
  margin-top: 14px;
}
.mb-1 {
  margin-bottom: 6px;
}
.mb-2 {
  margin-bottom: 10px;
}
.p-2 {
  padding: 8px;
}

/* Sidebar & map layout */
#mapContainer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  transition: margin-left 0.3s ease-in-out;
}
.sidebar.active ~ #mapContainer {
  margin-left: 250px;
}

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

/* Accordion / collapses */
.accordion-toggle {
  /* background: #2a2a40; */
  background-color: #75a99b;
  color: white;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin: 6px 0;
  display: block;
  line-height: 1.2;
}

.accordion-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.accordion-toggle.active {
  /* background: #3a3a55; */
  color: #fff;
}
.collapse-panel {
  display: none;
  padding: 8px 10px;
}
.collapse-panel.active {
  display: block;
  background: transparent;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
  border: 1px solid transparent; /* Base border for alignment */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn.sm {
  padding: 4px 8px;
  font-size: 13px;
}
.btn.primary {
  background-color: #007bff;
  color: #fff;
}
.btn.secondary {
  background-color: #6c757d;
  color: #fff;
}
.btn.success {
  background-color: #28a745;
  color: #fff;
}
.btn.warning {
  background-color: #ffc107;
  color: #000;
}
.btn.danger {
  background-color: #dc3545;
  color: #fff;
}
.btn.light {
  background: #fff;
  color: #000;
}
.btn.dark {
  background: #4db397;
  color: #fff;
}

/* Outline commen button */
.common-outline-btn-primary {
  background-color: transparent;
  border: 1px solid #007bff;
  color: #007bff;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  padding: 3px 7px 3px 7px;
  border-radius: 5px;
}
.common-outline-btn-primary:hover {
  background-color: #007bff;
  color: #fff;
}

.common-outline-btn-warning {
  background-color: transparent;
  border: 1px solid #ffc107;
  color: #e7ad00;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  padding: 3px 7px 3px 7px;
  border-radius: 5px;
}
.common-outline-btn-warning:hover {
  background-color: #ffc107;
  color: #ffff;
}

.common-outline-btn-danger {
  background-color: transparent;
  border: 1px solid #dc3545;
  color: #dc3545;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  padding: 3px 7px 3px 7px;
  border-radius: 5px;
}
.common-outline-btn-danger:hover {
  background-color: #dc3545;
  color: #fff;
}

/* Outline Buttons */
.btn.outline-success {
  background-color: transparent;
  border: 1px solid #28a745;
  color: #28a745;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}
.btn.outline-success:hover {
  background-color: #28a745;
  color: #fff;
}

.btn-success {
  background-color: transparent;
  border: 1px solid #28a745;
  color: #0eba36;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  padding: 3px 7px 3px 7px;
  border-radius: 5px;
}
.btn-success:hover {
  background-color: #28a745;
  color: #fff;
}
.btn-secondary {
  background-color: transparent;
  border: 1px solid #2a332c;
  color: #2a332c;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  padding: 3px 7px 3px 7px;
  border-radius: 5px;
}
.btn-secondary:hover {
  background-color: #2a332c;
  color: #fff;
}

/* Inputs */
.form-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #cfcfcf;
  box-sizing: border-box;
}

/* Search container for icon */
.search-container {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  pointer-events: none; /* So you can click through it */
}

/* Add padding to the input to make space for the icon */
#searchInput {
  padding-left: 35px !important;
}

/* Search results list item */
#searchResults {
  list-style: none;
  padding: 0;
  margin: 6px 0 0 0;
  z-index: 2000;
}
#searchResults .list-item {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  background: #fff;
  color: #111;
}
#searchResults .list-item:hover {
  background: #f0f0f0;
}
#searchResults mark {
  background: #ffeb3b;
}

/* Tooltip base */
.toggle-btn {
  position: relative;
}

/* Tooltip text (hidden by default) */
.toggle-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -35px; /* distance below button */
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2000;
}

/* Show on hover */
.toggle-btn:hover::after {
  opacity: 1;
}

/* Toggle button base style */
.toggle-btn {
  position: absolute;
  top: 5px;
  width: 35px;
  height: 35px;
  padding: 0;
  z-index: 900;
  border-radius: 8px;
  transition: all 0.25s ease;
  transform: scale(1);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Positioning for each toggle button */
#toggleBtn {
  left: 5px;
}
#toggleBtn1 {
  left: 45px;
}
#toggleBtn2 {
  left: 85px;
}

.toggle-btn.dark {
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Highlight on hover */
.toggle-btn:hover {
  background: linear-gradient(135deg, #5d8875, #36aca1);
  transform: scale(1.15); /* grow 15% */
  box-shadow: 0 6px 16px rgba(0, 123, 255, 0.6); /* blue glow */
}

/* Style for SVG icons inside buttons */
.toggle-btn > svg {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  stroke: currentColor; /* Use the button's text color for the stroke */
  stroke-width: 2;
  fill: none; /* Ensure SVGs are not filled by default */
}

#toolsBox1,
#toolsBox2,
#toolsBox3 {
  display: none;
  position: absolute;
  top: 80px;
  left: 15px;
  width: 270px;
  background: #1e1e2f;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  padding: 12px;
  z-index: 1200;
  max-height: 75vh;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

/* Show when active */
#toolsBox1.active,
#toolsBox2.active,
#toolsBox3.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.tools-menu1 {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tools-menu2 {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tools-menu3 {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Mapbox control look (small) */
.mapboxgl-ctrl-locate {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.mapboxgl-ctrl-locate:hover {
  background: #f0f0f0;
}

/* Reset Button */
.reset-btn {
  position: absolute;
  top: 10px;
  right: 45px;
  background: #4db397;
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 3;
  transition: all 0.25s ease;
}

/* Tooltip for reset button */
.reset-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2000;
}
.reset-btn:hover {
  background: linear-gradient(135deg, #5d8875, #36aca1);
  transform: scale(1.15);
  box-shadow: 0 6px 16px rgba(0, 123, 255, 0.6);
}
.reset-btn:hover::after {
  opacity: 1;
}

/* Coordinates */
#coords {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: #fff;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 5;
  color: #000;
}

/* Basemap gallery */
#basemapGallery {
  position: absolute;
  bottom: 60px;
  right: 10px;
  z-index: 5;
}
#basemapBtn {
  background: #4db397;
  color: #fff;
  border-radius: 6px;
  font-size: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100px;
}
.basemap-list {
  display: none;
  position: absolute;
  bottom: 50px;
  left: 20%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  width: 140px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  max-height: 250px;
  overflow-y: auto;
  -webkit-scrollbar: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.basemap-option {
  margin-bottom: 8px;
  text-align: center !important;
  cursor: pointer;
}
.basemap-option img {
  width: 100px;
  height: 60px;
  border-radius: 6px;
  border: 2px solid #ddd;
  margin-left: auto;
  margin-right: auto;
  transition: border 0.15s ease;
}
.basemap-option img:hover {
  border-color: #0078d7;
}
.basemap-option span {
  font-size: 12px;
  display: block;
  margin-top: 6px;
  color: #000 !important;
  text-align: center !important;
}

/* Popup styling */
.mapboxgl-popup {
  max-width: 360px !important;
}
.mapboxgl-popup-content {
  /* padding: 14px; */
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  max-width: 300px;
  line-height: 1.4;
}
.popup-content h5 {
  margin: 0 0 8px 0;
  font-size: 16px;
}
.price-row {
  background: #ecfff9;
  padding: 8px;
  border-left: 4px solid #30a586;
  border-radius: 6px;
  margin-bottom: 8px;
  color: #0e8c65;
}
.price-row span {
  font-weight: 600;
  color: #042744;
}
/* On small screens, take most of width */
@media (max-width: 600px) {
  .mapboxgl-popup-content {
    max-width: 90vw !important;
    font-size: 14px;
    /* padding: 12px; */
  }
}

/* badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
}
.badge-primary {
  background: #007bff;
  color: #fff;
}
.badge-info {
  background: #d1ecf1;
  color: #0c5460;
}

/* popup actions */
.popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 13px;
}

/* form popup */
.popup-form-wrapper {
  display: flex;
  flex-direction: column;
  /* width: 320px; */
  /* Let height be determined by content */
}
.popup-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #ddd;
  background: #f8f9fa;
}
.popup-form-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  max-height: 60vh; /* Set a max-height for scrolling on very long forms */
}
.popup-form-footer {
  padding: 8px 12px;
  border-top: 1px solid #ddd;
  background: #f8f9fa;
  text-align: right;
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* heatmap legend */
.heatmap-legend {
  position: absolute;
  bottom: 80px;
  left: 20px;
  background: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  z-index: 9999;
  font-size: 13px;
}
.heatmap-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.heatmap-legend .legend-color {
  width: 18px;
  height: 18px;
  border-radius: 3px;
}

/* === Position Mapbox Geocoder === */
.mapboxgl-ctrl-geocoder {
  position: absolute !important;
  top: 0px; /* distance from top */
  right: 75px; /* distance from left */
  width: 100px;
  height: 35px;
  font-size: 12px;
  z-index: 9999;
  text-align: left;
}

.mapboxgl-ctrl-bottom-left {
  transition: left 0.3s ease-in-out;
  left: 10px; /* default position */
}

.sidebar.active ~ #mapContainer .mapboxgl-ctrl-bottom-left {
  left: 30px; /* shift when sidebar is open (≈ sidebar width + padding) */
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
  /* Stack toggle buttons vertically */
  #toggleBtn {
    top: 10px;
    left: 10px;
    width: 35px;
    height: 35px;
    font-size: 18px;
  }
  #toggleBtn1 {
    top: 55px; /* move below first button */
    left: 10px;
    width: 35px;
    height: 35px;
    font-size: 18px;
  }
  #toggleBtn2 {
    top: 100px; /* move below second button */
    left: 10px;
    width: 35px;
    height: 35px;
    font-size: 18px;
  }

  /* Tools boxes take almost full width */
  #toolsBox1,
  #toolsBox2,
  #toolsBox3 {
    top: 150px;
    left: 10px;
    right: 10px;
    width: 200px;
    max-width: calc(100% - 20px);
    max-height: 60vh;
  }

  /* Geocoder shrinks */
  .mapboxgl-ctrl-geocoder {
    width: 200px !important;
    height: 40px !important;
    right: 80px !important;
    font-size: 14px !important;
    top: 0px !important; /* below buttons */
  }

  /* Reset button smaller */
  .reset-btn {
    top: 10px;
    right: 50px;
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  /* Coordinates smaller */
  #coords {
    font-size: 10px;
    padding: 4px 6px;
  }

  .basemap-list {
    max-height: 180px; /* shorter scroll area on small screens */
  }
}

/* --- Force consistent colors across light/dark browser modes --- */

/* General body background */
body {
  background: #fff !important;
  color: #000 !important;
}

/* Search results */
#searchResults,
#searchResults .list-item {
  background: #fff !important;
  color: #000 !important;
}

/* Popup box */
.mapboxgl-popup-content {
  background: #fff !important;
  color: #000 !important;
}
/* .mapboxgl-popup-content * {
  color: #000;
} */

/* Inputs (like search bar) */
.form-input,
#searchInput {
  background: #fff !important;
  color: #000 !important;
}

/* Heatmap legend */
.heatmap-legend {
  background: #fff !important;
  color: #000 !important;
}

/* Tools panels */
#toolsBox1,
#toolsBox2,
#toolsBox3 {
  background: #fff !important;
  color: #000 !important;
}

.mapboxgl-ctrl.mapboxgl-ctrl-group button {
  color: #000;
}
/* --- Force all text left aligned --- */

/* Global text */
body,
#searchResults,
#searchResults .list-item,
.mapboxgl-popup-content,
.mapboxgl-popup-content *,
.form-input,
#searchInput,
.heatmap-legend,
#toolsBox1,
#toolsBox2,
#toolsBox3,
.mapboxgl-ctrl-geocoder {
  text-align: left !important;
}

/* --- Force black font for all tool texts --- */
.accordion-toggle,
.accordion-toggle *,
#toolsBox1 label,
#toolsBox2 label,
#toolsBox3 label,
#toolsBox1 .menu-text,
#toolsBox2 .menu-text,
#toolsBox3 .menu-text {
  text-align: left !important;
}

/* Edit Popup Improvements */
.popup-form-wrapper {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.popup-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0078d7;
  color: #fff;
  padding: 8px 12px;
  cursor: move; /* draggable cursor */
}

.popup-form-header h3 {
  margin: 0;
  font-size: 15px;
}

.popup-close-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.popup-close-btn:hover {
  color: #ff4d4f; /* bright red hover */
}
.mapboxgl-popup-close-button {
  background-color: transparent;
  border: 0;
  border-radius: 0 3px 0 0;
  cursor: pointer;
  position: absolute;
  right: 15px !important;
  font-size: 20px !important;
  top: 10px !important;
}

/* Main container for the actions menu */
.popup-content-actions {
  background-color: #ffffff;
  border-radius: 8px;
  color: #333;
  text-align: center;
  width: 150px;
}

.action-menu-title {
  display: block;
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 16px;
  color: #30a586; /* Primary accent color */
}

.action-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 8px; /* Space between buttons */
}

.action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    transform 0.1s ease,
    box-shadow 0.2s ease;
}

.action-button i {
  margin-right: 8px;
  font-size: 1.1em;
}

/* --- Primary Action (Verify Property) --- */
.primary-action {
  background-color: #549080;
  color: #ffffff;
  box-shadow: rgba(79, 70, 229, 0.3) 0px 4px 10px -3px;
}

.primary-action:hover {
  background-color: #abc6bf;
  transform: translateY(-1px);
  box-shadow: rgba(79, 70, 229, 0.4) 0px 6px 12px -4px;
}

.primary-action:active {
  background-color: #549080;
  transform: translateY(0);
  box-shadow: none;
}

/* --- Secondary Action (List Property) --- */
.secondary-action {
  background-color: #f1f5f9; /* Light Gray */
  color: #333;
  border: 1px solid #cbd5e1;
}

.secondary-action:hover {
  background-color: #e2e8f0; /* Slightly darker gray */
  transform: translateY(-1px);
  box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 2px 0px;
}

.secondary-action:active {
  background-color: #cbd5e1; /* Even darker gray */
  transform: translateY(0);
  box-shadow: none;
}

/* Map Keys Box */
.map-keys-box {
  position: absolute;
  bottom: 110px;
  right: 10px;
  background: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  z-index: 4;
  display: flex;
  width: 78px;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  color: #000;
}

#map-key {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}

#map-key p {
  margin: 0;
}

#map-key img {
  width: 18px;
  height: 21px;
}

/*Popup Card Styling */
.popup-card {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: #ffffff;
  border-radius: 12px;
  padding: 20px;
  color: #333;
  max-width: 250px;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.popup-header h4 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
  color: #1a202c;
  text-transform: capitalize;
}

.price {
  font-size: 1.1em;
  font-weight: 800;
  color: #38a169;
  background-color: #f0fff4;
  padding: 4px 4px;
  border-radius: 8px;
}

.address {
  font-size: 1em;
  color: #718096;
  margin-bottom: 12px;
  line-height: 1.4;
}

.details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.95em;
  margin-bottom: 16px;
}

.details p {
  margin: 0;
  background-color: #f7fafc;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid #edf2f7;
  color: #4a5568;
}

.details p strong {
  color: #2d3748;
  font-weight: 600;
}

.desc {
  font-size: 0.9em;
  color: #4a5568;
  line-height: 1.6;
  margin-top: 16px;
  background-color: #f7fafc;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #edf2f7;
}

/* Responsive adjustments for the popup card */
@media (max-width: 768px) {
  .popup-card {
    max-width: 220px;
    padding: 15px;
  }

  .popup-header h4 {
    font-size: 1.1em;
  }

  .price {
    font-size: 1em;
  }

  .details {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .popup-card {
    max-width: 220px;
    padding: 10px;
  }

  .popup-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .popup-header h4 {
    font-size: 1em;
  }

  .price {
    font-size: 0.9em;
    align-self: flex-end;
  }

  .address {
    font-size: 0.9em;
  }

  .details {
    font-size: 0.85em;
  }

  .desc {
    font-size: 0.8em;
  }
}
