@import (reference) '../variables.less';

.title {
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reset {
  font: @text-small;
  color: currentColor;
  margin: -10px;
  padding: 10px;
  border: 0;
  background-color: transparent;
  appearance: none;
  outline: none;
  text-decoration: underline;
  position: relative;

  &:before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: @radius-large;
    background-color: currentColor;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: @transition-medium;

    :focus&,
    :hover& {
      opacity: 0.1;
      transform: scale(1);
    }
  }
}

.label {
  position: relative;
  display: flex;
  align-items: center;
  height: @grid * 9;
  cursor: pointer;
  user-select: none;
}

@checkbox-size: 20px;
.checkbox {
  position: absolute;
  left: 0;
  margin: 0;
  right: 0;
  height: @checkbox-size;
  width: @checkbox-size;
  opacity: 0;
  pointer-events: none;
}

.fakeCheckbox {
  @padding-size: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 0;
  flex-shrink: 0;
  height: @checkbox-size - (@padding-size * 2);
  width: @checkbox-size - (@padding-size * 2);
  padding: @padding-size;
  margin-right: 15px;
  position: relative;
  border-radius: @radius-large;
  box-shadow: inset 0 0 0px 1px currentColor;

  &::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: @radius-medium;
    box-shadow: 0 0 0 4px currentColor;
    transition: @transition-fast;
    opacity: 0;
    transform: scale(0.5);

    .checkbox:hover:not(:focus) ~ &,
    .checkbox:focus ~ & {
      opacity: 0.1;
      transform: scale(1);
    }
  }

  > :global(svg) {
    height: 100%;
    width: 100%;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity @transition-speed-fast ease, transform 0s;
    transition-delay: 0.1s, 0.3s;

    .checkbox:checked ~ & {
      opacity: 1;
      transform: none;
      transition: @transition-fast;
    }
  }
}
