@import "../../scss/mnd-bootstrap/variables/variables";

$font-source-sans-pro: $font-family-sans-serif;

.mnd-ui-c-form-field {
  margin: 0 0 0.5rem;
  width: 100%;

  .form-control {
    border: 1px solid $color-gray-4000;
    border-radius: 0.25rem;
    background-color: $color-white;
    color: $color-gray-1000;
    font-family: $font-source-sans-pro;
    font-size: 0.875rem;
    line-height: 1.25rem;
    z-index: 4;
    position: relative;
    padding: 0.5rem 2rem 0.5rem 1rem;

    &:focus {
      border: 1px solid $color-gray-2000;
      background-color: $color-gray-6000;
      box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.2);
      z-index: 2;
    }

    &:disabled {
      border: 1px solid $color-gray-4000;
      background-color: $color-gray-5000;
    }

    &::placeholder {
      height: 1.25rem;
      color: $color-gray-3000;
      font-family: $font-source-sans-pro;
      font-size: 0.875rem;
      font-style: italic;
      line-height: 1.25rem;
    }

    &:-ms-input-placeholder {
      color: $color-gray-3000;
      font-family: $font-source-sans-pro;
      font-size: 0.875rem;
      font-style: italic;
      line-height: 1.25rem;
    }

    &.success {
      border: 1px solid $color-chewing-grass;
    }

    &.warning {
      border: 1px solid $color-lemons;
    }

    &.error {
      border: 1px solid $color-copenhagen-red;
      z-index: 3;
    }
  }

  &__icon {
    border: none;
    padding: 0.75rem;
    font-size: 14px;

    &.success {
      color: $color-chewing-grass;
    }

    &.warning {
      color: $color-lemons;
    }

    &.error {
      color: $color-copenhagen-red;
    }

    &:hover {
      border: none;
      background: transparent;
      outline: none;
      box-shadow: none;
    }
  }

  &__label {
    color: $color-gray-1000;
    font-family: $font-source-sans-pro;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
  }

  &__label-description {
    color: $color-gray-2000;
    font-family: $font-source-sans-pro;
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  input.form-control {
    height: 2.75rem;
  }

  textarea.form-control {
    height: 5rem;
    min-height: 2.75rem;
    resize: vertical;
  }

  &__input-icon-wrapper {
    display: flex;
    flex-direction: row;
  }

  &__input-block {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: row;
  }

  &__remove-button {
    display: none;

    &.show {
      display: block;
      padding: 0.75rem;
      background-color: transparent;
      color: $color-gray-3000;
      border: none;
      border-left: 0;
      border-radius: 0.25rem;
      position: absolute;
      z-index: 4;
      top: 1px;
      right: 1px;
    }

    &:hover,
    &:active,
    &:focus,
    &:active:hover,
    &:active:focus {
      outline: none;
      box-shadow: none;
      background-color: transparent;
    }
  }

  &.success {
    .form-control,
    .form-control:hover,
    .form-control:focus {
      border: 1px solid $color-chewing-grass;
    }
  }

  &.warning {
    .form-control,
    .form-control:hover,
    .form-control:focus {
      border: 1px solid $color-lemons;
    }
  }

  &.error {
    .form-control,
    .form-control:hover,
    .form-control:focus {
      border: 1px solid $color-copenhagen-red;
      z-index: 3;
    }
  }
}

.mnd-ui-c-form-field__input-icon-wrapper--code {
  border: 1px solid $color-gray-4000;
  border-radius: 0.25rem;
  overflow: hidden;

  .mnd-ui-c-form-field__input-block {
    border-left: 2rem solid $color-gray-6000;
  }

  .form-control {
    border-width: 0 0 0 1px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    font-family: monospace;

    &:focus {
      padding-top: calc(0.5rem - 1px);
    }
  }
}
