/* Main map container - add class for consistency */
.multi-marker-map-container {
  width: 100%;
  height: 600px;
  border: 3px solid black;
  /* allows side-bar */
  position: relative;
  /* Essential for absolute/fixed children like sidebar */
  display: flex;
  flex-direction: column;
  /* Default for mobile layout */
  align-items: stretch;
  overflow: hidden;
  /* Prevent map overflow */
}

/* Fallback for specific ID */
#goa-map {
  width: 100%;
  height: 600px;
  border: 1px solid black;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  border-radius: 4px 4px;
  margin-top: 15px;
}

/* Coordinates display styling */
.pin-coordinates {
  font-size: 16px;
  margin: 0;
  color: rgba(0, 0, 0, 0.589);
  font-weight: 600;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.5rem;
  flex: 0 0 100%;
}

.leaflet-popup-content p {
  margin: 0 !important;
  font-size: 16px;
}

.leaflet-popup ul {
  margin: 0;
}

.leaflet-popup ul {
  margin: 0;
  font-size: 14px;
}

.leaflet-popup li {
  margin: 0;
}

/* .leaflet-popup-content .popup-content {
			max-width: 200px;
			min-width: 100px;
		} */

p>strong {
  margin-top: 8px;
  display: inline-block;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(0, 112, 202, 0.6) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: rgba(0, 112, 202, 1) !important;
  color: #fff;
}

/* Generated Map Styles */

.placeholder-section {
  padding: 2rem 0;
  text-align: center;
  color: #6b7280;
}

/* Map instance - now dynamically generated with container prefix */
[id$="-instance"] {
  flex-grow: 1;
  /* Map height/width is now relative to the root container */
  height: 100%;
  width: 100%;
  margin: 0;
  border-radius: 0;
  z-index: 1;
}

/* Sidebar Styling (Mobile/Overlay) - now dynamically generated */
[id$="-sidebar"] {
  position: absolute;
  /* Changed from fixed to absolute within the root container */
  top: 0;
  right: 0;
  width: 300px;
  max-width: 80vw;
  height: 100%;
  background-color: white;
  box-shadow: -4px 0 10px rgba(0, 0, 0, 0.2);
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 15px;
  /* p-6 */
}

[id$="-sidebar"].open {
  transform: translateX(0);
}

/* --- Replicated existing styles to ensure containment --- */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
  flex-wrap: wrap;
}

[id$="-sidebar-title"] {
  font-size: 1.25rem;
  /* text-xl */
  font-weight: 700;
  /* font-bold */
  color: #1f2937;
  /* text-gray-800 */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin: 0 0 0;
}

[id$="-sidebar-content"] {
  overflow-y: auto;
  color: #4b5563;
  /* text-gray-700 */
  /*display: flex;*/
  flex-direction: column;
}

[id$="-sidebar-content"] p.text-sm {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

[id$="-sidebar-content"] h3 {
  font-size: 1rem;
  /* text-base */
  font-weight: 600;
  /* font-semibold */
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.25rem;
  margin-bottom: 0.5rem;
  color: #1f2937;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  padding: 2px 0;
  /* Tightened spacing */
  cursor: pointer;
  font-size: .950rem;
  /*font-size: 0.875rem;*/
  /* text-sm */
  color: #000000;
}

.checkbox-label input[type="checkbox"] {
  height: 2rem;
  /* h-4 */
  width: auto;
  /* w-4 */
  color: #2563eb;
  /* text-blue-600 */
  border: 1px solid #d1d5db;
  /* border-gray-300 */
  border-radius: 0.25rem;
  margin-right: 0.5rem;
  outline: none;
}

.sidebar-actions {
  display: flex;
  margin-top: 1.5rem;
  /* mt-6 */
  gap: 0.5rem;
  /* space-x-2 */
  flex-shrink: 0;
}

.sidebar-actions button {
  flex-grow: 1;
  padding: 0.5rem 1rem;
  /* px-4 py-2 */
  font-weight: 600;
  /* font-semibold */
  color: white;
  border-radius: 0.5rem;
  /* rounded-lg */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  /* shadow-md */
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  outline: none;
  border: none;
  cursor: pointer;
}

[id$="-save-pin-btn"] {
  background-color: #2563eb;
  /* bg-blue-600 */
}

[id$="-save-pin-btn"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

[id$="-save-pin-btn"]:hover {
  background-color: #1d4ed8;
  /* hover:bg-blue-700 */
}

[id$="-remove-pin-btn"] {
  background-color: #dc2626;
  /* bg-red-600 */
}

[id$="-remove-pin-btn"]:hover {
  background-color: #b91c1c;
  /* hover:bg-red-700 */
}

.save-pending {
  border: 2px solid #10B981 !important;
  /* Green border for unsaved changes */
  box-shadow: 0 0 5px rgba(16, 185, 129, 0.5);
}

/* Leaflet legend control */
.multi-marker-legend {
  background: rgba(255, 255, 255, 0.95);
  padding: 10px 12px;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  line-height: 1.2;
}

.multi-marker-legend .legend-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.multi-marker-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.multi-marker-legend .legend-swatch {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 1px solid rgba(0, 0, 0, 0.35);
}

.multi-marker-legend .legend-swatch.circle {
  border-radius: 50%;
}

.multi-marker-legend .legend-line {
  width: 20px;
  height: 0;
  flex: 0 0 20px;
  border-top: 3px solid #000;
}

.multi-marker-legend .legend-label {
  white-space: nowrap;
}


/* Desktop Layout (Map and Sidebar side-by-side) - Confined to root container */
@media (min-width: 1024px) {
  .multi-marker-map-container {
    flex-direction: row;
    align-items: stretch;
  }

  [id$="-instance"] {
    height: 100%;
    width: 100%;
    /* Default width */
  }

  [id$="-sidebar"] {
    /* position: relative; */
    /* Static positioning in the flow */
    transform: translateX(0);
    width: 350px;
    height: calc(100% - 20px);
    /* Adjusting for margin */
    margin: 10px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    /* Added shadow for desktop view */
    display: none;
  }

  [id$="-sidebar"].open {
    display: flex;
  }

  /* Map shrinks when sidebar is open: 10px margin + 280px sidebar + 10px margin = 300px */
  [id$="-sidebar"].open+[id$="-instance"] {
    width: calc(100% - 300px);
  }
}

/* Hidden Header (removed from original code) */
.header {
  display: none;
}