@media (max-width: 640px) {
  .custom-legend {
    margin-left: 12%;
  }
}

.custom-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* Center align the items */
  width: 100%; /* Take full width of container */
  gap: 20px;
  margin-bottom: 20px;
}

.legend-item {
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s ease, color 0.3s ease;
  /* transition: all 0.2s ease; */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  font-family: "Nunito Sans", sans-serif;
  position: relative;
}

.legend-item:hover {
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
  /* transform: translateY(-2px); */
  transition: font-weight 0.3s ease, scale 0.3s ease;
  transform: scale(1.1);
  font-weight: 700;
}

.legend-item.selected {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: font-weight 0.3s ease, scale 0.3s ease;
  transform: translateY(-2px);
  transform: scale(1.1);
  font-weight: 700;
}

.legend-item.selected::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  /* width: 40%; */
  height: 2px;
  background-color: rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
  border-radius: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .custom-legend {
    justify-content: center;
  }

  .legend-item {
    font-size: 0.9em;
    padding: 6px 12px;
  }
}
