@use 'pix-design-tokens/breakpoints';

/* stylelint-disable no-descending-specificity */

.form-textfield {
  position: relative;
}

.form-textfield__label {
  color: var(--pix-neutral-800);
  font-weight: var(--pix-font-medium);
  font-size: 0.938rem;
  letter-spacing: 0.031rem;
}

.form-textfield__help {
  font-weight: normal;
  letter-spacing: normal;
  text-transform: none;
}

.form-textfield__date {
  display: flex;
  flex-flow: row nowrap;
  gap: var(--pix-spacing-2x);
  align-items: center;
}

.form-textfield__input-field-container {
  display: flex;
  align-items: center;
  width: 100%;
  height: 46px;
  background-color: var(--pix-neutral-0);
  border: 2px solid var(--pix-neutral-20);
  border-radius: 3px;

  &:hover,
  &:focus,
  &:focus-within {
    border: 2px solid var(--pix-primary-500);
  }

  @include breakpoints.device-is('desktop') {
    height: 50px;
  }
}

.form-textfield__input-container--default {
  border: 2px solid var(--pix-neutral-100);
}

.form-textfield__input-container--error {
  border: 2px solid var(--pix-error-700);
}

.form-textfield__input-container--success {
  border: 2px solid var(--pix-success-700);
}

.form-textfield__input-container--disabled {
  background-color: var(--pix-neutral-20);
}

.form-textfield__input-container--password {
  .form-textfield__input {
    width: calc(100% - 42px);
  }
}

.form-textfield__input-field-container input {
  flex-grow: 1;
  height: 40px;
  padding: 0 10px;
  color: var(--pix-neutral-500);
  font-size: 0.875rem;
  border: none;
  border-radius: 3px;
  outline: none;

  &:focus {
    outline: none;
  }

  &::-ms-clear,
  &::-ms-reveal {
    display: none;
  }

  &[disabled] {
    background-color: var(--pix-neutral-20);
  }
}

.form-textfield__message {
  font-size: 0.875rem;
  text-transform: none;
}

.form-textfield__message--error {
  color: var(--pix-error-700);
}

.form-textfield__message--success {
  color: var(--pix-success-700);
}

.form-textfield__message--error.form-textfield__message-password,
.form-textfield__message--error.form-textfield__message-email,
.form-textfield__message--error.form-textfield__message-text {
  position: relative;
  margin-top: 5px;
  margin-bottom: 5px;
}

.form-textfield__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.form-textfield__icons {
  height: 20px;
  margin: 6px 8px;
  background: none;
  border: none;

  &:focus {
    outline: 1px solid var(--pix-primary-500);
    box-shadow: 0 0 5px 0 rgb(61 104 255 / 50%);
  }
}

.form-textfield-icon {
  &__button {
    display: flex;
    margin: 10px;
    padding: 0;
    background: none;
    border: none;

    &:focus {
      outline: 1px solid var(--pix-primary-500);
      box-shadow: 0 0 5px 0 rgb(61 104 255 / 50%);
    }
  }

  &__state {
    margin-right: 10px;
  }
}

.form-textfield-icon-button {
  &__eye {
    margin-top: 1px;
    color: var(--pix-neutral-500);
    font-size: 1.125rem;
    transition: 0.5s;

    &:hover {
      color: var(--pix-neutral-900);
      cursor: pointer;
    }
  }
}
