@import "colors/index";
@import "forms/inputs";

$input-hint-color: $color-text-med;
$input-invalid-color: $color-red;
$input-active-underline-fill: $color-blue;
$input-inactive-underline-fill: $color-bg-med;

.swui-input {
  display: block;
  margin-bottom: 1rem;
  position: relative;
  margin-top: 18px;

  // override chrome autofill styles
  input:-webkit-autofill,
  input:-webkit-autofill:hover,
  input:-webkit-autofill:focus,
  input:-webkit-autofill:active {
    transition: background-color 5000s ease-in-out 0s;
    -webkit-text-fill-color: white !important;
  }

  .swui-input-wrap {
    position: relative;

    .swui-input-box-wrap {
      position: relative;

      &:focus {
        outline: none;
      }

      .swui-input-box {
        background: transparent;
        border: none;
        margin-bottom: 0px;
        padding-left: 0px;
        width: 100%;
        color: $color-input-text;
        font-size: 16px;

        &:focus {
          box-shadow: none;
        }

        &[disabled] {
          color: $color-input-text-disabled;
          user-select: none;
        }
      }

      .icon-eye {
        line-height: 25px;
        top: 0;
        bottom: 0;
        position: absolute;
        right: 10px;
        cursor: pointer;
        font-size: .8rem;
        color: $color-text-med-dark;
        transition: color 100ms;

        &:hover {
          color: $color-text-light;
        }
      }
    }

    .swui-input-label {
      pointer-events: none;
      position: absolute;
      font-size: 16px;
    }

    .swui-input-underline {
      width: 100%;
      height: 1px;
      background-color: $input-inactive-underline-fill;

      .underline-fill {
        background-color: $input-active-underline-fill;
        width: 100%;
        height: 2px;
        margin: 0 auto;
      }
    }

    .swui-input-hint {
      font-size: 12px;
      color: $input-hint-color;
      margin-top: 2px;
    }

    &.ng-invalid.ng-touched {
      .swui-input-underline {
        background-color: $input-invalid-color;
      }

      .swui-input-label {
        color: $input-invalid-color;
      }
    }
  }
}
