/* ── FDW Product Filters — Dark Theme ── */

.fdw-product-filters-wrap {
    --fdw-bg: #111113;
    --fdw-surface: #1a1b1f;
    --fdw-surface2: #222226;
    --fdw-text: #e4e6ed;
    --fdw-text-muted: #8b8fa3;
    --fdw-accent: #e41e26;
    --fdw-accent-hover: #ff453a;
    --fdw-border: #2a2b30;
    --fdw-radius: 8px;
}

/* ── Filter layout — single fused card, wider ── */
.fdw-product-filters-wrap .fdw-filters {
    display: flex;
    margin-bottom: 1.5rem;
    background: var(--fdw-surface);
    border: 1px solid var(--fdw-border);
    border-radius: var(--fdw-radius);
    max-width: 100%;
}

.fdw-filter-group {
    flex: 1;
    min-width: 0;
    padding: 1.25rem 1.5rem;
}

.fdw-filter-group + .fdw-filter-group {
    border-left: 1px solid var(--fdw-border);
}

/* ── Filter headings ──
 * font-family pinned to system stack to bypass theme's single-weight Facet
 * display font (FACETBK.TTF). Forcing weight 700 against a single-weight
 * font triggers browser synthetic-bold, which renders blurry on dark BG.
 * Using a real semibold (600) from system fonts + font-synthesis:none
 * guarantees crisp glyphs.
 */
.fdw-filter-heading {
    font-family: var(--theme-font-stack-default, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif) !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    font-synthesis: none !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.2;
    margin: 0 0 1rem !important;
    padding-bottom: 0.7rem;
    border-bottom: 2px solid #e41e26;
    color: #fff !important;
    text-shadow: none !important;
    filter: none !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
}

/* ── Clear filters toolbar ── always rendered, button muted until a filter is active ── */
.fdw-filters-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.fdw-clear-filters {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 1px solid var(--fdw-border);
    color: var(--fdw-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    padding: 0.45rem 0.9rem;
    border-radius: 4px;
    cursor: not-allowed;
    opacity: 0.45;
    pointer-events: none;
    transition: color 0.15s, border-color 0.15s, background 0.15s, opacity 0.15s;
}

.fdw-product-filters-wrap.fdw-has-filters .fdw-clear-filters {
    cursor: pointer;
    opacity: 1;
    pointer-events: auto;
}

.fdw-clear-filters:hover,
.fdw-clear-filters:focus-visible {
    color: #fff;
    border-color: #e41e26;
    background: rgba(228, 30, 38, 0.12);
    outline: none;
}

/* ── Checkbox tree ── */
.fdw-term-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Children list — accordion container */
.fdw-term-list .fdw-term-list {
    padding-left: 1.25rem !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 0;
}

/* Expanded state */
.fdw-has-children.fdw-expanded > .fdw-term-list {
    max-height: 500px;
    opacity: 1;
}

.fdw-term-item {
    margin: 0 !important;
}

.fdw-term-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0.4rem 0.25rem;
    border-radius: 4px;
    color: var(--fdw-text) !important;
    transition: background 0.15s;
}

.fdw-term-label:hover {
    background: var(--fdw-surface2);
}

.fdw-parent-label {
    font-weight: 600;
    font-size: 0.9rem;
}

/* ── Accordion toggle — SVG red arrow ── */
.fdw-has-children > .fdw-term-label .fdw-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.fdw-has-children > .fdw-term-label .fdw-toggle svg {
    width: 12px;
    height: 12px;
    fill: #e41e26;
    transition: fill 0.15s;
}

.fdw-has-children > .fdw-term-label:hover .fdw-toggle svg {
    fill: #ff453a;
}

.fdw-has-children.fdw-expanded > .fdw-term-label .fdw-toggle {
    transform: rotate(90deg);
}

.fdw-has-children.fdw-expanded > .fdw-term-label .fdw-toggle svg {
    fill: #ff453a;
}

/* ── Custom checkboxes — glowing red circles (all depths) ── */
.fdw-filter-checkbox {
    -webkit-appearance: none !important;
    appearance: none !important;
    margin: 0 !important;
    flex-shrink: 0;
    width: 14px !important;
    height: 14px !important;
    border: 1.5px solid #e41e26 !important;
    border-radius: 50% !important;
    background: transparent !important;
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s, box-shadow 0.15s;
    padding: 0 !important;
}

.fdw-filter-checkbox:hover {
    border-color: #ff453a !important;
    box-shadow: 0 0 6px rgba(228, 30, 38, 0.3) !important;
}

.fdw-filter-checkbox:checked {
    background: #e41e26 !important;
    border-color: #e41e26 !important;
    box-shadow: 0 0 8px rgba(228, 30, 38, 0.5), 0 0 16px rgba(228, 30, 38, 0.2) !important;
    animation: fdw-pulse 2s ease-in-out infinite !important;
}

.fdw-filter-checkbox:checked::after {
    content: '' !important;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: none !important;
}

@keyframes fdw-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(228, 30, 38, 0.5), 0 0 16px rgba(228, 30, 38, 0.2); }
    50% { box-shadow: 0 0 12px rgba(228, 30, 38, 0.7), 0 0 24px rgba(228, 30, 38, 0.35); }
}

.fdw-no-terms {
    color: var(--fdw-text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* ── Children count badge ── */
.fdw-child-count {
    font-size: 0.7rem;
    color: var(--fdw-text-muted);
    margin-left: 0.25rem;
    font-weight: 400;
}

/* ── Loading overlay — hosts FdwLoader cinematic / static-pulse ── */
.fdw-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3rem;
    background: rgba(8, 8, 10, 0.85);
    backdrop-filter: blur(3px);
    z-index: 50;
    border-radius: var(--fdw-radius);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.35s ease;
}

.fdw-loading.fdw-loading-fadeout {
    opacity: 0;
}

.fdw-loader-host {
    position: relative;
    line-height: 0;
}

.fdw-loader-scene {
    position: relative;
    display: block;
    border-radius: 24px;
    transition: transform 0.35s ease;
}

.fdw-loader-scene canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.fdw-loader-scene canvas:first-child {
    position: relative;
}

.fdw-loader-pulse {
    animation: fdw-loader-pulse 1.6s ease-in-out infinite;
}

@keyframes fdw-loader-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(228, 30, 38, 0.45),
                    0 0 18px 0 rgba(228, 30, 38, 0.18);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(228, 30, 38, 0.05),
                    0 0 36px 4px rgba(228, 30, 38, 0.45);
    }
}

.fdw-loading-active {
    opacity: 0.4;
    transition: opacity 0.15s;
}

/* ── No products ── */
.fdw-no-products {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--fdw-text-muted);
    font-size: 1rem;
}

/* ── AJAX pagination ── */
.fdw-ajax-pagination {
    margin-top: 2rem;
    text-align: center;
}

.fdw-pagination-inner {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
}

.fdw-page-btn {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--fdw-border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--fdw-text);
    font-size: 0.8rem;
    cursor: pointer;
    background: var(--fdw-surface);
    transition: background 0.15s, border-color 0.15s;
}

.fdw-page-btn:hover {
    background: var(--fdw-surface2);
    border-color: var(--fdw-text-muted);
    color: var(--fdw-text);
}

.fdw-page-btn.fdw-current {
    background: #e41e26;
    color: #fff;
    border-color: #e41e26;
    cursor: default;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .fdw-product-filters-wrap .fdw-filters {
        flex-direction: column;
    }

    .fdw-filter-group + .fdw-filter-group {
        border-left: none;
        border-top: 1px solid var(--fdw-border);
    }
}
