@import "../error-message/index";
@import "../hint/index";
@import "../label/index";

@include moaland-exports("moaland/component/select") {
  .moaland-select {
    @include moaland-font($size: 19, $line-height: 1.25);

    box-sizing: border-box; // should this be global?
    max-width: 100%;
    height: 40px;
    @if $moaland-typography-use-rem {
      height: moaland-px-to-rem(40px);
    }
    padding: moaland-spacing(1); // was 5px 4px 4px - size of it should be adjusted to match other form elements
    border: $moaland-border-width-form-element solid $moaland-input-border-colour;

    &:focus {
      outline: $moaland-focus-width solid $moaland-focus-colour;
      // Ensure outline appears outside of the element
      outline-offset: 0;
      // Double the border by adding its width again. Use `box-shadow` to do
      // this instead of changing `border-width` (which changes element size) and
      // since `outline` is already used for the yellow focus state.
      box-shadow: inset 0 0 0 $moaland-border-width-form-element;

      @include moaland-if-ie8 {
        // IE8 doesn't support `box-shadow` so double the border with
        // `border-width`.
        border-width: $moaland-border-width-form-element * 2;
      }
    }
  }

  .moaland-select option:active,
  .moaland-select option:checked,
  .moaland-select:focus::-ms-value {
    color: moaland-colour("white");
    background-color: moaland-colour("blue");
  }

  .moaland-select--error {
    border: $moaland-border-width-form-element-error solid $moaland-error-colour;

    &:focus {
      border-color: $moaland-input-border-colour;
    }
  }
}
