/* Product listing: layout, filters, pagination — loaded by its page on top of shop.css */

/* Title and product count on one line, the filters and sort at the right */
.shop-listing-header {
    align-items: center;
    gap: 8px 16px;
    margin-bottom: 12px;
}

@media (min-width: 768px) {
    .shop-listing-header {
        margin-bottom: 16px;
    }
}

.shop-listing-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.shop-listing-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.shop-listing-tools .btn,
.shop-listing-sort select {
    height: 40px;
}

.shop-listing-sort select {
    width: auto;
    padding-block: 0;
}

/* Phones: Filters and Sort share the row in two equal halves */
@media (max-width: 767.98px) {
    .shop-listing-tools {
        flex: 1 1 100%;
        margin-left: 0;
    }

    .shop-listing-tools > * {
        flex: 1 1 0;
        min-width: 0;
    }

    .shop-listing-sort select {
        width: 100%;
        min-width: 0;
    }
}

/* minmax(0, …): a plain 1fr column can't get narrower than the cards' width, so phones scrolled sideways */
.shop-listing {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}

@media (min-width: 992px) {
    .shop-listing {
        grid-template-columns: 264px minmax(0, 1fr);
        align-items: start;
    }
}

.shop-filters {
    padding: 16px;
}

/* The filters sit in a Bootstrap modal: full screen below lg (opened by the Filters button),
   and on desktop the modal is flattened back into the sticky sidebar column. */

@media (min-width: 992px) {
    .shop-filter-modal.modal {
        position: sticky;
        top: 84px;
        z-index: auto;
        display: block !important; /* beats the inline display:none Bootstrap leaves after a hide */
        width: auto;
        height: auto;
        overflow: visible;
        opacity: 1;
    }

    /* .modal.fade adds translate(0,-50px) until shown — 0,3,0 to beat it, or the sidebar covers the title */
    .shop-filter-modal.modal .modal-dialog {
        max-width: none;
        height: auto;
        margin: 0;
        transform: none;
        transition: none;
        pointer-events: auto;
    }

    .shop-filter-modal .modal-content {
        background: none;
        border: 0;
        border-radius: 0;
    }

    .shop-filters {
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
}

@media (max-width: 991.98px) {
    .shop-filter-modal .shop-filters {
        border: 0;
        border-radius: 0;
        padding-bottom: 0;
    }

    .shop-filters__actions {
        position: sticky;
        bottom: 0;
        margin: 0 -16px;
        padding: 12px 16px;
        background: var(--bg-surface);
        border-top: 1px solid var(--border);
    }
}

.shop-filter-group {
    padding: 14px 0;
    border-top: 1px solid var(--border);
}

.shop-filter-group:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.shop-filter-group__title {
    font-weight: 700;
    font-size: 0.9375rem;
    margin-bottom: 10px;
}

/* padding and margin set here: Bootstrap's list indent (2rem) and bottom margin beat the reset in layout.css */
.shop-filter-tree {
    list-style: none;
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
}

.shop-filter-tree ul {
    list-style: none;
    margin: 6px 0 0;
    padding-left: 14px;
    display: grid;
    gap: 6px;
}

.shop-filter-tree a {
    color: var(--tx-secondary);
}

.shop-filter-tree a.active,
.shop-filter-tree a:hover {
    color: var(--accent);
    font-weight: 600;
}

.shop-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.shop-check input {
    accent-color: var(--accent);
}

.shop-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--border);
    flex: none;
}

.shop-pagination a,
.shop-pagination span {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    font-weight: 600;
}

.shop-pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.shop-pagination .is-current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.shop-pagination .is-disabled {
    opacity: 0.45;
}
