.affilizz-block  {
    padding: var(--block-padding-block) var(--block-padding-inline);
    background: var(--background-color);

    color: var(--text-color);

    max-height: 80vh;
    overflow: visible;

    ::selection {
        background: var(--green-100);
    }

    a {
        outline: 0 !important;
        color: currentColor;
    }

    & + & {
        padding-block-start: 0;
    }

    &--border {
        padding-block-end: rem(16);
    }

    &--reduce {

        .affilizz-block__section--border {
            padding-block-end: rem(16);
        }
    }

    &__section,
    &__alert {
        & + *:not(.affilizz-block__section) {
            margin-top: rem(16);
        }
    }

    &__section {
        padding: rem(16) 0 0;
        .affilizz-block__title  {
            margin-top: rem(16);
        }

        &--select {
            padding-block-end: rem(20);
            padding: 0 !important;

            border-radius: var(--radius--lg);
            outline: rem(1) solid var(--background-color--light);
            outline-offset: rem(-1);

            position: relative;
            z-index: 10;

            + .affilizz-block__section--border {
                margin-top: rem(20);
            }

            &::before {
                content: "";
                display: block;
                width: rem(12);
                height: rem(12);

                border: rem(12) solid transparent;
                border-top-color: var(--background-color--light);
                position: absolute;
                bottom: 0;
                left: 50%;
                z-index: -1;
                transform-origin: center top;
                transform: translate(-50%,100%);
            }

            .affilizz-block__type__list  {
                margin-top: 1.25rem;
                padding-bottom: 1rem;
            }

            .affilizz-block__product {
                border: none;
                padding: rem(16) rem(24);
                gap: rem(12);

                border-radius: 0;
                border-top-left-radius: inherit;
                border-top-right-radius: inherit;
                background: var(--background-color--light);
                cursor: auto !important;

                transform: none !important;

                &::before {
                    display: none;
                }

                & + *  {
                    margin-top: rem(20);
                }

                &__title {
                    grid-row: 1/-1;
                    align-self: center;
                }

                img {
                    width: rem(72);
                    height: rem(72);
                    padding: rem(4);
                    border-radius: rem(2);
                    background-color: var(--background-color);
                }
            }
        }

        &--border {
            padding: rem(28);

            background: var(--background-color--light);
            border-radius: var(--radius--lg);

            position: relative;
            z-index: 2;

            + .affilizz-block__section--border {
                margin-top: rem(20);
            }

            &::before {
                content: "";
                display: block;
                width: calc(100% - #{ rem(16) } * 2);
                height: calc(100% - #{ rem(16) } * 2);

                background: var(--background-color);
                border-radius: var(--radius--sm);

                position: absolute;
                top: 50%;
                left: 50%;
                z-index: -1;
                transform: translate(-50%,-50%);
            }
        }

        .brand-and-price  {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: rem(8);
            margin-top: rem(8);

            & > *  {
                flex: 1;
            }

            & > *:first-child  {
                justify-content: end;
            }
        }
    }

    &__title  {
        // Needed to counter the padding from WordPress default styles
        padding: 0 !important;

        // Custom styles
        &.affilizz-title--thin + * {
            margin-top: rem(4);
        }
    }

    .affilizz-title  {
        + .affilizz-title  {
            margin-top: rem(10);
        }
    }

    &__section-title  {
        color: $black_medium !important;
        font-size: rem(16) !important;
        padding: 0 !important;
    }

    &__choice {
        padding: 0;

        display: flex;
        flex-wrap: wrap;
        justify-items: center;

        border-radius: var(--radius);
        border: rem(1) solid var(--stroke-color--light);
        background: var(--background-color);
        cursor: pointer !important;

        text-align: center;

        position: relative;
        z-index: 2;

        transition: var(--transition);

        &::before {
            content: "";
            display: block;
            width: 100%;
            height: 100%;

            border-radius: inherit;
            box-shadow: var(--drop-shadow);
            pointer-events: none;
            opacity: 0;

            position: absolute;
            top: 0;
            left: 0;
            z-index: -1;

            transition: var(--transition);
        }

        &:hover {
            border-color: var(--stroke-color);
            transform: translate(0,rem(-1));

            &::before {
                opacity: 1;
            }
        }

        & > *  {
            flex: 0 0 100%;
        }

        span {
            padding: rem(12) rem(24);
            font-size: rem(16);
            line-height: rem(20);
        }

        strong {
            @extend .affilizz-title, .affilizz-title--sm;
            display: block;
            font-weight: 600;
        }

        img {
            order: -1;
            display: block;
            padding: rem(12) 0;
            pointer-events: none;
            border-radius: var(--radius);
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
            aspect-ratio: 16/9;
            object-fit: contain;
        }

        &--blue {
            img {
                background-color: var(--background-color--lighter);
            }
        }
        &--yellow {
            img {
                background-color: var(--background-yellow--lighter);
            }
        }

        &__list {
            display: flex;
            justify-content: center;
            gap: rem(16);
        }

        &__item {
            flex: 1;
            max-width: rem(210);
        }
    }

    &__button {
        justify-self: start;
        border: none;

        &:hover {
            border: none;
        }
    }

    * + &__button {
        margin-top: rem(16);
    }

    &__checkbox  {
        &:selected  {
            + label  {
                &:before  {
                    background: red !important;
                }
            }
        }
    }

    &__filter {

        &__list {
            display: flex;
            flex-wrap: wrap;
            border: rem(1) solid var(--stroke-color--shade);
            gap: rem(1);
            margin-inline: 0;

            background: var(--stroke-color--shade);

            border-radius: var(--radius);
            overflow: hidden;

            + p {
                margin-bottom: 0 !important;
            }
        }

        &__item {
            display: grid;
            flex: 1 1 auto;
            margin: 0;

            background: var(--background-color);
            user-select: none;
            cursor: pointer;

            & > *  {
                grid-row: 1/-1 !important;
                grid-column: 1/-1 !important;
            }

            &.checked  {
                label {
                    color: var(--text-color--medium);

                    &::before {
                        background: var(--background-green--lighter);
                        opacity: 1;
                    }
                }
                &.checked-first, &.checked-last  {
                    label  {
                        &::before {
                            background: var(--background-green--medium);
                            opacity: 1;
                        }
                    }
                }
            }

            input {
                width: 100% !important;
                height: 100% !important;
                border: none !important;
                color: unset !important;
                outline: none !important;
                border-radius: 0 !important;
                appearance: none !important;
                box-shadow: none !important;
                margin: 0 !important;

                pointer-events: none;

                transition: var(--transition) !important;
            }

            label {
                width: 100%;
                padding-inline: rem(8);

                font-size: rem(14);
                font-weight: 500;
                line-height: rem(28);
                text-align: center;
                white-space: nowrap;
                color: var(--text-color--lighter);

                position: relative;
                z-index: 2;

                transition: var(--transition);

                &::before {

                    content: "";
                    display: block;
                    width: calc( 100% + calc( rem(2) ));
                    height: 100%;

                    background: var(--background-green--medium);
                    opacity: 0;

                    position: absolute;
                    top: 0;
                    left: 50%;
                    transform: translate(-50%,0);
                    z-index: -1;

                    transition: var(--transition);
                }
            }

            &:hover {
                label {

                    color: var(--text-color--medium);

                    &::before {
                        background: var(--background-green--lighter);
                        opacity: 1;
                    }
                }
            }
        }
    }

    * + &__filter {
        margin-top: rem(16);
    }

    &__back-button {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 1rem;
        margin-top: -0.5rem !important;
        background: var(--blue-0);
        padding: 0.25rem 0.5rem;
        border-radius: 5px;
        border: 1px solid var(--blue-300);
    }

    &__alert {
        padding: rem(16) rem(24);
        border-radius: var(--radius--lg);
        background: var(--background-color--lighter);

        font-size: rem(14);
        line-height: rem(22);

        a {
            color: currentColor !important;
            text-decoration: underline;
        }

        .affilizz-button--hollow  {
            border-color: var(--blue-800);
            color: var(--blue-800);

            // Recolor the SVGS through a filter
            img  {
                padding: 0 !important;
            }
        }

        &__actions  {
            display: flex;
            gap: rem(6);
            margin-top: rem(6);

            a  {
                padding: 0 rem(4);
            }
        }

        &--red {
            background: var(--background-red--lighter);
        }
        &--orange {
            background: var(--background-orange--lighter);
        }
    }

    &__type {

        &__item {
            margin-bottom: 0;
        }

        &__list {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: rem(8);
        }

        &__button {
            background: #fff;
            display: flex;
            flex-wrap: wrap;
            align-content: center;
            justify-content: center;
            flex: 0 0 rem(72);
            width: rem(72);
            border: rem(1) solid var(--stroke-color--medium);
            aspect-ratio: 1/1;
            border-radius: var(--radius);

            color: var(--text-color--medium);
            text-align: center;
            cursor: pointer !important;

            transition: var(--transition);

            p {
                flex: 0 0 100%;
                font-size: rem(14);
                font-weight: 400;
                margin-bottom: 0;
            }

            i {
                font-size: rem(20);
                margin-bottom: .2em;
                order: -1;
            }

            &.active {
                color: var(--text-color);

                background: var(--background-green--lighter);
                border-color: var(--stroke-color-dark);
            }

            &.disable {
                color: var(--text-color--lighter);
                border-color: var(--stroke-color--shade);
                background: var(--background-grey--lighter);

                cursor: default !important;
            }
        }
    }

    &__merchant {
        display: block;
        width: 100%;
        font-size: rem(12);
        line-height: rem(20);
        text-align: center;
        margin: 0;

        mark {
            color: var(--text-color--accent);
            font-weight: 500;
            font-size: rem(16);
        }

        span {
            display: inline-flex;
            align-items: baseline;
            gap: rem(4);
        }

        img {
            align-self: center;
            width: rem(20);
            object-fit: contain;
        }

        &--single {
            span {
                padding-inline-end: rem(8);
                border-right: rem(1) solid var(--stroke-color);
                margin-inline-end: rem(8);
            }
        }
    }

    &__message {
        padding-block: rem(4) rem(12);
        margin: 0;

        font-style: italic;
        font-size: rem(11);
        text-align: center;
        color: var(--text-color--medium);

        transform: translate(0, .2rem);

        transition: var(--transition);
    }

    &__infos  {
        text-align: center;
        margin: rem(16) auto;
        color: var(--blue-800);

        &__starting {
            display: flex;
            align-items: center;
            gap: 5px;
            justify-content: center;
            margin-bottom: 5px;

            img {
                max-height: 16px;
            }

            + br {
                display: none !important;
            }
        }

        .price  {
            font-size: rem(14);
            font-weight: 500;
            color: var(--text-color--accent);
        }

        em  {
            font-style: italic;
            font-size: rem(13);
            color: var(--blue-600);
        }

        img {
            max-width: rem(24);
        }
    }

    &__more-button  {
        display: flex;
        align-items: center;
        margin: 0 auto;
        cursor: pointer;
        justify-content: center;
        gap: 5px;

        img {
            max-width: 10px;
        }
    }

    * + &__merchant {
        margin-top: rem(8);
    }

    &__offers  {
        position: relative;


        &:after, &:before  {
            content: '';
            position: absolute;
            height: rem(16);
            width: 100%;
            z-index: 50;
        }

        &:before  {
            background: linear-gradient(white, transparent);
            top: 0;
        }

        &:after  {
            background: linear-gradient(transparent, white);
            bottom: 0;
        }

        &--scroller  {
            overflow-y: auto;
            overflow-x: hidden;
            max-height: 50vh;
            padding: rem(16) 0;
        }
    }

    &__price  {
        font-size: rem(14);
        font-weight: 500;
        color: var(--text-color--accent);
    }

    &__shop  {
        display: flex;
        flex-direction: column;
        background: $blue_background;
        border-radius: var(--radius);
        margin-bottom: rem(4);
        padding: rem(8);

        &-upper  {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
        }

        &-lower  {
            margin-top: 5px;

            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            gap: rem(16);

            .affilizz-button  {
                font-size: rem(12);
                padding: rem(2) rem(5);
            }
        }

        &-left  {
            display: flex;
            align-items: center;
            gap: 5px;

            img  {
                max-width: 16px;
                height: auto;
            }
        }

        &-right  {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: rem(4);
            font-weight: bold;
        }

        p  {
            margin: 0;
            font-size: rem(12);
        }

        &:last-child {
            margin-bottom: rem(16);
        }

        &__label {
            border-radius: 3px;
            font-weight: bold;
            font-size: rem(11);
            padding: rem(2) rem(3);
            line-height: 1;

            &--marketplace  {
                background: $black_light;
                color: $white_main;
                margin-left: rem(16);
            }

            &--refurbished {
                background: #fec8ff;
                color: var(--text-color);
            }

            &--refurbished {
                background: #fec8ff;
                color: var(--text-color);
            }

            &--used {
                background: #cfb8ff;
                color: var(--text-color);
            }
        }
    }

    &__loader  {
        position: absolute;
        border-radius: var(--border-radius);
        background: rgba(255, 255, 255, 0.9);
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 100;

        display: flex;
        justify-content: center;
        align-items: center;

        opacity: 0;
        transition: opacity 200ms ease-in;

        & > div  {
            text-align: center;
        }

        img  {
            transform: rotate(90deg);
        }

        p  {
            font-size: rem(16);
        }
    }

    &__more-button {
        background-color: #fff;
        color: #111453;
        border: none;
    }
}
