#chatsSearchContainer {
    overflow: hidden;
}

#chatsSearchContainer .chats-search-input-row {
    margin-bottom: 20px;
}

#chatsSearchContainer .chats-search-input-row .input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

#chatsSearchContainer .chats-search-input-row .input-wrapper svg {
    width: 18px;
    height: 18px;
    color: var(--text-color-secondary);
}

#chatsSearchContainer .chats-search-input-row input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-color);
    font-size: 16px;
}

#chatsSearchContainer .chats-search-input-row input::placeholder {
    color: var(--text-color-secondary);
}

#chatsSearchContainer .chats-search-input-row .clear-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: var(--text-color-secondary);
    transition: background-color 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    #chatsSearchContainer .chats-search-input-row .clear-button:hover {
        background-color: var(--hover);
    }
}

/* Results layout */
#chatsSearchContainer .projects-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#chatsSearchContainer .chats-search-results {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden auto;
    margin: 0px -14px;
}

#chatsSearchContainer .projects-content-main.chats-search-results {
    gap: 0;
}

#chatsSearchContainer .chats-search-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#chatsSearchContainer .chats-search-section + .chats-search-section {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

#chatsSearchContainer .chats-search-section-title {
    margin: 0 0 4px;
    padding: 0 12px;
    color: var(--text-color-secondary);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
    text-transform: uppercase;
}

#chatsSearchContainer .chats-search-section-list {
    display: flex;
    flex-direction: column;
}

/* Result cards */
#chatsSearchContainer .chats-search-result {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#chatsSearchContainer .chats-search-result:last-child {
    border-bottom: none;
}

@media (hover: hover) and (pointer: fine) {
    #chatsSearchContainer .chats-search-result:hover {
        background-color: var(--hover);
    }
}

#chatsSearchContainer .chats-search-result-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 24px;
}

#chatsSearchContainer .chats-search-result-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

#chatsSearchContainer .chats-search-result-content:focus-visible {
    border-radius: 6px;
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

#chatsSearchContainer .chats-search-result-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--text-color);
    font-size: 16px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#chatsSearchContainer .chats-search-result-snippet {
    margin: 0;
    overflow: hidden;
    color: var(--text-color);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#chatsSearchContainer .chats-search-result-highlight {
    color: var(--warning-color);
}

#chatsSearchContainer .chats-search-result-meta {
    align-self: center;
    margin: 0;
    color: var(--text-color-secondary);
    font-size: 12px;
}

/* Result actions stay visible for keyboard and touch users. */
#chatsSearchContainer .chats-search-result-actions {
    display: none;
    gap: 6px;
}

#chatsSearchContainer .chats-search-result-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-color-secondary);
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

#chatsSearchContainer .chats-search-result-action svg {
    width: 18px;
    height: 18px;
}

#chatsSearchContainer .chats-search-result-action:focus-visible {
    background-color: var(--hover);
    color: var(--text-color);
}

@media (hover: hover) and (pointer: fine) {
    #chatsSearchContainer .chats-search-result-action:hover {
        background-color: var(--hover);
        color: var(--text-color);
    }
}

#chatsSearchContainer .can-show-actions:focus-within .chats-search-result-meta {
    display: none;
}

#chatsSearchContainer .can-show-actions:focus-within .chats-search-result-actions {
    display: flex;
}

@media (hover: hover) and (pointer: fine) {
    #chatsSearchContainer .can-show-actions:hover .chats-search-result-meta {
        display: none;
    }

    #chatsSearchContainer .can-show-actions:hover .chats-search-result-actions {
        display: flex;
    }
}

@media (hover: none), (pointer: coarse) {
    #chatsSearchContainer .can-show-actions .chats-search-result-actions {
        display: flex;
    }
}

/* Empty and loading states are exclusive to this routed page. */
#chatsSearchContainer .projects-empty-state {
    grid-column: 1 / -1;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 48px 32px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-align: center;
    justify-self: stretch;
}

#chatsSearchContainer .projects-empty-state svg {
    margin-bottom: 4px;
    color: var(--text-color-secondary);
    stroke: currentColor;
}

#chatsSearchContainer .projects-empty-state p {
    margin: 0;
}

#chatsSearchContainer .projects-empty-state p:first-of-type {
    color: var(--text-color);
    font-size: 16px;
    font-weight: 600;
}

#chatsSearchContainer .projects-empty-state .secondary {
    color: var(--text-color-secondary);
    font-size: 14px;
}

#chatsSearchContainer .projects-empty-state .spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--text-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
