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

.van-sku {
  &-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 80%;
    max-height: max-content; /* avoid androiod keyboard cover fields */
    overflow-y: visible;
    font-size: @font-size-md;
    background: @white;
  }

  &-body {
    flex: 1 1 auto;
    max-height: 350px;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  /* sku header */
  &-header {
    margin-left: @padding-md;

    &__img-wrap {
      position: relative;
      float: left;
      width: 96px;
      height: 96px;
      margin: @padding-sm 0;
      background: @background-color;
      border-radius: 4px;

      img {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        max-width: 100%;
        max-height: 100%;
        margin: auto;
      }
    }

    &__goods-info {
      min-height: 96px;
      padding: @padding-sm 36px @padding-sm @padding-xs;
      overflow: hidden;
    }
  }

  &-header-item {
    margin-top: @padding-xs;
    color: @gray-dark;
    font-size: @font-size-sm;
    line-height: 16px;
  }

  &__price-symbol {
    font-size: @font-size-lg;
    vertical-align: middle;
  }

  &__price-num {
    font-weight: 500;
    font-size: 22px;
    vertical-align: middle;
    word-break: break-all;
  }

  &__goods-price {
    color: @red;
  }

  &__price-tag {
    position: relative;
    display: inline-block;
    margin-left: @padding-xs;
    padding: 0 5px;
    overflow: hidden;
    color: @red;
    font-size: @font-size-sm;
    line-height: 16px;
    vertical-align: middle;
    border-radius: 8px;

    &::before {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: currentColor;
      opacity: .1;
      content: '';
    }
  }

  &__close-icon {
    position: absolute;
    top: @padding-sm;
    right: @padding-md;
    color: @sku-icon-gray-color;
    font-size: 20px;
    text-align: center;
  }

  &-group-container {
    margin-left: @padding-md;
    padding: @padding-sm 0 2px;

    &--hide-soldout {
      .van-sku-row__item--disabled {
        display: none;
      }
    }
  }

  /* sku row */
  &-row {
    margin: 0 3px @padding-sm 0;

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

    &__title {
      padding-bottom: @padding-sm;
    }

    &__item {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 40px;
      margin: 0 @padding-sm @padding-sm 0;
      overflow: hidden;
      color: @text-color;
      font-size: 13px;
      line-height: 16px;
      vertical-align: middle;
      border-radius: 4px;

      &::before {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: @sku-item-background-color;
        content: '';
      }

      &-img {
        z-index: 1;
        width: 24px;
        height: 24px;
        margin: 4px 0 4px 4px;
        object-fit: cover;
        border-radius: 2px;
      }

      &-name {
        z-index: 1;
        padding: @padding-xs;
      }

      &--active {
        color: @red;

        &::before {
          background: currentColor;
          opacity: .1;
        }
      }

      &--disabled {
        color: @gray;
        background: @active-color;

        .van-sku-row__item-img {
          opacity: .3;
        }
      }
    }
  }

  /* sku stepper */
  &-stepper {
    &-stock {
      margin-left: @padding-md;
      padding: @padding-sm 0;
    }

    &-container {
      height: 30px;
      margin-right: 20px;
    }
  }

  &__stepper {
    float: right;

    &-title {
      float: left;
      line-height: 30px;
    }
  }

  &__stock {
    display: inline-block;
    margin-right: @padding-xs;
    color: @gray-dark;
    font-size: @font-size-sm;
  }

  &__quota {
    display: inline-block;
    color: @red;
    font-size: @font-size-sm;
  }

  &-messages {
    padding-bottom: @padding-xs;
    background: @background-color;

    &__image-cell {
      .van-cell__title {
        max-width: 90px;
      }

      .van-cell__value {
        overflow: visible;
        text-align: left;
      }
    }
  }

  &-img-uploader {
    display: inline-block;

    &__uploader {
      vertical-align: middle;
    }

    &__img {
      position: relative;
      float: left;
      width: 64px;
      height: 64px;
      margin-right: @padding-xs;
      background: @sku-item-background-color;
      border-radius: 2px;

      img {
        width: 100%;
        height: 100%;
        object-fit: contain;
      }
    }

    &__delete {
      position: absolute;
      top: -12px;
      right: -14px;
      z-index: 1;
      padding: 6px;
      color: @sku-upload-mask-color;
      opacity: .8;

      &::before {
        background-color: @white;
        border-radius: 14px;
      }
    }

    &__mask {
      position: absolute;
      top: 0;
      left: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      color: white;
      background: @sku-upload-mask-color;
    }

    &__warn-text {
      margin-top: 6px;
      font-size: @font-size-sm;
      line-height: 14px;
    }

    &__trigger {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      color: @sku-icon-gray-color;
    }
  }

  &-actions {
    display: flex;
    padding: @padding-xs @padding-md;

    .van-button {
      height: 36px;
      font-weight: 500;
      font-size: @font-size-md;
      line-height: 34px;
      border: none;
      border-radius: 0;

      &:first-of-type {
        border-top-left-radius: 18px;
        border-bottom-left-radius: 18px;
      }

      &:last-of-type {
        border-top-right-radius: 18px;
        border-bottom-right-radius: 18px;
      }

      &--warning {
        background: linear-gradient(to right, #ffd01e, #ff8917);
      }

      &--danger {
        background: linear-gradient(to right, #ff6034, #ee0a24);
      }
    }
  }
}
