//*// MIXIN FORMS //*//

// Form validation states
//
// Used in forms.less to generate the form validation CSS for warnings, errors,
// and successes.

.form-control-validation(@plone-text-color: #555; @plone-border-color: #ccc; @plone-background-color: #f5f5f5) {
  // Color the label and help text
  .help-block,
  .control-label,
  .radio,
  .checkbox,
  .radio-inline,
  .checkbox-inline  {
    color: @plone-text-color;
  }
  // Set the border and box shadow on specific inputs to match
  .form-control {
    border-color: @plone-border-color;
    .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
    &:focus {
      border-color: darken(@plone-border-color, 10%);
      @plone-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@plone-border-color, 20%);
      .box-shadow(@plone-shadow);
    }
  }
  // Set validation states also for addons
  .input-group-addon {
    color: @plone-text-color;
    border-color: @plone-border-color;
    background-color: @plone-background-color;
  }
  // Optional feedback icon
  .form-control-feedback {
    color: @plone-text-color;
  }
}


// Form control focus state
//
// Generate a customized focus state and for any input with the specified color,
// which defaults to the `@input-border-focus` variable.
//
// We highly encourage you to not customize the default value, but instead use
// this to tweak colors on an as-needed basis. This aesthetic change is based on
// WebKit's default styles, but applicable to a wider range of browsers. Its
// usability and accessibility should be taken into account with any change.
//
// Example usage: change the default blue border and shadow to white for better
// contrast against a dark gray background.
.form-control-focus(@plone-color: @plone-input-border-focus) {
  @plone-color-rgba: rgba(red(@plone-color), green(@plone-color), blue(@plone-color), .6);
  &:focus {
    border-color: @plone-color;
    outline: 0;
    .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{plone-color-rgba}");
  }
}

// Form control sizing
//
// Relative text size, padding, and border-radii changes for form controls. For
// horizontal sizing, wrap controls in the predefined grid classes. `<select>`
// element gets special love because it's special, and that's a fact!
.input-size(@plone-input-height; @plone-padding-vertical; @plone-padding-horizontal; @plone-font-size; @plone-line-height; @plone-border-radius) {
  height: @plone-input-height;
  padding: @plone-padding-vertical @plone-padding-horizontal;
  font-size: @plone-font-size;
  line-height: @plone-line-height;
  border-radius: @plone-border-radius;

  select& {
    height: @plone-input-height;
    line-height: @plone-input-height;
  }

  textarea&,
  select[multiple]& {
    height: auto;
  }
}