$chip-font-size: rem(1.6) !default;
$chip-height: rem(3.2) !default;
$chip-padding: 0 rem(1.2) 0 rem(1.2) !default;
$chip-input-padding: 0 !default;
$chip-remove-padding-right: rem(2.2) !default;
$chip-remove-line-height: rem(2.2) !default;
$chip-margin: rem(0.8) rem(0.8) 0 0 !default;
$chip-wrap-padding: 0 0 rem(0.8) rem(0.3) !default;
$chip-delete-icon-size: rem(1.8) !default;
$contact-chip-padding: 0 rem(2.5) 0 0 !default;
$contact-chip-suggestion-image-height: rem(4.0) !default;
$contact-chip-suggestion-margin: rem(0.8) !default;
$contact-chip-name-width: rem(12) !default;

.md-contact-chips {
  .md-chips {
    md-chip {
      @include rtl(padding, $contact-chip-padding, rtl-value($contact-chip-padding));
      .md-contact-avatar {
        @include rtl(float, left, right);
        img {
          height: $chip-height;
          border-radius: $chip-height / 2;
        }
      }
      .md-contact-name {
        display: inline-block;
        height: $chip-height;
        @include rtl-prop(margin-left, margin-right, rem(0.8), auto);
      }
    }
  }
}
.md-contact-suggestion {
  height: ($contact-chip-suggestion-margin * 2) + $contact-chip-suggestion-image-height;
  img {
    height: $contact-chip-suggestion-image-height;
    border-radius: $contact-chip-suggestion-image-height / 2;
    margin-top: $contact-chip-suggestion-margin;
  }
  .md-contact-name {
    @include rtl-prop(margin-left, margin-right, $contact-chip-suggestion-margin, auto);
    width: $contact-chip-name-width;
  }
  .md-contact-name, .md-contact-email {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.md-contact-chips-suggestions li {
  height: 100%;
}
.md-chips {
  @include pie-clearfix();

  display: block;
  font-family: $font-family;
  font-size: $chip-font-size;
  @include rtl(padding, $chip-wrap-padding, rtl-value($chip-wrap-padding));
  vertical-align: middle;

  &.md-readonly .md-chip-input-container {
    min-height: $chip-height;
  }

  &:not(.md-readonly) {
    cursor: text;
  }

  &.md-removable {

    md-chip {
      @include rtl-prop(padding-right, padding-left, $chip-remove-padding-right, 0);

      .md-chip-content {
        @include rtl-prop(padding-right, padding-left, rem(0.4), 0);
      }
    }

  }

  md-chip {
    cursor: default;
    border-radius: $chip-height / 2;
    display: block;
    height: $chip-height;
    line-height: $chip-height;
    @include rtl(margin, $chip-margin, rtl-value($chip-margin));
    padding: $chip-padding;
    @include rtl(float, left, right);
    box-sizing: border-box;
    max-width: 100%;
    position: relative;

    .md-chip-content {
      display: block;
      @include rtl(float, left, right);
      white-space: nowrap;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      &:focus {
        outline: none;
      }
    }
    &._md-chip-content-edit-is-enabled {
      -webkit-user-select: none; /* webkit (safari, chrome) browsers */
      -moz-user-select: none; /* mozilla browsers */
      -khtml-user-select: none; /* webkit (konqueror) browsers */
      -ms-user-select: none; /* IE10+ */
    }
    .md-chip-remove-container {
      position: absolute;
      @include rtl-prop(right, left, 0, auto);
      line-height: $chip-remove-line-height;
    }
    .md-chip-remove {
      text-align: center;
      width: $chip-height;
      height: $chip-height;
      min-width: 0;
      padding: 0;
      background: transparent;
      border: none;
      box-shadow: none;
      margin: 0;
      position: relative;
      md-icon {
        height: $chip-delete-icon-size;
        width: $chip-delete-icon-size;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate3d(-50%, -50%, 0);
      }
    }
  }
  .md-chip-input-container {
    display: block;
    line-height: $chip-height;
    @include rtl(margin, $chip-margin, rtl-value($chip-margin));
    padding: $chip-input-padding;
    @include rtl(float, left, right);
    input {
      &:not([type]),&[type="email"],&[type="number"],&[type="tel"],&[type="url"],&[type="text"] {
        border: 0;
        height: $chip-height;
        line-height: $chip-height;
        padding: 0;
        &:focus {
          outline: none;
        }
      }
    }
    md-autocomplete, md-autocomplete-wrap {
      background: transparent;
      height: $chip-height;
    }
    md-autocomplete {
      md-autocomplete-wrap {
        box-shadow: none;
      }
      input {
        position: relative;
      }
    }
    input {
      border:0;
      height: $chip-height;
      line-height: $chip-height;
      padding: 0;
      &:focus {
        outline:none;
      }
    }
    md-autocomplete, md-autocomplete-wrap {
      height: $chip-height;
    }
    md-autocomplete {
      box-shadow: none;
      input {
        position: relative;
      }
    }
    &:not(:first-child) {
      @include rtl(margin, $chip-margin, rtl-value($chip-margin));
    }
    input {
      background:transparent;
      border-width: 0;
    }
  }
  md-autocomplete {
    button {
      display: none;
    }
  }
}
// IE only
@media screen and (-ms-high-contrast: active) {
  .md-chip-input-container,
  md-chip {
    border: 1px solid #fff;
  }
  .md-chip-input-container md-autocomplete {
    border: none;
  }
}

