@import './theme/default.pcss';

.zent-checkbox-wrap {
  display: inline-block;
  cursor: pointer;
  font-weight: 400;
  font-size: 12px;
  line-height: 14px;
  margin: 0;
  padding: 0;
  margin-right: 15px;
  vertical-align: middle;

  &.zent-checkbox-disabled {
    cursor: not-allowed;
  }

  &:last-child {
    margin-right: 0;
  }
}

.zent-checkbox {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  white-space: nowrap;
  outline: none;
  vertical-align: middle;
  line-height: 1;
  margin: 0;
  padding: 0;

  input {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0;
    cursor: pointer;
  }

  & + span {
    margin-left: 5px;
    margin-right: 5px;
    vertical-align: middle;
    line-height: 16px;
  }
}

.zent-checkbox-inner {
  position: relative;
  top: 0;
  left: 0;
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid $theme-stroke-5;
  background: $theme-stroke-10;
  box-sizing: border-box;
  transition: all 0.3s;

  &::after {
    box-sizing: content-box;
    position: absolute;
    display: block;
    content: ' ';
    font-size: 0;
    top: 3px;
    left: 2px;
    width: 6px;
    height: 3px;
    border: 2px solid $theme-stroke-10;
    background: transparent;
    border-top: none;
    border-right: none;
    transform: rotate(-45deg) scale(0);
    transition: all 0.12s ease-in-out;
  }
}

.zent-checkbox-checked {
  .zent-checkbox-inner {
    border-color: $theme-primary-1;
    background: $theme-primary-2;

    &::after {
      transform: rotate(-45deg) scale(1);
    }
  }
}

.zent-checkbox-indeterminate {
  .zent-checkbox-inner {
    border-color: $theme-primary-2;
    background: $theme-stroke-10;

    &::after {
      top: 5px;
      left: 3px;
      width: 6px;
      height: 2px;
      border: none;
      background: $theme-primary-2;
      transform: rotate(0deg);
    }
  }
}

.zent-checkbox-disabled {
  .zent-checkbox-inner {
    opacity: 0.4;
  }

  input[type="checkbox"] {
    cursor: not-allowed;
  }
}
