.astrashoptoolkit-bonuses {
    /* Shared plugin palette uses Astra colors when available and plugin fallbacks otherwise. */
    --asb-accent-color: var(--astrashoptoolkit-astra-color-0);
    --asb-heading-color: var(--astrashoptoolkit-astra-color-2);
    --asb-text-color: var(--astrashoptoolkit-astra-color-3);
    --asb-muted-color: var(--asb-text-color);
    --asb-surface-color: var(--astrashoptoolkit-astra-color-5);
    --asb-soft-surface-color: var(--astrashoptoolkit-astra-color-4);
    --asb-border-color: var(--astrashoptoolkit-border-color);
    color: var(--asb-text-color);
    width: 100%;
    min-width: 0;
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.astrashoptoolkit-bonuses,
.astrashoptoolkit-bonuses * {
    box-sizing: border-box;
}

.astrashoptoolkit-bonuses[hidden],
.astrashoptoolkit-bonuses__rule[hidden] {
    display: none;
}

.astrashoptoolkit-bonuses .astrashoptoolkit-bonuses__title {
    color: var(--asb-heading-color);
    margin: 0 0 4px;
    font-size: 1.05em;
}

/* Reguła bonusu bez własnej karty (ramki, tła, paddingu) – kartami są tylko produkty bonusowe w środku.
   Wygląd karty można nadal ustawić w widgecie Elementora. */
.astrashoptoolkit-bonuses__rule {
    min-width: 0;
}

.astrashoptoolkit-bonuses__rule-label {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
    margin-bottom: 12px;
    line-height: 1.5;
    font-weight: 600;
}

.astrashoptoolkit-bonuses__condition {
    color: var(--asb-heading-color);
}

.astrashoptoolkit-bonuses__condition,
.astrashoptoolkit-bonuses__progress {
    min-width: 0;
    overflow-wrap: anywhere;
}

.astrashoptoolkit-bonuses__progress {
    font-size: .82em;
    font-weight: 400;
    color: var(--asb-muted-color);
}

.astrashoptoolkit-bonuses__progress:empty {
    display: none;
}

.astrashoptoolkit-bonuses__rule--active .astrashoptoolkit-bonuses__progress {
    color: var(--asb-accent-color);
    font-weight: 600;
}

.astrashoptoolkit-bonuses__items {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
}

.astrashoptoolkit-bonuses__item {
    display: grid;
    grid-template-columns: var(--asb-image-size, 56px) minmax(0, 1fr) minmax(0, auto);
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--asb-border-color);
    border-radius: var(--astrashoptoolkit-radius-sm);
    background: var(--asb-surface-color);
    line-height: 1.4;
    transition: border-color .2s, background-color .2s, box-shadow .2s;
}

.astrashoptoolkit-bonuses__item-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--asb-image-size, 56px);
    height: var(--asb-image-size, 56px);
    overflow: hidden;
    border-radius: var(--astrashoptoolkit-radius-sm);
    background: var(--asb-soft-surface-color);
}

.astrashoptoolkit-bonuses .astrashoptoolkit-bonuses__item-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    object-fit: contain;
    border-radius: 0;
}

.astrashoptoolkit-bonuses__item-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.astrashoptoolkit-bonuses__item-name {
    color: var(--asb-heading-color);
    font-size: .92em;
    font-weight: 600;
    white-space: normal;
    overflow-wrap: anywhere;
}

.astrashoptoolkit-bonuses__item-qty {
    font-size: .82em;
    color: var(--asb-muted-color);
    white-space: nowrap;
}

.astrashoptoolkit-bonuses__item-price {
    color: var(--asb-heading-color);
    min-width: 0;
    justify-self: end;
    text-align: right;
    font-size: .9em;
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* The shop's global price-hiding rule must not hide a paid bonus price. */
.astrashoptoolkit-bonuses .astrashoptoolkit-bonuses__item-price .woocommerce-Price-amount.amount {
    display: inline !important;
    color: inherit;
}

@media (max-width: 480px) {
    .astrashoptoolkit-bonuses__item {
        grid-template-columns: var(--asb-image-size, 48px) minmax(0, 1fr);
        gap: 6px 10px;
        padding: 10px;
    }

    .astrashoptoolkit-bonuses__item-thumb {
        width: var(--asb-image-size, 48px);
        height: var(--asb-image-size, 48px);
        grid-row: 1 / span 2;
    }

    .astrashoptoolkit-bonuses__item-price {
        grid-column: 2;
        justify-self: start;
        text-align: left;
    }
}

.astrashoptoolkit-bonus-qty {
    display: inline-block;
    padding: .4em .6em;
    color: var(--astrashoptoolkit-astra-color-3);
}
