/*
 * WooCommerce catalog / loop styles.
 *
 * Ported Step 20.14 from old theme css/woocommerce.css — loop subset only.
 * The product card markup comes from woocommerce/content-product.php
 * (li > .shadow.p-4 wrapper) plus the loop filters in inc/woocommerce.php
 * (.wc-img-wrapper bg-image thumbnail, .category-name, "Starting from:"
 * price prefix) and loop/add-to-cart.php (.wt-link "View details" button).
 *
 * Loaded on WC contexts AND on the ACF flexible-content surfaces where the
 * [products] shortcode renders inside WYSIWYG fields (see inc/enqueue.php).
 *
 * Out of scope (not ported): cart/checkout/my-account form styling,
 * YITH wishlist/compare rules, slick-slider carousel variants — none of
 * that markup is emitted by v2 templates. Single-product styling lives in
 * woocommerce-single.css.
 */

/* --- Product grid --- */

ul.products {
    list-style: none;
    margin: 0 -0.75rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

ul.products > li.product {
    width: 100%;
    max-width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

@media (min-width: 1024px) {
    ul.products.columns-2 > li.product { flex: 0 0 auto; width: 50%; }
    ul.products.columns-3 > li.product { flex: 0 0 auto; width: 33.33333333%; }
    ul.products.columns-4 > li.product { flex: 0 0 auto; width: 25%; }
}

/* Equal-height cards within a row */
ul.products > li.product > .shadow { height: 100%; }

/* --- Card internals --- */

ul.products li.product a:not(.add_to_cart_button) {
    display: block;
    margin-bottom: 1rem;
}

ul.products li.product a .wc-img-wrapper {
    height: 300px;
    overflow: hidden;
}

ul.products li.product a .category-name {
    font-size: 14px;
    margin-bottom: 1rem;
}

ul.products li.product a .woocommerce-loop-product__title {
    color: var(--wt-black);
    font-size: 20px;
}

ul.products li.product a .price {
    display: block;
    color: var(--wt-black);
    font-weight: 600;
}

/* --- Sale flash --- */

/* !important: WC core positions .onsale absolutely with its own offsets */
.onsale {
    z-index: 3 !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    margin-left: 1rem;
    margin-top: 0.5rem;
    color: var(--wt-white);
    font-weight: 600 !important;
    background-color: var(--wt-red);
    border-radius: 6px;
    font-size: 12px;
    line-height: 12px;
    padding: 4px 8px;
}

ul.products li.product a:not(.add_to_cart_button) .onsale {
    left: auto !important;
    margin-left: 0 !important;
    right: 0 !important;
    margin-right: 1rem !important;
}

/* --- Add-to-cart fallback button (used when a product has no
       "View details" override — see loop/add-to-cart.php) --- */

ul.products li.product a.add_to_cart_button {
    line-height: 20px;
    padding: 15px 20px;
    border: 1px solid var(--wt-red);
    display: block;
    text-align: center;
    background-color: var(--wt-white);
    cursor: pointer;
    text-decoration: none;
    font-weight: 400;
    color: var(--wt-red);
    margin: 0 0 1rem 0;
}

ul.products li.product a.add_to_cart_button:hover {
    color: var(--wt-white);
    background-color: var(--wt-red);
}

ul.products li.product a.added_to_cart {
    display: inline-block !important;
    float: right;
    margin-top: 8px;
}

/* --- Catalog ordering + pagination --- */

.woocommerce-ordering select.orderby { height: 48px; }

.woocommerce-pagination .page-numbers > li {
    display: inline-block;
    margin: 0 4px;
}

.woocommerce-pagination .page-numbers > li > .page-numbers {
    border-color: var(--wt-red);
}
