/* Dropdown styling similar to screenshot */
.dropdown-check-list {
  display: inline-flex;
  align-items: center;
  position: relative;
  border: 1px solid #d3d3d3;
  padding: 0; /* move padding to the anchor so the full box is clickable */
  border-radius: 10px;
  cursor: pointer;
  background: white;
  min-width: 120px;
  height: 36px;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.dropdown-check-list .anchor {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  cursor: pointer;
  padding: 8px 14px; /* ensure anchor fills the visual padding area */
}

.dropdown-check-list .anchor:after {
  content: "▼";
  margin-left: auto;
  font-size: 10px;
  opacity: .6;
  padding-left: 8px;
}

/* When dropdown is visible, remove bottom radius on toggle so list looks like a continuation */
.dropdown-check-list.visible {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.dropdown-check-list.visible .anchor:after {
  content: "▲";
}

.dropdown-check-list .items {
  position: absolute;
  /* position immediately below the toggle and match its width */
  top: calc(100% - 16px);
  left: -1px;
  width: calc(100% + 2px);
  background: white;
  border: 1px solid #ccc;
  border-radius: 0 0 8px 8px;
  /* hide the top border so it visually connects to the parent toggle */
  border-top: none;
  padding: 8px;
  z-index: 1000;
  box-sizing: border-box;
  overflow-wrap: anywhere;

  /* Animation and collapse behavior */
  max-height: 0;
  opacity: 0;
  transform-origin: top center;
  transform: scaleY(0);
  transition: transform 0.2s ease, max-height 0.2s ease;
  overflow: visible;
}

/* Visible state: expand with transition, allow nested submenus to escape and keep the list height limited */
.dropdown-check-list.visible .items {
  max-height: 240px; /* limit height for long lists */
  opacity: 1;
  transform: scaleY(1);
  overflow: visible;
}


.dropdown-check-list .items li {
  position: relative;
  list-style: none;
  padding: 4px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem; /* slightly smaller text */
}

/* Submenu that appears on hover over + focus on a list item */
.dropdown-check-list .items li .subitems {
  position: absolute;
  top: 0;
  left: 100%;
  min-width: 200px;
  max-width: 240px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  display: none;
  z-index: 1100;
}

.dropdown-check-list .items li:hover > .subitems,
.dropdown-check-list .items li:focus-within > .subitems {
  display: block;
}

.dropdown-check-list .items li .subitems li {
  padding: 4px 0;
}

.dropdown-check-list .items li input[type="checkbox"],
.dropdown-check-list .items li input[type="radio"] {
  flex: 0 0 auto;
  margin-top: 3px; /* visually align with wrapped text */
}

.dropdown-check-list .items li span {
  flex: 1 1 auto;
  white-space: normal;
  word-break: break-word;
}