.wdsf {
    --wdsf-border: #e4e7eb;
    --wdsf-text: #1f2937;
    --wdsf-muted: #6b7280;
    --wdsf-bg: #ffffff;
    --wdsf-soft: #f7f8fa;
    --wdsf-accent: #111827;
    position: relative;
    margin: 0 0 24px;
    color: var(--wdsf-text);
    font-size: 14px;
}

.wdsf-panel {
    background: var(--wdsf-bg);
    border: 1px solid var(--wdsf-border);
    border-radius: 14px;
    padding: 18px;
}

.wdsf-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.wdsf-panel-header h2 {
    margin: 0;
    color: var(--wdsf-text);
    font-size: 19px;
    line-height: 1.25;
}

.wdsf-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wdsf-clear-all,
.wdsf-close,
.wdsf-mobile-toggle,
.wdsf-mobile-apply,
.wdsf-chip {
    appearance: none;
    border: 0;
    cursor: pointer;
    font: inherit;
}

.wdsf-clear-all {
    padding: 7px 10px;
    background: transparent;
    color: var(--wdsf-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.wdsf-clear-all:hover { color: var(--wdsf-text); }
.wdsf-close { display: none; }

.wdsf-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: start;
}

.wdsf-group {
    min-width: 0;
    margin: 0;
    padding: 13px;
    background: var(--wdsf-soft);
    border: 1px solid var(--wdsf-border);
    border-radius: 11px;
}

.wdsf-group-title {
    display: block;
    margin: 0 0 10px;
    color: var(--wdsf-text);
    font-weight: 700;
    font-size: 14px;
    list-style: none;
    cursor: default;
}

details.wdsf-group > summary::-webkit-details-marker { display: none; }

.wdsf-options {
    display: grid;
    gap: 8px;
    max-height: 210px;
    overflow: auto;
    padding-right: 3px;
    scrollbar-width: thin;
}

.wdsf-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--wdsf-text);
    cursor: pointer;
    line-height: 1.3;
}

.wdsf-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.wdsf-checkmark {
    width: 18px;
    height: 18px;
    border: 1.5px solid #b9c0ca;
    border-radius: 5px;
    background: #fff;
    position: relative;
    transition: .15s ease;
}

.wdsf-option input:checked + .wdsf-checkmark {
    border-color: var(--wdsf-accent);
    background: var(--wdsf-accent);
}

.wdsf-option input:checked + .wdsf-checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.wdsf-option input:focus-visible + .wdsf-checkmark {
    outline: 2px solid #9ca3af;
    outline-offset: 2px;
}

.wdsf-option-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.wdsf-option-count {
    min-width: 24px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #fff;
    color: var(--wdsf-muted);
    font-size: 11px;
    text-align: center;
}

.wdsf-option-emphasis { font-weight: 700; }

.wdsf-price-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.wdsf-price-fields label { margin: 0; }
.wdsf-price-fields label span {
    display: block;
    margin-bottom: 5px;
    color: var(--wdsf-muted);
    font-size: 12px;
}

.wdsf-price-fields input {
    width: 100%;
    min-height: 38px;
    margin: 0;
    padding: 7px 9px;
    border: 1px solid var(--wdsf-border);
    border-radius: 8px;
    background: #fff;
    color: var(--wdsf-text);
    box-shadow: none;
}

.wdsf-active {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0 0 14px;
}

.wdsf-active[hidden] { display: none; }

.wdsf-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 9px 6px 11px;
    border-radius: 999px;
    background: var(--wdsf-accent);
    color: #fff;
    line-height: 1;
}

.wdsf-chip b { font-size: 16px; font-weight: 400; }

.wdsf-status {
    min-height: 1px;
    margin-top: 8px;
    color: var(--wdsf-muted);
    font-size: 12px;
}

.wdsf-mobile-toggle,
.wdsf-mobile-apply { display: none; }

.wdsf-results-container {
    position: relative;
    min-height: 100px;
}

.wdsf.is-loading + .wdsf-results-container,
.wdsf-results-container[aria-busy="true"] {
    opacity: .55;
    pointer-events: none;
}

.wdsf-results-container[aria-busy="true"]::before {
    content: '';
    position: absolute;
    z-index: 10;
    top: 50px;
    left: 50%;
    width: 34px;
    height: 34px;
    margin-left: -17px;
    border: 3px solid rgba(0,0,0,.15);
    border-top-color: rgba(0,0,0,.7);
    border-radius: 50%;
    animation: wdsf-spin .75s linear infinite;
}

@keyframes wdsf-spin { to { transform: rotate(360deg); } }

@media (max-width: 767px) {
    .wdsf {
        margin-bottom: 16px;
    }

    .wdsf-panel {
        position: static;
        width: 100%;
        overflow: visible;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        transform: none;
    }

    .wdsf-panel-header {
        position: static;
        margin: 0 0 14px;
        padding: 0;
        background: transparent;
        border: 0;
    }

    .wdsf-panel-header h2 {
        font-size: 20px;
    }

    .wdsf-groups {
        grid-template-columns: 1fr;
    }

    .wdsf-group {
        padding: 14px;
    }

    .wdsf-options {
        max-height: 220px;
    }

    details.wdsf-group > summary {
        cursor: default;
    }
}


/* v0.2.0: dynamic facets and color swatches */
.wdsf-option.has-color {
    grid-template-columns: 18px 20px minmax(0, 1fr) auto;
}

.wdsf-color-swatch {
    width: 20px;
    height: 20px;
    border: 1px solid rgba(17, 24, 39, .18);
    border-radius: 50%;
    background: var(--wdsf-swatch, #fff);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45);
}

.wdsf-color-swatch.is-empty {
    background:
        linear-gradient(135deg, transparent 44%, #c7cbd1 45%, #c7cbd1 55%, transparent 56%),
        #fff;
}

.wdsf-option.is-unavailable {
    display: none;
}

.wdsf [data-facet][hidden] {
    display: none !important;
}

.wdsf.is-loading .wdsf-panel {
    cursor: progress;
}

.wdsf.is-loading .wdsf-option,
.wdsf.is-loading .wdsf-price-fields {
    opacity: .72;
}

/* v0.6.1: compact sidebar cards and clear dimension presentation */
@media (min-width: 768px) {
    .wdsf-panel {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .wdsf-panel-header {
        margin-bottom: 14px;
    }

    .wdsf-panel-header h2 {
        font-size: 21px;
        font-weight: 500;
        letter-spacing: -.01em;
    }

    .wdsf-clear-all {
        min-height: 42px;
        padding: 9px 13px;
        border-radius: 0;
        background: #f2f2f2;
        color: #344054;
        font-size: 11px;
        font-weight: 800;
        text-decoration: none;
        text-transform: uppercase;
        letter-spacing: .01em;
    }

    .wdsf-clear-all:hover {
        background: #e9eaec;
        color: #111827;
    }

    .wdsf-groups {
        grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
        gap: 12px;
    }

    .wdsf-group {
        padding: 13px 12px 12px;
        border-color: #dfe3e8;
        border-radius: 12px;
        background: #f7f8fa;
        box-shadow: none;
    }

    .wdsf-group-title {
        margin-bottom: 9px;
        font-size: 14px;
        line-height: 1.35;
    }

    .wdsf-options {
        max-height: 220px;
        gap: 7px;
        padding: 1px 7px 1px 1px;
        scrollbar-color: #858585 transparent;
        scrollbar-width: thin;
    }

    .wdsf-options::-webkit-scrollbar {
        width: 6px;
    }

    .wdsf-options::-webkit-scrollbar-track {
        background: transparent;
    }

    .wdsf-options::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: #858585;
    }

    .wdsf-option {
        min-height: 24px;
        gap: 8px;
        font-size: 14px;
        line-height: 1.25;
    }

    .wdsf-checkmark {
        width: 18px;
        height: 18px;
        border-color: #b7c0cd;
        border-radius: 5px;
    }

    .wdsf-dimension-group .wdsf-option-name {
        white-space: nowrap;
        overflow-wrap: normal;
        word-break: normal;
        font-variant-numeric: tabular-nums;
        letter-spacing: .005em;
    }

    .wdsf-dimension-group .wdsf-option-count {
        margin-left: 4px;
    }
}


/* v0.7.1: no mobile toggle/apply controls; filters remain inline on every device. */
body .wdsf .wdsf-mobile-toggle,
body .wdsf .wdsf-mobile-apply,
body .wdsf .wdsf-backdrop,
body .wdsf .wdsf-close {
    display: none !important;
}


/* v0.7.2: compact desktop header for narrow Woodmart shop sidebars. */
@media (min-width: 768px) {
    body .wdsf .wdsf-panel-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        width: 100%;
        gap: 7px;
        margin-bottom: 14px;
    }

    body .wdsf .wdsf-panel-header h2 {
        min-width: 0;
        margin: 0;
        font-size: 17px;
        line-height: 1.2;
        font-weight: 600;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
    }

    body .wdsf .wdsf-panel-actions {
        min-width: 0;
        justify-self: end;
    }

    body .wdsf .wdsf-clear-all {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        width: auto;
        min-width: 0;
        min-height: 36px;
        margin: 0;
        padding: 7px 8px;
        font-size: 10px;
        line-height: 1;
        letter-spacing: 0;
        white-space: nowrap;
        box-sizing: border-box;
    }
}


/* v0.7.3: place clear button below the filter title for a cleaner narrow-sidebar layout. */
body .wdsf .wdsf-panel-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
}

body .wdsf .wdsf-panel-actions {
    justify-self: start;
}

body .wdsf .wdsf-clear-all {
    margin-top: 0;
}

@media (min-width: 768px) {
    body .wdsf .wdsf-panel-header {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    body .wdsf .wdsf-panel-header h2 {
        white-space: normal;
    }

    body .wdsf .wdsf-panel-actions {
        justify-self: start;
    }
}


/* v0.7.4: no horizontal scrollbar in narrow filter cards. */
body .wdsf .wdsf-options {
    overflow-y: auto;
    overflow-x: hidden;
}

body .wdsf .wdsf-dimension-group .wdsf-option-name {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}


/* v0.8.4: smart manufacturer filter uses brand logos and appears first. */
.wdsf-brand-group .wdsf-options {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    max-height: 260px;
}

.wdsf-brand-option {
    display: block;
    position: relative;
}

.wdsf-brand-option .wdsf-brand-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    padding: 8px;
    overflow: hidden;
    border: 1px solid var(--wdsf-border);
    border-radius: 10px;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.wdsf-brand-option .wdsf-checkmark {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    box-shadow: 0 0 0 2px rgba(255,255,255,.92);
}

.wdsf-brand-option .wdsf-option-count {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    min-width: 20px;
    min-height: 18px;
    padding: 1px 5px;
    border: 1px solid var(--wdsf-border);
    font-size: 10px;
}

.wdsf-brand-option .wdsf-brand-logo {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 38px;
    margin: auto;
    object-fit: contain;
}

.wdsf-brand-option .wdsf-brand-name {
    display: block;
    padding: 0 18px;
    color: var(--wdsf-text);
    font-weight: 600;
    text-align: center;
    line-height: 1.25;
}

.wdsf-brand-option input:checked + .wdsf-brand-frame {
    border-color: var(--wdsf-accent);
    box-shadow: inset 0 0 0 1px var(--wdsf-accent);
}

.wdsf-brand-option input:checked + .wdsf-brand-frame .wdsf-checkmark {
    border-color: var(--wdsf-accent);
    background: var(--wdsf-accent);
}

.wdsf-brand-option input:checked + .wdsf-brand-frame .wdsf-checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

@media (max-width: 767px) {
    .wdsf-brand-group .wdsf-options {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* v0.8.8: visual marine-plywood finish samples. */
.wdsf-sample-group .wdsf-options {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    max-height: 280px;
}

.wdsf-sample-option {
    display: block;
    position: relative;
}

.wdsf-sample-option .wdsf-sample-frame {
    position: relative;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-height: 52px;
    padding: 7px 28px 7px 7px;
    border: 1px solid var(--wdsf-border);
    border-radius: 10px;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.wdsf-sample-option .wdsf-checkmark {
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 2;
    width: 16px;
    height: 16px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 0 0 2px rgba(255,255,255,.82);
}

.wdsf-sample-option .wdsf-sample-image,
.wdsf-sample-option .wdsf-sample-placeholder {
    display: block;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(17,24,39,.16);
    border-radius: 50%;
    background: #f3f4f6;
    object-fit: cover;
}

.wdsf-sample-option .wdsf-sample-name {
    min-width: 0;
    color: var(--wdsf-text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.wdsf-sample-option .wdsf-option-count {
    position: absolute;
    top: 5px;
    right: 5px;
    min-width: 19px;
    min-height: 17px;
    padding: 1px 4px;
    border: 1px solid var(--wdsf-border);
    font-size: 9px;
}

.wdsf-sample-option input:checked + .wdsf-sample-frame {
    border-color: var(--wdsf-accent);
    box-shadow: inset 0 0 0 1px var(--wdsf-accent);
}

.wdsf-sample-option input:checked + .wdsf-sample-frame .wdsf-checkmark {
    border-color: var(--wdsf-accent);
    background: var(--wdsf-accent);
}

.wdsf-sample-option input:checked + .wdsf-sample-frame .wdsf-checkmark::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

@media (max-width: 420px) {
    .wdsf-sample-group .wdsf-options {
        grid-template-columns: 1fr;
    }
}


/* v0.8.9: logo and finish filters use one full-width column. */
.wdsf-brand-group .wdsf-brand-frame {
    width: 100%;
}

.wdsf-sample-group .wdsf-sample-frame {
    width: 100%;
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 56px;
}

.wdsf-sample-option .wdsf-sample-image,
.wdsf-sample-option .wdsf-sample-placeholder {
    width: 36px;
    height: 36px;
}

.wdsf-sample-option .wdsf-sample-name {
    font-size: 13px;
    overflow-wrap: normal;
    word-break: normal;
}


/* v0.8.10: compact dimension labels without spaces or character wrapping. */
.wdsf-dimension-group .wdsf-option-name {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}
