@import '../../style/mixins';
@import '../../style/themes/default';

@listPrefixCls: fm-list;
@textareaPrefixCls: fm-textarea;

.@{textareaPrefixCls} {
  background-color: @fill-base;
  width: 100%;
  box-sizing: border-box;
  padding: @v-spacing-md @h-spacing-lg @v-spacing-md @h-spacing-lg;
  position: relative;
  display: flex;
  .hairline('bottom');

  textarea {
    flex: 1;
    color: @color-text-base;
    font-size: @font-size-heading;
    line-height: @line-height-paragraph * @font-size-heading;
    appearance: none;
    width: 100%;
    padding: 0;
    border: 0;
    background-color: transparent;
    overflow: visible;
    display: block;
    resize: none;
    word-break: break-word;
    word-wrap: break-word;

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

    &:disabled {
      color: @color-text-disabled;
      background-color: #fff;
    }
  }

  &-hidden {
    position: absolute;
    left: 0;
    width: 100%;
    height: initial;
    visibility: hidden;
    overflow: auto;
    resize: none;
    padding: 0;
  }
}

.@{textareaPrefixCls}-clear {
  display: none;
  width: @icon-size-sm;
  height: @icon-size-sm;
  margin-top: 2 * @hd;
  border-radius: @radius-circle;
  overflow: hidden;
  font-style: normal;
  color: #fff;
  background-color: @input-color-icon;
  background-repeat: no-repeat;
  background-size: @icon-size-sm auto;
  .encoded-svg-background('textarea_item_delete');

  &-active {
    background-color: @input-color-icon-tap;
  }
}

&.@{textareaPrefixCls}-focus {
  .@{textareaPrefixCls}-clear {
    display: block;
  }
}

.@{textareaPrefixCls}-has-count {
  padding-bottom: 25 * @hd !important;
}

.@{textareaPrefixCls}-count {
  position: absolute;
  bottom: @v-spacing-sm;
  right: @h-spacing-sm;
  color: @color-text-placeholder;
  font-size: @font-size-base;

  span {
    color: @color-text-base;
  }
}

&.@{textareaPrefixCls}-disabled {
  .@{textareaPrefixCls}-label {
    color: @color-text-disabled;
  }
}

// List.Item包裹后
.@{listPrefixCls}-item {
  &.@{textareaPrefixCls}-item {
    .@{textareaPrefixCls} {
      min-height: 28 * @hd;
      padding: 0;
      .hairline-remove('bottom');
    }

    .@{listPrefixCls}-label {
      flex: none;
      align-self: flex-start;
      width: 60 * @hd;
    }
  }

  &-active {
    background-color: #fff!important;
  }
}
