@use 'sass:color';
@use '../../styles/theming';
@use '../../styles/statuses';

.field {
  box-sizing: border-box;
  width: 100%;
  min-width: 20em;
  max-width: 50vw;
  height: 1.5em;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  background-color: transparent;
  color: inherit;
  border: 1px solid transparent;
}

.statuses {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  list-style: none;
  padding: 0;
  margin: 0;
}

.label {
  position: relative;
  font-size: 0.75em;
}

.checkbox {
  position: absolute;
  top: 0.125em;
  left: 0.5em;
  width: 1em;
  height: 1em;
  padding: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.status {
  padding: 0.333em 0.5em;
  border-radius: 0.333em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;

  @each $name, $color in statuses.$statusColors {
    &[data-status='#{$name}'] {
      background-color: color.adjust($color, $alpha: -0.666);

      svg {
        color: $color;
      }
    }
  }

  .checkbox:not(:checked) + & {
    opacity: 0.666;

    svg {
      opacity: 0;
    }
  }

  > * + * {
    margin-left: 0.25em;
  }
}
