@import '../common/style/var.less';

.van-checkbox {
  display: flex;
  align-items: center;
  overflow: hidden;
  user-select: none;

  &--horizontal {
    margin-right: @padding-sm;
  }

  &__icon-wrap,
  &__label {
    line-height: var(--checkbox-size, @checkbox-size);
  }

  &__icon-wrap {
    flex: none;
  }

  &__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 1em;
    height: 1em;
    color: transparent;
    text-align: center;
    transition-property: color, border-color, background-color;
    font-size: var(--checkbox-size, @checkbox-size);
    border: 1px solid var(--checkbox-border-color, @checkbox-border-color);
    transition-duration: var(
      --checkbox-transition-duration,
      @checkbox-transition-duration
    );

    &--round {
      border-radius: 100%;
    }

    &--checked {
      color: @white;
      background-color: var(
        --checkbox-checked-icon-color,
        @checkbox-checked-icon-color
      );
      border-color: var(
        --checkbox-checked-icon-color,
        @checkbox-checked-icon-color
      );
    }

    &--disabled {
      background-color: var(
        --checkbox-disabled-background-color,
        @checkbox-disabled-background-color
      );
      border-color: var(
        --checkbox-disabled-icon-color,
        @checkbox-disabled-icon-color
      );
    }

    &--disabled&--checked {
      color: var(--checkbox-disabled-icon-color, @checkbox-disabled-icon-color);
    }
  }

  &__label {
    word-wrap: break-word;
    padding-left: var(--checkbox-label-margin, @checkbox-label-margin);
    color: var(--checkbox-label-color, @checkbox-label-color);

    &--left {
      float: left;
      margin: 0 var(--checkbox-label-margin, @checkbox-label-margin) 0 0;
    }

    &--disabled {
      color: var(
        --checkbox-disabled-label-color,
        @checkbox-disabled-label-color
      );
    }

    &:empty {
      margin: 0;
    }
  }
}
