:root {
    --ap-vm-accent: #ffa428;
    --ap-vm-accent-dark: #e88b0f;
    --ap-vm-text: #222222;
    --ap-vm-muted: #6f747c;
    --ap-vm-border: #e4e7eb;
    --ap-vm-surface: #ffffff;
    --ap-vm-surface-soft: #f7f8fa;
}

/* Prevent the server-rendered VirtueMart toolbar from flashing before enhancement. */
.category-view .orderby-displaynumber:not([data-ap-modern-sort="1"]) {
    min-height: 82px;
    visibility: hidden;
}

.com_virtuemart .orderby-displaynumber.ap-vm-toolbar,
.category-view .orderby-displaynumber.ap-vm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    width: 100%;
    min-height: 82px;
    margin: 0 0 28px;
    padding: 16px 20px;
    border: 1px solid var(--ap-vm-border);
    border-left: 4px solid var(--ap-vm-accent);
    border-radius: 8px;
    background: var(--ap-vm-surface);
    box-shadow: 0 7px 22px rgba(20, 25, 32, 0.055);
    font-family: inherit;
    visibility: visible;
}

.ap-vm-toolbar .ap-vm-controls {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

.ap-vm-toolbar .ap-vm-control-group--sort {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.ap-vm-toolbar .ap-vm-control-label,
.ap-vm-toolbar .ap-vm-limit-wrap > span {
    display: block;
    color: var(--ap-vm-muted);
    font-family: "Roboto Condensed", "Arial Narrow", Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.ap-vm-toolbar .ap-vm-control-label {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
}

.ap-vm-toolbar .ap-vm-sort-pills {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ap-vm-toolbar .ap-vm-sort-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid #d9dde2;
    border-radius: 19px;
    background: #ffffff;
    color: #555b63;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.ap-vm-toolbar .ap-vm-sort-pill:hover,
.ap-vm-toolbar .ap-vm-sort-pill:focus {
    border-color: var(--ap-vm-accent);
    color: var(--ap-vm-text);
    text-decoration: none;
}

.ap-vm-toolbar .ap-vm-sort-pill.is-active {
    border-color: var(--ap-vm-accent);
    background: rgba(255, 164, 40, 0.11);
    color: var(--ap-vm-text);
    box-shadow: inset 0 -2px 0 var(--ap-vm-accent);
}

.ap-vm-toolbar .ap-vm-sort-arrow {
    margin-left: 7px;
    color: #bd6800;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.ap-vm-toolbar .ap-vm-mobile-sort {
    display: none;
}

.ap-vm-toolbar .ap-vm-select-wrap,
.ap-vm-toolbar .ap-vm-limit-wrap {
    position: relative;
}

.ap-vm-toolbar .ap-vm-select-wrap::after,
.ap-vm-toolbar .ap-vm-limit-wrap::after {
    position: absolute;
    right: 15px;
    bottom: 16px;
    width: 7px;
    height: 7px;
    border-right: 2px solid #767b82;
    border-bottom: 2px solid #767b82;
    content: "";
    pointer-events: none;
    transform: rotate(45deg);
}

.ap-vm-toolbar .ap-vm-select,
.ap-vm-toolbar .ap-vm-limit-select {
    display: block !important;
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 42px 0 14px;
    border: 1px solid #d9dde2;
    border-radius: 6px;
    outline: 0;
    background: var(--ap-vm-surface-soft);
    color: var(--ap-vm-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 42px;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
    cursor: pointer;
}

.ap-vm-toolbar .ap-vm-select:hover,
.ap-vm-toolbar .ap-vm-limit-select:hover {
    border-color: #c5cbd2;
    background: #ffffff;
}

.ap-vm-toolbar .ap-vm-select:focus,
.ap-vm-toolbar .ap-vm-limit-select:focus {
    border-color: var(--ap-vm-accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 164, 40, 0.18);
}

.ap-vm-toolbar .ap-vm-direction-mobile {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin-left: 8px;
    border: 1px solid var(--ap-vm-accent);
    border-radius: 6px;
    background: rgba(255, 164, 40, 0.11);
    color: #9f5700;
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
}

.ap-vm-toolbar .ap-vm-results {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    gap: 16px;
}

.ap-vm-toolbar > .vm-pagination-top {
    display: none;
}

.ap-vm-toolbar .ap-vm-results-summary {
    max-width: 230px;
    color: var(--ap-vm-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    text-align: right;
}

.ap-vm-toolbar .ap-vm-limit-wrap {
    display: block;
    min-width: 112px;
    margin: 0;
}

.ap-vm-toolbar .ap-vm-limit-wrap > span {
    margin: 0 0 7px;
}

.ap-vm-toolbar .ap-vm-limit-wrap::after {
    right: 14px;
}

.ap-vm-toolbar .ap-vm-limit-select {
    min-width: 112px;
    padding-left: 13px;
}

@media (max-width: 991px) {
    .com_virtuemart .orderby-displaynumber.ap-vm-toolbar,
    .category-view .orderby-displaynumber.ap-vm-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 15px;
    }

    .ap-vm-toolbar .ap-vm-results {
        justify-content: space-between;
        border-top: 1px solid var(--ap-vm-border);
        padding-top: 14px;
    }

    .ap-vm-toolbar .ap-vm-results-summary {
        max-width: none;
        text-align: left;
    }
}

@media (max-width: 700px) {
    .category-view .orderby-displaynumber:not([data-ap-modern-sort="1"]) {
        min-height: 184px;
    }

    .com_virtuemart .orderby-displaynumber.ap-vm-toolbar,
    .category-view .orderby-displaynumber.ap-vm-toolbar {
        margin-bottom: 22px;
        padding: 16px;
        border-left-width: 3px;
        border-radius: 6px;
    }

    .ap-vm-toolbar .ap-vm-control-group--sort {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .ap-vm-toolbar .ap-vm-sort-pills {
        display: none;
    }

    .ap-vm-toolbar .ap-vm-mobile-sort {
        display: flex;
        min-width: 0;
    }

    .ap-vm-toolbar .ap-vm-mobile-sort .ap-vm-select {
        min-width: 0;
    }

    .ap-vm-toolbar .ap-vm-direction-mobile {
        display: inline-flex;
    }

    .ap-vm-toolbar .ap-vm-results {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .ap-vm-toolbar .ap-vm-limit-wrap,
    .ap-vm-toolbar .ap-vm-limit-select {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ap-vm-toolbar .ap-vm-sort-pill,
    .ap-vm-toolbar .ap-vm-select,
    .ap-vm-toolbar .ap-vm-limit-select {
        transition: none;
    }
}
