// yc-input-outer
.yc-input-outer {
  width: 100%;
  display: inline-flex;
  align-items: center;

  .yc-input-prepend,
  .yc-input-append,
  .yc-input-wrapper {
    flex-shrink: 0;
    font-size: inherit;
  }
  .yc-input-prepend,
  .yc-input-append {
    overflow: hidden;
    height: 100%;
    padding: 0 12px;
    color: var(--color-text-1);
    font-weight: 400;
    white-space: nowrap;
    background-color: var(--color-fill-2);
    display: flex;
    align-items: center;
  }
  .yc-input-prepend {
    border-right: 1px solid var(--color-neutral-3);
    border-top-left-radius: 2px;
    border-bottom-left-radius: 2px;
  }
  .yc-input-append {
    border-left: 1px solid var(--color-neutral-3);
    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
  }
}
// prepend
.yc-input-has-prepend {
  .yc-input-wrapper {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}
// append
.yc-input-has-append {
  .yc-input-wrapper {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}
// error
.yc-input-error {
  .yc-input-wrapper {
    background-color: var(--color-danger-light-1);
    &:not(.yc-input-wrapper-disabled) {
      &:hover {
        border-color: transparent;
        background-color: var(--color-danger-light-2);
      }
      &:focus-within {
        background: var(--color-bg-2);
        border-color: rgb(var(--danger-6));
        box-shadow: 0 0 0 0 var(--color-danger-light-2);
      }
    }
  }
}
// disabled
.yc-input-disabled {
  cursor: not-allowed;
  .yc-input-wrapper {
    cursor: not-allowed;
    border-color: transparent;
    background-color: var(--color-fill-2);
    color: var(--color-text-4);
    .yc-input-prefix,
    .yc-input-suffix {
      color: inherit;
    }
    .yc-input {
      &::placeholder {
        color: var(--color-text-4);
      }
    }
  }
}
// search
.yc-input-search {
  .yc-input-prepend,
  .yc-input-append {
    border: none;
    padding: 0;
    .yc-button {
      border-radius: 0;
    }
  }
}
// yc-input-wrapper
.yc-input-wrapper {
  flex: 1;
  height: 100%;
  width: 100%;
  cursor: text;
  padding: 0 12px;
  background-color: var(--color-fill-2);
  border: 1px solid transparent;
  border-radius: var(--border-radius-small);
  transition:
    color 0.1s cubic-bezier(0, 0, 1, 1),
    border-color 0.1s cubic-bezier(0, 0, 1, 1),
    background-color 0.1s cubic-bezier(0, 0, 1, 1);
  color: var(--color-text-1);
  font-size: inherit;
  font-weight: 400;
  display: flex;
  align-items: center;
  &:not(.yc-input-wrapper-disabled) {
    &:hover {
      border-color: transparent;
      background-color: var(--color-fill-3);
    }
    &:hover .yc-input-clear-button {
      visibility: visible;
    }
    &:focus-within {
      background-color: var(--color-bg-2);
      border-color: rgb(var(--primary-6));
      box-shadow: 0 0 0 0 var(--color-primary-light-2);
    }
  }
  .yc-input-prefix,
  .yc-input-suffix,
  .yc-input {
    flex-shrink: 0;
    color: inherit;
  }
  .yc-input-prefix,
  .yc-input-suffix {
    height: 100%;
    color: var(--color-text-2);
    display: flex;
    justify-content: center;
    align-items: center;
    .yc-input-word-limit {
      color: var(--color-text-3);
      font-size: 12px;
    }
    .yc-icon-button {
      color: inherit;
    }
    &.yc-input-prefix {
      padding-right: 12px;
    }
    &.yc-input-suffix {
      padding-left: 12px;
    }
  }
  .yc-input-clear-button {
    visibility: hidden;
  }
  .yc-input {
    flex: 1;
    cursor: inherit;
    outline: none;
    border: none;
    border-radius: var(--border-radius-none);
    background-color: transparent;
    color: inherit;
    &::placeholder {
      color: var(--color-text-3);
    }
  }
}

//size
@sizes: {
  @mini: {
    height: 24px;
    padding: 1px;
  };
  @small: {
    height: 28px;
    padding: 2px;
  };
  @medium: {
    height: 32px;
    padding: 4px;
  };
  @large: {
    height: 36px;
    padding: 6px;
  };
};
each(@sizes, .(@value, @name) {
  @key: replace(~"@{name}", "@", "");
  @font-size:if(@key=mini,12px,14px);
  @line-height:if(@key=mini,1.667,1.5715);
  .yc-input-size-@{key} {
    font-size: @font-size;
    height: @value[height];
    .yc-input-wrapper{
      .yc-input {
        padding: @value[padding] 0;
        line-height: @line-height;
      }
    }
  }
});
