@import '../style/var';
@import '../style/mixins/ellipsis';

.van-card {
  position: relative;
  color: @card-text-color;
  padding: @card-padding;
  font-size: @card-font-size;
  box-sizing: border-box;
  background-color: @card-background-color;

  &:not(:first-child) {
    margin-top: 10px;
  }

  &__header {
    display: flex;
  }

  &__thumb {
    display: flex;
    position: relative;
    width: @card-thumb-size;
    height: @card-thumb-size;
    margin-right: 10px;
    flex: none;
    align-items: center;
    justify-content: center;

    img {
      border: none;
      max-width: 100%;
      max-height: 100%;
    }
  }

  &__content {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0; /* hack for flex box ellipsis */
    min-height: @card-thumb-size;

    &--centered {
      justify-content: center;
    }
  }

  &__title,
  &__desc {
    word-break: break-all;
  }

  &__title {
    line-height: @card-title-line-height;
    max-height: 32px;
    font-weight: 500;

    .multi-ellipsis(2);
  }

  &__desc {
    color: @card-desc-color;
    max-height: @card-desc-line-height;
    line-height: @card-desc-line-height;
  }

  &__bottom {
    line-height: 20px;
  }

  &__price {
    display: inline-block;
    color: @card-price-color;
    font-weight: 500;
  }

  &__origin-price {
    display: inline-block;
    margin-left: 5px;
    color: @card-origin-price-color;
    font-size: @card-origin-price-font-size;
    text-decoration: line-through;
  }

  &__num {
    float: right;
  }

  &__tag {
    position: absolute;
    top: 2px;
    left: 0;
  }

  &__footer {
    text-align: right;
    flex: none;

    .van-button {
      margin-left: 5px;
    }
  }
}
