/*
 * Pixonical WoodMart Product Grid v1.3.0
 * Equal-height WooCommerce/WoodMart cards + refined two-button footer.
 */

/* ==========================================================
   1) EQUAL HEIGHT GRID ITEMS
   ========================================================== */
.pxpg-enabled .products > .product,
.pxpg-enabled .wd-products > .product,
.pxpg-enabled .wd-products > .wd-product,
.pxpg-enabled .product-grid-item,
.pxpg-enabled .wd-product,
.pxpg-enabled .wd-carousel-item {
    display: flex;
    height: auto;
    align-self: stretch;
}

.pxpg-enabled .product-grid-item .product-wrapper,
.pxpg-enabled .wd-product .product-wrapper,
.pxpg-enabled .wd-carousel-item .product-wrapper {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 100%;
    padding: 16px 16px 18px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(17, 17, 17, .06);
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(24, 31, 45, .055);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.pxpg-enabled .product-grid-item:hover .product-wrapper,
.pxpg-enabled .wd-product:hover .product-wrapper {
    transform: translateY(-2px);
    border-color: rgba(17, 17, 17, .09);
    box-shadow: 0 10px 26px rgba(24, 31, 45, .08);
}

/* ==========================================================
   2) FIXED / CONSISTENT IMAGE AREA
   ========================================================== */
.pxpg-enabled .product-grid-item .product-element-top,
.pxpg-enabled .wd-product .product-element-top,
.pxpg-enabled .wd-carousel-item .product-element-top {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 260px;
    min-height: 260px;
    margin: 0 0 18px;
    overflow: hidden;
    background: #fff;
    border-radius: 11px;
}

.pxpg-enabled .product-grid-item .product-image-link,
.pxpg-enabled .wd-product .product-image-link,
.pxpg-enabled .wd-carousel-item .product-image-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.pxpg-enabled .product-grid-item .product-image-link img,
.pxpg-enabled .wd-product .product-image-link img,
.pxpg-enabled .wd-carousel-item .product-image-link img,
.pxpg-enabled .product-grid-item .product-element-top img,
.pxpg-enabled .wd-product .product-element-top img,
.pxpg-enabled .wd-carousel-item .product-element-top img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 245px !important;
    object-fit: contain !important;
    object-position: center !important;
}

/* ==========================================================
   3) CONTENT AREA - CONSISTENT TITLE + PRICE HEIGHTS
   ========================================================== */
.pxpg-enabled .product-grid-item .product-element-bottom,
.pxpg-enabled .wd-product .product-element-bottom,
.pxpg-enabled .wd-carousel-item .product-element-bottom {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 0;
    text-align: center;
}

.pxpg-enabled .product-grid-item .wd-entities-title,
.pxpg-enabled .wd-product .wd-entities-title,
.pxpg-enabled .wd-carousel-item .wd-entities-title,
.pxpg-enabled .product-grid-item .woocommerce-loop-product__title,
.pxpg-enabled .wd-product .woocommerce-loop-product__title {
    display: -webkit-box;
    width: 100%;
    min-height: 52px;
    max-height: 52px;
    margin: 0 0 11px !important;
    overflow: hidden;
    color: #111;
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.42 !important;
    text-align: center;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.pxpg-enabled .product-grid-item .wd-entities-title a,
.pxpg-enabled .wd-product .wd-entities-title a,
.pxpg-enabled .product-grid-item .woocommerce-loop-product__title a,
.pxpg-enabled .wd-product .woocommerce-loop-product__title a {
    color: inherit !important;
}

.pxpg-enabled .product-grid-item .price,
.pxpg-enabled .wd-product .price,
.pxpg-enabled .wd-carousel-item .price {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 7px;
    width: 100%;
    min-height: 42px;
    margin: 0 0 14px !important;
    color: #111 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    text-align: center;
}

.pxpg-enabled .product-grid-item .price ins,
.pxpg-enabled .wd-product .price ins,
.pxpg-enabled .wd-carousel-item .price ins {
    color: inherit;
    text-decoration: none;
}

.pxpg-enabled .product-grid-item .price del,
.pxpg-enabled .wd-product .price del,
.pxpg-enabled .wd-carousel-item .price del {
    opacity: .55;
    font-size: .88em;
    font-weight: 500;
}

/* Keep the product cards clean: title + price + two buttons. */
.pxpg-enabled .product-grid-item .wd-product-cats,
.pxpg-enabled .wd-product .wd-product-cats,
.pxpg-enabled .wd-carousel-item .wd-product-cats,
.pxpg-enabled .product-grid-item .star-rating,
.pxpg-enabled .wd-product .star-rating,
.pxpg-enabled .wd-carousel-item .star-rating,
.pxpg-enabled .product-grid-item .wd-product-stock,
.pxpg-enabled .wd-product .wd-product-stock,
.pxpg-enabled .product-grid-item .product-rating-price .star-rating,
.pxpg-enabled .wd-product .product-rating-price .star-rating,
.pxpg-enabled .product-grid-item .wd-swatches-grid,
.pxpg-enabled .wd-product .wd-swatches-grid {
    display: none !important;
}

/* ==========================================================
   4) HIDE WOODMART'S EXTRA GRID/HOVER ACTIONS
   ========================================================== */
.pxpg-enabled .product-grid-item .wd-buttons,
.pxpg-enabled .wd-product .wd-buttons,
.pxpg-enabled .wd-carousel-item .wd-buttons,
.pxpg-enabled .product-grid-item .woodmart-buttons,
.pxpg-enabled .wd-product .woodmart-buttons,
.pxpg-enabled .product-grid-item .wd-product-footer .wd-action-btn,
.pxpg-enabled .wd-product .wd-product-footer .wd-action-btn,
.pxpg-enabled .product-grid-item .product-element-top .wd-action-btn,
.pxpg-enabled .wd-product .product-element-top .wd-action-btn,
.pxpg-enabled .product-grid-item .quick-shop-wrapper,
.pxpg-enabled .wd-product .quick-shop-wrapper {
    display: none !important;
}

/* ==========================================================
   5) BADGES
   ========================================================== */
.pxpg-enabled .product-grid-item .product-labels,
.pxpg-enabled .wd-product .product-labels,
.pxpg-enabled .wd-carousel-item .product-labels {
    top: 12px;
    left: 12px;
    right: auto;
    z-index: 4;
}

.pxpg-enabled .product-grid-item .product-label,
.pxpg-enabled .wd-product .product-label,
.pxpg-enabled .wd-carousel-item .product-label {
    min-width: 0;
    min-height: 0;
    padding: 8px 11px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.pxpg-enabled .product-grid-item .product-label.out-of-stock,
.pxpg-enabled .wd-product .product-label.out-of-stock,
.pxpg-enabled .wd-carousel-item .product-label.out-of-stock {
    background: #e20f22;
    color: #fff;
}

/* ==========================================================
   6) REFINED TWO-BUTTON FOOTER
   ========================================================== */
.pxpg-enabled .pxpg-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    gap: 8px;
    width: 100%;
    margin-top: auto;
    padding-top: 2px;
}

.pxpg-enabled .pxpg-btn,
.pxpg-enabled .pxpg-btn.button {
    position: relative;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100% !important;
    min-width: 0;
    min-height: 46px !important;
    height: 46px !important;
    margin: 0 !important;
    padding: 9px 10px !important;
    overflow: hidden;
    border-radius: 8px !important;
    box-shadow: none !important;
    font-family: inherit;
    font-size: 13px !important;
    font-weight: 650 !important;
    line-height: 1 !important;
    text-align: center;
    text-decoration: none !important;
    text-transform: none !important;
    white-space: nowrap;
    transition: transform .17s ease, background-color .17s ease, color .17s ease, border-color .17s ease, box-shadow .17s ease;
}

/* Quick Shop: clean outlined secondary action. */
.pxpg-enabled .pxpg-quick-view {
    background: #fff !important;
    color: #222 !important;
    border: 1px solid #d9dde4 !important;
}

.pxpg-enabled .pxpg-quick-view:hover {
    background: #f4f6f8 !important;
    color: #111 !important;
    border-color: #bcc3cc !important;
    transform: translateY(-1px);
}

/* Add to Cart: stronger primary action. */
.pxpg-enabled .pxpg-add-cart,
.pxpg-enabled .pxpg-add-cart.button {
    background: rgb(241, 108, 7) !important;
    color: #fff !important;
    border: 1px solid rgb(241, 108, 7) !important;
}

.pxpg-enabled a.pxpg-add-cart:hover,
.pxpg-enabled a.pxpg-add-cart.button:hover {
    background: rgb(217, 94, 4) !important;
    color: #fff !important;
    border-color: rgb(217, 94, 4) !important;
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(241, 108, 7, .18) !important;
}

.pxpg-enabled .pxpg-btn::before,
.pxpg-enabled .pxpg-btn::after {
    display: none !important;
}

.pxpg-enabled .pxpg-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pxpg-enabled .pxpg-disabled {
    cursor: not-allowed;
    background: #f1f2f4 !important;
    color: #90949c !important;
    border-color: #e2e5e9 !important;
    box-shadow: none !important;
    opacity: 1;
}

.pxpg-enabled .pxpg-add-cart.loading {
    pointer-events: none;
    opacity: .7;
}

.pxpg-enabled .pxpg-add-cart.added {
    background: #173d2a !important;
    border-color: #173d2a !important;
}

/* WooCommerce may insert a separate View cart link after AJAX add. */
.pxpg-enabled .pxpg-actions + .added_to_cart,
.pxpg-enabled .product-grid-item > .added_to_cart,
.pxpg-enabled .wd-product > .added_to_cart {
    display: none !important;
}

/* ==========================================================
   7) TABLET
   ========================================================== */
@media (max-width: 1024px) {
    .pxpg-enabled .product-grid-item .product-wrapper,
    .pxpg-enabled .wd-product .product-wrapper,
    .pxpg-enabled .wd-carousel-item .product-wrapper {
        padding: 13px 13px 15px;
        border-radius: 12px;
    }

    .pxpg-enabled .product-grid-item .product-element-top,
    .pxpg-enabled .wd-product .product-element-top,
    .pxpg-enabled .wd-carousel-item .product-element-top {
        height: 220px;
        min-height: 220px;
        margin-bottom: 14px;
    }

    .pxpg-enabled .product-grid-item .product-image-link img,
    .pxpg-enabled .wd-product .product-image-link img,
    .pxpg-enabled .wd-carousel-item .product-image-link img,
    .pxpg-enabled .product-grid-item .product-element-top img,
    .pxpg-enabled .wd-product .product-element-top img,
    .pxpg-enabled .wd-carousel-item .product-element-top img {
        max-height: 205px !important;
    }

    .pxpg-enabled .product-grid-item .wd-entities-title,
    .pxpg-enabled .wd-product .wd-entities-title,
    .pxpg-enabled .wd-carousel-item .wd-entities-title,
    .pxpg-enabled .product-grid-item .woocommerce-loop-product__title,
    .pxpg-enabled .wd-product .woocommerce-loop-product__title {
        min-height: 46px;
        max-height: 46px;
        font-size: 16px !important;
    }

    .pxpg-enabled .product-grid-item .price,
    .pxpg-enabled .wd-product .price,
    .pxpg-enabled .wd-carousel-item .price {
        min-height: 38px;
        font-size: 15px !important;
    }

    .pxpg-enabled .pxpg-btn,
    .pxpg-enabled .pxpg-btn.button {
        min-height: 43px !important;
        height: 43px !important;
        padding: 8px 7px !important;
        font-size: 11.5px !important;
    }

    .pxpg-enabled .pxpg-icon {
        width: 16px;
        height: 16px;
        flex-basis: 16px;
    }
}

/* ==========================================================
   8) MOBILE - COMPACT CARD + FULL-WIDTH STACKED BUTTONS
   ========================================================== */
@media (max-width: 575px) {
    .pxpg-enabled .product-grid-item .product-wrapper,
    .pxpg-enabled .wd-product .product-wrapper,
    .pxpg-enabled .wd-carousel-item .product-wrapper {
        padding: 7px 7px 9px;
        border-radius: 10px;
        box-shadow: 0 3px 10px rgba(24, 31, 45, .045);
    }

    .pxpg-enabled .product-grid-item:hover .product-wrapper,
    .pxpg-enabled .wd-product:hover .product-wrapper {
        transform: none;
    }

    /* Smaller image stage keeps the overall card compact. */
    .pxpg-enabled .product-grid-item .product-element-top,
    .pxpg-enabled .wd-product .product-element-top,
    .pxpg-enabled .wd-carousel-item .product-element-top {
        height: 120px;
        min-height: 120px;
        margin-bottom: 7px;
        border-radius: 8px;
    }

    .pxpg-enabled .product-grid-item .product-image-link img,
    .pxpg-enabled .wd-product .product-image-link img,
    .pxpg-enabled .wd-carousel-item .product-image-link img,
    .pxpg-enabled .product-grid-item .product-element-top img,
    .pxpg-enabled .wd-product .product-element-top img,
    .pxpg-enabled .wd-carousel-item .product-element-top img {
        max-height: 112px !important;
    }

    .pxpg-enabled .product-grid-item .wd-entities-title,
    .pxpg-enabled .wd-product .wd-entities-title,
    .pxpg-enabled .wd-carousel-item .wd-entities-title,
    .pxpg-enabled .product-grid-item .woocommerce-loop-product__title,
    .pxpg-enabled .wd-product .woocommerce-loop-product__title {
        min-height: 34px;
        max-height: 34px;
        margin-bottom: 5px !important;
        font-size: 12.5px !important;
        line-height: 1.35 !important;
    }

    .pxpg-enabled .product-grid-item .price,
    .pxpg-enabled .wd-product .price,
    .pxpg-enabled .wd-carousel-item .price {
        min-height: 27px;
        margin-bottom: 7px !important;
        font-size: 12.5px !important;
        line-height: 1.15 !important;
    }

    /* One full-width button per row on mobile. */
    .pxpg-enabled .pxpg-actions {
        grid-template-columns: minmax(0, 1fr);
        gap: 5px;
        width: 100%;
        padding-top: 0;
    }

    .pxpg-enabled .pxpg-btn,
    .pxpg-enabled .pxpg-btn.button {
        width: 100% !important;
        min-height: 34px !important;
        height: 34px !important;
        gap: 5px;
        padding: 5px 8px !important;
        border-radius: 6px !important;
        font-size: 10.5px !important;
        letter-spacing: 0;
    }

    .pxpg-enabled .pxpg-icon {
        width: 13px;
        height: 13px;
        flex-basis: 13px;
    }

    .pxpg-enabled .product-grid-item .product-label,
    .pxpg-enabled .wd-product .product-label,
    .pxpg-enabled .wd-carousel-item .product-label {
        top: 7px;
        left: 7px;
        padding: 5px 7px;
        border-radius: 5px;
        font-size: 9px;
    }
}


/* ==========================================================
   9) LOADING STATES
   ========================================================== */
.pxpg-enabled .pxpg-btn.pxpg-is-loading,
.pxpg-enabled .pxpg-btn.loading {
    position: relative;
    pointer-events: none !important;
    cursor: wait !important;
    transform: none !important;
}

.pxpg-enabled .pxpg-btn.pxpg-is-loading > .pxpg-icon,
.pxpg-enabled .pxpg-btn.pxpg-is-loading > span,
.pxpg-enabled .pxpg-btn.loading > .pxpg-icon,
.pxpg-enabled .pxpg-btn.loading > span {
    opacity: 0 !important;
}

.pxpg-enabled .pxpg-btn.pxpg-is-loading::after,
.pxpg-enabled .pxpg-btn.loading::after {
    content: "" !important;
    display: block !important;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    opacity: 1 !important;
    animation: pxpg-spin .62s linear infinite;
}

.pxpg-enabled .pxpg-quick-view.pxpg-is-loading::after,
.pxpg-enabled .pxpg-quick-view.loading::after {
    color: #222;
}

.pxpg-enabled .pxpg-add-cart.pxpg-is-loading::after,
.pxpg-enabled .pxpg-add-cart.loading::after {
    color: #fff;
}

/* Keep sold-out state neutral. */
.pxpg-enabled .pxpg-add-cart.pxpg-disabled {
    background: #f3f4f6 !important;
    color: #9a9a9a !important;
    border-color: #e2e5e9 !important;
    box-shadow: none !important;
}

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