// Increased to account for chip height
$control-height: control-height() + 0.8rem;
$backdrop-horizontal-spacing: spacing(tighter) * 1.5;

$stacking-order: (
  popover: 200,
);

// AutoSuggest Container Styles

.containerWrapper {
  width: 100%;
  border-radius: .5rem;
  cursor: text;
  min-height: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  position: relative;

  
  &.empty {
    min-width: 10rem;

    > .container {
      width:100%;
    }
  }

  //TODO: Consider using Stack component instead of adding margin.
  .Chip {
    // margin-top: control-vertical-padding();
    vertical-align: top;
    margin-bottom:.5rem;
    margin-right: .5rem;
    .chipContent {
      padding-right: 0px !important;
    }
  }
}
.labelWrapper {
  margin-top: -.6rem !important;
  z-index: 4;
  &.focused,
  &:not(.empty) {
    margin-top: auto !important;
  }
}

.textField{
  &:not(.focused) {
    .container {
      height: 0 !important;
      width: 0 !important;
    }
  }
  .suffix {
    margin-left: 0;
  }
}

.container {
  flex: 1 0 auto;
  display: inline-block;
  //overflow: hidden;
  // text-overflow: ellipsis;
}

.input {
  @include text-style-input;
  position: relative;
  display: block;
  flex: 1 1 0%;
  width: 100%;
  min-height: $control-height;
  margin: 0;
  padding: control-vertical-padding() 0;
  background: none;
  border: border(transparent);
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  z-index: 5;
  appearance: none;
  &:disabled {
    color: color(ink, lightest);
  }

  &:focus {
    outline: none;
  }

  &::placeholder {
    color: color(ink, lightest);
  }
}

// AutoSuggest Suggestions Styles

.suggestionsList {
  position: absolute;
  margin: -0.5rem 0 0;
  padding: 0;
  background: color(white);
  box-shadow: shadow();
  list-style-type: none;
  z-index: z-index(popover, $stacking-order);
  min-width: 13rem;
  max-width: 100rem;
}


// AutoSuggest Card Styles

.cardItem {
  padding: 0 0.4rem;

  &.highlighted {
    background: color(sky, light);
  }
  .subscriberIcon {
    width: 3.2rem;
    height: 3.2rem;
    background: color(ink, lightest);
    border-radius: 5rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    fill: color(white)
  }
  .avatarImage {
    border-radius: 50%;
    width: 4rem;
    height: 4rem;
    margin: 0.8rem 0 0.8rem 1.2rem;
    vertical-align: middle;
  }

  .nameStyle {
    @include text-style-body;
    margin: 1.8rem 0 1.8rem 1.2rem;
    // width: 200px;
  }

  .emailStyle {
    @include text-style-body;
    @include text-emphasis-subdued;
    margin: 1.8rem 1.2rem;
    // width: 200px;
  }

  .hinting {
    font-weight: bold;
  }
}

// TODO: Do we need these? Should display be none, or hidden?
.pickerResultShow{display:block;}
.pickerResultHide{display:none;}


.PopoverButtonWrap {
  min-height: 3rem;
  position: absolute;
  height: 100%;
  min-width: 13rem;
  .suggestionsList {
    width:100%;
    padding-bottom: 3rem;
    position: relative;
  }
  .pickerResultHide,
  .pickerResultShow{
    width: 100%;
    background: #fff;
    bottom: 3.5rem;
    position: relative;
    text-align: center;
    z-index: z-index(popover, $stacking-order);
    height: 3.5rem;
    line-height: 3rem;
  }

}

.error {
  .labelWrapper{
    cursor: pointer;
  }
  .input::placeholder {
    // This is the only place this color is used.
    // stylelint-disable-next-line color-no-hex
    color: #9c9798;
  }
  .input{
    cursor: pointer;
  }
  .backdrop {
    background-color: color(red, lighter);
    border-color: color(red);
    box-shadow: none;
    cursor: pointer;
  }
}

.pickerWithHeader {
  div[role="listbox"] {
    position: absolute;
    width: 100%;
    z-index: 999;
    &>div {
      position: relative;
      min-width: 13rem;
      max-width: 100rem;
    }
    .suggestionsList {
      position: relative;
    }
  }
  .PopoverButtonWrap {
        min-width: 13rem;
        max-width: 100rem;
        .suggestionsList {
          width: 100%;
          position: absolute;
        }
      }
}

