@charset "UTF-8";
@import "./common/var.css";

@component-namespace el {

  @b checkbox {
    color: var(--checkbox-color);
    position: relative;
    cursor: pointer;
    display: inline-block;
    white-space: nowrap;
    @utils-user-select none;

    @e input {
      white-space: nowrap;
      cursor: pointer;
      outline: none;
      display: inline-block;
      line-height: 1;
      position: relative;
      vertical-align: middle;

      @when disabled {
        .el-checkbox__inner {
          background-color: var(--checkbox-disabled-input-fill);
          border-color: var(--checkbox-disabled-input-border-color);
          cursor: not-allowed;

          &::after {
            cursor: not-allowed;
            border-color: var(--checkbox-disabled-icon-color);
          }

          & + .el-checkbox__label {
            cursor: not-allowed;
          }
        }
        &.is-checked {
          .el-checkbox__inner {
            background-color: var(--checkbox-disabled-checked-input-fill);
            border-color: var(--checkbox-disabled-checked-input-border-color);

            &::after {
              border-color: var(--checkbox-disabled-checked-icon-color);
            }
          }
        }
        &.is-indeterminate {
          .el-checkbox__inner {
            background-color: var(--checkbox-disabled-checked-input-fill);
            border-color: var(--checkbox-disabled-checked-input-border-color);

            &::before {
              border-color: var(--checkbox-disabled-checked-icon-color);
            }
          }
        }
        & + .el-checkbox__label {
          color: var(--disabled-color-base);
          cursor: not-allowed;
        }
      }
      @when checked {
        .el-checkbox__inner {
          background-color: var(--checkbox-checked-input-fill);
          border-color: var(--checkbox-checked-input-border-color);

          &::after {
            transform: rotate(45deg) scaleY(1);
          }
        }
      }
      @when focus {
        .el-checkbox__inner {
          border-color: var(--checkbox-input-border-color-hover);
        }
      }
      @when indeterminate {
        .el-checkbox__inner {
          background-color: var(--checkbox-checked-input-fill);
          border-color: var(--checkbox-checked-input-border-color);

          &::before {
            content: '';
            position: absolute;
            display: block;
            border: 1px solid var(--checkbox-checked-icon-color);
            margin-top: -1px;
            left: 3px;
            right: 3px;
            top: 50%;
          }

          &::after {
            display: none;
          }
        }
      }
    }
    @e inner {
      display: inline-block;
      position: relative;
      border: var(--checkbox-input-border);
      border-radius: var(--checkbox-input-border-radius);
      box-sizing: border-box;
      rect: var(--checkbox-input-width) var(--checkbox-input-height) var(--checkbox-input-fill);
      z-index: var(--index-normal);
      transition: border-color .25s cubic-bezier(.71,-.46,.29,1.46),
                  background-color .25s cubic-bezier(.71,-.46,.29,1.46);

      &:hover {
        border-color: var(--checkbox-input-border-color-hover);
      }

      &::after {
        box-sizing: content-box;
        content: "";
        border: 2px solid var(--checkbox-checked-icon-color);
        border-left: 0;
        border-top: 0;
        height: 8px;
        left: 5px;
        position: absolute;
        top: 1px;
        transform: rotate(45deg) scaleY(0);
        width: 4px;
        transition: transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;
        transform-origin: center;
      }
    }

    @e original {
      opacity: 0;
      outline: none;
      position: absolute;
      margin: 0;
      left: -999px;
    }

    @e label {
      font-size: var(--checkbox-font-size);
      padding-left: 5px;
    }

    & + .el-checkbox {
      margin-left: 15px;
    }
  }
}
