

legend {
  margin-top: 15px;
  margin-bottom: 15px;
  font-size: $font-size-base;
  color: $brand-grey-dark;
  border: 0;
  @include medium-weight;
  strong {
    font-size: $font-size-large;
  }
  span {
    font-weight: $roboto-light;
    font-size: $font-size-base;
    color: $brand-copy-light;
  }
}

label {
	font-size: $font-size-small;
  font-weight: $roboto-regular;
}

input::-ms-clear { display: none;}
input[type="radio"],
input[type="checkbox"] {
  &, &:checked {
    outline: none;
  }
}

.form-control {
  padding: 0 10px;
  box-shadow: none;
  font-weight: $roboto-light;

  // styles for label+input
  .form-group label:not(.sr-only) + &,
  .form-group label:not(.sr-only) + span &,
  .form-group label:not(.sr-only) + .twitter-typeahead &,
  .form-group label:not(.sr-only) + .autocomplete-widget &,
  .form-group label:not(.sr-only) + .autocomplete-widget .twitter-typeahead &,
  .form-group label:not(.sr-only) + .geounits-autocomplete-input-widget .twitter-typeahead &,
  .form-group label:not(.sr-only) ~ &.bootstrap-select .dropdown-toggle {
    height: 55px;/*$input-height-base;*/ // Make inputs at least the height of their button counterpart (base line-height + padding + border)
    padding: $padding-base-input;
  }
  // exception for long labels (two lines)
  .form-group label.long-label + &,
  .form-group label.long-label + span &,
  .form-group label.long-label + .twitter-typeahead &,
  .form-group label.long-label + .autocomplete-widget &,
  .form-group label.long-label + .autocomplete-widget .twitter-typeahead &,
  .form-group label.long-label + .geounits-autocomplete-input-widget .twitter-typeahead &,
  .form-group label.long-label:not(.sr-only) ~ &.bootstrap-select .dropdown-toggle {
    height: 70px;
    padding-top: 35px;
  }

  .form-group.form-group-mail label:not(.sr-only) + &,
  .form-group.form-group-mail label:not(.sr-only) + span &,
  .form-group.form-group-mail label:not(.sr-only) + .twitter-typeahead &,
  .form-group.form-group-password label:not(.sr-only) + &,
  .form-group.form-group-password label:not(.sr-only) + span &,
  .form-group.form-group-password label:not(.sr-only) + .twitter-typeahead & {
    padding-left: 30px;
  }
}
.form-group label:not(.sr-only) + .form-control-static,
.form-group label:not(.sr-only) + span .form-control-static,
.form-group label:not(.sr-only) + .twitter-typeahead .form-control-static {
  height: 40px;
  padding: $padding-base-input;
}
//exception for read only groups
.form-group.read-only-group label:not(.sr-only) + .form-control-static,
.form-group.read-only-group label:not(.sr-only) + span .form-control-static,
.form-group.read-only-group label:not(.sr-only) + .twitter-typeahead .form-control-static {
  padding: 20px 0 0 0;
}
input:not([type=checkbox]):not([type=radio]), textarea {
  &.form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
  }
}

select.form-control {
  padding: 0 26px 0 10px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url('/headers/ilusion/'+ $assets-folder +'/dist/svg/icon-ownfill-ui-chevron-down-46403c.svg');
  background-color: $input-bg;
  background-repeat: no-repeat;
  background-size: 10px 10px;
  background-position: right 10px top 50%;
  text-indent:0.01px;
  text-overflow: '';
  &::-ms-expand { display: none; }
  .form-group label:not(.sr-only) + &,
  .form-group label:not(.sr-only) + span &,
  .form-group label:not(.sr-only) + .twitter-typeahead & {
    padding-right: 30px;
    background-position: right 10px top 32px;
  }
  .form-group label.long-label:not(.sr-only) + &,
  .form-group label.long-label:not(.sr-only) + span &,
  .form-group label.long-label:not(.sr-only) + .twitter-typeahead & {
    background-position: right 10px top 47px;
  }
}
.form-group label:not(.sr-only) ~ .form-control.bootstrap-select {
  height: 55px;
  padding:0;
  .dropdown-toggle {
    padding-right: 20px;
    border: 1px solid $input-border;
    @include form-control-focus;
    outline: 0 !important;
    font-weight: $roboto-light;
    .caret {
      top: 32px;
      right: 10px;
      left: auto;
    }
    &:hover, &:focus {
      color: $brand-grey-dark;
    }
  }
}
.form-group label.long-label:not(.sr-only) ~ .form-control.bootstrap-select {
  height: 70px;
  .dropdown-toggle {
    .caret {
      top: 47px;
    }
  }
}


.form-group {
  margin-bottom: $form-group-margin-bottom;
  position: relative;
  &.form-group-mail, &.form-group-password {
    &:before {
      content: '';
      position: absolute;
      left: 10px;
      top: 30px;
      width: 16px;
      height: 16px;
      background: top left no-repeat transparent;
      background-size: 100% 100%;
      z-index: 2;
    }
  }
  &.form-group-password.includes_error input {
    background-image: none;
  }
  .form-group-password-icon {
    position: absolute;
    top: 20px;
    right: 1px;
    padding: 5px 10px 0;
    cursor: pointer;
    svg, svg * {
      width: 16px;
      height: 16px;
      vertical-align: middle;
      margin-right: 5px;
    }
  }
  &.read-only-group {
    margin-bottom: 10px;
  }
  &.form-group-mail:before {
    background-image: url('/headers/ilusion/'+ $assets-folder +'/dist/svg/icon-ownfill-graph-email-beb8b3.svg');
  }
  &.form-group-password:before {
    background-image: url('/headers/ilusion/'+ $assets-folder +'/dist/svg/icon-ownfill-graph-lock-beb8b3.svg');
  }
  label {
    position: absolute;
    top:1px;
    left:1px;
    right: 1px;
    display: block;
    max-width: 100%;
    border-radius: $border-radius-large;
    padding:5px 10px 0;
    margin-bottom: 0;
    font-size: $font-size-small;
    color:$brand-grey-dark;
    font-weight:$roboto-regular;
    text-align: left;
    line-height: 1.2;
    z-index: 3;
    pointer-events: none;
    &.textarea-label {
      background: #fff;
      top:1px;
      left:1px;
      right: 1px;
    }
  }
  &.read-only-group label {
    padding:5px 0 0;
  }
  label.textarea-label.disabled {
    background: $input-bg-disabled;
  }
}
fieldset.form-group {
  margin-bottom: 5px;
}

.radio,
.checkbox {
  margin-bottom: 15px;
  text-align: left;
  margin-top: 0;

  label {
    font-size: $font-size-base;
    font-weight: $roboto-light;
  }
}
.radio input[type="radio"],
.radio-inline input[type="radio"],
.checkbox input[type="checkbox"],
.checkbox-inline input[type="checkbox"] {
  margin-left: 0;
}
.radio label input[type="radio"],
.radio-inline label input[type="radio"],
.checkbox label input[type="checkbox"],
.checkbox-inline label input[type="checkbox"] {
  margin-left: -20px;
}
// Radios and checkboxes on same line
.radio-inline,
.checkbox-inline {
  padding-left: 20px;
  margin-bottom: 0;
  font-weight: normal;
}
.radio-inline + .radio-inline,
.checkbox-inline + .checkbox-inline {
  margin-top: 0;
  margin-left: 10px; // space out consecutive inline controls
}

input[type="radio"],
input[type="checkbox"] {
  &[disabled],
  &.disabled,
  fieldset[disabled] & {
    cursor: $cursor-disabled;
  }
}
// These classes are used directly on <label>s
.radio-inline,
.checkbox-inline {
  &.disabled,
  fieldset[disabled] & {
    cursor: $cursor-disabled;
  }
}
// These classes are used on elements with <label> descendants
.radio,
.checkbox {
  &.disabled,
  fieldset[disabled] & {
    label {
      cursor: $cursor-disabled;
    }
  }
}


// Help text
//
// Apply to any element you wish to create light text for placement immediately
// below a form control. Use for general help, formatting, or instructional text.

.help-block {
  display: block; // account for any element using help-block
  margin-top: 5px;
  margin-bottom: 10px;
  color: lighten($text-color, 25%); // lighten the text some for contrast
}


// Inline forms
//
// Make forms appear inline(-block) by adding the `.form-inline` class. Inline
// forms begin stacked on extra small (mobile) devices and then go inline when
// viewports reach <768px.
//
// Requires wrapping inputs and labels with `.form-group` for proper display of
// default HTML form controls and our custom form controls (e.g., input groups).
//
// Heads up! This is mixin-ed into `.navbar-form` in navbars.less.

// [converter] extracted from `.form-inline` for libsass compatibility
@mixin form-inline {

  // Kick in the inline
    // Inline-block all the things for "inline"
    .form-group {
      display: inline-block;
      margin-bottom: 0;
      vertical-align: middle;
    }

    // In navbar-form, allow folks to *not* use `.form-group`
    .form-control {
      display: inline-block;
      width: auto; // Prevent labels from stacking above inputs in `.form-group`
      vertical-align: middle;
    }

    // Make static controls behave like regular ones
    .form-control-static {
      display: inline-block;
    }

    .input-group {
      display: inline-table;
      vertical-align: middle;

      .input-group-addon,
      .input-group-btn,
      .form-control {
        width: auto;
      }
    }

    // Input groups need that 100% width though
    .input-group > .form-control {
      width: 100%;
    }

    label, .control-label {
      margin-bottom: 0;
      vertical-align: middle;
    }
    .form-group label:not(.sr-only), .form-group .control-label:not(.sr-only) {
      position: static;
      display: inline-block;
      width: auto;
      max-width: 100%;
      padding: 0;
      margin-bottom: 0;
      font-size: $font-size-base;
      line-height: $line-height-base;
      & + .form-control {
        padding-top: 0;
        height: $input-height-base;
        max-width: 100%;
      }
      & + select.form-control {
        background-position: right 10px top 50%;
      }
    }

    // Remove default margin on radios/checkboxes that were used for stacking, and
    // then undo the floating of radios and checkboxes to match.
    .radio,
    .checkbox {
      display: inline-block;
      margin-top: 0;
      margin-bottom: 0;
      vertical-align: middle;

      label {
        padding-left: 0;
      }
    }
    .radio input[type="radio"],
    .checkbox input[type="checkbox"] {
      position: relative;
      margin-left: 0;
    }

    // Re-override the feedback icon.
    .has-feedback .form-control-feedback {
      top: 0;
    }
}
// [converter] extracted as `@mixin form-inline` for libsass compatibility
.form-inline {
  @include form-inline;
}
.radio-group-inline {
  margin-bottom: 15px;
  .checkbox + .checkbox, .radio + .radio {
    margin-left: 15px;
  }
}

/* element for prefix + phone */
.form-prefix-phone {
  &:after {
    content:'';
    clear: both;
    width: 100%;
    display: block;
    height: 0;
  }
  .form-group {
    float: left;
    width:50%;
    // Small screen / tablet
    @media (max-width: $screen-sm-max) {
      width:40%;
      &.phone_number{width:60%;}
    }

    select {
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
      border-right: 0;
    }
    input {
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
      min-width: 160px;
    }
  }
}

.form-complete-date {
  margin-bottom: $form-group-margin-bottom;
  .form-inline {
    display: block;
    font-size: 0;
    border: 1px solid $input-border;
    border-radius: $input-border-radius; // Note: This has no effect on <select>s in some browsers, due to the limited stylability of <select>s in CSS.
    padding: 0;
    background: #fff;
    .form-group .form-control {
      border: 0;
      border-radius: 0;
      height: 30px;
      padding: 0 10px;
    }
    .form-group select.form-control {
      padding-right: 26px;
    }
    .form-group + .form-group .form-control {
      border-left: 1px solid $input-border;
    }
  }
  &.date-inline .form-inline {
    display: inline-block;
  }
  &.includes_error .form-inline {
    border: 1px solid $brand-red;
    .form-group .form-control {
      border: 0 !important;
    }
    .form-group + .form-group .form-control {
      border-left: 1px solid $input-border !important;
    }
    select.form-control {
      padding-right:26px;
      background-image: url('/headers/ilusion/'+ $assets-folder +'/dist/svg/icon-ownfill-ui-chevron-down-46403c.svg');
    }
    input.form-control {
      padding-right:10px;
      background-image: none;
    }
  }
  &.daymonthyear .form-inline {
    .form-group {
      width: 30%;
      .form-control {
        width: 100%;
      }
      &.date-day {
        .form-control {
          border-bottom-left-radius: 6px;
        }
      }
      &.date-year {
        width: 40%;
        .form-control {
          border-bottom-right-radius: 6px;
        }
      }
    }
  }
  &.monthyear .form-inline {
    .form-group {
      &:nth-child(2) {
        width: 43%;
      }
      &:nth-child(3) {
        width: 57%;
      }
      .form-control {
        width: 100%;
      }
      &:nth-of-type(2) {
        .form-control {
          border-bottom-left-radius: 6px;
        }
      }
      &:nth-of-type(3) {
        .form-control {
          border-bottom-right-radius: 6px;
        }
      }
    }
  }
  &.focus-element {
    .form-inline {
      box-shadow: 0 0 8px rgba(208, 203, 201, .8);
      .form-group .form-control:focus {
        box-shadow: none;
      }
    }
  }
}
.pseudo-label {
  display: block;
  width: 100%;
  padding:6px 10px 3px;
  margin-bottom: 0;
  font-size: $font-size-small;
  font-weight:$roboto-regular;
  color:$brand-grey-dark;
  text-align: left;
  font-weight:$roboto-regular;
  line-height: 1.2;
}