.nut-searchbar {
  display: flex;
  align-items: center;
  width: $searchbar-width;
  padding: $searchbar-padding;
  background: $searchbar-background;
  color: $searchbar-color;
  font-size: $searchbar-font-size;
  box-sizing: border-box;
  justify-content: center;

  .nut-icon {
    width: $searchbar-icon-size;
    height: $searchbar-icon-size;
    font-size: $searchbar-icon-size;
  }

  &-content {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 $searchbar-gap;
    height: $searchbar-input-height;
    background: $searchbar-content-background;
    border-radius: $searchbar-content-border-radius;
    border: scale-px(1px) solid $color-primary;
  }

  &-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    color: $color-primary;
  }

  &-leftin {
    margin-right: $searchbar-inner-gap;
  }

  &-rightin {
    font-size: $font-size-l;
    font-weight: 500;
    color: $color-primary;

    &.nut-searchbar-icon {
      color: var(--nutui-black-5);
    }
  }

  &-input-box,
  &-input {
    display: flex;
    align-items: center;
    flex: 1;
  }

  &-input {
    border: 0;
    outline: 0;
    box-sizing: border-box;
    width: 100%;
    padding: 0;
    margin: 0;
    font-size: $searchbar-font-size;
    color: $searchbar-input-text-color;
    caret-color: $searchbar-input-curror-color;
    background: transparent;
    text-align: $searchbar-input-text-align;
  }

  &-clear {
    &.nut-searchbar-icon {
      position: relative;
      .nut-icon {
        width: $icon-size-12;
        height: $icon-size-12;
        color: var(--nutui-black-5, rgba(0, 0, 0, 0.2));
        margin-right: $searchbar-inner-gap;
      }
      &::after {
        content: '';
        position: absolute;
        width: 100%;
        height: 200%;
        left: -20%;
      }
    }
  }

  &-values {
    position: absolute;
    display: flex;
    flex-direction: row;
    z-index: 2;
    background-color: $searchbar-content-background;
    top: scale-px(9px);
    left: scale-px(6px);
    font-size: $font-size-s;
    line-height: scale-px(12px);

    .nut-searchbar-value {
      display: flex;
      flex-direction: row;
      align-items: center;
      padding: scale-px(4px) scale-px(8px);
      background-color: $color-background-sunken;
      border-radius: scale-px(4px);
      margin-right: scale-px(2px);
    }

    .nut-icon {
      width: $icon-size-6;
      height: $icon-size-6;
      font-size: $icon-size-6;
      color: $color-text-disabled;
      margin-left: scale-px(4px);
    }
  }

  &-left,
  &-right {
    /* #ifdef dynamic*/
    display: flex;
    /* #endif */
    /* #ifndef dynamic*/
    display: inline-flex;
    /* #endif */
    align-items: center;

    &.nut-icon {
      width: scale-px(20px);
      height: scale-px(20px);
    }
  }

  &-left {
    margin-right: $searchbar-gap;

    & > div,
    & > span,
    & > i,
    & > svg,
    .nut-icon {
      margin-right: $searchbar-gap;

      &:last-child {
        margin-right: 0;
      }
    }
  }

  &-right {
    margin-left: $searchbar-gap;
    & > div,
    & > span,
    & > i,
    & > svg,
    .nut-icon {
      margin-left: $searchbar-gap;

      &:first-child {
        margin-left: 0;
      }
    }
  }

  &-left > text,
  &-left > view {
    margin-right: $searchbar-gap;

    &:last-child {
      margin-right: 0;
    }
  }

  &-right > text,
  &-right > view {
    margin-left: $searchbar-gap;

    &:first-child {
      margin-left: 0;
    }
  }

  &-round {
    border-radius: $searchbar-content-round-border-radius;
  }

  &-disabled {
    cursor: not-allowed;
  }

  &-focus {
    padding: scale-px(5px) $searchbar-gap;

    .nut-searchbar-content {
      border: scale-px(0.5px) solid $color-primary;
    }
  }
}

[dir='rtl'] .nut-searchbar,
.nut-rtl .nut-searchbar {
  &-left {
    margin-right: 0;
    margin-left: $searchbar-gap;

    & > div,
    & > span,
    & > svg {
      margin-right: 0;
      margin-left: $searchbar-gap;
      &.nut-icon {
        transform: rotate(180deg);
      }
      &:last-child {
        margin-right: 0;
        margin-left: 0;
      }
    }
  }
  &-right {
    margin-left: 0;
    margin-right: $searchbar-gap;

    & > div,
    & > span,
    & > svg {
      margin-left: 0;
      margin-right: $searchbar-gap;

      &:first-child {
        margin-left: 0;
        margin-right: 0;
      }
    }
  }

  &-left > text,
  &-left > view {
    margin-right: 0;
    margin-left: $searchbar-gap;

    &:last-child {
      margin-right: 0;
      margin-left: 0;
    }
  }

  &-right > text,
  &-right > view {
    margin-left: 0;
    margin-right: $searchbar-gap;

    &:first-child {
      margin-left: 0;
      margin-right: 0;
    }
  }
  &-input {
    text-align: var(--nutui-searchbar-input-text-align, right);
  }
}
