/* ==========================================================================
  Forms
  Redefine form and select elements here.
 ========================================================================== */

/* Fix input field placeholder contrast
 ========================================================================== */

.input-field {
  // Placeholder styles
  &::-webkit-input-placeholder {
    color: $gray-light-contrast;
    font-style: italic;
    font-weight: 300;
  }

  &::-moz-placeholder {
    color: $gray-light-contrast;
    font-style: italic;
    font-weight: 300;
  }

  &:-ms-input-placeholder {
    color: $gray-light-contrast;
    font-style: italic;
    font-weight: 300;
  }

  &:-moz-placeholder {
    color: $gray-light-contrast;
    font-style: italic;
    font-weight: 300;
  }
}


/* Fix datepicker width
 ========================================================================== */

.input-field--block .datepicker {
  width: 100%;

  .input-field {
    width: 100%;
  }
}

/* Alternative sizes
 ========================================================================== */

.form-group--inline--large .input-field,
.form-group--inline--large select,
.js-select.js-select.js-select--large .js-select__input,
.select.select--large,
.input-field.input-field--large {
  height: 4.5rem;
  font-size: 2rem;
  height: 4.5rem;
}

.form-group--inline--small select,
.form-group--inline--small .input-field,
.input-field__wrapper--small .input-field,
.js-select__input.js-select__input--small,
.js-select.js-select.js-select--small .js-select__input,
.select.select--small,
.input-field.input-field--small {
  max-width: none; // this is defined in the vlaanderen css, I don't know why. I've had to overwrite it, because it was not an exception anymore.

  font-size: 1.4rem;
  height: 3rem;
  line-height: 1.5;
  padding-left: 1rem;
}

.js-select__input.js-select__input--small.js-select__input--multi {
  min-height: 3rem;
  font-size: 1.4rem;
  line-height: 1.5;
  padding-left: 0.4rem;

  .pill {
    font-size: 1.3rem;
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
    margin-right: 0.3rem;
    border-radius: 3px;
    height: 2.2rem;
    line-height: 2rem;

    .pill__close, .taggle_list .taggle .close {
      margin-top: -1px;
      height: 2.2rem;
    }


    &:last-child:after {
      height: 1.9rem;
      top: 0.05rem;
    }
  }

  &:after {
    top: 0.1rem;
  }
}

.input-field--min-content {
  width: min-content;
}

.input-field--max-content {
  width: max-content;
}

// TODO: review and put in component library


/* Labels
 ========================================================================== */

label.label--subtle {
  font-size: 1.5rem;
  color: $gray;
}

.form__label--block {
  display: block;
}

.form__label--large {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

/* Icons
 ========================================================================== */

.input-field-icon-container--left,
.input-field-icon-container--right {
  position: relative;
  display: inline-block;

  &.input-field-icon-container--block {
    display: block;
  }
}

i.input-field__icon {
  position: absolute;
  left: 1.5rem;
  top: 0.5rem;
  color: $gray;
  font-size: 1.6rem;
  pointer-events: none;
}

.input-field.input-field--large + i.input-field__icon {
  font-size: 2rem;
  top: 0.7rem;
}

.input-field.input-field--small + i.input-field__icon {
  font-size: 1.4rem;
  top: 0.45rem;
}

.input-field-icon-container--left {

  > .input-field {
    padding-left: 4rem;

    + i.input-field__icon {
      left: 1.5rem;
    }
  }

  > .input-field.input-field--large {
    padding-left: 4.5rem;
  }

  > .input-field.input-field--small {
    padding-left: 4rem;

    + i.input-field__icon {
      left: 1rem;
    }
  }
}

.input-field-icon-container--right {

  .input-field {
    padding-right: 4rem;

    + i.input-field__icon {
      left: auto;
      right: 1.5rem;
    }
  }

  > .input-field.input-field--large {
    padding-right: 4.5rem;
  }

  > .input-field.input-field--small {
    padding-right: 3rem;

    + i.input-field__icon {
      right: 1rem;
    }
  }
}

/* Select search behaviour
 ========================================================================== */

.input-field__wrapper {
  display: inline-block;
  position: relative;

  &.input-field__wrapper--block {
    display: block;
  }
}

.temporary-select__wrapper {
  display: inline-block;
  font-family: flanders-sans, sans-serif;
  position: relative;

  &.temporary-select__wrapper--block {
    display: block;

    .input-field__wrapper {
      display: block;
    }
  }

  .select__form-wrapper {
    padding: 1rem;
  }

  .select__search-results {
    position: absolute;
    background-color: white;
    width: calc(100% + 2px);
    display: block;
    left: -1px;
    border-left: 1px solid $blue-gray-light;
    border-right: 1px solid $blue-gray-light;
  }

  .tabs__wrapper {
    z-index: 2;
    background-color: white;
    width: 100%;
  }

  .select__tab__item {
    display: inline-block;
  }

  .select__tab {
    color: $gray-dark;
    text-align: left;
      cursor: pointer;
      font-size: 1.6rem;
      border: none;
      background: 0 0;
      padding: .7rem 1rem .5rem 1rem;
      font-weight: 400;
      transition: background .1s ease-in-out;
    font-family: flanders-sans, sans-serif;
  }

  .select__list-wrapper {
    max-height: 35vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 2px 2px rgba($blue-gray, 0.5);
    position: absolute;
    width: 100%;
    z-index: 5;
    background-color: $white;
    margin-bottom: 1rem;
  }

  .select__cta {
    display: block;
    width: 100%;
    color: $gray-dark;
    text-align: left;
      cursor: pointer;
      font-size: 1.6rem;
      border: none;
      background: 0 0;
      padding: .7rem 0 .5rem 3.2rem;
      font-weight: 400;
      transition: background .1s ease-in-out;
    font-family: flanders-sans, sans-serif;

    &:focus,
    &:hover,
    .select__cta[data-selected=true] {
      color: $primary-blue;
    }

    a.select__cta__title {
      text-decoration: none;
      color: $gray-dark;
    }

    &:hover,
    &.select__cta--active {
      position: relative;

      &:before {
          position: absolute;
          top: 1.3rem;
          left: 1rem;
          font-size: 7px;
          z-index: 2;

        font-family: vlaanderen_iconfont;
          font-style: normal;
          font-variant: normal;
          font-weight: 400;
          text-decoration: none;
          text-transform: none;

          content: "\E00C";
          color: $primary-blue;
      }

      .select__cta__title {
          display: block;
          font-size: 1.6rem;
          color: $primary-blue;
          text-decoration: underline;
          position: relative;
          z-index: 2;
      }

      &:after {
          content: '';
          position: absolute;
          top: 0;
          left: -2rem;
          width: calc(100% + 4rem);
          background: $blue-gray-lighter;
          height: 100%;
          z-index: 1;
      }
    }

    .select__cta:focus:after,
    .select__cta:hover:after,
    .select__cta[data-selected=true]:after {
      background-color: $blue-gray-lightest;
    }

  }

  a {
    position: relative;
    z-index: 2;
  }
}

.select__item.select__item--disabled {
  padding: 0.5rem 1rem;
}

.select__list--radios {
  .select__cta {
    position: relative;
    padding-left: 4rem;
  }

  .select__cta:before {
    font-size: 1.6rem;
    position: absolute;
    top: 0.8rem;
    left: 1rem;
    z-index: 2;
    font-family: fontawesome;
    font-style: normal;
    font-variant: normal;
    font-weight: 400;
    text-decoration: none;
    text-transform: none;
    color: $primary-blue;
    content: "\f10c";
    transition: all 200ms;
  }

  .select__cta:hover:before,
  .select__cta.select__cta--active:before {
    font-size: 1.6rem;
    position: absolute;
    top: 0.8rem;
    left: 1rem;
    z-index: 2;
    font-family: fontawesome;
    font-style: normal;
    font-variant: normal;
    font-weight: 400;
    text-decoration: none;
    text-transform: none;
    color: $primary-blue;
    content: "\f192";
  }
}

.select__list--checkboxes {
  .select__cta {
    position: relative;
    padding-left: 4rem;
  }

  .select__cta:before {
    font-size: 1.6rem;
    position: absolute;
    top: 0.8rem;
    left: 1rem;
    z-index: 2;
    font-family: fontawesome;
    font-style: normal;
    font-variant: normal;
    font-weight: 400;
    text-decoration: none;
    text-transform: none;
    color: $primary-blue;
    content: "\f096";
    transition: all 200ms;
  }

  .select__cta:hover:before,
  .select__cta.select__cta--active:before {
    font-size: 1.6rem;
    position: absolute;
    top: 0.8rem;
    left: 1rem;
    z-index: 2;
    font-family: fontawesome;
    font-style: normal;
    font-variant: normal;
    font-weight: 400;
    text-decoration: none;
    text-transform: none;
    color: $primary-blue;
    content: "\f14a";
  }
}


/* Multi select styling
 ========================================================================== */

.js-select__input--multi {
  background-image: none;
  position: relative;

  .pill {
    position: relative;
  }

  .pill:last-child:after {
    content: " ";
    height: 2rem;
    width: 1px;
    background-color: $gray;
    display: block;
    top: 0.1rem;
    position: absolute;
    right: -1rem;
    animation: blinker 1s linear infinite;
  }

  &:after {
    content: "\E004";
    display: block;
    position: absolute;
    right: 0.85rem;
    top: 0.3rem;
    font-size: 1.4rem;
    color: $gray;
    transform: rotate(90deg);
    font-family: vlaanderen_iconfont!important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-style: normal;
    font-variant: normal;
    font-weight: 400;
    text-decoration: none;
    text-transform: none;
  }
}


/* Inline forms
 ========================================================================== */

.form-group--inline {
  margin-bottom: 1rem;

  .form-group--inline--tiny {
    margin-bottom: 0.5rem;
  }

  .form-group--inline--small {
    margin-bottom: 1rem;
  }

  .form-group--inline--large {
    margin-bottom: 2rem;
  }

  .form-group__item,
  .input-field,
  select,
  .button {
    width: auto;
    float: left;
    margin-left: -1px;
  }
}

.grid.form-group {
  [class^="col--"]:first-child {
    .form-group__item,
    .input-field,
    select,
    .button {
      border-right: none;
    }
  }
}

/* Errors
 ========================================================================== */

.form__error {
  margin-bottom: 1.5rem;
}


/* Double input
 ========================================================================== */

.form__group--mobile-full-width {
  @include for-phone-only {
    width: 100% !important;
    margin-left: 0;
  }
}

/* Disabled state
 ========================================================================== */

textarea[disabled],
input[disabled] {
  background-color: rgba($gray-dark, 0.1);
  color: $gray;
}


/* Fix disabled input field background color
 ========================================================================== */

form.input-field--disabled {
  background-color: transparent;
}


/* ==========================================================================
  Style overwrite ember-power-select
 ========================================================================== */

/* trigger */

.ember-power-select-trigger {
  line-height: 3.5rem;
  padding: 0 1rem;
  overflow: hidden;
  position: relative;
  border-radius: 0 !important;
  border-color: $blue-gray-light;
}

  .ember-power-select-trigger.ember-basic-dropdown-trigger.ember-view.ember-power-select-trigger--active {
    border-color: $blue-gray-light;
    box-shadow: none;
  }

  .ember-power-select-trigger--active {
    outline: 2px solid $orange;
  }

  .ember-basic-dropdown-trigger--below.ember-power-select-trigger--active {
    outline: 0;
  }

/* search input */

.ember-power-select-search-input {
  font-family: flanders-sans,sans-serif;

  &::-webkit-input-placeholder {
    color: $gray-light-contrast;
    font-style: italic;
    font-weight: 300;
  }

  &::-moz-placeholder {
    color: $gray-light-contrast;
    font-style: italic;
    font-weight: 300;
  }

  &:-ms-input-placeholder {
    color: $gray-light-contrast;
    font-style: italic;
    font-weight: 300;
  }

  &:-moz-placeholder {
    color: $gray-light-contrast;
    font-style: italic;
    font-weight: 300;
  }
}

  .ember-power-select-search-input:focus {
    outline: none;
    border-color: $orange;
    box-shadow: inset 0 0 0 1px $orange;
  }

/* dropdown */ // Reformat

.ember-power-select-dropdown.ember-basic-dropdown-content--below,
.ember-power-select-dropdown.ember-basic-dropdown-content--above,
.ember-power-select-dropdown.ember-basic-dropdown-content--in-place,
.ember-power-select-trigger {
  border-radius: 0;
  border-color: $blue-gray-light;
  color: $gray-dark;
}

.ember-power-select-dropdown.ember-basic-dropdown-content--above {
  border-top: 1px solid $blue-gray-light;
}

.ember-basic-dropdown-content.ember-power-select-dropdown.ember-basic-dropdown-content--below {
  box-shadow: 0 2px 2px rgba($blue-gray, 1);
}


/* select */

.ember-power-select-option {
  line-height: 2.2rem !important;
  padding: 0.3em 0 0.3em 1.6em !important;
  position: relative;
}

  .ember-power-select-option.ember-power-select-option--loading-message,
  .ember-power-select-option.ember-power-select-option--no-matches-message,
  .ember-power-select-option.ember-power-select-option--search-message {
    padding-left: 0.5rem;
    color: $gray-light-contrast;
    font-style: italic;
    font-weight: 300;
  }

  .ember-power-select-option[aria-selected="true"],
  .ember-power-select-option[aria-current="true"] {
    background-color: $blue-gray-lighter !important;
    color: $primary-blue !important;
    text-decoration: underline;

     &:before {
      position: absolute;
      top: 0.8em; // 1.8em
      left: 1em;
      font-size: 7px; // 40%
      z-index: 2;
      font-family: vlaanderen_iconfont;
      font-style: normal;
      font-variant: normal;
      font-weight: 400;
      text-decoration: none;
      text-transform: none;
      content: "\E00C";
      color: $primary-blue;
    }
  }

  .ember-power-select-trigger-multiple-input,
  .ember-power-select-placeholder,
  .ember-power-select-selected-item {
    font-size: 1.6rem;
    margin-left: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  // Fix placeholder contrast
  .ember-power-select-trigger-multiple-input {
    &::-webkit-input-placeholder {
      color: $gray-light-contrast;
      font-style: italic;
      font-weight: 300;
    }

    &::-moz-placeholder {
      color: $gray-light-contrast;
      font-style: italic;
      font-weight: 300;
    }

    &:-ms-input-placeholder {
      color: $gray-light-contrast;
      font-style: italic;
      font-weight: 300;
    }

    &:-moz-placeholder {
      color: $gray-light-contrast;
      font-style: italic;
      font-weight: 300;
    }
  }

  .ember-power-select-placeholder,
  .ember-power-select-selected-item {
    display: inline;
  }

  // Fix placeholder contrast
  .ember-power-select-placeholder {
    color: $gray-light-contrast;
    font-style: italic;
    font-weight: 300;
  }

  .ember-power-select-trigger[aria-disabled="true"] .ember-power-select-placeholder {
    color: $gray;
  }

/* Restyle for steps with power select
 ========================================================================== */


.step .ember-power-select-trigger {
  padding-right: 6rem;
  height: 4.5rem;
  font-size: 1.8rem;
  width: 100%;
  display: block;
  line-height: 2.5;

  .ember-power-select-clear-btn {
    top: 1.2rem;
    line-height: 0.9;
    right: 35px;
  }
}

  .ember-power-select-trigger .ember-power-select-status-icon:after {
    content: "\E004";
    font-family: vlaanderen_iconfont!important;
    font-size: 1.4rem;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  .ember-power-select-status-icon {
    right: 0.8rem;
    width: 1.4rem !important;
    height: 1.4rem !important;
    color: $gray;
    border-width: 0 !important;
    transition: all 200ms;
    -webkit-transform: rotate(90deg) !important;
    -ms-transform: rotate(90deg) !important;
    transform: rotate(90deg) !important;
    line-height: 1;
  }

  .ember-basic-dropdown-trigger[aria-expanded="true"] .ember-power-select-status-icon {
    -webkit-transform: rotate(-90deg) !important;
    -ms-transform: rotate(-90deg) !important;
    transform: rotate(-90deg) !important;
  }

  .ember-power-select-clear-btn {
    background-color: $blue-gray-lighter;
    border-radius: 100%;
    position: absolute;
    width: 2rem;
    height: 2rem;
    line-height: 1.1;
    text-align: center;
    top: 0.5rem;
  }

.power-select.power-select--inline .ember-power-select-trigger,
.ember-power-select.ember-power-select--inline .ember-power-select-trigger { // remove second selector when all apps are updated
  display: inline-block;
}

/* Smaller size
 ========================================================================== */

.ember-power-select--small .ember-power-select-trigger,
.power-select.power-select--small .ember-power-select-trigger { // remove second selector when all apps are updated
  font-size: 1.4rem;
  height: 3rem;
  line-height: 1.8;
  padding-left: 0.5rem;
  padding-right: 3rem;
}

.ember-power-select--small .ember-power-select-trigger.ember-power-select-multiple-trigger {
  height: auto;
  min-height: 3rem;
}

/* bigger size
 ========================================================================== */

.ember-power-select--large .ember-power-select-trigger,
.power-select.power-select--large .ember-power-select-trigger { // remove second selector when all apps are updated
  font-size: 2rem;
  height: 4.5rem;
  line-height: 4.5rem;
  padding-right: 4.5rem;

  > * {
    font-size: 2rem;
  }
}

.ember-power-select--large .ember-power-select-trigger.ember-power-select-multiple-trigger {
  height: auto;
  min-height: 4.5rem;
}
