/* Product archive pages (views products::listing.*, assets/js/product-listing.js) */

/* desktop toolbar: sorts and count */
.listing-toolbar {
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 12px;
}
.listing-toolbar-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    white-space: nowrap;
}
.listing-sorts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.listing-sorts a {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--colorText);
}
.listing-sorts a:hover {
    background: #f4f4f4;
}
.listing-sorts a.active {
    color: var(--colorMain);
    font-weight: bold;
    background: rgba(var(--colorMainRGB), .08);
}

/* mobile bar: sheets and quick switches, scrolls sideways */
.listing-mobile-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 10px;
    margin-bottom: 4px;
    scrollbar-width: none;
}
.listing-mobile-bar::-webkit-scrollbar {
    display: none;
}
/* sticks under the fixed mobile header (56px); full width so the products pass under it cleanly */
@media (max-width: 991.98px) {
    .listing-mobile-bar {
        position: sticky;
        top: 56px;
        z-index: 1020;
        margin: 0 -15px 4px;
        padding: 8px 15px;
        background: #fff;
        transition: transform .25s ease, box-shadow .2s ease;
    }
    [data-listing].bar-stuck .listing-mobile-bar {
        box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    }
    /* slides up under the header, which sits above it */
    [data-listing].bar-hidden .listing-mobile-bar {
        transform: translateY(-110%);
        box-shadow: none;
    }
}
@media (max-width: 991.98px) and (prefers-reduced-motion: reduce) {
    .listing-mobile-bar {
        transition: none;
    }
}
.listing-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid #e3e3e3;
    border-radius: 50px;
    background: #fff;
    color: var(--colorText);
    font-size: 13px;
    white-space: nowrap;
}
.listing-chip i {
    font-size: 15px;
}
.listing-chip.active {
    border-color: var(--colorMain);
    color: var(--colorMain);
    background: rgba(var(--colorMainRGB), .06);
}
.listing-chip-count {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 50px;
    background: var(--colorMain);
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

/* active filters */
.listing-active {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}
.listing-active-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 50px;
    background: rgba(var(--colorMainRGB), .08);
    color: var(--colorMain);
    font-size: 12px;
}
.listing-active-chip i {
    font-size: 13px;
}
.listing-clear {
    font-size: 12px;
    color: var(--colorRed);
    padding: 5px 4px;
}

/* filters */
.listing-filters {
    padding: 8px 16px;
}
.listing-filter-group {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.listing-filter-group:last-child {
    border-bottom: 0;
}
.listing-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--colorText);
    font-size: 14px;
    text-align: right;
}
.listing-toggle > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.listing-toggle i {
    font-size: 16px;
    color: var(--colorGray);
}
.listing-switch {
    position: relative;
    flex-shrink: 0;
    width: 36px;
    height: 20px;
    border-radius: 50px;
    background: #d9d9d9;
    transition: background .2s;
}
.listing-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    transition: transform .2s;
}
.listing-toggle[aria-checked="true"] .listing-switch {
    background: var(--colorMain);
}
.listing-toggle[aria-checked="true"] .listing-switch::after {
    transform: translateX(-16px);
}
.listing-filter-title {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: bold;
}
.listing-filter-clear {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--colorRed);
}

/* bottom sheets on smaller screens */
@media (max-width: 1199.98px) {
    .listing-filters-sheet.offcanvas-bottom,
    .listing-sort-sheet.offcanvas-bottom {
        height: auto;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
    }
    .listing-filters-sheet .listing-filters {
        border: 0;
        box-shadow: none;
        padding: 0;
    }
    .listing-sheet-footer {
        padding: 12px 16px;
        border-top: 1px solid #eee;
        background: #fff;
    }
}
@media (min-width: 1200px) {
    .listing-filters-sheet {
        position: sticky;
        top: 90px;
    }
}
.listing-sort-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    border-bottom: 1px solid #f2f2f2;
    color: var(--colorText);
    font-size: 15px;
}
.listing-sort-list a.active {
    color: var(--colorMain);
    font-weight: bold;
}

/* results */
[data-listing].is-loading [data-listing-items] {
    pointer-events: none;
}
.listing-more {
    display: flex;
    justify-content: center;
    padding: 16px 0 8px;
}
/* while pages load by themselves the link stays out of sight (crawlers still see it) */
[data-listing-more]:not(.is-manual) .listing-more .kt-btn {
    opacity: 0;
}
.listing-end {
    text-align: center;
    color: var(--colorGray);
    font-size: 13px;
    padding: 16px 0 8px;
}
.listing-empty {
    text-align: center;
    padding: 32px 16px;
}
.listing-empty img {
    margin-bottom: 12px;
}
.listing-back-to-start {
    display: inline-flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
}
.listing-skeleton .product-item {
    pointer-events: none;
}
.sk-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
}
.listing-skeleton .product-item-head .sk-line {
    margin-bottom: 10px;
}

@media (prefers-reduced-motion: reduce) {
    .listing-switch, .listing-switch::after {
        transition: none;
    }
}

/* Sub-categories strip of a category page (products::includes.archive_sub_categories): native scrolling, no library */
.sub-cats { position: relative; --sub-cats-gap: 12px; --sub-cats-per-view: 2.5; }
.sub-cats-track {
    display: flex; gap: var(--sub-cats-gap); overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.sub-cats-track::-webkit-scrollbar { display: none; }
.sub-cats-item {
    flex: 0 0 calc((100% - var(--sub-cats-gap) * (var(--sub-cats-per-view) - 1)) / var(--sub-cats-per-view));
    min-width: 0;
}
.sub-cats .category-item { display: block; }
.sub-cats .category-item img { display: block; aspect-ratio: 1 / 1; object-fit: cover; background: #f5f5f5; }
.sub-cats.is-simple .sub-cats-item { flex-basis: auto; }
.sub-cats.is-simple .simple-category-item { white-space: nowrap; }
@media (min-width: 576px) { .sub-cats { --sub-cats-per-view: 2.7; } }
@media (min-width: 768px) { .sub-cats { --sub-cats-per-view: 3.7; } }
@media (min-width: 1240px) { .sub-cats { --sub-cats-per-view: 5.7; } }

.sub-cats-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 40px; height: 40px;
    display: none; align-items: center; justify-content: center; border: 0; border-radius: 50%;
    background: #fff; color: #333; font-size: 18px; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); transition: opacity .2s ease;
}
.sub-cats-arrow.is-prev { right: -8px; }
.sub-cats-arrow.is-next { left: -8px; }
.sub-cats-arrow:disabled { opacity: 0; pointer-events: none; }
/* only with a mouse; on touch screens the strip is swiped */
@media (hover: hover) and (pointer: fine) {
    .sub-cats-arrow:not([hidden]) { display: flex; }
}
