@import '../../style/mixins';
@import '../../style/themes/default';

@searchPrefixCls: am-search;

/* 默认搜索bar */
.@{searchPrefixCls} {
  position: relative;
  display: flex;
  align-items: center;
  height: 88px;
  padding: 0 @h-spacing-md;
  overflow: hidden;
  background-color: @search-bar-fill;
  &-input {
    position: relative;
    width: 100%;
    height: @search-bar-input-height;
    overflow: hidden;
    background-color: @fill-base;
    .border-radius(@radius-sm);
    .@{searchPrefixCls}-synthetic-ph,
    input[type="search"] {
      position: absolute;
      top: 0;
      left: 0;
    }
    .@{searchPrefixCls}-synthetic-ph {
      z-index: 1;
      height: @search-bar-input-height;
      line-height: @search-bar-input-height;
      width: 100%;
      transition: width 0.3s;
      display: block;
      text-align: center;
      &-icon {
        display: inline-block;
        margin-left: @h-spacing-sm;
        margin-right: @h-spacing-sm;
        width: @icon-size-xxs;
        height: @icon-size-xxs;
        overflow: hidden;
        vertical-align: -5px;
        .encoded-svg-background('search_bar_search');
        background-repeat: no-repeat;
        background-size: @icon-size-xxs auto;
      }
      &-placeholder {
        color: @color-text-placeholder;
      }
    }
    input[type="search"] {
      z-index: 2;
      opacity: 0;
      width: 100%;
      text-align: left;
      display: block;
      color: @color-text-base;
      height: @search-bar-input-height;
      font-size: @searchbar-font-size;
      background-color: transparent;
      border: 0;
      .border-radius(@radius-sm);
      &::-webkit-input-placeholder {
        background: none;
        text-align: left;
        // color: @color-text-placeholder;
        color: transparent;
        // font-size: @input-font-size;
      }
      &::-webkit-search-cancel-button {
        -webkit-appearance: none;
      }
    }
    .@{searchPrefixCls}-clear {
      position: absolute;
      display: none;
      z-index: 3;
      width: @icon-size-xxs;
      height: @icon-size-xxs;
      border-radius: 50%;
      right: 24px;
      top: (@search-bar-input-height - @icon-size-xxs) / 2;
      background-color: @input-color-icon;
      background-position: center;
      background-repeat: no-repeat;
      .encoded-svg-background('search_bar_clear');
      background-size: @icon-size-xxs auto;
      transition: all .3s;
      &:active {
        .encoded-svg-background('search_bar_clear_active');
      }
      &-show {
        display: block;
      }
    }
    flex: 1;
  }
  &-cancel {
    flex: none;
    opacity: 0;

    margin-left: @h-spacing-md;
    height: 88px;
    line-height: 88px;
    font-size: @link-button-font-size;
    color: @brand-primary;
    text-align: right;

    &-anim {
      transition: margin-right 0.3s, opacity 0.3s;
      transition-delay: 0.1s;
    }
    &-show {
      opacity: 1;
    }
  }
  &.@{searchPrefixCls}-start {
    .@{searchPrefixCls}-input {
      input[type="search"] {
        opacity: 1;
        padding-left: @h-spacing-sm * 2 + @icon-size-xxs + 30px;
        &::-webkit-input-placeholder {
          // display: none;
          color: transparent;
        }
      }
      .@{searchPrefixCls}-synthetic-ph {
        padding-left: 30px;
        width: auto;
      }
    }
  }
}
