/*
INPUTS
======
- site-wide styles for inputs
*/

@import './variables';

$input-border: 1px solid $dark-gray;

.u-sr-only {
  height: 1px;
  left: -999em;
  outline: none !important;
  overflow: hidden;
  position: absolute !important;
  width: 1px;
}

input[type='number'] {
  &::-webkit-outer-spin-button,
  &::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.Input {
  border: $input-border;
  color: $dark-gray;
  font-size: $main-font-size;
  margin: $pad-mar-small 0;
  padding: $pad-mar-small $pad-mar-med;
  width: 100%;

  &:disabled {
    cursor: not-allowed;
  }

  &-error {
    display: block;
    color: $red;
    font-size: $h5-font-size;
    margin: 0 0 $pad-mar-med;
    padding: 0;
    width: 100%;
  }

  &-label {
    display: inline-flex;
    flex-wrap: wrap;
    position: relative;
    width: 100%;

    &-text {
      display: inline-block;
      width: 100%;
    }

    &--small {
      margin: $pad-mar-small 0 $pad-mar-small $pad-mar-small;
      width: 40%;

      &:last-of-type {
        margin-right: $pad-mar-small;
      }
    }

    &--inline {
      align-items: center;
      flex-wrap: nowrap;
    }

    &--wrap {
      flex-wrap: wrap;
    }
  }

  &-placeholder {
    &--file {
      border: $input-border;
      display: flex;
      justify-content: space-between;
      min-width: 300px;
      width: 100%;

      .Btn {
        border: 0;
      }
    }
  }

  &--currency {
    &-before {
      height: 1.5em;
      left: 10px;
      overflow: hidden;
      position: absolute;
      top: 38px;
      width: 1.5em;

      & ~ .Input--currency {
        padding-left: 2.5em;
      }

      svg,
      img {
        height: 100%;
      }
    }

    & ~ .Input-after {
      color: $light-gray;
      margin-top: 40px;
      position: absolute;
      right: 10px;
    }
  }

  &--invalid {
    box-shadow: 0 0 5px $red;
  }

  &--file {
    cursor: pointer;

    .Btn {
      background-color: $green;
      color: $white;
      display: inline-block;
      padding: $pad-mar-small;
      text-align: center;
      width: 70px;
    }

    &-label-text {
      width: 100%;
    }

    &-text {
      display: inline-block;
      padding: $pad-mar-small;
      overflow: hidden;
      max-width: calc(100% - 70px);
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
}
