@charset "UTF-8";
@import "../../theme/variables";
@import "~@jereation/sass-helpers/_mixins";

.vui-searchbar {
  @include display-flex;
  width: 100%;
  padding-top: .4rem;
  padding-bottom: .4rem;
  background-color: #efeff4;
  &.focus {
    .vui-searchbar-cancel {
      display: block;
    }
    .vui-searchbar-label {
      display: none;
    }
  }
  .fa {
    color: #aaa;
  }
  //干掉input[search]默认的clear button
  input[type=text]::-ms-clear {
    display: none;
    width: 0;
    height: 0;
  }

  input[type=text]::-ms-reveal {
    display: none;
    width: 0;
    height: 0;
  }

  input[type="search"]::-webkit-search-decoration,
  input[type="search"]::-webkit-search-cancel-button,
  input[type="search"]::-webkit-search-results-button,
  input[type="search"]::-webkit-search-results-decoration {
    display: none;
  }
}

.vui-searchbar-form {
  position: relative;
  @include flex(1);
  height: 100%;
  margin-right: 5px;
  margin-left: 5px;
  &:after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 200%;
    height: 200%;
    border: 1px solid #e6e6ea;
    @include border-radius(10px);
    @include transform(scale(.5));
    @include transform-origin(0, 0);
    background-color: #fff;
  }
}

.vui-searchbar-inner {
  position: relative;
  padding-left: 30px;
  padding-right: 30px;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
  z-index: 1;
  .vui-searchbar-input {
    padding: 4px 0;
    width: 100%;
    height: 100%;
    border: 0;
    background-color: transparent;
    &:focus {
      outline: none;
    }
  }
}

.vui-searchbar-icon-search, .vui-searchbar-icon-clear {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30px;
  i {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -.35rem;
    margin-left: -.35rem;
    font-size: .7rem;
  }
}

.vui-searchbar-icon-search {
  left: 0;
}

.vui-searchbar-icon-clear {
  right: 0;
}

.vui-searchbar-label {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  left: 1px;
  z-index: 2;
  border-radius: 3px;
  text-align: center;
  color: #9b9b9b;
  background-color: #fff;
  span, i {
    display: inline-block;
    margin-top: 3px;
  }
  i {
    margin-right: 5px;
    font-size: .7rem;
    color: #aaa;
  }
}

.vui-searchbar-cancel {
  display: none;
}

.vui-searchbar.focus {
  .searchbar-label {
    display: none;
  }
  .vui-searchbar-cancel {
    display: block;
  }
}

.vui-searchbar-input:not(:valid) ~ .icon-clear {
  display: none;
}
