/**
 * Badge component responsible for styling different kinds of badges.
 */

.#{$namespace}badge {
    $root: &;
    font-size: 1rem;
    border-radius: 2px;
    text-align: center;
    color: $colorWhite;
    background: $colorGray;
    padding: 0.15rem 0.5rem 0.2rem;
    box-shadow: 0 0 0 1px $colorWhite;
    transform: skew(-15deg);
    box-sizing: border-box;
    min-width: 1.9rem;
    overflow: hidden;
    display: inline-block;
    margin-left: 0.3rem;

    &--short {
        max-width: 2rem;
        max-height: 1.8rem;

        #{$root}__span {
            max-width: 1.2rem;
            max-height: 1.7rem;
        }
    }

    &--attention {
        background-color: $colorCrimson;

        &:before {
            background-color: $colorCrimson;
        }

        #{$root}__span {
            color: $colorWhite;
            font-weight: 400;
        }
    }

    &--info {
        background-color: $colorGold;

        &:before {
            background-color: $colorGold;
        }

        #{$root}__span {
            color: $colorMineShaft;
        }
    }

    &--amount {
        background-color: $colorCeruleanBlue;

        &:before {
            background-color: $colorCeruleanBlue;
        }

        #{$root}__span {
            color: $colorWhite;
        }
    }

    &--new {
        background-color: $colorGold;

        &:before {
            background-color: $colorGold;
        }

        #{$root}__span {
            color: $colorMineShaft;
        }
    }

    &--label {
        transform: skew(-15deg);
        height: 2.1rem;
        padding: 0.6rem 0.7rem 0.5rem 1.5rem;
        line-height: 1;
        box-shadow: none;
        text-indent: -0.5rem;
        border-radius: 3px;

        #{$root}__span {
            font-size: 1.2rem;
            text-transform: uppercase;
            transform: skew(15deg);
            font-weight: 400;
            padding-left: 0.4rem;
        }

        &#{$root}--new #{$root}__span {
            font-weight: 700;
        }
    }

    &--label-big {
        transform: skew(-15deg);
        height: 2.7rem;
        line-height: 1;
        box-shadow: none;
        padding: 0.8rem 0.6rem 0.5rem 0.5rem;
        border-radius: 3px;

        #{$root}__span {
            font-weight: 400;
            font-size: 1.5rem;
            text-transform: uppercase;
            transform: skew(18deg);
        }
    }

    &--cut {
        overflow: visible;
        display: inline-block;
        position: relative;
        padding-left: 0.5rem;
        padding-right: 0.4rem;
        margin-right: 0.5rem;

        #{$root}__span {
            transform: skew(15deg);
        }

        &:before {
            content: '';
            display: inline-block;
            height: 100%;
            width: 1.5rem;
            position: absolute;
            top: 0;
            left: -0.3rem;
            transform: skew(15deg);
            border-top-left-radius: 3px;
            border-bottom-left-radius: 3px;
        }

        #{$root}__span {
            transform: skew(15deg) translateX(-0.5rem);
            padding-left: 0.8rem;
        }
    }

    &--positive {
        background: $colorApple;
        color: $colorWhite;
        text-transform: uppercase;
        box-shadow: none;

        &:before {
            background-color: $colorApple;
        }
    }

    &--round {
        max-width: 10rem;
        transform: none;
        border-radius: 8px;
        box-shadow: none;
        padding: 0.7rem;

        @include media('>=phone-lg') {
            padding: 1rem;
        }

        #{$root}__icon {
            display: block;
            width: 2.8rem;
            height: 2.9rem;
            margin: 0 auto 0.7rem;
            fill: currentColor;
        }

        #{$root}__span {
            display: block;
            text-align: center;
            transform: none;
            text-transform: uppercase;
        }
    }

    &--free-shipping {
        #{$root}__icon {
            width: 3.5rem;
            height: 2rem;
            margin: 0.5rem auto 1.2rem;
        }
    }

    &--limited-offer {
        #{$root}__span {
            font-weight: 600;
            text-transform: uppercase;
        }
    }

    &__span {
        color: $colorWhite;
        display: inline-block;
        font-weight: 700;
        transform: skew(15deg);

        &--no-space {
            padding-left: 0 !important; // stylelint-disable-line
        }
    }

    & ~ & {
        margin-top: 0.5rem;
    }

    & ~ .#{$namespace}multiple-badges {
        margin-top: 0.5rem;
    }
}

.#{$namespace}multiple-badges {
    display: flex;
    padding-left: 0.2rem;

    .#{$namespace}badge {
        margin-left: 0.1rem;

        &.#{$namespace}badge {
            margin-top: 0;
        }
    }
}
