/* Reusable catalogue drawer. Activation follows rendered markup, including PJAX. */
.wd-sidebar:has(.cgr-sb-head) {
    --cgr-sb-accent: #ad4d2f;
    --cgr-sb-accent-dark: #8f3b24;
    --cgr-sb-ink: #302d2a;
    --cgr-sb-muted: #776b64;
    --cgr-sb-line: #e8ded6;
    --cgr-sb-cream: #f6eee4;
    color: var(--cgr-sb-ink);
}
.cgr-sb-head {
    margin: 0;
    padding: 20px 18px;
    border-bottom: 1px solid var(--cgr-sb-line);
    background: var(--cgr-sb-cream);
}
.cgr-sb-head h2 {
    margin: 0 0 6px;
    color: var(--cgr-sb-ink);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
}
.cgr-sb-head p { margin: 0; color: var(--cgr-sb-accent-dark); font-size: 13px; line-height: 1.5; }
.cgr-sb-context,
.cgr-sb-filter {
    margin: 0;
    padding: 17px 18px;
    border-bottom: 1px solid var(--cgr-sb-line);
    background: #fff;
}
.cgr-sb-context h3,
.cgr-sb-filter h3 {
    margin: 0 0 10px;
    color: var(--cgr-sb-ink);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
}
.cgr-sb-back {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin: -4px 0 7px;
    color: var(--cgr-sb-muted);
    font-size: 12px;
    line-height: 1.4;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.cgr-sb-links { margin: 0; padding: 0; list-style: none; }
.cgr-sb-links li { margin: 0; padding: 0; }
.cgr-sb-links li + li { margin-top: 3px; }
.cgr-sb-links li > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-inline-start-width: 3px;
    border-radius: 6px;
    color: var(--cgr-sb-ink);
    font-size: 14px;
    font-weight: 550;
    line-height: 1.45;
    text-decoration: none;
}
.cgr-sb-links a > span { min-width: 0; overflow-wrap: anywhere; }
.cgr-sb-links a > small {
    flex: 0 0 auto;
    min-width: 23px;
    padding: 1px 6px;
    border-radius: 20px;
    background: rgb(80 51 35 / 6%);
    color: var(--cgr-sb-muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.6;
    text-align: center;
}
.cgr-sb-links a[aria-current="page"] {
    border-color: #f2d8ca;
    border-inline-start-color: var(--cgr-sb-accent);
    background: #fbece4;
    font-weight: 700;
}
.cgr-sb-links a:hover { background: #faf6f1; color: var(--cgr-sb-accent-dark); }
.cgr-sb-product-search,
.cgr-sb-category-search {
    display: block;
    margin: 0 0 12px;
    color: var(--cgr-sb-ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}
.wd-sidebar:has(.cgr-sb-head) :is(.cgr-sb-filter, .cgr-sb-catalog, .cgr-sb-product-search, .cgr-sb-category-search, .cgr-sb-price-fields) {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
}
.wd-sidebar:has(.cgr-sb-head) :is(.cgr-sb-product-search, .cgr-sb-category-search) { width: 100%; }
.wd-sidebar:has(.cgr-sb-head) .cgr-sb-product-search input[type="search"],
.wd-sidebar:has(.cgr-sb-head) .cgr-sb-category-search input[type="search"],
.wd-sidebar:has(.cgr-sb-head) .cgr-sb-price-fields input[type="number"] {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 44px;
    margin-top: 6px;
    padding: 8px 11px;
    border: 1px solid #e1d4ca;
    border-radius: 6px;
    background: #fff;
    color: var(--cgr-sb-ink);
    font: inherit;
    font-size: 16px;
    font-weight: 400;
}
.cgr-sb-search-help { display: block; margin: 6px 0 0; color: var(--cgr-sb-muted); font-size: 12px; font-weight: 400; line-height: 1.4; }
.cgr-sb-filter .cgr-sb-sale {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    margin: 0;
    color: var(--cgr-sb-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}
.cgr-sb-filter input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--cgr-sb-accent);
}
.cgr-sb-price { margin: 6px 0 0; }
.cgr-sb-context-more { margin: 7px 0 0; padding-top: 3px; border-top: 1px solid var(--cgr-sb-line); }
.cgr-sb-context-more > summary,
.cgr-sb-price > summary,
.cgr-sb-catalog > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 10px 0;
    color: var(--cgr-sb-ink);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
    list-style: none;
    cursor: pointer;
}
.cgr-sb-context-more > summary::-webkit-details-marker,
.cgr-sb-price > summary::-webkit-details-marker,
.cgr-sb-catalog > summary::-webkit-details-marker { display: none; }
.cgr-sb-context-more > summary::after,
.cgr-sb-price > summary::after,
.cgr-sb-catalog > summary::after { content: "+"; flex: 0 0 auto; font-size: 20px; font-weight: 400; }
.cgr-sb-context-more[open] > summary::after,
.cgr-sb-price[open] > summary::after,
.cgr-sb-catalog[open] > summary::after { content: "−"; }
.cgr-sb-context-more > summary { min-height: 38px; padding: 8px 0; color: var(--cgr-sb-accent-dark); font-size: 13px; font-weight: 600; }
.cgr-sb-price-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 4px 0; }
.cgr-sb-price-fields label { min-width: 0; margin: 0; color: var(--cgr-sb-muted); font-size: 12px; font-weight: 600; line-height: 1.5; }
.cgr-sb-active { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--cgr-sb-line); background: #fff; }
.cgr-sb-active:empty { display: none; }
.cgr-sb-active h3 { flex-basis: 100%; margin: 0 0 3px; color: var(--cgr-sb-ink); font-size: 13px; font-weight: 700; line-height: 1.45; }
.cgr-sb-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    min-height: 32px;
    padding: 5px 8px;
    border: 1px solid #e9d8ca;
    border-radius: 5px;
    background: #faf3ec;
    color: var(--cgr-sb-accent-dark);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.cgr-sb-catalog { margin: 0; padding: 5px 18px 13px; border-bottom: 1px solid var(--cgr-sb-line); background: #fff; }
.cgr-sb-category-search { margin: 5px 0 10px; }
.cgr-sb-category-empty { margin: 5px 0 10px; color: var(--cgr-sb-muted); font-size: 12px; line-height: 1.45; }
.cgr-sb-tree-widget.widget { margin: 0; padding: 0; border: 0; }
.cgr-sb-tree-widget .widget-title { display: none; }
.cgr-sb-tree-widget .product-categories { margin: 0; }
.cgr-sb-tree-widget .product-categories li { margin-bottom: 0; }
.cgr-sb-tree-widget .product-categories li > a { padding-block: 8px; color: var(--cgr-sb-ink); font-size: 13px; font-weight: 500; line-height: 1.45; }
.cgr-sb-tree-widget .product-categories .children { margin-top: 0; padding-inline-start: 12px; }
.cgr-sb-tree-widget .product-categories .current-cat > a { color: var(--cgr-sb-accent-dark); font-weight: 700; }
.cgr-sb-tree-widget .product-categories .count { color: var(--cgr-sb-muted); font-size: 11px; }
.cgr-sb-tree-widget .cgr-catnav-seasons > summary { min-height: 38px; font-size: 13px; }
.cgr-sb-tree-widget:is(.wd-scroll, .wd-scroll-content),
.cgr-sb-tree-widget :is(.wd-scroll, .wd-scroll-content) { max-height: none !important; overflow: visible !important; }
.cgr-sb-catalog [hidden] { display: none !important; }
.cgr-sb-tree-widget .cgr-sb-search-open { display: block !important; }
.cgr-sb-tree-widget[data-cgr-sb-searching] .wd-cats-toggle { visibility: hidden; }
.cgr-sb-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 0;
    padding: 12px 18px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--cgr-sb-line);
    background: #fff;
    box-shadow: 0 -4px 14px rgb(80 51 35 / 5%);
}
.cgr-sb-footer button {
    min-height: 44px;
    padding: 10px 14px;
    border: 0;
    border-radius: 7px;
    background: var(--cgr-sb-accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}
.cgr-sb-footer button:hover { background: var(--cgr-sb-accent-dark); color: #fff; }
.cgr-sb-footer > a { align-self: center; padding: 6px 10px; color: var(--cgr-sb-muted); font-size: 12px; font-weight: 600; line-height: 1.4; text-decoration: underline; text-underline-offset: 3px; }
.wd-sidebar:has(.cgr-sb-head) :is(a, button, input, summary):focus-visible { outline: 2px solid var(--cgr-sb-accent); outline-offset: 3px; }

/* Keep WoodMart's toolbar trigger and click handling, with a clear compact button. */
.wd-page-content:has(.cgr-sb-head) .wd-show-sidebar-btn { min-width: 0; max-width: 100%; }
.wd-page-content:has(.cgr-sb-head) .wd-show-sidebar-btn a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    max-width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid #ad4d2f;
    border-radius: 7px;
    background: #ad4d2f;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: none;
    white-space: normal;
}
.wd-page-content:has(.cgr-sb-head) .wd-show-sidebar-btn a::before { margin: 0; color: inherit; }
.wd-page-content:has(.cgr-sb-head) .wd-show-sidebar-btn a:hover { border-color: #8f3b24; background: #8f3b24; color: #fff; }
.wd-page-content:has(.cgr-sb-head) .wd-show-sidebar-btn a:focus-visible { outline: 2px solid #ad4d2f; outline-offset: 3px; }

/* Keep the native opener, but reveal it before long category grids reach the toolbar. */
body:has(.wd-sidebar .cgr-sb-head) .wd-sidebar-opener {
    top: auto;
    inset-inline-start: 16px;
    inset-inline-end: auto;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #8f3b24;
    border-radius: 50%;
    background: #ad4d2f;
    color: #fff;
    box-shadow: 0 4px 14px rgb(80 51 35 / 18%);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
body:has(.wd-sidebar .cgr-sb-head) .wd-sidebar-opener:not(.cgr-sb-float-visible) { visibility: hidden; opacity: 0; pointer-events: none; transform: translateX(-65px); }
body:has(.wd-sidebar .cgr-sb-head) .wd-sidebar-opener.cgr-sb-float-visible { visibility: visible; opacity: 1; pointer-events: auto; transform: translateX(0); }
body:has(.wd-sidebar .cgr-sb-head) .wd-sidebar-opener:hover { background: #8f3b24; }
body:has(.wd-sidebar .cgr-sb-head) .wd-sidebar-opener::before,
body:has(.wd-sidebar .cgr-sb-head) .wd-sidebar-opener a,
body:has(.wd-sidebar .cgr-sb-head) .wd-sidebar-opener a::before { color: #fff; }
body:has(.wd-sidebar .cgr-sb-head) .wd-sidebar-opener:focus-visible { outline: 2px solid #ad4d2f; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
    body:has(.wd-sidebar .cgr-sb-head) .wd-sidebar-opener { transition: none; }
}
@media (min-width: 1025px) {
    .wd-sidebar:has(.cgr-sb-head) > .widget-area { max-height: none; overflow: visible; border: 1px solid var(--cgr-sb-line); border-radius: 9px; }
    .cgr-sb-head { border-radius: 8px 8px 0 0; }
    .cgr-sb-footer { position: static; border-radius: 0 0 8px 8px; box-shadow: none; }
}
@media (max-width: 1024px) {
    .wd-sidebar.wd-side-hidden:has(.cgr-sb-head) {
        display: flex;
        flex-direction: column;
        width: min(88vw, 360px);
        max-width: 360px;
        height: calc(100vh - var(--wd-admin-bar-h, 0px));
        height: calc(100dvh - var(--wd-admin-bar-h, 0px));
        padding: 0;
        overflow: hidden;
        background: #fff;
    }
    .wd-sidebar:has(.cgr-sb-head) > .wd-heading {
        flex: 0 0 auto;
        min-height: 46px;
        margin: 0;
        padding: 11px 18px;
        border-bottom: 1px solid var(--cgr-sb-line);
        background: #fff;
        color: var(--cgr-sb-ink);
        font-size: 13px;
        font-weight: 700;
    }
    .wd-sidebar:has(.cgr-sb-head) > .widget-area {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}
