//
// FORM
// ---------------------

// firefox select option showing times roman fix
input,
button,
select,
textarea {
  // variabels not working here ?!
  font-family: @font-family-base, sans-serif !important;
}

// copied from bootstrap 4
/*.custom-select {
    display: inline-block;
    width: 100%;
    height: calc(2.25rem + 2px);
    padding: .375rem 1.75rem .375rem .75rem;
    line-height: 1.5;
    color: #495057;
    vertical-align: middle;
    background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right .75rem center;
    background-size: auto;
    background-size: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}*/

form {

  select {
    padding-left: 10px;
    padding-right: 10px;

    // from bootstrap 4
    line-height: 1.5;
    vertical-align: middle;
    background: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right .75rem center @input-bg;
    background-size: auto;
    background-size: 14px 10px;
    appearance: none;

    option {
      // nothing happens here
      padding: 5px 0;
    }
  }

  .form-group {
    position: relative;

    label, .control-label {
      transition: all .3s;
      color: @input-label-color;
      font-size: @input-label-size;
      position: absolute;
      top: ((@input-height-base - @font-size-small) / 2);
      left: 32px;
      margin: 0;
      line-height: 1;
      font-weight: @font-weight-normal;
    }

    .form-control {
      padding-top: 16px;
      background-color: @input-bg;
      color: @input-color;
      border-color: @input-border;
      border-radius: @input-border-radius;
      box-shadow: none;

      &::placeholder {
        opacity: 0; // hide it as it used to be the "label"
      }

      &:focus {
        border-color: @input-border-focus;
      }
    }
    
    // class .filled is set in form.js
    &.filled {
      .form-control + label {
        font-size: @font-size-xxs;
        top: 4px;
      }
    }

    // always with select fields
    select.form-control + label {
      font-size: @font-size-xxs;
      top: 4px;
    }

    input {
      height: @input-height-base;
    }

    &.has-feedback {
      .form-control {
        padding-right: @padding-base-horizontal;
      }

      .glyphicon.form-control-feedback {
        font-size: @font-size-base-p;
        position: absolute;
        top: 2px;
        right: 20px;
      }

      .form-control {
        &:focus {
          box-shadow: none;
          //border-color: @input-border-focus !important;
        }
      }

      &.has-success {
        .form-control {
          color: @input-color;
          border-color: @state-success-border;
          background-color: @input-bg;
          //&:focus {
          //    box-shadow: 0 0 6px @brand-success;
          //}
        }

        .glyphicon.form-control-feedback {
          color: @brand-success;
        }
      }

      &.has-error {
        .form-control {
          color: @input-color;
          border-color: @state-danger-border;
          background-color: @input-bg;
        }

        .glyphicon.form-control-feedback {
          color: @brand-danger;
        }
      }
    }
  }

  input[type="checkbox"] {
    appearance: checkbox;
    width: 24px;
    height: 24px;
  }

  input[type="radio"] {
    appearance: radio;
    width: 20px;
    height: 20px;
  }

  .checkbox, .radio {
    label {
      padding-left: 30px;

      input[type="checkbox"],
      input[type="radio"] {
        top: -5px;
        margin-left: -30px;
      }
    }
  }
}