/* Mobile product-card action popover.
   On touch devices a "+" toggle appears at the bottom-right of every product
   thumbnail. Tapping it reveals a popover with Wishlist / Compare /
   Quick-View / Add-to-Cart as uniform glass chips.

   The chips are the original <a> elements extracted from Minimog's
   .product-action wrappers (see JS), tagged with `.mca-chip--<kind>` so we
   can paint a distinct icon per kind via ::before. */

@media (hover: none) {

    /* ─────── + toggle: small liquid-glass button ─────── */
    .product-thumbnail .mca-toggle {
        position: absolute;
        right: 8px;
        bottom: 8px;
        z-index: 5;
        width: 28px;
        height: 28px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(255, 255, 255, 0.45);
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.35);
        -webkit-backdrop-filter: blur(12px) saturate(180%);
        backdrop-filter: blur(12px) saturate(180%);
        box-shadow:
            0 2px 8px rgba(0, 0, 0, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.6),
            inset 0 -1px 0 rgba(0, 0, 0, 0.04);
        color: #1c1c1c;
        cursor: pointer;
        line-height: 1;
        font-size: 0;
        transition: transform 0.18s ease, background-color 0.18s ease;
    }

    .product-thumbnail .mca-toggle::before {
        content: '+';
        font-size: 20px;
        font-weight: 300;
        line-height: 1;
        color: #1c1c1c;
        transition: transform 0.2s ease;
    }

    .product-thumbnail .mca-toggle:active {
        transform: scale(0.92);
    }

    .product-thumbnail .mca-toggle:focus-visible {
        outline: 2px solid rgba(28, 28, 28, 0.6);
        outline-offset: 2px;
    }

    /* Rotate + → × when open */
    .product-wrapper.mca-open .product-thumbnail .mca-toggle::before {
        transform: rotate(45deg);
    }

    /* ─────── popover: row of glass chips above the toggle ─────── */
    .product-thumbnail .mca-popover {
        position: absolute;
        right: 8px;
        bottom: 44px;
        z-index: 6;
        display: none;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        padding: 6px;
        background: rgba(255, 255, 255, 0.55);
        -webkit-backdrop-filter: blur(14px) saturate(180%);
        backdrop-filter: blur(14px) saturate(180%);
        border: 1px solid rgba(255, 255, 255, 0.4);
        border-radius: 999px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
        white-space: nowrap;
        max-width: calc(100% - 16px);
        animation: mca-popover-in 0.18s ease-out;
    }

    .product-wrapper.mca-open .product-thumbnail .mca-popover {
        display: inline-flex;
    }

    @keyframes mca-popover-in {
        from { opacity: 0; transform: translateY(6px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* Hide Minimog's original .product-actions container in mobile mode —
       we've moved its children out, but Minimog's auto-margin between
       buttons would still create a phantom column. */
    .product-thumbnail .product-actions {
        display: none !important;
    }
    .product-thumbnail .woocommerce_loop_add_to_cart_wrap:empty {
        display: none !important;
    }

    /* ─────── chips inside the popover ─────── */
    .product-thumbnail .mca-popover .mca-chip {
        flex-shrink: 0;
        width: 28px !important;
        height: 28px !important;
        margin: 0 !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(255, 255, 255, 0.6) !important;
        background-image: none !important;
        border: 1px solid rgba(255, 255, 255, 0.4) !important;
        border-radius: 50% !important;
        color: #1c1c1c !important;
        text-decoration: none !important;
        font-size: 0 !important; /* hide Minimog text labels */
        line-height: 1 !important;
        position: static !important;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
        transition: background-color 0.15s ease, transform 0.15s ease;
    }

    .product-thumbnail .mca-popover .mca-chip:active {
        transform: scale(0.92);
    }

    /* Icon via ::before — Font Awesome glyphs. Minimog ships Font Awesome 5
       Pro; we fall back to Free as a second family. Override any inherited
       ::before content. */
    .product-thumbnail .mca-popover .mca-chip::before {
        font-family: 'Font Awesome 5 Pro', 'Font Awesome 5 Free', 'Font Awesome 6 Pro', 'Font Awesome 6 Free', sans-serif;
        font-weight: 900;
        font-size: 13px;
        line-height: 1;
        color: #1c1c1c;
        content: '';
    }

    /* Suppress any pre-existing ::after from Minimog's button styles */
    .product-thumbnail .mca-popover .mca-chip::after {
        content: none !important;
    }

    /* Per-kind glyphs. Quick View is excluded on touch (the JS skips it). */
    .product-thumbnail .mca-popover .mca-chip--wishlist::before  { content: '\f004'; } /* heart */
    .product-thumbnail .mca-popover .mca-chip--compare::before   { content: '\f021'; } /* swap-arrows */
    .product-thumbnail .mca-popover .mca-chip--cart::before      { content: '\f07a'; } /* shopping cart */

    /* "Loading" / "Added" states for the add-to-cart chip */
    .product-thumbnail .mca-popover .mca-chip--cart.loading {
        opacity: 0.6 !important;
    }
    .product-thumbnail .mca-popover .mca-chip--cart.added::before {
        content: '\f00c'; /* check */
    }

    /* Hide any text nodes that Minimog injects via i / span inside the chip
       (the original markup has text like "Add to wishlist" + an icon span). */
    .product-thumbnail .mca-popover .mca-chip > * {
        display: none !important;
    }
}

/* ─────── Belt: hide everything on non-touch ─────── */
@media (hover: hover) {
    .product-thumbnail .mca-toggle,
    .product-thumbnail .mca-popover {
        display: none !important;
    }
}
