/* map.css - All styles combined for the map viewer */
/* (C)2025 Clayton Smith/C5 Projects */

/* Page layout styles */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

.map-container {
  position: relative;
  width: 100%;
  height: 100%; /* Changed to 100% for better embedding */
}

#map {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

:root {
  --legend-btn-reserve: 140px; /* space for button + margins on right */
}

.logo-overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  opacity: 0.6;
  align-items: flex-start;
  font-size: clamp(0.9rem, 1.2vw, 1.2rem);
}

.logo-overlay img {
  height: clamp(15px, 4vw, 25px);
  /* 20px left margin + reserved right area */
  max-width: calc(100vw - var(--legend-btn-reserve));
  object-fit: contain;
}

@media (max-width: 600px) {
  .logo-overlay img {
    height: 15px;
    max-width: calc(100vw - var(--legend-btn-reserve));
  }
}

.custom-bottom-logo {
  position: absolute;
  bottom: 28px;   /* adjust upward above Mapbox attribution */
  left: 5px;     /* same left margin as Mapbox logo */
  z-index: 9999;  /* above the map + attribution */
  opacity: 0.9;   /* optional */
}

.custom-bottom-logo img {
  height: 28px;   /* adjust size as needed */
  object-fit: contain;
}


.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
}

/* Map settings, legend, popups, and related styles */

/* ---------- FONT ---------- */
.mapboxgl-popup,
.mapboxgl-popup-content,
.mapboxgl-popup * {
  font-family: 'Manrope', sans-serif !important;
}

.mapboxgl-popup-content {
  background: #fff;
  color: #222;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.mapboxgl-popup-tip {
  border-top-color: white;
}

/*--- Map Legend ---*/
/*--- Map Legend ---*/
.legend {
  position: absolute;
  top: 70px;
  right: 20px;
  background: rgba(255,255,255,0.9);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  display: none;
  z-index: 999;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

.legend-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #e87511;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  z-index: 1000;
}

.legend-btn:hover { background: #cf6b0f; }

.legend h4 { margin: 0 0 8px; font-weight: 700; }

.legend label {
  display: block;
  margin-bottom: 4px;
  cursor: pointer;
  user-select: none;
}

.legend-symbol {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.legend-symbol.fill {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.legend-symbol.circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.subgroup {
  margin: 6px 0 10px 10px;
  padding-left: 6px;
  border-left: 2px solid #ddd;
}



@media (max-width:600px){
  .legend { right:10px; top:60px; font-size:13px; padding:10px; max-height: calc(100vh - 110px); overflow-y: auto; }
  .legend-btn { right:10px; top:20px; padding:5px 10px; font-size:13px; }
}

.legend-group {
  margin-bottom: 10px;
  border-top: 1px solid #ddd;
  padding-top: 8px;
}

.legend-collapse {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #222;
}

.legend-collapse::after {
  content: "▼";
  font-size: 11px;
  transition: transform 0.2s ease;
}

.legend-collapse.collapsed::after {
  transform: rotate(-90deg);
}

.legend-group .subgroup {
  margin-top: 6px;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
  max-height: 500px; /* enough for full list when expanded */
  opacity: 1;
}

.legend-group .subgroup.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}
	
		
/* ---------- POPUP BUTTONS ---------- */
.map-popup-btn {
  width: 190px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: 'Manrope', sans-serif;
  background-color: #e87511; /* brand orange */
  color: #fff; /* white text */
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;

}

.map-popup-btn:hover {
  background-color: #cc660e; /* slightly darker on hover */
  transform: translateY(-1px);
}