/* Filters + product grid — category listing browse */
.pg-browse {
    --pg-teal: #0b5d57;
    --pg-teal-dark: #073b37;
    --pg-light: #eef4f3;
    --pg-border: #dde3e3;
    --pg-divider: #eaeeee;
    --pg-ink: #1c2528;
    --pg-muted: #5b6b6f;
    --pg-input-border: #cfd8d8;
    --pg-chip-bg: #e3f1ef;
    --pg-chip-text: #0a4b46;
    --pg-tag-bg: #dcf3e6;
    --pg-tag-text: #11643a;
    --pg-wa-bg: #e3f6ec;
    --pg-wa-text: #0f6b3a;
    --pg-wa-border: #b9e4cb;
    --pg-amber: #f2a900;
    --pg-help-bg: #fff8e6;
    --pg-help-border: #f0dca6;
    --pg-max: var(--site-max, 1360px);

    font-family: Inter, system-ui, sans-serif;
    background: #f1f3f3;
    color: var(--pg-ink);
    padding: 16px var(--site-gutter, 40px) 80px;
}

.pg-browse-inner {
    width: 100%;
    max-width: var(--pg-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

/* —— Sidebar —— */
.pg-sidebar {
    background: #fff;
    border: 1px solid var(--pg-border);
    border-radius: 6px;
    font-size: 13px;
    position: sticky;
    top: 8px;
    max-height: calc(100vh - 16px);
    overflow: hidden;
    z-index: 5;
    display: flex;
    flex-direction: column;
}

.pg-sidebar-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
    /* Hide native scrollbar (Linux/GTK arrows cannot be removed via CSS) */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.pg-sidebar-scroll::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
}

/* Custom scrollbar — track + thumb only, no arrows */
.pg-sb {
    position: absolute;
    right: 2px;
    width: 4px;
    min-width: 4px;
    border-radius: 999px;
    background: var(--pg-light);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 6;
}

.pg-sidebar.is-scrollable .pg-sb {
    opacity: 1;
    pointer-events: auto;
}

.pg-sidebar:hover .pg-sb,
.pg-sb.is-dragging {
    opacity: 1;
}

.pg-sb-thumb {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    min-height: 32px;
    border-radius: 999px;
    background: var(--pg-teal);
    cursor: grab;
}

.pg-sb-thumb:hover,
.pg-sb.is-dragging .pg-sb-thumb {
    background: var(--pg-teal-dark);
}

.pg-sb.is-dragging .pg-sb-thumb {
    cursor: grabbing;
}

/* Page scrollbar is owned by layout.css (same width on home + listing — no jerk). */

.pg-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--pg-light);
    padding: 11px 14px;
    border-bottom: 1px solid var(--pg-border);
}

.pg-sidebar-title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--pg-ink);
}

.pg-clear-all {
    border: 0;
    background: none;
    padding: 0;
    color: var(--pg-teal);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.pg-clear-all:hover {
    text-decoration: underline;
}

.pg-filter-group {
    padding: 10px 14px;
    border-bottom: 1px solid var(--pg-divider);
}

.pg-filter-group-title {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pg-muted);
}

.pg-cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pg-cat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 5px 0;
    border: 0;
    background: none;
    font: inherit;
    color: var(--pg-ink);
    text-align: left;
    cursor: pointer;
}

.pg-cat-row:hover,
.pg-cat-row:focus-visible {
    color: var(--pg-teal);
    outline: none;
}

.pg-cat-row.is-active {
    color: var(--pg-teal);
    font-weight: 700;
}

.pg-cat-row.is-active:not(.is-child),
.pg-cat-group:has(.pg-cat-children:not([hidden])) > .pg-cat-row:not(.is-child) {
    color: var(--pg-teal);
    font-weight: 700;
}

.pg-cat-empty {
    margin: 0;
    font-size: 13px;
    color: var(--pg-muted);
}

.pg-cat-row.is-child {
    padding-left: 14px;
    font-weight: 400;
    color: var(--pg-ink);
}

.pg-cat-row.is-grandchild {
    padding-left: 28px;
}

.pg-cat-grandchildren {
    margin: 0;
    padding: 0;
}

.pg-cat-label {
    min-width: 0;
    flex: 1;
}

.pg-cat-index {
    color: var(--pg-muted);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.pg-cat-count {
    font-size: 12px;
    color: var(--pg-muted);
    font-weight: 400;
    flex-shrink: 0;
}

.pg-cat-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pg-cat-children[hidden] {
    display: none;
}

.pg-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 26px;
    margin: 0;
    cursor: pointer;
    color: var(--pg-ink);
}

.pg-check-row + .pg-check-row {
    margin-top: 0;
}

.pg-check-row input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--pg-teal);
    flex-shrink: 0;
}

.pg-size-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.pg-size-input {
    width: 70px;
    border: 1px solid var(--pg-input-border);
    border-radius: 4px;
    padding: 7px;
    font-size: 13px;
    font-family: inherit;
    color: var(--pg-ink);
    background: #fff;
}

.pg-size-input:focus {
    outline: 2px solid rgba(11, 93, 87, 0.35);
    outline-offset: 1px;
}

.pg-size-to {
    font-size: 12px;
    color: var(--pg-muted);
}

.pg-help {
    background: var(--pg-help-bg);
    border-top: 1px solid var(--pg-help-border);
    padding: 14px;
    border-radius: 0 0 5px 5px;
}

.pg-help-title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--pg-ink);
}

.pg-help-text {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--pg-muted);
    line-height: 1.45;
}

.pg-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    width: 100%;
    border: 1.5px solid var(--pg-teal);
    border-radius: 6px;
    background: #fff;
    color: var(--pg-teal);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.pg-help-btn:hover {
    background: var(--pg-light);
}

.pg-filters-open-btn,
.pg-drawer-close,
.pg-drawer-apply,
.pg-drawer-backdrop {
    display: none;
}

/* —— Main —— */
.pg-main {
    min-width: 0;
}

.pg-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 10px;
}

.pg-showing-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.pg-showing {
    margin: 0;
    font-size: 13px;
    color: var(--pg-ink);
}

.pg-showing::before {
    content: "Showing ";
}

.pg-showing b {
    font-weight: 700;
}

.pg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.pg-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--pg-chip-bg);
    color: var(--pg-chip-text);
    font-size: 12px;
    font-weight: 600;
    border-radius: 99px;
    padding: 5px 11px;
    border: 0;
    font-family: inherit;
    cursor: pointer;
}

.pg-chip:hover {
    filter: brightness(0.97);
}

.pg-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.pg-select,
.pg-view-btn {
    height: auto;
    border: 1px solid var(--pg-input-border);
    border-radius: 6px;
    background: #fff;
    color: var(--pg-ink);
    font-size: 13px;
    font-family: inherit;
    padding: 7px 12px;
    cursor: pointer;
}

.pg-select:focus,
.pg-view-btn:focus-visible {
    outline: 2px solid rgba(11, 93, 87, 0.4);
    outline-offset: 1px;
}

.pg-view-toggle {
    display: inline-flex;
    border: 1px solid var(--pg-input-border);
    border-radius: 6px;
    overflow: hidden;
}

.pg-view-btn {
    border: 0;
    border-radius: 0;
    background: #fff;
}

.pg-view-btn.is-active {
    background: var(--pg-teal);
    color: #fff;
}

/* —— Grid —— */
.pg-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.pg-grid.is-list {
    grid-template-columns: 1fr;
}

.pg-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--pg-border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pg-card:hover {
    border-color: var(--pg-teal);
    box-shadow: 0 8px 22px rgba(11, 93, 87, 0.12);
}

.pg-card.is-selected {
    border-width: 2px;
    border-color: var(--pg-teal);
}

.pg-card:focus-within {
    outline: 2px solid rgba(11, 93, 87, 0.45);
    outline-offset: 2px;
}

.pg-card-media {
    position: relative;
    height: 150px;
    background: #f6f7f7;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pg-card-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    background: #f6f7f7;
}

.pg-card-ph {
    color: var(--pg-muted);
    font-size: 12px;
    font-weight: 500;
}

.pg-card-check {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 26px;
    height: 26px;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    border: 1px solid var(--pg-input-border);
    border-radius: 5px;
    cursor: pointer;
    z-index: 2;
}

.pg-card-check:checked {
    background: var(--pg-teal);
    border-color: var(--pg-teal);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20 6 9 17l-5-5' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: center;
}

.pg-card-check:focus-visible {
    outline: 2px solid var(--pg-amber);
    outline-offset: 2px;
}

.pg-card-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--pg-tag-bg);
    color: var(--pg-tag-text);
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    padding: 4px 7px;
    z-index: 2;
    line-height: 1.2;
}

.pg-card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1;
}

.pg-card-cat {
    margin: 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--pg-teal);
}

.pg-card-name {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    min-height: 39px;
    color: var(--pg-ink);
}

.pg-card-name a {
    color: inherit;
    text-decoration: none;
}

.pg-card-name a:hover {
    color: var(--pg-teal);
}

.pg-card-price {
    margin: 0;
    color: var(--pg-ink);
}

.pg-card-price-value {
    font-size: 19px;
    font-weight: 700;
}

.pg-card-price-unit {
    font-size: 12px;
    color: var(--pg-muted);
    font-weight: 400;
}

.pg-card-specs {
    margin: 0;
    padding: 8px 0;
    border-top: 1px solid var(--pg-divider);
    border-bottom: 1px solid var(--pg-divider);
    display: grid;
    gap: 4px;
}

.pg-card-specs dt,
.pg-card-specs dd {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
}

.pg-spec-row {
    display: grid;
    grid-template-columns: 68px 1fr;
    gap: 6px;
}

.pg-card-specs dt {
    color: var(--pg-muted);
    font-weight: 400;
}

.pg-card-specs dd {
    font-weight: 500;
    color: var(--pg-ink);
}

.pg-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.pg-btn-price {
    flex: 1;
    height: 42px;
    border: 0;
    border-radius: 6px;
    background: var(--pg-teal);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.pg-btn-price:hover {
    background: var(--pg-teal-dark);
}

.pg-btn-price:focus-visible {
    outline: 2px solid var(--pg-amber);
    outline-offset: 2px;
}

.pg-btn-wa {
    width: 40px;
    height: 42px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--pg-wa-bg);
    color: var(--pg-wa-text);
    border: 1px solid var(--pg-wa-border);
    text-decoration: none;
}

.pg-btn-wa:hover {
    filter: brightness(0.98);
}

.pg-btn-wa svg {
    width: 20px;
    height: 20px;
    display: block;
}

.pg-grid.is-list .pg-card {
    flex-direction: row;
}

.pg-grid.is-list .pg-card-media {
    width: 180px;
    flex-shrink: 0;
    height: auto;
    min-height: 150px;
}

.pg-grid.is-list .pg-card-body {
    flex: 1;
}

/* Skeletons */
.pg-skel {
    background: #fff;
    border: 1px solid var(--pg-border);
    border-radius: 8px;
    overflow: hidden;
}

.pg-skel-media {
    height: 150px;
    background: linear-gradient(90deg, #eef1f1 25%, #f7f8f8 50%, #eef1f1 75%);
    background-size: 200% 100%;
    animation: pg-shimmer 1.1s linear infinite;
}

.pg-skel-body {
    padding: 12px;
    display: grid;
    gap: 8px;
}

.pg-skel-line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #eef1f1 25%, #f7f8f8 50%, #eef1f1 75%);
    background-size: 200% 100%;
    animation: pg-shimmer 1.1s linear infinite;
}

.pg-skel-line.lg { height: 18px; width: 78%; }
.pg-skel-line.md { width: 55%; }
.pg-skel-line.sm { width: 40%; }

@keyframes pg-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty */
.pg-empty {
    display: none;
    text-align: center;
    padding: 48px 20px;
    background: #fff;
    border: 1px solid var(--pg-border);
    border-radius: 8px;
}

.pg-empty.is-visible {
    display: block;
}

.pg-empty-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
}

.pg-empty-text {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--pg-muted);
}

.pg-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 18px;
    border: 0;
    border-radius: 6px;
    background: var(--pg-teal);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

/* Pagination */
.pg-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 22px;
    flex-wrap: wrap;
}

.pg-page-meta {
    margin: 0;
    font-size: 13px;
    color: var(--pg-muted);
}

.pg-pages {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pg-page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--pg-input-border);
    border-radius: 6px;
    background: #fff;
    color: var(--pg-ink);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}

.pg-page-btn.is-active {
    background: var(--pg-teal);
    border-color: var(--pg-teal);
    color: #fff;
}

.pg-page-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.pg-page-ellipsis {
    color: var(--pg-muted);
    font-size: 13px;
    padding: 0 2px;
}

/* Bulk bar */
.pg-bulk {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 960;
    background: var(--pg-teal-dark);
    color: #fff;
    padding: 12px var(--site-gutter, 40px);
}

.pg-bulk.is-visible {
    display: block;
}

.pg-bulk-inner {
    max-width: var(--pg-max);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.pg-bulk-left {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 18px;
    min-width: 0;
}

.pg-bulk-count {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.pg-bulk-meta {
    margin: 0;
    font-size: 13px;
    color: #bfe0dc;
}

.pg-bulk-meta button {
    border: 0;
    background: none;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.pg-bulk-go {
    height: 40px;
    padding: 0 18px;
    border: 0;
    border-radius: 6px;
    background: var(--pg-amber);
    color: #10201f;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.pg-bulk-go:hover {
    filter: brightness(1.05);
}

body.pg-bulk-open {
    padding-bottom: 72px;
}

/* Hide legacy float bar on browse pages */
.pg-browse ~ #catalogFloat,
body:has(.pg-browse) #catalogFloat {
    display: none !important;
}

/* Tablet + mobile — filter drawer */
@media (max-width: 1024px) {
    .pg-browse-inner {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .pg-filters-open-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 1px solid var(--pg-border);
        border-radius: 6px;
        background: #fff;
        color: var(--pg-teal);
        cursor: pointer;
        margin: 0;
    }

    .pg-filters-open-btn svg {
        display: block;
        flex-shrink: 0;
    }

    .pg-showing::before {
        content: none;
    }

    .pg-toolbar {
        row-gap: 10px;
    }

    .pg-card-name {
        font-size: 14px;
        line-height: 1.3;
        min-height: 36px;
    }

    .pg-card-price-value {
        font-size: 16px;
    }

    .pg-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(340px, 92vw);
        max-height: none;
        border-radius: 0;
        z-index: 1100;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        display: flex;
        flex-direction: column;
    }

    .pg-sidebar.is-open {
        transform: translateX(0);
    }

    .pg-sidebar-scroll {
        flex: 1;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .pg-drawer-close {
        display: inline-flex;
        border: 0;
        background: none;
        color: var(--pg-ink);
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
        padding: 0 2px;
    }

    .pg-drawer-apply {
        display: block;
        margin: 12px 14px 16px;
        height: 42px;
        width: calc(100% - 28px);
        border: 0;
        border-radius: 6px;
        background: var(--pg-teal);
        color: #fff;
        font-size: 14px;
        font-weight: 700;
        font-family: inherit;
        cursor: pointer;
    }

    .pg-drawer-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(7, 59, 55, 0.35);
        z-index: 1090;
    }

    .pg-drawer-backdrop.is-open {
        display: block;
    }

    /* Tablet default: 3-up when sidebar is a drawer */
    .pg-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }

    .pg-toolbar-right {
        width: auto;
        margin-left: auto;
        flex-wrap: wrap;
    }

    .pg-card-media {
        height: 140px;
    }

    .pg-bulk {
        padding: 10px var(--site-gutter, 24px);
    }

    .pg-bulk-inner {
        gap: 10px;
    }

    .pg-bulk-meta {
        display: none;
    }

    .pg-bulk-go {
        padding: 0 12px;
        font-size: 13px;
    }
}

@media (max-width: 767px) {
    .pg-browse {
        padding: 12px var(--site-gutter, 16px) 88px;
    }

    .pg-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .pg-toolbar-right {
        width: 100%;
        margin-left: 0;
    }

    .pg-card-media {
        height: 130px;
    }

    .pg-card-name {
        font-size: 13px;
        line-height: 1.25;
        min-height: 33px;
    }

    .pg-card-price-value {
        font-size: 15px;
    }
}
