/**
 * Form styles.
 */

// Browsers do not recognize pseudo :after selectors, we must create a wrapper
// around the select element to style it properly.
// $see http://stackoverflow.com/q/21103542
.select-wrapper {
  display: inline-block;
  position: relative;
  width: 100%;
  .form-inline & {
    width: auto;
  }
  .input-group & {
    display: table-cell;
    // Reset rounded corners
    &:first-child .form-control:first-child {
      @include border-left-radius($border-radius-base);
    }
    &:last-child .form-control:first-child {
      @include border-right-radius($border-radius-base);
    }
  }
  select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    line-height: 1;
    padding-right: 2em;
    &::-ms-expand {
      opacity: 0;
    }
  }
  &:after {
    color: $brand-primary;
    content: '▼';
    font-style: normal;
    font-weight: 400;
    line-height: 1;
    margin-top: -.5em;
    padding-right: .5em;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 50%;
    z-index: 10;

    // Use a more stylish icon if the theme uses glyphicons.
    .has-glyphicons & {
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      content: '\e114'; // .glyphicon-chevron-down
      display: inline-block;
      font-family: 'Glyphicons Halflings';
      //margin-left: -10px;
      //margin-top: 2px;
    }
    .has-error & {
      color: $state-danger-text;
    }
    .has-success & {
      color: $state-success-text;
    }
    .has-warning & {
      color: $state-warning-text;
    }
  }
}

// Use CSS for required mark.
// Inspired from https://www.drupal.org/node/2152217.
.form-required:after {
  content:"";
  background-image: url(../images/required.svg);
  display: inline-block;
  line-height:1;
  color: #e00;
  background-size:7px 7px;
  width: 7px;
  vertical-align: super;
  margin-left: 4px;
  height: 7px;
}

.form-item {
  h4.label {
    border: none;
    padding: 0px;
    display: block;
    text-align: left;
    color: #000;
    font-size: 100%;
  }
}
