$autocomplete-option-height: 48px;
$input-container-padding: 2px !default;
$input-error-height: 24px !default;

@keyframes md-autocomplete-list-out {
  0% {
    animation-timing-function: linear;
  }
  50% {
    opacity: 0;
    height: 40px;
    animation-timing-function: ease-in;
  }
  100% {
    height: 0;
    opacity: 0;
  }
}
@keyframes md-autocomplete-list-in {
  0% {
    opacity: 0;
    height: 0;
    animation-timing-function: ease-out;
  }
  50% {
    opacity: 0;
    height: 40px;
  }
  100% {
    opacity: 1;
    height: 40px;
  }
}
md-autocomplete {
  border-radius: 2px;
  display: block;
  height: 40px;
  position: relative;
  overflow: visible;
  min-width: 190px;
  &[disabled] {
    input {
      cursor: not-allowed;
    }
  }
  &[md-floating-label] {
    border-radius: 0;
    background: transparent;
    height: auto;

    md-input-container {
      padding-bottom: $input-container-padding + $input-error-height;

      // When we have ng-messages, remove the input error height from our bottom padding, since the
      // ng-messages wrapper has a min-height of 1 error (so we don't adjust height as often; see
      // input.scss file)
      &.md-input-has-messages {
        padding-bottom: $input-container-padding;
      }
    }
    md-autocomplete-wrap {
      height: auto;
    }
    button {
      position: absolute;
      top: auto;
      bottom: 0;
      right: 0;
      width: 30px;
      height: 30px;
    }
  }
  md-autocomplete-wrap {
    display: block;
    position: relative;
    overflow: visible;
    height: 40px;
    &.md-menu-showing {
      z-index: $z-index-backdrop + 1;
    }
    md-progress-linear .md-mode-indeterminate {
      position: absolute;
      top: 20px; left: 0; width: 100%;
      height: 3px;
      transition: none;

      .md-container {
        transition: none;
        height: 3px;
      }
      &.ng-enter {
        transition: opacity 0.15s linear;
        &.ng-enter-active {
          opacity: 1;
        }
      }
      &.ng-leave {
        transition: opacity 0.15s linear;
        &.ng-leave-active {
          opacity: 0;
        }
      }
    }
  }
  input:not(.md-input) {
    @include md-flat-input();
    width: 100%;
    padding: 0 15px;
    line-height: 40px;
    height: 40px;
  }
  button {
    position: relative;
    line-height: 20px;
    text-align: center;
    width: 30px;
    height: 30px;
    cursor: pointer;
    border: none;
    border-radius: 50%;
    padding: 0;
    font-size: 12px;
    background: transparent;
    margin: auto 5px;
    &:after {
      content: '';
      position: absolute;
      top: -6px;
      right: -6px;
      bottom: -6px;
      left: -6px;
      border-radius: 50%;
      transform: scale(0);
      opacity: 0;
      transition: $swift-ease-out;
    }
    &:focus {
      outline: none;

      &:after {
        transform: scale(1);
        opacity: 1;
      }
    }
    md-icon {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate3d(-50%, -50%, 0) scale(0.9);
      path {
        stroke-width: 0;
      }
    }
    &.ng-enter {
      transform: scale(0);
      transition: transform 0.15s ease-out;
      &.ng-enter-active {
        transform: scale(1);
      }
    }
    &.ng-leave {
      transition: transform 0.15s ease-out;
      &.ng-leave-active {
        transform: scale(0);
      }
    }
  }
  @media screen and (-ms-high-contrast: active) {
    $border-color: #fff;

    input {
      border: 1px solid $border-color;
    }
    li:focus {
      color: #fff;
    }
  }
}

.md-virtual-repeat-container.md-autocomplete-suggestions-container {
  position: absolute;
  box-shadow: 0 2px 5px rgba(black, 0.25);
  height: 41px * 5.5;
  max-height: 41px * 5.5;
  z-index: $z-index-tooltip;
}
.md-autocomplete-suggestions {
  margin: 0;
  list-style: none;
  padding: 0;
  li {
    cursor: pointer;
    font-size: 14px;
    overflow: hidden;
    padding: 0 15px;
    line-height: $autocomplete-option-height;
    height: $autocomplete-option-height;
    transition: background 0.15s linear;
    margin: 0;
    white-space: nowrap;
    text-overflow: ellipsis;

    &:focus {
      outline: none;
    }
  }
}

@media screen and (-ms-high-contrast: active) {
  md-autocomplete,
  .md-autocomplete-suggestions {
    border: 1px solid #fff;
  }
}
