/**
 * Form styles.
 */

::-webkit-input-placeholder,
::-moz-placeholder,
:-ms-input-placeholder,
input:-moz-placeholder {
  font-style: italic;
}

//.form-type-checkbox,
.form-type-radio {
  display: flex;
  align-items: center;

  label {
    margin: 0;
  }
}

// Checkboxes / radio buttons.
.checkbox, .radio {
  // Remove top/bottom margins when in table context, because this is most
  // likely a tableselect checkbox element.
  table &.form-no-label {
    margin-bottom: 0;
    margin-top: 0;
  }
}

// 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;
  width: 100%;
  text-align: center;

  .form-inline & {
    width: auto;
  }

  .input-group & {
    display: table-cell;

    &:first-child .form-control:first-child {
      @include border-left-radius($border-radius);
    }

    &:last-child .form-control:first-child {
      @include border-right-radius($border-radius);
    }
  }

  select {
    appearance: none;
    line-height: 1;
    padding-right: 2em;

    &::-ms-expand {
      opacity: 0;
    }
  }

  // arrow down
  i {
    color: $primary;
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 26px;

    .has-error & {
      color: theme-color-level("danger", -10);
    }

    .has-success & {
      color: theme-color-level("success", -10);
    }

    .has-warning & {
      color: theme-color-level("warning", -10);
    }
  }
}

// Use CSS/SVG image for required mark.
// @see https://www.drupal.org/node/2152217
// @see https://www.drupal.org/node/2274631
.form-required:after {
  background-image: url(../img/required.svg);
  background-size: 10px 7px;
  content:"";
  display: inline-block;
  line-height:1;
  height: 7px;
  width: 10px;
  vertical-align: text-top;
}

// Form items.
.form-actions,
.form-item,
.form-text {
  margin: 0;
}

// Form action buttons.
.form-actions {
  .btn, .btn-group {
    @include cachet-book();
    margin-left: 10px;
  }

  .btn-group {
    .btn {
      margin-left: 0;
    }
  }
}

.btn-primary {
  background-color: $dark-blue;
  border-color: $dark-blue;
}
