/* Input Fields & Input Groups - Bootstrap Compatible */

fieldset {
  padding: @default-gutter-size;
  border-color: @default-border-color;
  border-radius: @default-border-radius;
  > legend {
    font-size: 1.25em;
    padding: 0.25em 0.5em;
  }
}

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  outline: 0;
}

input[data-type="currency"], input[data-type="number"], input[data-type="decimal"] {
  text-align: right;
}

.form-group {
  &.required label::after {
    content: ' *';
    color: #f00;
  }
  &:not([class*="col-"]) {
    margin-bottom: @default-gutter-size;
  }
  > label {
    display: inline-block;
    padding-bottom: @form-input-padding/2;
  }
}

.input-field() {
  position: relative;
  color: #555;
  background: @form-input-background;
  border: 1px solid @default-border-color;
  border-radius: @default-border-radius;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.form-control {
  .input-field();
  display: block;
  width: 100%;
  min-width: 1px; // Firefox fix
  padding: @form-input-padding @form-input-padding * 2;
  transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
  &[type="color"] {
    height: 37px;
  }
  &[type="file"] {
    font-size: 12px;
    padding: 4px @form-input-padding/2;
  }
  &[disabled] {
    text: lighter(@default-text-color, 50%);
  }
  &[readonly] {
    color: #999;
  }
}

.select-wrapper {
  position: relative;
  width: 100%;
  &:before {
    content: ' ';
    position: absolute;
    top: 50%;
    width: 0;
    height: 0;
    right: @form-input-padding * 2;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #000;
    z-index: 1;
  }
  select.form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: @default-gutter-size * 2;
  }
}

.select-wrapper.multiple {
  .form-control {
    padding: 0;
  }
  option {
    padding: @form-input-padding @form-input-padding*2;
  }
}

.input-unstyled {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
}

.checkbox, .radio {
  padding: @form-input-padding @form-input-padding * 2;
}
.form-control .checkbox {
  padding: @form-input-padding 0;
}

.input-group {
  .input-field();
  display: flex;
  .form-control {
    background: none;
    box-shadow: none;
    border-radius: 0;
    border: none;
    margin-left: -1px;
  }
  .input-group-addon {
    flex: 1 0 auto;
    margin: 0 -1px;
    padding: @form-input-padding @form-input-padding * 2;
    background-color: @default-color;
    border-left: 1px solid @default-border-color;
    border-right: 1px solid @default-border-color;
    color: #555;
    white-space: nowrap;
    font-weight: normal;
    text-align: center;
    .select-wrapper {
      background: none;
      margin: -@form-input-padding -@form-input-padding * 2;
      &:before {
        right: -@form-input-padding * 2;
      }
    }
    select {
      width: auto;
      background: none;
      border: none;
    }
  }
  .input-group-icon {
    flex: 1 0 auto;
    padding: @form-input-padding @form-input-padding * 2;
    margin-right: -12px;
  }
  .input-group-btn {
    flex: 1 0 auto;
    .btn {
      border-top: none;
      border-bottom: none;
    }
    .form-control {
      padding: .4em 1em;
    }
  }
  .form-control:first-child,
  .input-group-addon:first-child,
  .input-group-btn:first-child > .btn,
  .input-group-btn:first-child > .btn-group > .btn,
  .input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
    border-radius: @default-border-radius 0 0 @default-border-radius;
  }
  .form-control:last-child,
  .input-group-addon:last-child,
  .input-group-btn:last-child > .btn,
  .input-group-btn:last-child > .btn-group > .btn,
  .input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
    margin-right: -1px;
    border-radius: 0 @default-border-radius @default-border-radius 0;
  }
  + .input-group {
    margin-top: -1px;
  }
}

[data-toggle="buttons"] input[type="checbox"],
[data-toggle="buttons"] input[type="radio"] {
  display: none;
}
