/*
Product box
==============================================
Styling for productbox component.
*/

$box-standard-height-img: 200px;
$box-image-height-img: 332px;

.product-box {
    height: 100%;
}

.product-variant-characteristics {
    min-height: 3em;

    .product-variant-characteristics-text {
        @include truncate-multiline(1.5em, 2, $sw-background-color);

        font-size: $font-size-sm;
    }

    .product-variant-characteristics-option {
        font-weight: $font-weight-bold;
    }
}

.product-image-wrapper {
    height: $box-standard-height-img;
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: 180px;
    margin-bottom: 15px;
    position: relative;
}

.product-image-link {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;

    &.is-cover {
        align-items: flex-start;
    }
}

.product-image {
    display: block;
    max-width: 100%;
    // 'max-height: 100%' not working in firefox
    max-height: $box-standard-height-img;

    &.is-standard,
    &.is-cover,
    &.is-contain {
        width: 100%;
        height: 100%;
    }

    &.is-cover {
        object-fit: cover;
    }

    &.is-contain {
        object-fit: contain;
    }

    &.is-standard {
        object-fit: scale-down;
    }
}

.product-image-placeholder {
    max-width: 180px;
    height: 100%;
}

.product-rating {
    margin-bottom: 10px;
    height: 25px;
}

/* stylelint-disable value-no-vendor-prefix, property-no-vendor-prefix */
// See for further information: https://github.com/postcss/autoprefixer/issues/1141#issuecomment-430938342
.product-name {
    color: $headings-color;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    height: 44px;
    margin-bottom: 10px;
    font-size: 18px;
    line-height: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;

    &:hover {
        color: var(--text-color-brand-primary);
        text-decoration: none;
    }
}

.product-description {
    height: 54px;
    margin-top: 10px;
    font-size: 14px;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
/* stylelint-enable value-no-vendor-prefix, property-no-vendor-prefix */

.product-price-info {
    margin-top: 10px;

    .product-advanced-list-price-wrapper {
        font-weight: $font-weight-normal;
    }
}

.product-price-unit {
    height: 36px;
    font-size: 14px;
    line-height: 18px;
    overflow: hidden;
}

.product-unit-label {
    font-weight: $font-weight-bold;
}

.product-cheapest-price {
    min-height: 20px;
    font-size: $font-size-sm;
    line-height: 20px;
    margin-bottom: 32px;

    .product-cheapest-price-price {
        font-weight: $font-weight-bold;
    }

    &.with-regulation-price,
    &.with-list-price {
        margin-bottom: 6px;
    }

    &.with-from-price {
        margin-bottom: 5px;
    }
}

.product-price {
    color: $headings-color;
    min-height: 20px;
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 18px;
    font-weight: $font-weight-bold;
    line-height: 20px;
    overflow: hidden;

    &.with-list-price {
        color: #e52427;
    }

    .list-price {
        color: $headings-color;
        font-weight: $font-weight-normal;
        padding-left: 5px;
        font-size: 12px;

        .list-price-price {
            text-decoration: line-through;
        }
    }

    .regulation-price {
        color: $headings-color;
        font-weight: $font-weight-normal;
        padding-left: 5px;
        font-size: 12px;
        padding-left: 0;
    }

    .list-price-no-line-through .list-price-price {
        text-decoration: none;
    }

    .strikeprice-text {
        color: $headings-color;
        font-weight: $font-weight-normal;
        padding-left: 5px;
        font-size: 12px;
    }
}

.product-action {
    margin-top: 20px;
}

.product-badges {
    position: absolute;
    top: 30px;
    left: -1px;
    z-index: 10;

    .badge {
        padding: 0 8px;
        height: 32px;
        margin: 0 0 8px;
        line-height: 32px;
        font-weight: $font-weight-bold;
        color: $white;
        border-radius: 0 3px 3px 0;
        border-color: transparent;
        font-size: 18px;
        letter-spacing: 0;
    }
}

.product-box {
    &.box-image {
        .product-image-wrapper {
            height: $box-image-height-img;
        }

        .product-image {
            max-height: $box-image-height-img;
        }

        // box-image uses cover mode for standard display mode
        .product-image.is-standard {
            height: 100%;
            object-fit: cover;
        }
    }
}

.product-price-wrapper {
    font-size: 18px;
}
