/**
 * Mini cart drawer upsell: free delivery nudge + complement strip.
 */

.mcf-drawer {
    padding: 12px 16px;
    border-top: 1px solid var(--wp--preset--color--border-color, #e0e0e0);
    background: var(--wp--preset--color--section-bg, #f8f8f8);
}

/* Nudge */
.mcf-drawer__nudge-text {
    margin: 0 0 6px;
    color: var(--wp--preset--color--heading, #2c1810);
    font-family: var(--wp--preset--font-family--outfit, "Outfit", sans-serif);
    font-size: 14px;
    font-weight: 600;
}

.mcf-drawer__nudge-text--done {
    color: var(--wp--preset--color--primary, #377237);
}

.mcf-drawer__nudge-bar {
    height: 6px;
    border-radius: 999px;
    background: var(--wp--preset--color--border-color, #e0e0e0);
    overflow: hidden;
}

.mcf-drawer__nudge-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--wp--preset--color--secondary, #9b1c1f);
}

@media (prefers-reduced-motion: no-preference) {
    .mcf-drawer__nudge-fill {
        transition: width 0.3s ease;
    }
}

.mcf-drawer__nudge-fill--done {
    background: var(--wp--preset--color--primary, #377237);
}

/* Suggestions */
.mcf-drawer__suggest {
    margin-top: 12px;
}

.mcf-drawer__suggest-heading {
    margin: 0 0 6px;
    color: var(--wp--preset--color--heading, #2c1810);
    font-family: var(--wp--preset--font-family--outfit, "Outfit", sans-serif);
    font-size: 14px;
    font-weight: 600;
}

.mcf-drawer__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.mcf-drawer__row-link {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
}

.mcf-drawer__row-link img {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
}

.mcf-drawer__row-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mcf-drawer__row-title {
    color: var(--wp--preset--color--heading, #2c1810);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcf-drawer__row-price {
    color: var(--wp--preset--color--secondary, #9b1c1f);
    font-size: 13px;
    font-weight: 700;
}

.mcf-drawer__row-price del {
    color: var(--wp--preset--color--body-text, #5a5a5a);
    font-weight: 400;
    margin-right: 4px;
}

.mcf-drawer__row-price ins {
    text-decoration: none;
}

.mcf-drawer__row-button {
    flex: 0 0 auto;
    padding: 7px 14px;
    background: var(--wp--preset--color--primary, #377237);
    color: #ffffff;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
}

.mcf-drawer__row-button:hover,
.mcf-drawer__row-button:focus {
    background: var(--wp--preset--color--secondary, #9b1c1f);
    color: #ffffff;
}

/* We are already in the basket - suppress WooCommerce's injected
   "View basket" link and keep the Add button for repeat adds. The
   theme styles .added_to_cart/.added with high specificity, hence
   the !important armour. */
.mcf-drawer .mcf-drawer__row a.added_to_cart {
    display: none !important;
}

.mcf-drawer .mcf-drawer__row a.mcf-drawer__row-button,
.mcf-drawer .mcf-drawer__row a.mcf-drawer__row-button.added {
    display: inline-block !important;
    background: var(--wp--preset--color--primary, #377237) !important;
    color: #ffffff !important;
}

.mcf-drawer .mcf-drawer__row a.mcf-drawer__row-button:hover,
.mcf-drawer .mcf-drawer__row a.mcf-drawer__row-button:focus {
    background: var(--wp--preset--color--secondary, #9b1c1f) !important;
}

/* Collapsible strip - the whole heading row toggles, with a clear
   circled chevron sized for thumbs. */
.mcf-drawer__suggest-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 4px 0;
    background: transparent;
    border: none;
    color: var(--wp--preset--color--heading, #2c1810);
    font-family: var(--wp--preset--font-family--outfit, "Outfit", sans-serif);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.mcf-drawer__suggest-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--wp--preset--color--border-color, #e0e0e0);
    border-radius: 50%;
    background: var(--wp--preset--color--base, #ffffff);
}

.mcf-drawer__suggest-chevron::before {
    content: "";
    width: 9px;
    height: 9px;
    margin-top: -4px;
    border-right: 2px solid var(--wp--preset--color--heading, #2c1810);
    border-bottom: 2px solid var(--wp--preset--color--heading, #2c1810);
    transform: rotate(45deg);
}

@media (prefers-reduced-motion: no-preference) {
    .mcf-drawer__suggest-chevron::before {
        transition: transform 0.2s ease;
    }
}

.mcf-drawer__suggest--collapsed .mcf-drawer__suggest-chevron::before {
    margin-top: 0;
    transform: rotate(-45deg);
}

.mcf-drawer__suggest--collapsed .mcf-drawer__suggest-rows {
    display: none;
}

/* Footer actions side by side on all sizes - reclaims a button's
   height of drawer space on mobile. */
.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions {
    display: flex;
    /* WC stacks these with flex-direction: column at equal specificity */
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 10px;
}

.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-components-button {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
}

/* ------------------------------------------------------------------ */
/* Desktop: larger drawer type                                         */
/*                                                                     */
/* Older customers read their cart here now that the cart page is out  */
/* of the flow - desktop gets a full size up while mobile keeps its    */
/* compact scale. !important where WooCommerce pins its own px sizes.  */
/* ------------------------------------------------------------------ */

@media (min-width: 782px) {
    .wc-block-mini-cart__drawer .wc-block-components-product-name {
        font-size: 17px !important;
        line-height: 1.35 !important;
    }

    .wc-block-mini-cart__drawer .wc-block-cart-item__prices,
    .wc-block-mini-cart__drawer .wc-block-components-product-price {
        font-size: 16px !important;
    }

    .wc-block-mini-cart__drawer .wc-block-components-product-details,
    .wc-block-mini-cart__drawer .wc-block-components-product-metadata,
    .wc-block-mini-cart__drawer .wc-block-components-product-metadata__description,
    .wc-block-mini-cart__drawer .wc-block-components-product-metadata__description p {
        font-size: 16px !important;
        line-height: 1.45 !important;
    }

    .wc-block-mini-cart__drawer .wc-block-components-quantity-selector input.wc-block-components-quantity-selector__input {
        font-size: 16px !important;
    }

    .wc-block-mini-cart__drawer .wc-block-components-totals-item,
    .wc-block-mini-cart__drawer .wc-block-mini-cart__footer .wc-block-components-totals-item__label,
    .wc-block-mini-cart__drawer .wc-block-mini-cart__footer .wc-block-components-totals-item__value {
        font-size: 18px !important;
    }

    .wc-block-mini-cart__drawer .wc-block-mini-cart__footer-actions .wc-block-components-button {
        font-size: 16px !important;
    }

    .wc-block-mini-cart__drawer .wc-block-mini-cart__title {
        font-size: 20px !important;
    }

    /* Our own drawer furniture keeps pace. */
    .wc-block-mini-cart__drawer .mcf-drawer__nudge-text {
        font-size: 15px;
    }

    .wc-block-mini-cart__drawer .mcf-drawer__suggest-toggle {
        font-size: 15px;
    }

    .wc-block-mini-cart__drawer .mcf-drawer__row-title {
        font-size: 15px;
    }

    .wc-block-mini-cart__drawer .mcf-drawer__row-price {
        font-size: 14px;
    }
}

/* Item prices in brand green so the cost stands out at a glance -
   all viewports. */
.wc-block-mini-cart__drawer .wc-block-components-product-price,
.wc-block-mini-cart__drawer .wc-block-cart-item__prices {
    color: var(--wp--preset--color--primary, #377237) !important;
    font-weight: 600;
}

/* Add-to-cart in flight: spinner on the button so the no-reload add
   visibly does something. */
form.cart .single_add_to_cart_button.loading,
form.cart button[type="submit"].loading {
    opacity: 0.75;
    pointer-events: none;
}

form.cart .single_add_to_cart_button.loading::after,
form.cart button[type="submit"].loading::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    vertical-align: -2px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: mcf-spin 0.6s linear infinite;
}

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