/* The stylesheet is enqueued only on desktop-width product archives. */
main .elementor-top-column > .elementor-widget-wrap > .elementor-widget-spacer:has(+ .hp-archive-toolbar) {
    display: none;
}

main .elementor .elementor-section.hp-archive-toolbar {
    margin: 0 0 16px;
    padding: 10px clamp(12px, 1.4vw, 22px);
    border: 1px solid var(--hp-border);
    border-radius: 12px;
    background: var(--hp-surface);
    box-shadow: none;
}

main .hp-archive-toolbar > .elementor-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px 16px;
    margin: 0;
}

main .hp-archive-toolbar > .elementor-container > .elementor-inner-column {
    width: auto;
    max-width: 100%;
}

main .hp-archive-toolbar .elementor-inner-column > .elementor-widget-wrap {
    padding: 0;
    gap: 8px 16px;
    align-items: center;
}

main .hp-archive-toolbar .elementor-widget-wrap > .elementor-widget {
    width: auto;
    max-width: 100%;
    margin: 0;
}

main .hp-archive-toolbar .wd-products-per-page,
main .hp-archive-toolbar .hp-column-picker {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0;
}

main .hp-archive-toolbar .per-page-title {
    margin: 0;
    margin-inline-end: 5px;
    font: inherit;
    font-size: max(14px, .875rem);
    color: var(--hp-muted);
}

main .hp-archive-toolbar .per-page-title::after,
main .hp-archive-toolbar .per-page-border,
main .hp-archive-toolbar .wd-products-shop-view:has(+ .hp-column-picker),
main .hp-archive-toolbar .hp-column-picker[hidden] { display: none; }

main .hp-archive-toolbar .per-page-variation {
    display: inline-grid;
    place-items: center;
    min-width: 32px;
    min-height: 36px;
    padding-inline: 3px;
    color: var(--hp-muted);
    border-radius: 6px;
    font-size: max(14px, .875rem);
}

main .hp-archive-toolbar .per-page-variation:hover,
main .hp-archive-toolbar .per-page-variation.current-variation {
    background: var(--hp-surface-soft);
    color: var(--hp-heading);
    text-decoration: underline;
    text-underline-offset: 4px;
}

main .hp-archive-toolbar .hp-column-picker {
    padding: 3px;
    border: 1px solid var(--hp-border);
    border-radius: 9px;
    background: var(--hp-surface-soft);
}
main .hp-archive-toolbar .wd-shop-view .elementor-widget-container:has(.hp-column-picker) {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-inline-start: 14px;
    border-inline-start: 1px solid var(--hp-border);
}
main .hp-archive-toolbar .wd-shop-view .elementor-widget-container:has(.hp-column-picker)::before {
    content: 'چیدمان';
    color: var(--hp-muted);
    font-size: max(14px, .875rem);
}

.hp-column-picker button {
    display: grid;
    place-items: center;
    min-width: 36px;
    min-height: 34px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    box-shadow: none;
    background: transparent;
    color: var(--hp-muted);
}

.hp-column-picker button:hover { background: var(--hp-surface); color: var(--hp-accent); }
.hp-column-picker button[aria-pressed="true"] {
    border-color: currentColor;
    background: var(--hp-accent);
    color: var(--hp-surface);
}

/* Each glyph is a miniature of the resulting two-, three- or four-column shelf. */
.hp-column-picker button::before {
    content: '';
    width: 22px;
    height: 16px;
    background: linear-gradient(to right, currentColor calc(100% - 2px), transparent 0) 1px 0 /
        calc(100% / var(--hp-icon-columns)) 100% repeat-x;
    mask-image: linear-gradient(to bottom, black 7px, transparent 7px 9px, black 9px);
}
.hp-column-picker button[value="2"] { --hp-icon-columns: 2; }
.hp-column-picker button[value="3"] { --hp-icon-columns: 3; }
.hp-column-picker button[value="4"] { --hp-icon-columns: 4; }
@media (forced-colors: active) {
    .hp-column-picker button::before { forced-color-adjust: none; background-color: transparent; color: ButtonText; }
    .hp-column-picker button[aria-pressed="true"] { outline: 2px solid Highlight; }
}

main .hp-archive-toolbar .woocommerce-ordering { margin: 0; max-width: 100%; }
main .hp-archive-toolbar select.orderby {
    width: max(220px, 15rem);
    max-width: 100%;
    height: auto;
    min-height: 40px;
    padding-block: 6px;
    border: 1px solid var(--hp-border);
    border-radius: 8px;
    color: var(--hp-text);
    background-color: var(--hp-surface);
    font: inherit;
    font-size: max(14px, .875rem);
}
main .hp-archive-toolbar :is(button, select, a):focus-visible,
main .sidebarshop .hpft-ready-input:focus-visible {
    outline: 3px solid var(--hp-accent);
    outline-offset: 2px;
}

main .wd-shop-product .products[data-source="main_loop"][style*="--hp-archive-columns"] {
    grid-template-columns: repeat(var(--hp-archive-columns), minmax(0, 1fr));
}

main .sidebarshop:has(.sidebar-widget) {
    overflow-wrap: anywhere;
    padding-inline: clamp(12px, 1.4vw, 22px);
    border: 1px solid var(--hp-border);
    border-radius: 12px;
    background: var(--hp-surface);
}
main .sidebarshop .hp-filter-title {
    padding-block-start: 16px;
    margin: 0;
    color: var(--hp-heading);
    font-size: max(17px, 1.0625rem);
    font-weight: 700;
}
main .sidebarshop > .sidebar-widget {
    margin: 0;
    padding: 14px 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}
main .sidebarshop > :is(.sidebar-widget, .hpft-ready-filter) ~ .sidebar-widget {
    border-block-start: 1px solid var(--hp-border);
}
main .sidebarshop .sidebar-widget .widget-title {
    margin: 0;
    padding: 5px 0;
    background: transparent;
    color: var(--hp-heading);
    font-size: max(14px, .9375rem);
}
main .sidebarshop > .hpft-ready-filter {
    display: flex;
    gap: 10px;
    margin: 0;
    padding-block: 14px;
    min-height: 52px;
    color: var(--hp-heading);
    font-size: max(14px, .875rem);
    cursor: pointer;
}
main .sidebarshop .hpft-ready-input { flex: none; accent-color: var(--hp-accent); }
