/* Inspired by: https://github.com/tonystar/float-label-css
 */

.form-group {
  border-radius: var(--small);
  background-color: var(--white);
  padding: var(--large);
}

.form-control {
  width: 100%;
}

.has-float-label {
  display: block;
  position: relative;
  margin-top: var(--xlarge);

  & label, > span {
    position: absolute;
    left: 0;
    top: -1.3em;
    cursor: text;
    font-size: 75%;
    opacity: .5;
    transition: all .2s;
  }

  & select {
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
  }

  & input, select, textarea {
    font-size: inherit;
    border: 0;
    border-bottom: 2px solid rgba(0,0,0,.1);
    background-color: transparent;

    &::placeholder {
      opacity: .5;
      transition: all .2s;
    }

    &:placeholder-shown:not(:focus)::placeholder {
        opacity: 0;
    }

    &:placeholder-shown:not(:focus) + * {
        font-size: 150%;
        opacity: .25;
        top: -0.2rem;
        right: -0.25em;
    }

    &:focus {
      outline: none;
      border-color: rgba(0,0,0,.5);
    }
  }

  & select {
    padding-right: 1em;
    background: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23333' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right .5em bottom .25em;
    background-size: 8px 10px;
  }
}

.form__actions {
  margin-top: var(--medium);
  display: flex;
  gap: var(--xsmall);
  justify-content: flex-end;
  align-items: baseline;
}

.checkbox {
  display: flex;
  flex-direction: row;
  & .inline {
    margin-right: 0.4rem;
  }

  & label {
    margin-bottom: 0;
  }
}
