@import "../mixins/mixins";
@import "../common/var";
@import "../common/transition";

@include b(date-editor) {
  position: relative;
  display: inline-block;
  text-align: left;

  &.el-input,
  &.el-input__inner {
    width: 256px;
  }

  @include m((monthrange)) {
    &.el-input,
    &.el-input__inner {
      width: 256px;
    }
  }

  @include m((daterange, timerange)) {
    &.el-input,
    &.el-input__inner {
      width: 256px;
    }

    .el-range-input {
      max-width: 90px;
    }
  }

  @include m(datetimerange) {
    &.el-input,
    &.el-input__inner {
      width: 400px;
    }

    .el-range-input {
      max-width: 146px;
    }
  }

  @include m(dates) {
    .el-input__inner {
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  .bi-iconfont-close-circle-fill {
    cursor: pointer;
  }

  .el-range__icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 5px;
    font-size: 16px;
    color: $--color-text-secondary;
    float: left;
    line-height: 34px;
  }

  .el-range-input {
    appearance: none;
    border: none;
    outline: none;
    display: inline-block;
    height: 100%;
    margin: 0;
    padding: 0;
    width: 39%;
    text-align: left;
    font-size: $--font-size-base;
    color: $--color-text-regular;

    &::placeholder {
      color: $--color-text-placeholder;
    }
  }

  .el-range-separator {
    display: table;
    height: 100%;
    padding: 0;
    margin: 0;
    margin-left: 5px;
    margin-right: 12px;
    text-align: center;
    line-height: 28px;
    font-size: 14px;
    width: 5%;
    color: $--color-text-secondary;
  }

  .el-range__close-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 5px;
    font-size: 16px;
    color: $--color-text-placeholder;
    width: 25px;
    display: inline-block;
    line-height: 34px;
  }
}

@include b(range-editor) {
  &.el-input__inner {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
  }

  .el-range-input {
    line-height: 1;
  }

  @include when(active) {
    border-color: $--color-primary;

    &:hover {
      border-color: $--color-primary;
    }
  }

  @include m(medium) {
    &.el-input__inner {
      height: $--input-medium-height;
    }

    .el-range-separator {
      line-height: 28px;
      font-size: $--input-medium-font-size;
    }

    .el-range-input {
      font-size: $--input-medium-font-size;
    }

    .el-range__icon,
    .el-range__close-icon {
      line-height: 28px;
    }
  }

  @include m(small) {
    &.el-input__inner {
      height: $--input-small-height;
    }

    .el-range-separator {
      line-height: 24px;
      font-size: $--input-small-font-size;
    }

    .el-range-input {
      font-size: $--input-small-font-size;
    }

    .el-range__icon,
    .el-range__close-icon {
      line-height: 24px;
    }
  }

  @include m(mini) {
    &.el-input__inner {
      height: $--input-mini-height;
    }

    .el-range-separator {
      line-height: 22px;
      font-size: $--input-mini-font-size;
    }

    .el-range-input {
      font-size: $--input-mini-font-size;
    }

    .el-range__icon,
    .el-range__close-icon {
      line-height: 22px;
    }
  }

  @include when(disabled) {
    background-color: $--input-disabled-fill;
    border-color: $--input-disabled-border;
    color: $--input-disabled-color;
    cursor: not-allowed;

    &:hover, &:focus {
      border-color: $--input-disabled-border;
    }

    input {
      background-color: $--input-disabled-fill;
      color: $--input-disabled-color;
      cursor: not-allowed;
      &::placeholder {
        color: $--input-disabled-placeholder-color;
      }
    }

    .el-range-separator {
      color: $--input-disabled-color;
    }
  }
}
