/* Include/Exclude filter component (cfd-*) – shared across Dashboard, Winning Products, Lotgenoten */

.cfd-container { position: relative; width: 100%; min-width: 270px; }
.cfd-trigger {
    display: flex; flex-wrap: nowrap; gap: 4px; align-items: center;
    min-height: 33px; padding: 4px 28px 4px 7px;
    border: 1px solid #e9e9e9 !important;
    border-radius: 11px !important;
    box-shadow: 0 0px 0px 0 rgb(0 0 0 / 10%), 0 1px 2px -1px rgb(0 0 0 / 10%);
    cursor: pointer; background: #fff !important;
    color: #555; font-size: 13px; font-weight: 400;
    -webkit-appearance: none; appearance: none;
    position: relative;
}
.cfd-trigger::before {
    content: '';
    position: absolute;
    right: 11px;
    top: 50%;
    margin-top: -5px;
    width: 6px;
    height: 6px;
    border: solid #94a3b8;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    background: none;
    border-radius: 0;
    pointer-events: none;
}
.cfd-container.open .cfd-trigger::before {
    transform: rotate(225deg);
    margin-top: -3px;
}
.cfd-tag {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 1px 6px; border-radius: 4px;
    height: 23px !important; line-height: 23px !important; margin-top: 2px !important;
    font-size: 12px; font-weight: 400; white-space: nowrap;
    border: none !important;
}
.cfd-tag-include { background: #dcfce7; color: #166534; }
.cfd-tag-blue { background: #dbeafe; color: #1e40af; }
.cfd-tag-exclude { background: #fee2e2; color: #991b1b; }
.cfd-tag-more { background: #f1f5f9; color: #000000; cursor: default; }
.cfd-tag img { width: 14px; height: 10px; border-radius: 1px; object-fit: cover; }
.cfd-tag .cfd-item-emoji {
    width: auto; flex: none; font-size: 12px; margin-right: 1px;
}
.cfd-tag-remove { cursor: pointer; font-size: 13px; line-height: 1; color: #6451ff !important; margin-left: 1px; }
.cfd-tag-remove:hover { opacity: 0.9; }
.cfd-search-input {
    border: none; outline: none; flex: 1 1 auto; min-width: 0; width: 100%;
    font-size: 13px !important; color: #555 !important;
    background: transparent !important; background-color: transparent !important;
    box-shadow: none !important;
    padding: 0; height: 23px; margin-top: 0;
    color-scheme: inherit;
}
.cfd-panel {
    display: none; position: absolute; top: calc(100% + 3px); left: 0; right: 0;
    min-width: 280px; width: max-content; max-width: 360px;
    background: #fff; border: 1px solid #e9e9e9;
    border-radius: 6px;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 10%), 0 1px 2px -1px rgb(0 0 0 / 10%);
    z-index: 1000;
    max-height: min(460px, 72vh); overflow-y: auto; overflow-x: hidden;
}
.cfd-panel.open { display: block; }
.cfd-item {
    display: flex; align-items: center; padding: 5px 8px; gap: 6px;
    font-size: 12px; transition: background .1s; user-select: none;
}
.cfd-item:hover { background: #f8fafc; }
.cfd-item.cfd-included { background: #f0fdf4; }
.cfd-item.cfd-excluded { background: #fef2f2; }
.cfd-item-flag { width: 18px; height: 13px; border-radius: 2px; object-fit: cover; flex-shrink: 0; }
.cfd-item-app-icon { width: 16px; height: 16px; border-radius: 3px; object-fit: cover; flex-shrink: 0; }
.cfd-item-icon { flex-shrink: 0; }
.cfd-item-emoji {
    width: 18px; flex: 0 0 18px; text-align: center;
    font-size: 14px; line-height: 1;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.cfd-item-name { flex: 1; }
.cfd-item-count { color: #5b6b82; font-weight: 400; font-size: 11px; margin-left: 2px; }
.cfd-item-actions { display: flex; gap: 3px; }
.cfd-btn {
    width: 22px; height: 22px; border: 1px solid #e2e8f0; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 13px; font-weight: 600; line-height: 1;
    background: #fff; transition: all .12s; color: #5b6b82;
}
.cfd-btn:hover { transform: scale(1.1); }
.cfd-btn-inc:hover, .cfd-btn-inc.active { background: #dcfce7; border-color: #86efac; color: #15803d; }
.cfd-btn-exc:hover, .cfd-btn-exc.active { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.cfd-empty { padding: 12px; text-align: center; color: #5b6b82; font-size: 12px; }
.cfd-toolbar {
    display: flex; gap: 4px; padding: 5px 8px;
    border-bottom: 1px solid #f1f5f9; position: sticky; top: 0; background: #fff; z-index: 1;
}
.cfd-bulk {
    flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid #e2e8f0; border-radius: 4px;
    font-size: 11px; font-weight: 600; cursor: pointer; background: #fff;
    color: #000000; transition: all .12s; line-height: 1.3; white-space: nowrap;
}
.cfd-bulk:hover { background: #f8fafc; }
.cfd-bulk-inc:hover { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.cfd-bulk-exc:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.cfd-bulk-clear:hover { background: #f8fafc; border-color: #cbd5e1; color: #334155; }

/* Quick-pick region bundles (rendered just under the bulk toolbar). */
.cfd-bundles {
    display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px;
    border-bottom: 1px solid #f1f5f9; background: #fff;
}
.cfd-bundle {
    padding: 3px 9px; border: 1px solid #e2e8f0; border-radius: 9999px;
    font-size: 11px; font-weight: 600; cursor: pointer; background: #f8fafc;
    color: #475569; transition: all .12s; line-height: 1.3; white-space: nowrap;
}
.cfd-bundle:hover { background: #225AEA; border-color: #225AEA; color: #fff; }

.cfd-group-header {
    padding: 6px 8px 3px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5b6b82;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 0;
}
.cfd-toolbar + .cfd-bundles + .cfd-group-header,
.cfd-toolbar + .cfd-group-header,
.cfd-bundles + .cfd-group-header:first-of-type,
.cfd-toolbar ~ .cfd-group-header:first-of-type {
    border-top: none;
}
.cfd-group-header + .cfd-item { padding-top: 4px; }

/* Compact summary preview (icon + label in trigger when compactSummary is on). */
.cfd-compact-preview {
    display: none;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    margin-top: 2px;
}
.cfd-compact-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: 46%;
}
.cfd-compact-item--exclude .cfd-compact-label { color: #991b1b; }
.cfd-compact-icon { width: 14px; height: 10px; border-radius: 2px; object-fit: cover; flex-shrink: 0; }
.cfd-compact-icon.cfd-item-app-icon { width: 14px; height: 14px; border-radius: 3px; }
.cfd-compact-label {
    font-size: 12px;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cfd-compact-sep { color: #5b6b82; font-size: 11px; flex-shrink: 0; }
.cfd-compact-more { font-size: 11px; color: #000000; font-weight: 600; flex-shrink: 0; }

/* Meta ads niche v3 — trigger matches filter row; dropdown = dark 3-column panels */
.n3-root { position: relative; width: 100%; min-width: 0; }
.n3-trigger {
    display: flex; align-items: center; gap: 6px;
    width: 100%; min-height: 33px; padding: 4px 28px 4px 7px;
    border: 1px solid #e9e9e9 !important; border-radius: 11px !important;
    box-shadow: 0 0px 0px 0 rgb(0 0 0 / 10%), 0 1px 2px -1px rgb(0 0 0 / 10%);
    cursor: pointer; background: #fff !important; color: #555 !important;
    font-size: 13px; font-weight: 400; text-align: left;
    -webkit-appearance: none; appearance: none;
    position: relative;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.n3-trigger:hover { border-color: #d0d0d0 !important; }
/* Same chevron affordance as .cfd-trigger::before */
.n3-trigger::before {
    content: '';
    position: absolute;
    right: 11px;
    top: 50%;
    margin-top: -5px;
    width: 6px;
    height: 6px;
    border: solid #94a3b8;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
    transition: transform 0.2s ease, margin-top 0.2s ease;
    pointer-events: none;
}
.n3-root.n3-open .n3-trigger::before {
    transform: rotate(225deg);
    margin-top: -3px;
}
.n3-trigger-label { flex: 1; min-width: 0; font-size: 13px; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.n3-trigger-count { flex-shrink: 0; font-size: 12px; font-weight: 500; color: #2563eb; margin-right: 2px; }
.n3-count-exc { color: #ef4444 !important; }

.n3-dropdown {
    position: fixed; z-index: 10050; display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 4px;
    /* Cap the box to the viewport. Placement (left vs right anchor) is done in
       niche-v3-cascade.js so a trigger at the right edge does not paint the
       fixed-width columns off-screen. */
    max-width: calc(100vw - 24px);
}
.n3-dropdown.hidden { display: none !important; }
/* Grow submenus to the left when the trigger is too close to the right edge. */
.n3-dropdown.n3-dropdown--flip { flex-direction: row-reverse; }
.n3-dropdown.n3-dropdown--flip .n3-item-arrow { transform: scaleX(-1); }
.n3-panel.hidden { display: none !important; }

.n3-panel { width: 208px; margin-left: 0; flex-shrink: 0; }
/* Light panel — aligned with the include/exclude (cfd) dropdown so niche matches the rest of the bar */
.n3-panel-inner {
    background: #fff;
    border: 1px solid #e9e9e9;
    border-radius: 8px;
    max-height: min(460px, 72vh);
    display: flex; flex-direction: column;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(15, 23, 42, 0.08);
}
.n3-list {
    overflow-y: auto; padding: 2px; flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 23, 42, 0.18) transparent;
}
.n3-item {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 6px; border-radius: 4px; cursor: pointer;
    transition: background 0.1s ease; user-select: none;
}
.n3-item:hover { background: #f8fafc; }
.n3-item.active { background: #eff6ff; }
.n3-item.excluded-active { background: #fef2f2; }
.n3-item-check {
    width: 10px; height: 10px; border-radius: 2px;
    border: 1px solid #cbd5e1;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.1s ease;
}
.n3-item-check.checked,
.n3-item-check.partial { background: #2563eb; border-color: #2563eb; }
.n3-item-check.excluded,
.n3-item-check.partial-excluded { background: #dc2626; border-color: #dc2626; }
.n3-item-check.partial-excluded { background: rgba(220, 38, 38, 0.45); }
.n3-item-name {
    flex: 1; font-size: 12px; font-weight: 500;
    color: #334155;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.n3-item.active .n3-item-name { color: #1e40af; }
.n3-item.excluded-active .n3-item-name { color: #991b1b; }
.n3-item-name-stack { white-space: normal; display: flex; flex-direction: column; gap: 1px; }
.n3-item-path { font-size: 9px; color: #5b6b82; line-height: 1.2; }
.n3-item-arrow {
    width: 12px; height: 12px; display: flex; align-items: center; justify-content: center;
    color: #cbd5e1; flex-shrink: 0;
}
.n3-item-icon {
    flex-shrink: 0; font-size: 13px; line-height: 1; width: 1.1em; text-align: center;
}
.n3-item-count {
    flex-shrink: 0; font-size: 10px; font-weight: 500; color: #94a3b8; margin-left: 2px;
}
.n3-item:hover .n3-item-arrow { color: #000000; }
.n3-empty {
    padding: 20px 10px; text-align: center; color: #5b6b82; font-size: 12px;
}

.n3-search-wrap { padding: 6px; flex-shrink: 0; }
.n3-search-box {
    display: flex; align-items: center; gap: 6px;
    padding: 0 8px; border-radius: 4px;
    background: #fff;
    border: 1px solid #e2e8f0;
    outline: none;
    box-shadow: none;
    transition: border-color 0.12s ease;
}
.n3-search-box:focus,
.n3-search-box:focus-within {
    outline: none !important;
    box-shadow: none !important;
    border-color: #cbd5e1;
}
.n3-search-box svg { flex-shrink: 0; color: #5b6b82; }
.n3-search-input {
    flex: 1; width: 100%; padding: 5px 0; font-size: 12px; color: #334155;
    background: transparent; border: none; outline: none !important; box-shadow: none !important;
}
.n3-search-input:focus,
.n3-search-input:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}
.n3-search-input::placeholder { color: #717c92; }

.n3-bulk-wrap {
    display: flex; gap: 4px; padding: 0 6px 6px; flex-shrink: 0;
}
.n3-bulk-btn {
    flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid #e2e8f0; border-radius: 4px;
    font-size: 11px; font-weight: 600; cursor: pointer; background: #fff;
    color: #000000; transition: all .12s; line-height: 1.3; white-space: nowrap;
    text-transform: none; letter-spacing: normal;
}
.n3-bulk-btn:hover { background: #f8fafc; }
.n3-bulk-btn.n3-bulk-inc:hover { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.n3-bulk-btn.n3-bulk-clear:hover { background: #f8fafc; border-color: #cbd5e1; color: #334155; }
