@import "../../themes/liberty.globals";

:host {
  display: inline-block;
  position: relative;

  font-size: 1em;
}

:host * {
  box-sizing: border-box;
}

:host(.lu-color) {
  select, option {
    color: current-color(base);
  }
}

:host([full-width]) {
  width: 100%;

  .select {
    width: 100%;
  }
}

.select {
  @include margin(2px, 0, 0, 0);
  @include padding(0);
  display: block;
  position: relative;

  max-width: 450px;
  height: 46px;

  transition: all .15s ease-in-out;

  border: 1px solid var(--lu-global-form-input-outline, var(--select-border-color,#686A6F));

  background: var(--select-background-color, #ffffff);

  font-size: 1em;

  overflow: hidden;

  // IE 11 fix to remove default dropdown arrow
  select::-ms-expand {
    display: none;
  }

  &.focused {
    svg {
      fill: #333;
    }
  }
}

.select--outline {
  @include position(null, null, 0, 0);
  position: absolute;

  width: 100%;
  height: 46px;

  transition: all .15s ease-in-out;

  border: 2px solid transparent;

  font-size: 1em;
  pointer-events: none;
}

.select.focused ~ .select--outline {
  border-color: $primary;
}

.select select {
  @include padding(10px, 4em, 11px, 10px);
  width: 100%;

  border: none;

  outline: none;

  background: none;

  font-size: 1em;

  line-height: 1.5;

  box-shadow: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  &:-moz-focusring {
    color: transparent;

    text-shadow: 0 0 0 #333;
  }
}

:host([is-invalid]) {
  .select--outline {
    border-color: $error;
  }
}

:host([is-valid]) {
  .select--outline {
    border-color: $success;
  }
}

:host(.is-disabled) {
  .select {
    background-color: #F1F1F1;
  }
}

.select__icon {
  @include position(null, 0, 0, null);
  @include padding(0.4em, 1em);
  position: absolute;

  width: 2.883em;
  height: 100%;

  font-size: 1rem;
  pointer-events: none;

  svg {
    display: inline-block;

    width: 100%;
    height: 100%;

    transition: all .15s ease-in-out;
    fill: #9b9b9b;
  }
}
