/** Multiselect component adapted from
    https://webdevtrick.com/html-combobox-with-javascript/
  */

*, *::before, *::after {
  box-sizing: border-box;
}

.combo {
  display: block;
  /* max-width: 400px; */
  position: relative;
}

.combo::after {
  border-bottom: 2px solid rgba(0, 0, 0, 0.5);
  border-right: 2px solid rgba(0, 0, 0, 0.5);
  content: '';
  display: block;
  height: 12px;
  pointer-events: none;
  position: absolute;
  right: 16px;
  bottom: 6px;
  transform: translate(0, -65%) rotate(45deg);
  width: 12px;
}

.combo-input {
  background-color: #f5f5f5;
  border: 2px solid rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  display: block;
  font-size: 1em;
  min-height: calc(1.4em);
  padding: 4px;
  text-align: left;
  width: 100%;
}

.open .combo-input {
  border-radius: 4px 4px 0 0;
}

.combo-input:focus {
  border-color: #54b1db;
  box-shadow: 0 0 4px 2px #54b1db;
  outline: 5px solid transparent;
}

.combo-menu {
  background-color: #f5f5f5;
  border: 1px solid rgba(0, 0, 0, 0.42);
  border-radius: 0 0 4px 4px;
  display: none;
  max-height: 300px;
  overflow-y: scroll;
  left: 0;
  position: absolute;
  top: 100%;
  width: 100%;
  z-index: 100;
}

.open .combo-menu {
  display: block;
}

.combo-option {
  padding: 10px 12px 12px;
}

.combo-option.option-current,
.combo-option:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.combo-option.option-selected {
  padding-right: 30px;
  position: relative;
}

.combo-option.option-selected::after {
  border-bottom: 2px solid #000;
  border-right: 2px solid #000;
  content: '';
  height: 16px;
  position: absolute;
  right: 15px;
  top: 45%;
  transform: translate(0, -50%) rotate(45deg);
  width: 8px;
}

.selected-options {
  list-style-type: none;
  margin: 0;
  max-width: 400px;
  padding: 0;
}

.selected-options li {
  display: inline-block;
  margin-bottom: 5px;
}

.remove-option {
  background-color: #54b1db;
  border: 1px solid #54b1db;
  border-radius: 3px;
  color: #fff;
  font-size: 0.75em;
  font-weight: bold;
  margin-bottom: 6px;
  margin-right: 6px;
  padding: 0.25em 1.75em 0.25em 0.25em;
  position: relative;
}

.remove-option:focus {
  border-color: #baa1dd;
  box-shadow: 0 0 3px 1px #54b1db;
  outline: 3px solid transparent;
}

.remove-option::before,
.remove-option::after {
  border-right: 2px solid #fff;
  content: "";
  height: 1em;
  right: 0.75em;
  position: absolute;
  top: 50%;
  width: 0;
}

.remove-option::before {
  transform: translate(0, -50%) rotate(45deg);
}

.remove-option::after {
  transform: translate(0, -50%) rotate(-45deg);
}
