/* ============================================
   POINTUS SHOP PAGE
   ============================================ */

/* Break out of Astra's narrow container on shop pages */
.woocommerce.archive .ast-container,
.woocommerce-page.archive .ast-container,
.woocommerce.tax-product_cat .ast-container,
.woocommerce.tax-manufacturer .ast-container,
.woocommerce.tax-industrial_sector .ast-container {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.woocommerce.archive #primary,
.woocommerce-page.archive #primary {
    padding: 0 !important;
    margin: 0 !important;
}

.ps-shop {
    background: var(--color-bg);
    padding: 32px 0 64px;
    font-family: var(--font-body);
    color: var(--color-body);
    width: 100%;
}

.ps-shop-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
}

/* ============ SIDEBAR ============ */
.ps-shop-sidebar {
    position: sticky;
    top: 24px;
    min-width: 0;
}

.ps-sidebar-inner {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.ps-sidebar-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.ps-sidebar-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-heading);
}

.ps-sidebar-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-body);
    padding: 4px;
}

.ps-filter-group {
    padding: 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
}

.ps-filter-group:last-child {
    border-bottom: none;
}

.ps-filter-heading {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6B7280;
    margin: 0;
    padding: 16px 18px 12px;
    background: var(--color-bg);
    position: sticky;
    top: 0;
    z-index: 2;
}

.ps-filter-list {
    list-style: none;
    margin: 0;
    padding: 0 8px 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-accent) transparent;
    scroll-behavior: smooth;
}

/* Each filter type gets its own height cap */
.ps-filter-cats {
    max-height: 320px;
}

.ps-filter-checks {
    max-height: 260px;
}

/* Blue scrollbar */
.ps-filter-list::-webkit-scrollbar {
    width: 6px;
}
.ps-filter-list::-webkit-scrollbar-track {
    background: transparent;
}
.ps-filter-list::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border-radius: 3px;
    opacity: 0.6;
}
.ps-filter-list::-webkit-scrollbar-thumb:hover {
    background: #0052cc;
}

/* Category filter (linked text + counts) */
.ps-filter-cats li a {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    color: var(--color-heading);
    text-decoration: none;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: background 0.1s ease, color 0.1s ease;
}

.ps-filter-cats li a:hover {
    background: var(--color-bg-soft);
    color: var(--color-accent);
}

.ps-filter-cats > li.is-active > a {
    background: var(--color-bg-soft);
    color: var(--color-accent);
    font-weight: 600;
}

/* Chevron indicator for parents with children */
.ps-cat-chevron {
    color: #9CA3AF;
    transition: transform 0.2s ease, color 0.15s ease;
    flex-shrink: 0;
}

.ps-filter-cats li.has-children a:hover .ps-cat-chevron {
    color: var(--color-accent);
}

.ps-filter-cats > li.is-active.has-children > a .ps-cat-chevron {
    transform: rotate(180deg);
    color: var(--color-accent);
}

.ps-cat-spacer {
    display: inline-block;
    width: 10px;
    height: 6px;
}

/* Sub-categories */
.ps-filter-sublist {
    list-style: none;
    margin: 4px 0 6px 22px;
    padding: 4px 0 4px 12px;
    border-left: 2px solid var(--color-accent);
}

.ps-filter-sublist li a {
    grid-template-columns: 1fr auto;
    padding: 6px 10px;
    font-size: 13px;
}

.ps-filter-sublist li.is-active a {
    color: var(--color-accent);
    font-weight: 600;
    background: var(--color-bg-soft);
}

.ps-count {
    color: #9CA3AF;
    font-size: 12px;
    font-weight: 400;
}

/* Checkbox-style filter (manufacturer + sector) */
.ps-filter-checks li.is-hidden {
    display: none;
}

.ps-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    color: var(--color-heading);
    text-decoration: none;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: background 0.1s ease;
}

.ps-check:hover {
    background: var(--color-bg-soft);
}

.ps-check-box {
    width: 18px;
    height: 18px;
    border: 1.5px solid #D1D5DB;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--color-bg);
    transition: background 0.1s ease, border-color 0.1s ease;
}

.ps-check.is-checked .ps-check-box {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.ps-check.is-checked .ps-check-box::after {
    content: "";
    width: 5px;
    height: 9px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg) translateY(-1px);
}

.ps-check-label {
    flex: 1;
}

.ps-filter-more {
    background: none;
    border: none;
    border-top: 1px solid var(--color-border);
    color: var(--color-accent);
    cursor: pointer;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-align: left;
    width: 100%;
}

.ps-filter-more:hover {
    background: var(--color-bg-soft);
}

.ps-filter-empty {
    color: #9CA3AF;
    font-size: 13px;
    font-style: italic;
    margin: 0;
}

/* ============ MAIN ============ */
.ps-shop-main {
    min-width: 0;
    width: 100%;
}

/* Mobile filter toggle */
.ps-mobile-filter-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--color-bg);
    color: var(--color-heading);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 16px;
}

/* Toolbar — chips */
.ps-shop-toolbar {
    margin-bottom: 16px;
}

.ps-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.ps-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-bg-soft);
    color: var(--color-heading);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.1s ease, color 0.1s ease;
}

.ps-chip:hover {
    background: var(--color-bg);
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.ps-chip-reset {
    background: var(--color-bg);
    color: var(--color-body);
    font-weight: 500;
}

.ps-chip svg {
    flex-shrink: 0;
    opacity: 0.6;
}

/* Controls bar */
.ps-shop-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ps-shop-results {
    font-size: 14px;
    color: var(--color-body);
}

.ps-shop-results strong {
    color: var(--color-heading);
    font-weight: 600;
}

.ps-shop-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ps-shop-sort,
.ps-shop-perpage {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ps-shop-perpage label {
    font-size: 13px;
    color: var(--color-body);
    white-space: nowrap;
}

.ps-shop-sort select,
.ps-shop-perpage select {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 7px 32px 7px 12px;
    font-family: inherit;
    font-size: 13px;
    color: var(--color-heading);
    background: var(--color-bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'><path d='M1 1L5 5L9 1' stroke='%23364151' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 10px center;
    appearance: none;
    cursor: pointer;
}

.ps-shop-sort select:focus,
.ps-shop-perpage select:focus {
    outline: none;
    border-color: var(--color-accent);
}

.ps-shop-view {
    display: inline-flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.ps-view-btn {
    background: var(--color-bg);
    border: none;
    padding: 8px 10px;
    color: #9CA3AF;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s ease, color 0.1s ease;
}

.ps-view-btn:hover {
    color: var(--color-heading);
}

.ps-view-btn.is-active {
    background: var(--color-bg-soft);
    color: var(--color-accent);
}

/* ============ PRODUCT GRID ============ */
.ps-product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.ps-product-grid[data-view="list"] {
    grid-template-columns: 1fr;
}

.ps-card {
    display: block;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.ps-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    transform: translateY(-2px);
}

.ps-card-image {
    aspect-ratio: 1 / 1;
    background: var(--color-bg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ps-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.ps-card-body {
    padding: 16px 18px 20px;
}

.ps-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-heading);
    margin: 0 0 6px;
    line-height: 1.3;
}

.ps-card-desc {
    font-size: 13px;
    color: var(--color-accent);
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* List view */
.ps-product-grid[data-view="list"] .ps-card {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0;
}

.ps-product-grid[data-view="list"] .ps-card-image {
    aspect-ratio: 1 / 1;
    padding: 16px;
}

.ps-product-grid[data-view="list"] .ps-card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ps-product-grid[data-view="list"] .ps-card-title {
    font-size: 18px;
}

.ps-product-grid[data-view="list"] .ps-card-desc {
    -webkit-line-clamp: 3;
    font-size: 14px;
}

/* ============ PAGINATION ============ */
.ps-shop-pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
}

.ps-shop-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    margin: 0 2px;
    background: var(--color-bg);
    color: var(--color-heading);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.ps-shop-pagination .page-numbers:hover,
.ps-shop-pagination .page-numbers.current {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

/* ============ EMPTY STATE ============ */
.ps-empty {
    text-align: center;
    padding: 64px 24px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-muted);
}

.ps-empty h3 {
    color: var(--color-heading);
    margin: 0 0 8px;
    font-size: 18px;
}

.ps-empty p {
    color: var(--color-body);
    margin: 0 0 20px;
}

.ps-empty-btn {
    display: inline-block;
    background: var(--color-accent);
    color: #fff;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s ease;
}

.ps-empty-btn:hover {
    background: #0052cc;
    color: #fff;
}

/* ============ BACKDROP (mobile) ============ */
.ps-sidebar-backdrop {
    display: none;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
    .ps-product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .ps-shop-container {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .ps-mobile-filter-toggle {
        display: inline-flex;
    }

    .ps-shop-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 85vw;
        max-width: 340px;
        height: 100vh;
        z-index: 9999;
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.25s ease, visibility 0.25s ease;
        overflow-y: auto;
        background: var(--color-bg);
        box-shadow: 4px 0 16px rgba(15, 23, 42, 0.12);
    }

    .ps-shop-sidebar.is-open {
        transform: translateX(0);
        visibility: visible;
    }

    .ps-sidebar-inner {
        border: none;
        border-radius: 0;
        padding: 0;
    }

    .ps-sidebar-header {
        display: flex;
    }

    .ps-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.4);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    .ps-sidebar-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }

    body.ps-shop-drawer-open {
        overflow: hidden;
    }

    .ps-shop-controls {
        gap: 12px;
    }
}

@media (max-width: 600px) {
    .ps-shop {
        padding: 16px 0 32px;
    }

    .ps-shop-container {
        padding: 0 16px;
    }

    .ps-product-grid {
        grid-template-columns: 1fr;
    }

    .ps-shop-actions {
        width: 100%;
        justify-content: space-between;
    }

    .ps-shop-perpage label {
        display: none;
    }

    .ps-product-grid[data-view="list"] .ps-card {
        grid-template-columns: 120px 1fr;
    }
}
