/* ── Category Hierarchical Filter — Extending multi-column with shared search ── */

.chf-root.chf-hidden {
    display: none !important;
}

.chf-root .chf-hidden {
    display: none !important;
}

/* ── Shared search bar ── */
.chf-root .chf-search-bar-wrap {
    padding: 8px 10px 6px;
    flex-shrink: 0;
}

.chf-root .cat-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 7px;
    border: none;
    box-shadow: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.chf-root .cat-search-box svg {
    flex-shrink: 0;
}

.chf-root .cat-search-box input {
    flex-grow: 1;
    width: 100%;
    padding: 0;
    font-size: 13px;
    line-height: 1.3;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
}

/* ── Columns row ── */
.chf-root .chf-columns {
    display: flex;
    align-items: stretch;
}

/* ── Column ── */
.chf-root .chf-col {
    width: 200px;
    display: flex;
    flex-direction: column;
    max-height: 300px;
    overflow: hidden;
    border: none;
    box-shadow: none;
}

/* Separator between columns — a 1px line */
.chf-root .chf-col + .chf-col {
    margin-left: 0;
    border-left: 1px solid;
}

/* ── Item list ── */
.chf-root .cat-list {
    overflow-y: auto;
    padding: 4px 4px 6px 4px;
    flex: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.chf-root .cat-list::-webkit-scrollbar {
    display: none;
}

/* ── Item base ── */
.chf-root .cat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 6px 8px 6px 10px;
    border-radius: 7px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    user-select: none;
    position: relative;
}

/* ── Checkbox ── */
.chf-root .cat-item-check {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
    border: 1.5px solid;
}

.chf-root .cat-item-check svg {
    opacity: 0;
    width: 9px;
    height: 9px;
    transition: opacity 0.15s ease;
}

.chf-root .cat-item-check.checked svg,
.chf-root .cat-item-check.partial svg,
.chf-root .cat-item-check.excluded svg,
.chf-root .cat-item-check.partial-excluded svg {
    opacity: 1;
}

/* ── Item name ── */
.chf-root .cat-item-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chf-root .cat-item-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
}

.chf-root .cat-item-icon + .cat-item-name {
    margin-left: -3px;
}

.chf-root .cat-item-path {
    font-size: 10px;
    margin-bottom: 1px;
}

.chf-root .cat-item--search-result {
    cursor: pointer;
}

.chf-root .cat-item-search-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.35;
}

/* ── Arrow ── */
.chf-root .cat-item-arrow {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 4px;
    transition: background 0.12s ease;
}

/* ── Loading / empty ── */
.chf-root .cat-loading,
.chf-root .cat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 12px;
    font-size: 12px;
}

.chf-root .cat-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid;
    border-radius: 50%;
    animation: chf-spin 0.8s linear infinite;
    margin-bottom: 6px;
}

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

/* ── Bulk buttons ── */
.chf-root .cat-search-bulk-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 0 8px 6px;
}

.chf-root .cat-bulk-btn {
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chf-root .cat-bulk-btn:focus {
    outline: none;
}

.chf-root .cat-bulk-btn:focus-visible {
    outline: 2px solid rgba(34, 90, 234, 0.45);
    outline-offset: 1px;
}

/* ── Mode buttons ── */
.chf-root .cat-mode-wrap {
    display: flex;
    gap: 4px;
    padding: 0 8px 8px;
}

.chf-root .cat-mode-btn {
    flex: 1;
    padding: 6px 4px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    outline: none;
}

/* ══════════════════════════════════════════════════════════
   LIGHT THEME (explore-shops)
   ══════════════════════════════════════════════════════════ */

.chf-root.chf-theme-light {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.1), 0 2px 8px rgba(15, 23, 42, 0.04);
}

/* Search — no border inside the already-bordered root */
.chf-root.chf-theme-light .cat-search-box {
    background: rgba(15, 23, 42, 0.03);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.chf-root.chf-theme-light .cat-search-box:focus-within {
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.04);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.chf-root.chf-theme-light .cat-search-box svg {
    color: rgba(15, 23, 42, 0.4);
}

.chf-root.chf-theme-light .cat-search-box input {
    color: rgba(15, 23, 42, 0.92);
}

.chf-root.chf-theme-light .cat-search-box input::placeholder {
    color: rgba(15, 23, 42, 0.4);
}

/* Column separator */
.chf-root.chf-theme-light .chf-col + .chf-col {
    border-left-color: rgba(15, 23, 42, 0.08);
}

/* Items — default */
.chf-root.chf-theme-light .cat-item {
    color: rgba(15, 23, 42, 0.85);
}

.chf-root.chf-theme-light .cat-item:hover {
    background: rgba(15, 23, 42, 0.04);
}

.chf-root.chf-theme-light .cat-item:active {
    background: rgba(15, 23, 42, 0.07);
}

/* ── Drilled (expanded parent) ── */
.chf-root.chf-theme-light .cat-item--drilled {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
}

.chf-root.chf-theme-light .cat-item--drilled:hover {
    background: rgba(37, 99, 235, 0.12);
}

.chf-root.chf-theme-light .cat-item--drilled .cat-item-name {
    font-weight: 600;
    color: #1d4ed8;
}

.chf-root.chf-theme-light .cat-item--drilled .cat-item-arrow {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

/* ── Selected (checked) ── */
.chf-root.chf-theme-light .cat-item--selected {
    background: rgba(37, 99, 235, 0.08);
}

.chf-root.chf-theme-light .cat-item--selected:hover {
    background: rgba(37, 99, 235, 0.12);
}

.chf-root.chf-theme-light .cat-item--selected .cat-item-name {
    color: #1e40af;
    font-weight: 600;
}

/* ── Partial (some children selected) ── */
.chf-root.chf-theme-light .cat-item--partial {
    background: rgba(37, 99, 235, 0.04);
}

.chf-root.chf-theme-light .cat-item--partial:hover {
    background: rgba(37, 99, 235, 0.08);
}

.chf-root.chf-theme-light .cat-item--partial .cat-item-name {
    color: #1e40af;
}

/* ── Excluded ── */
.chf-root.chf-theme-light .cat-item--excluded {
    background: rgba(220, 38, 38, 0.06);
}

.chf-root.chf-theme-light .cat-item--excluded:hover {
    background: rgba(220, 38, 38, 0.1);
}

.chf-root.chf-theme-light .cat-item--excluded .cat-item-name {
    color: #991b1b;
}

/* Checkbox states */
.chf-root.chf-theme-light .cat-item-check {
    border-color: rgba(15, 23, 42, 0.2);
    background: #fff;
}

.chf-root.chf-theme-light .cat-item-check.checked,
.chf-root.chf-theme-light .cat-item-check.partial {
    background: #2563eb;
    border-color: #2563eb;
}

.chf-root.chf-theme-light .cat-item-check.excluded {
    background: #dc2626;
    border-color: #dc2626;
}

.chf-root.chf-theme-light .cat-item-check.partial-excluded {
    background: rgba(220, 38, 38, 0.25);
    border-color: #dc2626;
}

/* Arrow */
.chf-root.chf-theme-light .cat-item-arrow {
    color: rgba(15, 23, 42, 0.35);
}

.chf-root.chf-theme-light .cat-item:hover .cat-item-arrow {
    color: rgba(15, 23, 42, 0.55);
    background: rgba(15, 23, 42, 0.04);
}

/* Item name */
.chf-root.chf-theme-light .cat-item-name {
    color: rgba(15, 23, 42, 0.88);
}

.chf-root.chf-theme-light .cat-item-path {
    color: rgba(15, 23, 42, 0.45);
}

/* Loading / empty */
.chf-root.chf-theme-light .cat-loading,
.chf-root.chf-theme-light .cat-empty {
    color: rgba(15, 23, 42, 0.55);
}

.chf-root.chf-theme-light .cat-loading .spinner {
    border-color: rgba(15, 23, 42, 0.16);
    border-top-color: rgba(15, 23, 42, 0.45);
}

/* Bulk buttons */
.chf-root.chf-theme-light .cat-bulk-btn {
    border-color: rgba(15, 23, 42, 0.16);
    background: rgba(15, 23, 42, 0.03);
    color: rgba(15, 23, 42, 0.78);
}

.chf-root.chf-theme-light .cat-bulk-btn:hover {
    border-color: rgba(15, 23, 42, 0.24);
    background: rgba(15, 23, 42, 0.07);
    color: rgba(15, 23, 42, 0.94);
}

/* Mode buttons */
.chf-root.chf-theme-light .cat-mode-btn {
    border-color: rgba(15, 23, 42, 0.14);
    background: #fff;
    color: rgba(15, 23, 42, 0.6);
}

.chf-root.chf-theme-light .cat-mode-btn:hover {
    color: rgba(15, 23, 42, 0.85);
    border-color: rgba(15, 23, 42, 0.24);
    background: rgba(15, 23, 42, 0.04);
}

.chf-root.chf-theme-light .cat-mode-btn.active[data-mode="include"] {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.4);
    color: #2563eb;
}

.chf-root.chf-theme-light .cat-mode-btn.active[data-mode="exclude"] {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(220, 38, 38, 0.4);
    color: #dc2626;
}

/* ══════════════════════════════════════════════════════════
   DARK THEME
   ══════════════════════════════════════════════════════════ */

.chf-root.chf-theme-dark {
    background: var(--fs-bg, #1a1a1a);
    border: 1px solid var(--fs-border, rgba(255, 255, 255, 0.06));
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}

.chf-root.chf-theme-dark .cat-search-box {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.chf-root.chf-theme-dark .cat-search-box:focus-within {
    border-color: rgba(34, 90, 234, 0.55);
    background: rgba(255, 255, 255, 0.07);
}

.chf-root.chf-theme-dark .cat-search-box svg {
    color: rgba(255, 255, 255, 0.35);
}

.chf-root.chf-theme-dark .cat-search-box input {
    color: rgba(255, 255, 255, 0.9);
}

.chf-root.chf-theme-dark .cat-search-box input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

/* Column separator */
.chf-root.chf-theme-dark .chf-col + .chf-col {
    border-left-color: rgba(255, 255, 255, 0.06);
}

/* Items */
.chf-root.chf-theme-dark .cat-item {
    color: rgba(255, 255, 255, 0.85);
}

.chf-root.chf-theme-dark .cat-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.chf-root.chf-theme-dark .cat-item--drilled {
    background: rgba(34, 90, 234, 0.1);
    color: #225aea;
}

.chf-root.chf-theme-dark .cat-item--drilled:hover {
    background: rgba(34, 90, 234, 0.14);
}

.chf-root.chf-theme-dark .cat-item--drilled .cat-item-name {
    font-weight: 600;
    color: #225aea;
}

.chf-root.chf-theme-dark .cat-item--drilled .cat-item-arrow {
    background: rgba(34, 90, 234, 0.15);
    color: #225aea;
}

.chf-root.chf-theme-dark .cat-item--selected {
    background: rgba(34, 90, 234, 0.1);
    color: #225aea;
}

.chf-root.chf-theme-dark .cat-item--selected:hover {
    background: rgba(34, 90, 234, 0.14);
}

.chf-root.chf-theme-dark .cat-item--selected .cat-item-name {
    font-weight: 600;
    color: #fff;
}

.chf-root.chf-theme-dark .cat-item--partial {
    background: rgba(34, 90, 234, 0.06);
    color: #225aea;
}

.chf-root.chf-theme-dark .cat-item--excluded {
    background: rgba(239, 68, 68, 0.07);
    color: #fca5a5;
}

.chf-root.chf-theme-dark .cat-item--excluded:hover {
    background: rgba(239, 68, 68, 0.1);
}

.chf-root.chf-theme-dark .cat-item--excluded .cat-item-name {
    color: #fca5a5;
}

/* Checkbox */
.chf-root.chf-theme-dark .cat-item-check {
    border-color: rgba(255, 255, 255, 0.2);
}

.chf-root.chf-theme-dark .cat-item-check.checked,
.chf-root.chf-theme-dark .cat-item-check.partial {
    background: #3b82f6;
    border-color: #3b82f6;
}

.chf-root.chf-theme-dark .cat-item-check.excluded {
    background: #ef4444;
    border-color: #ef4444;
}

.chf-root.chf-theme-dark .cat-item-check.partial-excluded {
    background: rgba(239, 68, 68, 0.35);
    border-color: #ef4444;
}

/* Arrow */
.chf-root.chf-theme-dark .cat-item-arrow {
    color: rgba(255, 255, 255, 0.35);
}

.chf-root.chf-theme-dark .cat-item:hover .cat-item-arrow {
    color: rgba(255, 255, 255, 0.55);
}

/* Item name */
.chf-root.chf-theme-dark .cat-item-name {
    color: rgba(255, 255, 255, 0.9);
}

.chf-root.chf-theme-dark .cat-item-path {
    color: rgba(255, 255, 255, 0.35);
}

/* Loading / empty */
.chf-root.chf-theme-dark .cat-loading,
.chf-root.chf-theme-dark .cat-empty {
    color: rgba(255, 255, 255, 0.35);
}

.chf-root.chf-theme-dark .cat-loading .spinner {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.5);
}

/* Bulk buttons */
.chf-root.chf-theme-dark .cat-bulk-btn {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.75);
}

.chf-root.chf-theme-dark .cat-bulk-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.95);
}

/* Mode buttons */
.chf-root.chf-theme-dark .cat-mode-btn {
    border-color: rgba(255, 255, 255, 0.1);
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
}

.chf-root.chf-theme-dark .cat-mode-btn:hover {
    color: rgba(255, 255, 255, 0.75);
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
}

.chf-root.chf-theme-dark .cat-mode-btn.active[data-mode="include"] {
    background: rgba(34, 90, 234, 0.12);
    border-color: rgba(34, 90, 234, 0.35);
    color: #3b82f6;
}

.chf-root.chf-theme-dark .cat-mode-btn.active[data-mode="exclude"] {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

/* ── Explore Shops niche filter — trigger open state ── */
.chf-explore-niche-wrapper {
    position: relative;
}

.chf-explore-niche-wrapper > .chf-root {
    z-index: 1200;
}

.chf-explore-niche-wrapper .chf-root .chf-search-bar-wrap {
    padding: 6px 8px 4px;
}

.chf-explore-niche-wrapper .chf-root .cat-search-box {
    gap: 6px;
    padding: 5px 8px;
    border-radius: 6px;
}

.chf-explore-niche-wrapper .chf-root .cat-search-box input {
    font-size: 12px;
}

.chf-explore-niche-wrapper .chf-root .chf-col {
    width: 186px;
    max-height: 276px;
}

.chf-explore-niche-wrapper .chf-root .cat-list {
    padding: 3px 3px 4px;
}

.chf-explore-niche-wrapper .chf-root .cat-item {
    gap: 6px;
    min-height: 30px;
    padding: 4px 6px 4px 8px;
    border-radius: 6px;
}

.chf-explore-niche-wrapper .chf-root .cat-item-name {
    font-size: 12px;
    line-height: 1.3;
}

.chf-explore-niche-wrapper .chf-root .cat-item-icon {
    width: 14px;
    height: 14px;
    font-size: 10px;
}

.chf-explore-niche-wrapper .chf-root .cat-item-arrow {
    width: 12px;
    height: 12px;
}

.filter-item--niche #nicheCategoryFilterTrigger.filter-open {
    border-color: rgba(29, 78, 216, 0.35) !important;
    box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.1) !important;
}

.chf-root.chf-search-active .chf-columns {
    min-width: 0;
}

.chf-root.chf-theme-light .cat-item--search-hit .cat-item-name {
    font-weight: 600;
    color: #1e40af;
}

.chf-root.chf-theme-light .cat-item--search-hit:not(.cat-item--drilled):not(.cat-item--selected) {
    background: rgba(37, 99, 235, 0.05);
}

.chf-root.chf-theme-light .cat-item--search-hit.cat-item--drilled .cat-item-name,
.chf-root.chf-theme-light .cat-item--search-hit.cat-item--selected .cat-item-name {
    color: #1e40af;
}
