.form-item {
  width: 100%;
  margin-bottom: 1.6rem;

  &-header {
    width: 100%;
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
    position: relative;
    & > *:not(:first-child) {
      margin-left: 1.5rem;
    }

    p {
      @include text-sm;
      margin: 0;
      cursor: pointer;
      &::first-letter { text-transform: uppercase; }
    }
  }
  &.is-hidden {
    display: none;
  }
  &.is-required &-header p::after {
    content: "*";
    margin-left: 0.5ch;
    color: var(--alert);
  }

  &-field {
    min-height: 4rem;
    display: grid;
    grid-template-areas: "icon field countdown addon";
    grid-template-columns: min-content minmax(0, 1fr) max-content min-content;
    background-color: var(--gray-soft-lightest);
    border: 1px solid var(--gray-soft-dark);
    border-radius: var(--border-radius);
    transition: border-color ease-in-out 0.15s;
    font-weight: 400;

    .icon,
    .addon {
      width: 4rem;
      display: flex;
      justify-content: center;
      align-items: center;
      color: var(--gray-hard-light);
      background-color: var(--gray-soft);
    }
    .icon {
      grid-area: icon;
      border-right: 1px solid var(--gray-soft-dark);
      border-top-left-radius: var(--border-radius);
      border-bottom-left-radius: var(--border-radius);
      & > * {
        max-width: 24px;
        max-height: 24px;
      }
    }

    .addon {
      grid-area: addon;
      border-left: 1px solid var(--gray-soft-dark);
      border-top-right-radius: var(--border-radius);
      border-bottom-right-radius: var(--border-radius);
      &.is-btn {
        color: var(--gray-soft-lightest);
        background-color: var(--gray-hard-darkest);
        &:hover {
          cursor: pointer;
          background-color: var(--gray-hard-light);
        }
      }
    }

    .countdown {
      grid-area: countdown;
      padding: 0 1.6rem 0 0.8rem;
      display: flex;
      align-items: center;
      @include text-sm;
      color: var(--gray-hard-lightest);
    }

    button.addon {
      border: 0;
    }

    & > input {
      grid-area: field;
      border: none;
      border-radius: var(--border-radius);
      padding: 0 0.8rem;
      color: var(--gray-hard-darkest);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      &::placeholder {
        font-weight: 400;
        color: var(--gray-soft-darkest);
      }
      &:focus {
        outline: none;
        box-shadow: 0 0 0 2px var(--information);
      }
    }

    // override React-select component's style
    .rs {
      grid-area: field;
      &__control {
        border: none;
        border-radius: var(--border-radius);
        &--is-focused {
          box-shadow: 0 0 0 2px var(--information);
        }
      }
      &__menu {
        margin-top: 1px;
        border: 1px solid var(--gray-soft-dark);
        box-shadow: var(--shadow);
      }
      &__option {
        color: #000000;
        &:hover {
          background-color: var(--information-lightest);
        }
        &--is-selected,
        &--is-selected:hover {
          background-color: var(--information-light);
        }
      }
      &__placeholder {
        font-weight: 400;
        color: var(--gray-soft-darkest);
      }
    }
  }
  &.is-incorrect &-field {
    border-color: var(--alert);
    input:focus { box-shadow: 0 0 0 2px var(--alert); }
    .icon {
      color: var(--alert);
      border-color: var(--alert);
      background-color: var(--alert-lightest);
    }
  }
  &.is-warned &-field {
    border-color: var(--notification);
    .icon {
      color: var(--notification);
      border-color: var(--notification);
      background-color: var(--notification-lightest);
    }
  }
  &.is-disabled &-field input,
  &.is-readOnly &-field input {
    background-color: var(--gray-soft-light);
  }

  &-error {
    margin-top: 0.4rem;
    color: var(--alert);
    font-weight: normal;
  }
  &-warning {
    margin-top: 0.4rem;
    color: var(--notification);
  }

  input[type='file'] {
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
  }
  .file-placeholder {
    border: none;
  }
}
