@import 'react-toolbox/lib/colors.css';
@import '../variables.css';
@import 'react-toolbox/lib/input/config.css';
@import './config.css';

.autocomplete {
  padding: var(--unit) 0;
  position: relative;

  @apply --reset;

  &.focus {
    & .suggestions {
      box-shadow: var(--zdepth-shadow-1);
      max-height: var(--autocomplete-overflow-max-height);
      visibility: visible;
    }
  }
}

.values {
  flex-direction: row;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0 0 calc(var(--unit) / 2) 0;
}

.value {
  margin: var(--autocomplete-value-margin);
}

.suggestions {
  background-color: var(--autocomplete-suggestions-background);
  list-style: none;
  max-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  position: absolute;
  transition-duration: var(--animation-duration);
  transition-property: max-height, box-shadow;
  transition-timing-function: var(--animation-curve-default);
  visibility: hidden;
  width: 100%;
  z-index: var(--z-index-high);

  &:not(.up) {
    margin-top: calc(-1 * var(--input-padding));
  }

  &.up {
    bottom: 0;
  }

  &::-webkit-scrollbar {
    height: 0;
    width: 0;
  }
}

.suggestion {
  cursor: pointer;
  font-size: var(--input-field-font-size);
  padding: var(--autocomplete-suggestion-padding);

  &.active {
    background-color: var(--autocomplete-suggestion-active-background);
  }

  &:hover {
    background-color: var(--autocomplete-suggestion-active-background);
  }
}

.input {
  position: relative;

  &::after {
    border-left: var(--autocomplete-border-size) solid transparent;
    border-right: var(--autocomplete-border-size) solid transparent;
    border-top: var(--autocomplete-border-size) solid var(--input-text-bottom-border-color);
    content: '';
    height: 0;
    pointer-events: none;
    position: absolute;
    right: var(--input-chevron-offset);
    top: 50%;
    transition: transform var(--animation-duration) var(--animation-curve-default);
    width: 0;
  }

}

.singleLine {
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  cursor: text;
  padding: 10px 18px 3px 0;
  margin-bottom: 10px;

  &::after {
    border-left: 5.48571px solid transparent;
    border-right: 5.48571px solid transparent;
    border-top: 5.48571px solid rgba(0, 0, 0, 0.12);
    content: '';
    height: 0;
    pointer-events: none;
    position: absolute;
    right: 8px;
    top: 50%;
  }
  & > * {
    vertical-align: middle;
  }

  & .input {
    display: inline-block;
    padding: 1px 0 1px 3px;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
  }
  & .input::after {
    border: 0;
  }
  & .input > input {
    display: inline-block;
    width: 100%;
    border-bottom: 0;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    min-width: 10px;
  }
  & .input > span {
    display: none;
  }

  & .suggestions:not(.up) {
    margin-top: 4px;
  }

  & .inputContainer {
    display: inline-block;
    position: relative;
    height: 32px;
    margin-left: 5px;
  }
  & .inputSizer {
    visibility: hidden;
    padding: 8px 2px;
    min-height: 35px;
    font-size: 16px;
    font-family: sans-serif;
  }

  & .singleLineBar {
    position: relative;
    width: calc(100% + 18px);
    display: block;
  }
  &.focus .singleLineBar::before, &.focus .singleLineBar::after {
    width: 50%;
  }
  & .singleLineBar::before, & .singleLineBar::after {
    background-color: var(--input-text-highlight-color);
    bottom: -4px;
    content: '';
    height: 2px;
    position: absolute;
    transition-duration: 0.2s;
    transition-property: width, background-color;
    transition-timing-function: var(--animation-curve-default);
    width: 0;
  }
  & .singleLineBar::before {
    left: 50%;
  }
  & .singleLineBar::after {
    right: 50%;
  }
  & .input > label {
    top: 6px;
    white-space: nowrap;
  }
  &&&.focus:not([disabled]):not([readonly]) label {
    display: none;
  }
}
