/* CFS Search V2 — additive styles for the live-suggestions dropdown.
 * Breakpoints (560/620/640/820/900px) intentionally match the existing
 * breakpoints already used in site/index.html (PHASE1_INSPECTION.md §5)
 * rather than introducing new ones, so the new dropdown collapses in step
 * with the rest of the page instead of fighting it at some in-between width.
 */

.cfs-v2-wrap {
    position: relative;
    width: 100%;
}

.cfs-v2-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.cfs-v2-chip {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(120, 120, 140, 0.4);
    background: transparent;
    cursor: pointer;
    color: inherit;
    line-height: 1.4;
}

.cfs-v2-chip.active {
    background: #4a6cf7;
    border-color: #4a6cf7;
    color: #fff;
}

.cfs-v2-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    margin-top: 6px;
    background: var(--cfs-panel-bg, #fff);
    border: 1px solid rgba(120, 120, 140, 0.25);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 60vh;
    overflow-y: auto;
}

.cfs-v2-listbox {
    list-style: none;
    margin: 0;
    padding: 4px;
}

.cfs-v2-item {
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.cfs-v2-item:hover,
.cfs-v2-item.highlighted {
    background: rgba(74, 108, 247, 0.12);
}

.cfs-v2-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cfs-v2-item-title mark,
.cfs-v2-item-snippet mark {
    background: rgba(255, 214, 0, 0.55);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.cfs-v2-badge {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(120, 120, 140, 0.18);
    font-weight: 500;
}

.cfs-v2-item-snippet {
    font-size: 0.82rem;
    opacity: 0.8;
    margin-top: 2px;
    line-height: 1.35;
}

.cfs-v2-status-row {
    padding: 14px 12px;
    font-size: 0.85rem;
    opacity: 0.75;
    text-align: center;
}

.cfs-v2-empty-row {
    padding: 14px 12px;
    text-align: center;
    font-size: 0.85rem;
}

/* CORRECTED per Codex #367 finding 1: informational row shown above
 * results/empty-state whenever the backend reports a truncated
 * (`*_incomplete`) search strategy — see search-v2.js's
 * INCOMPLETE_STRATEGIES / renderIncompleteNotice(). Deliberately styled as
 * a mild notice, not an error, since a truncated scan is not a failure. */
.cfs-v2-incomplete-notice {
    padding: 8px 12px;
    text-align: center;
    font-size: 0.78rem;
    color: #8a6d1a;
    background: rgba(255, 193, 7, 0.14);
    border-bottom: 1px solid rgba(120, 120, 140, 0.18);
}

@media (prefers-color-scheme: dark) {
    .cfs-v2-incomplete-notice {
        color: #f5d271;
        background: rgba(255, 193, 7, 0.1);
    }
}

.cfs-v2-request-btn {
    margin-top: 8px;
    font-size: 0.82rem;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid #4a6cf7;
    background: transparent;
    color: #4a6cf7;
    cursor: pointer;
}

.cfs-v2-request-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Dark-theme awareness: the host page may set a dark background; without
 * knowing its exact token names (never inspected — see PHASE1_INSPECTION.md),
 * this falls back to a system preference check on top of the overridable
 * --cfs-panel-bg custom property above, which the host page can set to
 * match its own theme exactly if desired. */
@media (prefers-color-scheme: dark) {
    .cfs-v2-panel {
        background: var(--cfs-panel-bg, #1c1e26);
        border-color: rgba(255, 255, 255, 0.12);
    }
    .cfs-v2-badge {
        background: rgba(255, 255, 255, 0.12);
    }
}

/* --- Responsive: matches site/index.html's existing breakpoint set --- */

@media (max-width: 900px) {
    .cfs-v2-panel {
        max-height: 55vh;
    }
}

@media (max-width: 820px) {
    .cfs-v2-item-title {
        font-size: 0.9rem;
    }
}

@media (max-width: 640px) {
    .cfs-v2-filters {
        gap: 4px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }
    .cfs-v2-chip {
        flex: none;
        white-space: nowrap;
    }
}

@media (max-width: 620px) {
    .cfs-v2-panel {
        max-height: 50vh;
        border-radius: 8px;
    }
    .cfs-v2-item-snippet {
        font-size: 0.78rem;
    }
}

@media (max-width: 560px) {
    .cfs-v2-item {
        padding: 10px 8px; /* slightly taller tap target on small touch screens */
    }
    .cfs-v2-badge {
        display: none; /* reclaim horizontal space; pillar still conveyed by filter chip state */
    }
}
