
.opsim-shop-page {
    padding-top: 40px;
    padding-bottom: 60px;
}
.shop-layout {
    display: flex;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.shop-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid var(--opsim-border);
    border-radius: var(--opsim-radius);
    padding: 20px;
    align-self: flex-start;
    position: sticky;
    top: calc(80px + var(--opsim-admin-bar, 0px));
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--opsim-border);
}
.sidebar-title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--opsim-text-primary);
}
.sidebar-close {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--opsim-text-secondary);
    padding: 4px;
}

.sidebar-section {
    border-bottom: 1px solid var(--opsim-border);
    padding-bottom: 12px;
    margin-bottom: 12px;
}
.sidebar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.sidebar-section-toggle {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 0;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--opsim-text-primary);
}
.sidebar-section-toggle:focus-visible {
    outline: 2px solid var(--opsim-brand);
    outline-offset: 2px;
}
.sidebar-section-name {
    flex: 1;
    text-align: left;
}
.sidebar-section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-right: 6px;
    /* Round counter, not a rectangle — intentionally exempt from --opsim-radius. */
    border-radius: 9px;
    background: var(--opsim-brand);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
/* The author display rule above outranks the UA [hidden] rule, so restate it. */
.sidebar-section-badge[hidden] {
    display: none;
}
.sidebar-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.sidebar-section-toggle[aria-expanded="false"] .sidebar-chevron {
    transform: rotate(-90deg);
}
.sidebar-section-content {
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.sidebar-section-toggle[aria-expanded="false"] + .sidebar-section-content {
    max-height: 0 !important;
}

.sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-option {
    margin-bottom: 2px;
    position: relative;
}
.sidebar-option[data-depth="1"] { padding-left: 18px; }
.sidebar-option[data-depth="2"] { padding-left: 36px; }
.sidebar-option[data-depth="3"] { padding-left: 54px; }

/* The native input stays focusable but invisible; the label is the control. */
.sidebar-checkbox-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}
.sidebar-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    color: var(--opsim-text-secondary);
    font-size: 0.8rem;
    line-height: 1.3;
    border-radius: var(--opsim-radius);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-option-label:hover {
    background: rgba(var(--opsim-brand-rgb), 0.05);
    color: var(--opsim-text-primary);
}
.sidebar-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1.5px solid var(--opsim-border);
    border-radius: var(--opsim-radius);
    background: #fff;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.sidebar-checkbox svg {
    width: 10px;
    height: 10px;
    color: #fff;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.sidebar-checkbox-input:checked + .sidebar-option-label .sidebar-checkbox {
    background: var(--opsim-brand);
    border-color: var(--opsim-brand);
}
.sidebar-checkbox-input:checked + .sidebar-option-label .sidebar-checkbox svg {
    opacity: 1;
    transform: scale(1);
}
.sidebar-checkbox-input:checked + .sidebar-option-label {
    color: var(--opsim-brand);
    font-weight: 600;
}
.sidebar-checkbox-input:focus-visible + .sidebar-option-label .sidebar-checkbox {
    outline: 2px solid var(--opsim-brand);
    outline-offset: 2px;
}
.sidebar-option-name {
    flex: 1;
    min-width: 0;
}
.sidebar-option-count {
    font-size: 0.7rem;
    opacity: 0.5;
    font-variant-numeric: tabular-nums;
}
.sidebar-option-count::before { content: '('; }
.sidebar-option-count::after  { content: ')'; }

/* Nothing matches this option under the current selection. */
.sidebar-option.is-empty > .sidebar-option-label {
    opacity: 0.4;
}

.sidebar-color-swatch-badge {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.sidebar-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 0;
}
.sidebar-color-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.sidebar-color-item label {
    cursor: pointer;
    display: block;
    line-height: 0;
}
.sidebar-color-swatch {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.sidebar-color-item label:hover .sidebar-color-swatch {
    transform: scale(1.1);
}
.sidebar-checkbox-input:checked + label .sidebar-color-swatch {
    border-color: var(--opsim-brand);
    transform: scale(1.12);
    box-shadow: 0 0 0 2px rgba(var(--opsim-brand-rgb), 0.3);
}
.sidebar-checkbox-input:focus-visible + label .sidebar-color-swatch {
    outline: 2px solid var(--opsim-brand);
    outline-offset: 2px;
}
.sidebar-color-text {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--opsim-text-secondary);
}
.sidebar-color-count {
    font-size: 0.65rem;
    opacity: 0.5;
    font-variant-numeric: tabular-nums;
}
.sidebar-color-item.is-empty {
    opacity: 0.4;
}

.sidebar-active {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--opsim-border);
}
.sidebar-active[hidden] {
    display: none;
}
.sidebar-active-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.sidebar-active-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--opsim-text-secondary);
}
.sidebar-clear {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--opsim-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    white-space: nowrap;
}
.sidebar-clear:hover {
    opacity: 0.75;
}
.sidebar-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sidebar-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border: 1px solid var(--opsim-border);
    border-radius: var(--opsim-radius);
    background: rgba(var(--opsim-brand-rgb), 0.06);
    color: var(--opsim-brand);
    font-size: 0.7rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s ease;
}
.sidebar-chip:hover {
    background: rgba(var(--opsim-brand-rgb), 0.14);
}
.sidebar-chip svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.shop-results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.shop-results-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--opsim-text-secondary);
}

.shop-products-area {
    flex: 1;
    min-width: 0;
}
.shop-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* gap comes from product-card.css — one rhythm for every product grid */
    transition: opacity 0.2s ease;
}
.shop-products-area.is-filtering .shop-products-grid {
    opacity: 0.4;
    pointer-events: none;
}
.shop-products-area.is-filtering .shop-pagination {
    opacity: 0.4;
    pointer-events: none;
}
.shop-pagination {
    display: flex;
    justify-content: center;
    padding: 30px 0;
}
.shop-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--opsim-border);
    border-radius: var(--opsim-radius);
    text-decoration: none;
    color: var(--opsim-text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 4px;
    transition: all 0.2s ease;
}
.shop-pagination .page-numbers.dots {
    border-color: transparent;
    cursor: default;
}
.shop-pagination .page-numbers.current,
.shop-pagination a.page-numbers:hover {
    background: var(--opsim-brand);
    border-color: var(--opsim-brand);
    color: #fff;
}
.no-products-found {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--opsim-text-secondary);
    font-size: 0.95rem;
}

.sidebar-mobile-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    /* Round counter, not a rectangle — intentionally exempt from --opsim-radius. */
    border-radius: 9px;
    background: var(--opsim-brand);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
}
.sidebar-mobile-count[hidden] {
    display: none;
}
.sidebar-mobile-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid var(--opsim-border);
    border-radius: var(--opsim-radius);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--opsim-text-primary);
    cursor: pointer;
    margin-bottom: 16px;
}

@media (max-width: 1200px) and (min-width: 1024px) {
    .shop-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1023px) {
    .opsim-shop-page {
        padding-top: 20px;
        padding-bottom: 40px;
    }
    .shop-layout {
        flex-direction: column;
        gap: 0;
        padding: 0 12px;
    }
    .shop-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        height: 100vh;
        height: 100dvh;
        z-index: 2000;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--opsim-border);
        overflow-y: auto;
        padding-top: 16px;
        background: #fff;
    }
    .shop-sidebar.is-open {
        display: flex;
        flex-direction: column;
    }
    .sidebar-close {
        display: flex;
    }
    .sidebar-mobile-toggle {
        display: inline-flex;
        width: 100%;
        justify-content: center;
        margin-bottom: 14px;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    .shop-products-area {
        width: 100%;
    }
    .shop-products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
    }
    .shop-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1999;
    }
    .shop-sidebar-overlay.is-open {
        display: block;
    }
}

@media (max-width: 480px) {
    .opsim-shop-page {
        padding-top: 15px;
        padding-bottom: 35px;
    }
    .shop-layout {
        padding: 0 8px;
    }
    .shop-products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
    }
    .shop-sidebar {
        width: 85vw;
        max-width: 320px;
    }
    .sidebar-mobile-toggle {
        padding: 9px 14px;
        font-size: 0.82rem;
        margin-bottom: 12px;
    }
}

.shop-sidebar .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Archive heading — woocommerce/archive-product.php. */
.shop-page-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.shop-page-header .shop-page-title {
    margin: 0;
    font-size: clamp(1.25rem, 1vw + 1rem, 1.75rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--opsim-text-primary);
}
.shop-page-description {
    max-width: 72ch;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--opsim-text-secondary);
}
.shop-page-description > :last-child {
    margin-bottom: 0;
}
