@include b(checkbox) {
  display: inline-block;
  position: relative;
  margin-left: r(10);

  &:first-child {
    margin-left: 0;
  }

  @include e(wrapper) {
    display: flex;
    align-items: center;
  }

  @include e(input) {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
  }

  @include e(text) {
    color: var(--color-text);
  }

  &__inner + &__text {
    margin-left: r(10);
  }

  @include e(inner) {
    display: flex;
    align-items: center;
    justify-content: center;
    width: r(20);
    height: r(20);
    border: 1px solid var(--theme-primary);
    border-radius: r(20);

    &:before {
      content: ' ';
      margin-top: r(-2);
      width: r(6);
      height: r(12);
      border: 2px solid var(--theme-primary);
      border-top: 0;
      border-left: 0;
      transform: rotate(45deg) scale(0);
      transition: all 0.2s cubic-bezier(0.71, -0.46, 0.88, 0.6);
    }
  }
  /* 选中状态 */
  @include m(checked) {
    @include e(inner) {
      &:before {
        transform: rotate(45deg) scale(1);
        transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;
      }
    }
  }

  /* 禁用状态 */
  @include m(disabled) {
    @include e(inner) {
      border-color: var(--disabled-background);
      cursor: not-allowed;

      &:before {
        border-color: var(--disabled-background);
      }
    }

    @include e(text) {
      color: var(--disabled-color);
    }
  }

  /* 形状 */
  @include m(radius) {
    @include e(inner) {
      border-radius: var(--radius-md);
    }
  }

  @include m(round) {
    @include e(inner) {
      border-radius: r(20);
    }
  }

  @include m(rect) {
    @include e(inner) {
      border-radius: r(0);
    }
  }
}

/* 组合 */
@include b(checkbox-group) {
  @include m(block) {
    display: flex;
  }

  @include m(radius) {
    @include b(checkbox) {
      border-radius: var(--radius-md);
    }
  }

  @include m(round) {
    @include b(checkbox) {
      border-radius: r(15);
    }
  }

  @include m(rect) {
    @include e(inner) {
      border-radius: r(0);
    }
  }

  @include m(compact) {
    @include b(checkbox) {
      margin-left: -1px;

      @include m(radius) {
        border-radius: 0;

        &:first-child {
          border-radius: var(--radius-md) 0 0 var(--radius-md);
        }

        &:last-child {
          border-radius: 0 var(--radius-md) var(--radius-md) 0;
        }
      }

      @include m(round) {
        border-radius: 0;

        &:first-child {
          border-radius: r(15) 0 0 r(15);
        }

        &:last-child {
          border-radius: 0 r(15) r(15) 0;
        }
      }
    }
  }
}
