@import '../common/style/var.less';

.van-field {
  --cell-icon-size: var(--field-icon-size, @field-icon-size);

  &__label {
    color: var(--field-label-color, @field-label-color);

    &--disabled {
      color: var(--field-disabled-text-color, @field-disabled-text-color);
    }
  }

  &__body {
    display: flex;
    align-items: center;

    &--textarea {
      box-sizing: border-box;
      padding: 3.6px 0;
      line-height: 1.2em;
      min-height: var(--cell-line-height, @cell-line-height);
    }
  }

  &__control:empty + &__control {
    display: block;
  }

  &__control {
    position: relative;
    display: none;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 0;
    line-height: inherit;
    text-align: left;
    background-color: transparent;
    border: 0;
    resize: none;
    color: var(--field-input-text-color, @field-input-text-color);
    height: var(--cell-line-height, @cell-line-height);
    min-height: var(--cell-line-height, @cell-line-height);

    &:empty {
      display: none;
    }

    &--textarea {
      height: var(--field-text-area-min-height, @field-text-area-min-height);
      min-height: var(
        --field-text-area-min-height,
        @field-text-area-min-height
      );
    }

    &--error {
      color: var(--field-input-error-text-color, @field-input-error-text-color);
    }

    &--disabled {
      background-color: transparent;
      opacity: 1;
      color: var(
        --field-input-disabled-text-color,
        @field-input-disabled-text-color
      );
    }

    &--center {
      text-align: center;
    }

    &--right {
      text-align: right;
    }

    &--custom {
      display: flex;
      align-items: center;
      min-height: var(--cell-line-height, @cell-line-height);
    }
  }

  &__placeholder {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    pointer-events: none;
    color: var(--field-placeholder-text-color, @field-placeholder-text-color);

    &--error {
      color: var(--field-error-message-color, @field-error-message-color);
    }
  }

  &__icon-root {
    display: flex;
    align-items: center;
    min-height: var(--cell-line-height, @cell-line-height);
  }

  &__clear-root,
  &__icon-container {
    line-height: inherit;
    vertical-align: middle;
    padding: 0 var(--padding-xs, @padding-xs);
    margin-right: calc(-1 * var(--padding-xs, @padding-xs));
  }

  &__clear-root,
  &__icon-container,
  &__button {
    flex-shrink: 0;
  }

  &__clear-root {
    font-size: var(--field-clear-icon-size, @field-clear-icon-size);
    color: var(--field-clear-icon-color, @field-clear-icon-color);
  }

  &__icon-container {
    font-size: var(--field-icon-size, @field-icon-size);
    color: var(--field-icon-container-color, @field-icon-container-color);

    &:empty {
      display: none;
    }
  }

  &__button {
    padding-left: var(--padding-xs, @padding-xs);

    &:empty {
      display: none;
    }
  }

  &__error-message {
    display: block;
    text-align: left;
    font-size: var(
      --field-error-message-text-font-size,
      @field-error-message-text-font-size
    );
    color: var(--field-error-message-color, @field-error-message-color);

    &--center {
      text-align: center;
    }

    &--right {
      text-align: right;
    }
  }

  &__word-limit {
    text-align: right;
    margin-top: var(--padding-base, @padding-base);
    color: var(--field-word-limit-color, @field-word-limit-color);
    font-size: var(--field-word-limit-font-size, @field-word-limit-font-size);
    line-height: var(
      --field-word-limit-line-height,
      @field-word-limit-line-height
    );
  }

  &__word-num {
    display: inline;

    &--full {
      color: var(--field-word-num-full-color, @field-word-num-full-color);
    }
  }
}
