/* WL Categories Block — matches archive-product template layout */
.wl-categories-block {
    width: 100%;
    max-width: var(--wp--style--global--wide-size, 1216px);
    margin-left: auto;
    margin-right: auto;
    padding: var(--wp--preset--spacing--16, 4rem) var(--wp--preset--spacing--10, 2.5rem);
    box-sizing: border-box;
}

.wl-categories-block .wl-categories-nav {
    scroll-margin-top: 15rem;
    margin-bottom: var(--wp--preset--spacing--3, 0.75rem);
}

/* Title — matches query-title styling */
.wl-products-title {
    font-size: var(--wp--preset--font-size--text-3-xl, 1.875rem);
    font-weight: 700;
    margin: var(--wp--preset--spacing--4, 1rem) 0 0.5rem;
    color: inherit;
}
.wl-products-count {
    font-weight: 400;
    color: #999;
    font-size: var(--wp--preset--font-size--text-base, 1rem);
}

/* Product grid — 5 columns matching archive-product */
.wl-products-grid {
    padding: 0;
    transition: opacity 0.2s;
}

/* Scope under .wl-categories-block and use ul.products to beat WooCommerce's
   own `.woocommerce ul.products li.product` rules (specificity 0-3-0), which
   are enqueued on the My Account page and otherwise override the grid with
   floats/widths. On the standalone WL Premium page those WC rules aren't
   present, but the higher specificity here is harmless and keeps both pages
   identical. */
.wl-categories-block .wl-products-grid ul.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(max(150px, calc(20% - 1.6rem)), 1fr));
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* WooCommerce adds a clearfix `ul.products::before/::after { content:" ";
   display:table }` for its float layout. In a grid those pseudo-elements
   become grid items and steal the first/last cell (empty space before the
   first product). Remove them. */
.wl-categories-block .wl-products-grid ul.products::before,
.wl-categories-block .wl-products-grid ul.products::after {
    content: none;
    display: none;
}

.wl-categories-block .wl-products-grid ul.products li.product {
    width: auto;
    float: none;
    clear: none;
    margin: 0;
    list-style: none;
    border: 1px solid var(--wp--preset--color--light-gray, #e6e6e6);
    border-radius: 0;
    overflow: hidden;
}

.wl-categories-block .wl-products-grid ul.products li.product a {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.wl-categories-block .wl-products-grid ul.products li.product img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0;
    margin-bottom: 0;
}

.wl-products-grid .product .wl-product-info {
    padding: var(--wp--preset--spacing--4, 1rem);
    display: flex;
    flex-direction: column;
    gap: var(--wp--preset--spacing--1, 0.25rem);
    flex-grow: 1;
}

.wl-products-grid .woocommerce-loop-product__title {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    text-align: left;
    font-family: var(--wp--preset--font-family--helvetica-now-display, inherit);
}

.wl-products-grid .price {
    font-size: var(--wp--preset--font-size--text-sm, 0.875rem);
    color: inherit;
}
.wl-products-grid .price::before {
    content: "Pris från: ";
    font-size: var(--wp--preset--font-size--text-sm, 0.875rem);
}

/* Pagination — centered */
.wl-pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 0;
}
.wl-pagination-current,
.wl-pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    text-decoration: none;
}
.wl-pagination-current {
    background: #1a1a1a;
    color: #fff;
    font-weight: 600;
}
.wl-pagination-link {
    background: #f5f5f5;
    color: #333;
}
.wl-pagination-link:hover {
    background: #e5e5e5;
}

.wl-no-products {
    text-align: center;
    color: #999;
    padding: 3rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .wl-categories-block {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    .wl-products-grid .products {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}
