@import './var.less';

:root {
  --van-quantity-input-padding: @quantity-input-padding;
  --van-quantity-input-gap: @quantity-input-gap;
  --van-quantity-input-border-radius: @quantity-input-border-radius;
  --van-quantity-input-selected-background: @quantity-input-selected-background;
}

.van-quantity-input {
  display: flex;
  box-sizing: border-box;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: 60px;
  overflow: hidden;
  background: var(--van-gray-2);

  &__list {
    margin: var(--van-quantity-input-padding);
    overflow: hidden;
    background: var(--van-white);
    border-radius: var(--van-quantity-input-border-radius);
  }

  &__item {
    min-height: 44px;
    padding: 10px var(--van-padding-md);

    .van-cell__title,
    .van-cell__value {
      font-size: var(--van-font-size-md);
      line-height: var(--van-line-height-lg);
    }

    .van-cell__right-select {
      margin-left: var(--van-padding-sm);
    }
  }

  &__expanded-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px var(--van-padding-md) 4px;
  }

  &__bottom-panel {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--van-bottom-action-bar-z-index);
    overflow: hidden;
    background: var(--van-white);
    box-shadow: var(--van-quantity-input-action-shadow);
  }

  &__expanded {
    overflow: hidden;
    background: var(--van-white);
  }

  &__clear,
  &__collapse {
    display: inline-flex;
    align-items: center;
    padding: 0;
    color: var(--van-primary-color);
    font: inherit;
    font-size: var(--van-font-size-md);
    line-height: var(--van-line-height-lg);
    background: transparent;
    border: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;

    &:active {
      opacity: var(--van-active-opacity);
      transform: scale(0.96);
    }
  }

  &__collapse {
    gap: 2px;
    color: var(--van-gray-5);

    .van-icon {
      font-size: 16px;
    }
  }

  &__selected-list {
    display: flex;
    flex-direction: column;
    gap: var(--van-quantity-input-gap);
    max-height: 326px;
    padding: var(--van-padding-xs) var(--van-padding-md);
    overflow-y: auto;
  }

  &__selected-item {
    min-height: 44px;
    padding: 11px var(--van-padding-md);
    background: var(--van-quantity-input-selected-background);
    border: 0;
    border-radius: var(--van-quantity-input-border-radius);

    .van-cell__title {
      font-size: var(--van-font-size-md);
      line-height: var(--van-line-height-lg);
    }
  }

  &__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    color: var(--van-text-color-3);
    background: transparent;
    border: 0;

    .van-icon {
      font-size: 16px;
    }

    &:not(:disabled) {
      cursor: pointer;

      &:active {
        opacity: var(--van-active-opacity);
      }
    }
  }

  .van-bottom-action-bar {
    box-shadow: none;
  }
}

.van-quantity-input-expand-enter-active,
.van-quantity-input-expand-leave-active {
  overflow: hidden;
  transition: max-height 0.24s ease, opacity 0.2s ease;
}

.van-quantity-input-expand-enter-from,
.van-quantity-input-expand-leave-to {
  max-height: 0;
  opacity: 0;
}

.van-quantity-input-expand-enter-to,
.van-quantity-input-expand-leave-from {
  max-height: 520px;
  opacity: 1;
}
