/* پرشین پت — فهرست محصولات (نمای XShop؛ فقط با CSS) */

#frm_panelProducts {
    --bs-gutter-x: 40px;
    padding-top: 24px;
    align-items: flex-start;
}

/*#region column sizes */
@media (min-width: 768px) {
    #frm_panelProducts > aside {
        flex: 0 0 280px;
        max-width: 280px;
    }

    #frm_panelProducts > article {
        flex: 1 1 0;
        max-width: none;
        min-width: 0;
    }
}
/*#endregion */

/*#region title & tools */
#frm_panelProducts > article > header {
    font-family: var(--pp-display);
    font-size: 41px;
    font-weight: 700;
    line-height: 1.15;
    padding: 0 0 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--pp-line);
}

#frm_panelProducts div.input-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    margin-bottom: 32px;
}

div.search-product {
    position: relative;
    display: flex;
    align-items: center;
    width: 240px;
    order: 2;
    margin-right: auto;
}

div.search-product {
    border-bottom: 1px solid var(--pp-line-2);
}

div.search-product:focus-within {
    border-bottom-color: var(--pp-accent);
}

div.search-product > input {
    flex: 1;
    min-width: 0;
    height: 42px;
    border: 0;
    border-radius: 0 !important;
    background: transparent;
    padding: 0;
    font: inherit;
    font-size: 14px;
    color: var(--pp-ink);
    outline: 0;
}

div.search-product > button {
    flex: none;
    width: 36px;
    height: 36px;
    margin: 0 !important;
    padding: 0;
    border: 0;
    border-radius: 0 !important;
    background: transparent;
    color: var(--pp-muted);
    font-size: 16px;
}

div.search-product > button:hover {
    background: transparent;
    color: var(--pp-accent);
}

div.sort-product {
    order: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

div.sort-product > button {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--pp-line);
    border-radius: var(--pp-btn-radius);
    background: var(--pp-surface);
    color: var(--pp-ink);
    font-size: 18px;
}

div.sort-product > ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 22px;
    margin: 0;
    padding: 0;
    font-size: 14px;
}

div.sort-product > ul > li {
    color: var(--pp-muted);
    cursor: pointer;
    padding-bottom: 3px;
    border-bottom: 1px solid transparent;
    transition: color .2s ease;
}

div.sort-product > ul > li:hover {
    color: var(--pp-ink);
}

div.sort-product > ul > li.active {
    color: var(--pp-ink);
    font-weight: 600;
    border-bottom-color: var(--pp-ink);
}

button.toggle-filter {
    display: none;
}
/*#endregion */

/*#region filters */
aside .filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

aside article {
    border-bottom: 1px solid var(--pp-line);
    padding-bottom: 16px;
}

aside article > header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    font-weight: 600;
    cursor: pointer;
}

aside article:not(.filter) > header::after {
    content: "";
    width: 9px;
    height: 9px;
    border-left: 1.5px solid var(--pp-ink);
    border-bottom: 1.5px solid var(--pp-ink);
    transform: rotate(-45deg);
    margin-left: 4px;
    transition: transform .2s ease;
}

aside article.minimize > header::after {
    transform: rotate(135deg);
}

aside article.minimize > div {
    display: none;
}

aside article.filter > header {
    cursor: default;
}

aside article.filter > header a {
    font-weight: 400;
    font-size: 13px;
    color: var(--pp-muted);
    text-decoration: underline;
    text-underline-offset: 4px;
    cursor: pointer;
}

aside article ul {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 280px;
    overflow-y: auto;
}

aside div.properties {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

aside div.properties:empty {
    display: none;
}

aside article.filter div > h3 {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--pp-line-2);
    border-radius: 999px;
    background: var(--pp-tint);
    font-size: 13px;
    font-weight: 400;
}

aside article.filter div > h3 > i {
    cursor: pointer;
    color: var(--pp-muted);
}

aside article.filter div > h3 > i:hover {
    color: var(--pp-danger);
}

.feature {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    cursor: pointer;
}

.feature > input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--pp-accent);
    cursor: pointer;
}

.feature > label {
    cursor: pointer;
    font-size: 14px;
}

/* «فقط محصولات موجود» به شکل کلید */
.feature > input#existing {
    order: 2;
    margin-right: auto;
    width: 44px;
    height: 24px;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 999px;
    background: var(--pp-line-2) radial-gradient(circle at calc(100% - 12px) 50%, #FFFFFF 8px, transparent 9px) no-repeat;
    transition: background-color .2s ease;
}

.feature > input#existing:checked {
    background: var(--pp-accent) radial-gradient(circle at 12px 50%, #FFFFFF 8px, transparent 9px) no-repeat;
}

.feature > input#existing + label {
    font-weight: 500;
}
/*#endregion */

/*#region product grid */
ul.products {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 44px 24px;
}

ul.products > li {
    position: relative;
    min-width: 0;
}

ul.products > li > a {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--pp-ink);
}

ul.products > li > a > img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    padding: 6%;
    box-sizing: border-box;
    background: var(--pp-surface);
    border: 1px solid var(--pp-line);
    border-radius: var(--pp-radius);
    margin-bottom: 6px;
    transition: opacity .3s ease;
}

ul.products > li > a:hover > img {
    opacity: .88;
}

ul.products > li > a > h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.75;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

ul.products > li > a:hover > h2 {
    color: var(--pp-accent);
}

ul.products > li > a > h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    direction: rtl;
}

/* قیمت صفر = «قیمت را بپرسید» */
ul.products > li[data-issoldout='true'] > a > h3 {
    font-size: 0;
}

ul.products > li[data-issoldout='true'] > a > h3::after {
    content: "قیمت را بپرسید";
    font-size: 14px;
    font-weight: 500;
    color: var(--pp-secondary);
}

ul.products > li > a > span,
ul.products > li ul {
    display: none;
}

#loadMore {
    text-align: center;
    color: var(--pp-muted);
    padding: 48px 0 0;
    font-size: 14px;
}
/*#endregion */

/*#region responsive */
@media (max-width: 767.98px) {
    #frm_panelProducts {
        padding-top: 12px;
    }

    #frm_panelProducts > article > header {
        font-size: 40px;
        text-align: center;
        margin-bottom: 16px;
    }

    #frm_panelProducts div.input-group {
        flex-wrap: nowrap;
        gap: 8px;
    }

    div.search-product {
        order: 1;
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        margin: 0;
    }

    div.sort-product {
        order: 2;
        position: relative;
    }

    div.sort-product > button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    div.sort-product > ul {
        display: none;
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        z-index: 50;
        width: 200px;
        flex-direction: column;
        gap: 0;
        padding: 6px;
        background: var(--pp-surface);
        border: 1px solid var(--pp-line);
        border-radius: var(--pp-radius);
        box-shadow: 0 16px 40px rgba(30, 42, 54, .12);
    }

    div.sort-product > button[data-showsort='true'] + ul {
        display: flex;
    }

    div.sort-product > ul > li {
        padding: 10px 12px;
        border: 0;
    }

    div.sort-product > ul > li.active {
        background: var(--pp-tint);
        border-radius: var(--pp-btn-radius);
    }

    #frm_panelProducts > article button.toggle-filter {
        order: 3;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        width: auto;
        height: 44px;
        padding: 0 12px;
        flex: none;
        white-space: nowrap;
        background: var(--pp-surface);
        color: var(--pp-ink);
        border: 1px solid var(--pp-line);
        font-size: 13px;
    }

    aside > .filters {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 1100;
        padding: 20px 16px 96px;
        background: var(--pp-ground);
        overflow-y: auto;
    }

    body.filter-mode {
        overflow: hidden;
    }

    body.filter-mode aside > .filters {
        display: flex;
    }

    body.filter-mode aside > .filters button.toggle-filter {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: 16px;
        width: auto;
        height: 52px;
    }

    aside article ul {
        max-height: none;
    }

    ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 12px;
    }

    ul.products > li > a > h2 {
        font-size: 13px;
    }

    ul.products > li > a > h3 {
        font-size: 13px;
    }
}
/*#endregion */
