/*
 * Columns and gap per breakpoint are set by Elementor's own responsive
 * controls (see LayoutControls), which generate {{WRAPPER}}-scoped CSS
 * matching this site's actual configured breakpoints. The values below are
 * only the fallback used if that generated CSS is absent for any reason.
 */
.md-product-grid {
    display: grid;
    grid-template-columns: repeat(var(--md-grid-columns, 4), 1fr);
    gap: 20px;
}

.md-product-grid--auto-height {
    align-items: start;
}

.md-product-grid__empty {
    padding: 40px 20px;
    text-align: center;
    color: #6d7a8a;
}

.md-product-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    /* !important: the card reuses WooCommerce's own <li class="product"> markup
       so themes' WooCommerce styling cascades onto it — but most themes (e.g.
       Astra) also give ul.products li.product a margin-bottom of their own,
       left over from float-based grid layouts. Since spacing here is fully
       controlled by this grid's own "Grid Gap" control (CSS Grid `gap`), that
       theme margin must be zeroed out, or the effective row spacing becomes
       theme-dependent and doesn't match the configured Grid Gap value. */
    margin: 0 !important;
}

.md-product-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.md-product-card__image {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8f9fb;
}

.md-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.md-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    line-height: 1;
}

.md-badge--sale {
    background: #e53e3e;
}

.md-product-card__content {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/*
 * Title and price intentionally do not set font-family/size/weight/color —
 * they inherit the active theme's heading/text styles by cascade, so the
 * card's typography always matches the current theme without any setting.
 */
.md-product-card__title {
    margin: 0;
    line-height: 1.4;
}

.md-product-card__title a,
.md-product-card__title a:hover {
    color: inherit !important;
    text-decoration: none !important;
}

.md-product-card__actions {
    padding: 0 16px 16px;
}

/*
 * The template also adds WooCommerce's own "button" class and Elementor's
 * "elementor-button" class alongside this one. Almost every WooCommerce
 * theme styles ".button"/".woocommerce a.button" with higher specificity
 * than this single-class rule, so the theme's real button look (color,
 * radius, padding, font) wins automatically by default. If a theme has no
 * such styling at all, this plugin's own values below apply as a safe
 * fallback so the button never looks broken. Users can still force a
 * specific color via this widget's own Style tab (no default is set there,
 * so it stays out of the way until someone actually chooses a color).
 */
.md-add-to-cart {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: center;
    background: #4f46e5;
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s ease;
}

.md-add-to-cart:hover {
    background: #3730a3;
    color: #fff;
    text-decoration: none !important;
}

/*
 * The pagination nav also carries WooCommerce's own "woocommerce-pagination"
 * class, so most themes style ".page-numbers" automatically. These rules are
 * only a minimal, theme-agnostic fallback (spacing, no visual styling).
 */
.md-pagination {
    margin-top: 24px;
    text-align: center;
}

.md-pagination ul.page-numbers {
    display: inline-flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.md-load-more {
    margin-top: 24px;
    text-align: center;
}

.md-load-more-button {
    display: inline-block;
    text-decoration: none !important;
}

.md-load-more-button:hover {
    text-decoration: none !important;
}
