/* Basket sync: the "in basket" state of a product card.
   Partner of assets/js/basket-sync.js. Colours come from the site's role tokens
   (customizer-styles.css, re-pointed by eg-dark-mode.css), with the quantity
   box's own fallbacks, so the badge reads as part of the box in both themes. */

/* While a card is bound to a basket line the ADD button steps aside for the badge. */
.eg-basket-bound .mlvf-loop-add-button,
.eg-basket-bound .mlvf-custom-add-button,
.eg-basket-bound .single_add_to_cart_button,
.eg-basket-bound .added_to_cart.wc-forward {
    display: none !important;
}

.eg-in-basket {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    order: 1;
    flex-shrink: 0;
    max-width: 100%;
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1.5px solid var(--eg-brand-sage, #a5ccbc);
    background: var(--eg-surface-mint, #e8f5f3);
    color: var(--eg-accent, #2c5e54);
    font-family: brandon-grotesque, "Brandon Grotesque", sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    box-sizing: border-box;
    transition: opacity 0.15s ease;
}

.eg-in-basket__mark {
    font-weight: 700;
    font-size: 15px;
}

.eg-in-basket__text {
    white-space: nowrap;
}

.eg-in-basket__link {
    margin-left: 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--eg-blue-deep, #1f5566);
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.eg-in-basket__link:hover,
.eg-in-basket__link:focus-visible {
    color: var(--eg-accent, #2c5e54);
}

/* Saving: the badge dims and the tick spins until the server answers. */
.eg-basket-saving .eg-in-basket {
    opacity: 0.7;
}

.eg-basket-saving .eg-in-basket__mark {
    animation: eg-basket-spin 0.8s linear infinite;
}

@keyframes eg-basket-spin {
    to { transform: rotate(360deg); }
}

/* Saved: one gentle pulse, like the ADDED pulse the card already has. */
.eg-in-basket.is-saved {
    animation: eg-basket-pop 0.4s ease;
}

@keyframes eg-basket-pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Minus at the smallest amount becomes "take it out". */
.quantity .qty-btn.minus.eg-remove-mode {
    color: #b32d00 !important;
    background: #fff5f5 !important;
    border-color: #f3c1c1 !important;
}

.quantity .qty-btn.minus.eg-remove-mode:hover {
    background: #ffeaea !important;
    border-color: #b32d00 !important;
}

.quantity .qty-btn.minus.eg-remove-mode svg {
    display: block;
}

/* Variable cards: what is in the basket before a variation is picked. */
.eg-basket-chip {
    display: block;
    margin: 0 0 8px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--eg-brand-sage, #a5ccbc);
    background: var(--eg-surface-mint, #e8f5f3);
    color: var(--eg-accent, #2c5e54);
    font-family: brandon-grotesque, "Brandon Grotesque", sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    max-width: 100%;
}

.eg-basket-chip--single {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 13px;
    white-space: normal;
}

/* Something went wrong saving: same look as the card's add-to-cart error. */
.eg-basket-error {
    margin-top: 8px;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #feb2b2;
    background: #fff5f5;
    color: #b32d00;
    font-size: 0.8em;
    width: 100%;
    box-sizing: border-box;
}

/* Loop cards: the action row is a column (see my_loop_variations_final.css);
   keep the badge at its natural width like the ADD button it replaces. */
body.woocommerce ul.products li.product .mlvf-quantity-box .mlvf-action-row .eg-in-basket {
    width: auto;
    margin: 0;
}

/* Variable overlay in the loop is tight; let the badge wrap onto two lines. */
.woocommerce ul.products li.product .mlvf-var-overlay .eg-in-basket {
    padding: 5px 10px;
    font-size: 12px;
}

/* Product page: badge sits where the add button was, on its own line. */
.single-product.woocommerce div.product form.cart .eg-in-basket {
    margin: 8px 0;
    font-size: 14px;
    padding: 8px 14px;
}

@media (max-width: 480px) {
    .eg-in-basket {
        font-size: 12px;
        padding: 5px 10px;
    }
    .eg-in-basket__link {
        font-size: 11px;
    }
}
