/* product listing pages (search, …): the shared product card (product-card.css) in a responsive grid */

.product-grid-panel {
    /* the theme's breadcrumb above is floated; without this the heading squeezes in beside it */
    clear: both;
    padding: 20px 24px 24px;
    border: var(--widget-border, 1px solid #e8eaee);
    border-radius: var(--widget-radius, 24px);
    background: #fff;
}

.product-grid-panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 16px;
    margin-bottom: 16px;
}

.product-grid-panel__title {
    margin: 0;
    color: #1f2328;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.6;
}

.product-grid-panel__count {
    color: #6b7280;
    font-size: 13px;
}

/* fixed column counts (2 / 3 / 4), so a short list doesn't leave thin cards and an empty row end */
.product-grid {
    --grid-cols: 2;
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
    gap: 16px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

@media (min-width: 768px) {
    .product-grid {
        --grid-cols: 3;
    }
}

@media (min-width: 1200px) {
    .product-grid {
        --grid-cols: 4;
    }
}

/* the filter sidebar takes a quarter of the row: one column less beside it */
@media (min-width: 1200px) {
    #category-products-div.col-lg-9 .product-grid {
        --grid-cols: 3;
    }
}

.product-grid > li {
    min-width: 0;
}

.product-grid > li > .item {
    height: 100%;
}

/* ---------- sort bar (keeps the jquery.horizontalmenu markup category.js relies on) ---------- */

.product-sort {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e8eaee;
}

.product-sort__label {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 4px;
    color: #6b7280;
    font-size: 13px;
}

.product-sort__label .mdi {
    font-size: 18px;
}

/* chips that don't fit scroll sideways (swipe on phones) instead of going into the plugin's tiny "more" menu */
.product-sort .ah-tab {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    letter-spacing: normal;
    scrollbar-width: none;
}

.product-sort .ah-tab::-webkit-scrollbar {
    display: none;
}

.product-sort .ah-tab-overflow-wrapper {
    display: none !important;
}

/* the plugin's white fade edges */
.product-sort .ah-tab::before,
.product-sort .ah-tab::after {
    display: none;
}

.product-sort .ah-tab > .ah-tab-item {
    margin-left: 6px;
    padding: 6px 14px;
    border: 1px solid #e8eaee;
    border-radius: 999px;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.6;
    transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.product-sort .ah-tab > .ah-tab-item:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.product-sort .ah-tab > .ah-tab-item[data-ah-tab-active='true'] {
    border-color: #1f2328;
    background: #1f2328;
    color: #fff;
}

/* phones: always two columns */
@media (max-width: 575.98px) {

    .product-sort {
        gap: 6px;
        margin-bottom: 14px;
    }

    /* the icon alone says "sort"; the chips get the room */
    .product-sort__label {
        font-size: 0;
    }

    .product-sort__label .mdi {
        font-size: 20px;
    }

    .product-sort .ah-tab > .ah-tab-item {
        padding: 5px 11px;
        font-size: 12px;
    }

    .product-grid-panel {
        padding: 14px 12px 16px;
    }

    .product-grid-panel__title {
        font-size: 15px;
    }

    .product-grid,
    #category-products-div.col-lg-9 .product-grid {
        --grid-cols: 2;
        gap: 10px;
    }
}

/* ---------- Dastar additions ---------- */

/* category description box: its background image is an <img> behind the text (no inline style) */
.category-background {
    position: relative;
    overflow: hidden;
}

.category-background__img {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 95%;
    height: 100%;
    margin: auto;
    object-fit: contain;
    pointer-events: none;
}

.category-background__content {
    position: relative;
    z-index: 1;
}
