@import url("variables.css");

.brand-updates {
    margin: 0 0 50px;

    & .bu--widget {
        & .bu-filters {
            margin-bottom: 8px;
        }
    } 

    & .bu-filters {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    & .bu-filters__row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    & .bu-filters__row--brands {
        margin: 0 0 10px;
        position: relative;
    }

    & .bu-filters__row--brands::after {
        background-image: linear-gradient(270deg, #fff, hsla(0, 0%, 100%, 0));
        bottom: 0;
        content: "";
        position: absolute;
        right: 0;
        height: 40px;
        width: 40px;
        z-index: 1;
    }

    & .bu-filters__brands,
    & .bu-filters__tags {
        display: flex;
        gap: 8px;
    }

    & .bu-filters__tags {
        position: relative;
        flex: 1;
        overflow-x: auto;
        user-select: none;
        scrollbar-width: none;
    }

    & .bonuses__list {
        display: flex;
        gap: 14px;
        overflow-x: auto;
        padding-right: 40px;
        height: 40px;
        margin: 0;
        user-select: none;
        scrollbar-width: none;
        -ms-overflow-style: none;

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

        &.active {
            cursor: grabbing;

            & .bonuses__item {
                & .bonuses__checkbox {
                    input {
                        &:not(:checked) + .bonuses__checkmark:hover {
                            background-color: #eff5fc;
                        }
                    }

                    & .bonuses__checkmark {
                        cursor: grabbing;

                        & img {
                            pointer-events: none;
                        }
                    }
                }
            }
        }
    }

    & .bonuses__item {
        padding: 0;
        display: flex;
        flex-shrink: 0;
        list-style: none;

        & .bonuses__checkbox {
            display: flex;

            input {
                display: none;

                &:checked + .bonuses__checkmark {
                    border: 1px solid var(--color-active);
                }

                &:not(:checked) + .bonuses__checkmark:hover {
                    background-color: #e6f1f9;
                }
            }

            & .bonuses__checkmark {
                overflow: hidden;
                flex-shrink: 0;
                display: flex;
                align-items: center;
                justify-content: center;
                gap: 8px;
                height: 40px;
                background-color: #eff5fc;
                border-radius: 10px;
                border: 1px solid transparent;
                font-size: 12px;
                font-weight: 700;
                cursor: pointer;
                user-select: none;

                & img {
                    object-fit: contain;
                    width: 40px;
                    height: 40px;
                    border-radius: 10px;
                    overflow: hidden;
                    background-color: #fff;
                }

                &:has(> img) span {
                    padding: 0 14px 0 0;
                }

                span {
                    color: #2e3246;
                    padding: 0 14px;
                }
            }
        }
    }

    & .bu-chip {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        border: 1px solid #e7e9f0;
        border-radius: 10px;
        background: #fff;
        color: #101828;
        cursor: pointer;
        transition: all 0.15s ease;
        font-size: 12px;
        line-height: 1;
    }

    & .bu-chip img {
        width: 20px;
        height: 20px;
        object-fit: contain;
    }

    & .bu-chip--brand img {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        background: #fff;
    }

    & .bu-chip.is-active {
        border-color: #111827;
        background: #111827;
        border-color: #e5e7eb;
        box-shadow: 0 4px 14px rgba(17, 24, 39, 0.18);
        color: #fff;
    }

    & .bu-chip--ghost {
        border-color: #e5e7eb;
        background: #f5f7fb;
        color: #101828;
    }

    & .sort {
        align-items: center;
        background-color: transparent;
        border: none;
        cursor: pointer;
        display: flex;
        flex-shrink: 0;
        gap: 12px;
        min-height: 24px;
        outline: none;
        padding: 0;
    }

    & .sort__label {
        color: var(--color-secondary);
        display: block;
        font-size: 16px;
        font-weight: 400;
        line-height: 1;
    }

    & .sort__icon {
        display: flex;
    }

    & .bu-filters__row--sort-only {
        justify-content: flex-end;
        margin: 0 0 15px;
    }

    & .bu-filters__actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin: 0 0 16px;
    }

    & .bu-link {
        background: none;
        border: none;
        color: #475467;
        cursor: pointer;
        padding: 0;
        font-weight: 600;
    }

    & .bu-cards {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    & .bu-card {
        display: grid;
        grid-template-columns: 140px 1fr 200px;
        gap: 16px;
        background: #fff;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0px 10px 40px 0px rgba(109, 141, 173, 0.4);
        transition: transform 0.1s ease, box-shadow 0.1s ease;
        position: relative;
    }

    & .bu-card__body {
        padding: 12px 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    & .bu-card__media {
        display: flex;
        align-items: center;
        width: 100%;
        height: 100%;

        & img {
            width: 100%;
            height: 140px;
            object-fit: contain;
            display: block;
            border-radius: 0 !important;
        }
    }

    & .bu-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    & .bu-tag {
        display: inline-flex;
        align-items: center;
        background: #e7f1ff;
        color: #1d4ed8;
        border-radius: 999px;
        border: 1px solid #ffffff80;
        font-size: 10px;
        font-weight: 700;
        line-height: 1.2;
        padding: 4px 12px;
    }

    & .bu-card__title {
        margin: 0;
        font-size: 1.125em;
    }

    & .bu-card__title a {
        color: #101828;
        text-decoration: none;
        font-size: 1em;
    }

    & .bu-card__excerpt {
        margin: 0;
        color: var(--color-secondary);
        font-size: 0.75em;
        line-height: 1.2;
    }

    & .bu-edit-link {
        position: absolute;
        top: 4px;
        right: 4px;
        color: var(--color-link, #1b72e8);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: rgba(27, 114, 232, 0.08);
        text-decoration: none;
        transition: background 0.2s ease, color 0.2s ease;
    }

    & .bu-edit-link:hover,
    & .bu-edit-link:focus {
        background: rgba(27, 114, 232, 0.16);
        color: #0f4da8;
    }

    & .bu-excerpt__toggle {
        background: none;
        border: none;
        color: var(--color-secondary);
        cursor: pointer;
        padding: 0;
        font-size: 0.75em;

        &.is-open {
            margin-left: 1px;
        }
    }

    & .bu-card__details {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        padding: 12px 0;
    }

    & .bu-author {
        display: flex;
        align-items: center;
        gap: 8px;
        
    }

    & .bu-author__avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        box-shadow: 0px 0px 0px 2px #F1F3F4;
        overflow: hidden;
        
        & img {
            object-fit: cover;
            width: 100%;
            height: 100%;
        }
    }

    & .bu-author__info {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    & .bu-author__name {
        margin: 0;
        padding: 0;
        font-weight: 600;
        font-size: 12px;
        line-height: 1.2;
        text-decoration: underline;
        color: #2E3246;
    }

    & .bu-date {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 12px;
        line-height: 1.2;
        color: var(--color-secondary);
    }

    & .bu-date__icon {
        width: 12px;
        height: 12px;
        object-fit: contain;
        display: inline-block;
    }

    & .bu-button {
        border: none;
        background: var(--color-active);
        color: #fff;
        padding: 10px 18px;
        border-radius: 200px;
        cursor: pointer;
        font-weight: 500;
        text-decoration: none;
        transition: all 0.2s ease;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    & .bu-button:hover {
        color: #fff;
    }

    & .bu-empty {
        padding: 24px;
        text-align: center;
        color: #98a2b3;
        border: 1px dashed #e5e7eb;
        border-radius: 12px;
        background: #f9fafb;
    }

    & .bu-actions {
        display: flex;
        justify-content: center;
        margin-top: 20px;
    }

    & .bu-button--ghost {
        background: #B2BEC3;
        color: #fff;
        font-size: 14px;
        line-height: 1.2;
    }

    & .bu-card.is-hidden {
        display: none;
    }
}

@media (max-width: 767px) {
    .brand-updates {
        & .bu-card {
            grid-template-columns: 1fr;
        }

        & .bu-card__body {
            padding: 0 12px;
        }

        & .bu-card__details {
            padding: 0 12px 15px;
            gap: 12px;
        }
    }
}
