/* Semantic Search — Shared Styles
 * Used by history, library, and collection pages for search results.
 */

/* Tier divider between text and semantic results */
.ldr-hybrid-divider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.ldr-hybrid-divider::before,
.ldr-hybrid-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--border-color);
}

/* Tier 1 & Tier 3: card matched via semantic search */
.ldr-history-item--semantic {
    border-left: 3px solid var(--primary-color);
}

/* Tier 3: semantic-only result (slightly dimmed) */
.ldr-history-item--semantic-only {
    border-left: 3px solid var(--primary-color);
    opacity: 0.95;
}

/* AI match indicator row (Tier 1 and Tier 3 cards) */
.ldr-history-item-ai-match {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.ldr-ai-match-badge {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 500;
}

.ldr-ai-match-badge i {
    margin-right: 0.25rem;
}

/* Snippet preview (2-line clamp, rendered markdown) */
.ldr-history-item-snippet {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ldr-history-item-snippet strong {
    color: var(--text-primary);
    font-weight: 600;
}
.ldr-history-item-snippet code {
    font-size: 0.8rem;
    padding: 0.1em 0.3em;
    background: var(--bg-secondary);
    border-radius: 3px;
}

/* Brief opacity transition during re-render */
.ldr-results-settling {
    opacity: 0.6;
    transition: opacity 150ms ease;
}

/* Hybrid search loading indicator */
.ldr-hybrid-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Semantic result card (used by createSemanticResultCard) */
.ldr-semantic-result {
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
    cursor: pointer;
}
.ldr-semantic-result:hover {
    background: var(--bg-tertiary, var(--bg-secondary));
}

.ldr-semantic-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.ldr-semantic-type-badge {
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

.ldr-semantic-result-date {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.ldr-semantic-result-title {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}
.ldr-semantic-result-title a {
    color: var(--text-primary);
    text-decoration: none;
}
.ldr-semantic-result-title a:hover {
    text-decoration: underline;
}

.ldr-semantic-result-source {
    margin: 0.5rem 0 0 0;
}
.ldr-semantic-result-source a {
    font-size: 0.8rem;
    color: var(--primary-color);
}

/* AI Search panel layout */
.ldr-semantic-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.ldr-semantic-panel-header h3 {
    margin: 0;
}
.ldr-semantic-panel-description {
    margin: 0 0 0.75rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.ldr-indexing-status {
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}
.ldr-indexing-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ldr-progress-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}
.ldr-progress-track .ldr-progress-bar {
    background: var(--primary-color);
    height: 100%;
    transition: width 0.3s;
}
.ldr-search-row {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

/* Library semantic search additions */
.ldr-semantic-result-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.15rem 0 0.5rem;
}
.ldr-search-notice {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    background: var(--bg-secondary);
    border-left: 3px solid var(--primary-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.ldr-search-notice a {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Library: semantic snippet injected into document cards during hybrid search */
.ldr-library-snippet {
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-tertiary, color-mix(in srgb, var(--primary-color) 8%, var(--bg-secondary)));
    border-radius: 6px;
    border-left: 2px solid var(--primary-color);
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
}
.ldr-library-snippet small {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
}
.ldr-library-snippet div {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Semantic result cards in library context: show more content */
.ldr-semantic-result .ldr-history-item-snippet {
    -webkit-line-clamp: 4;
}

/* Query term highlighting in snippets */
.ldr-search-highlight {
    background: color-mix(in srgb, var(--primary-color) 20%, var(--bg-tertiary, transparent));
    color: var(--text-primary);
    border-radius: 2px;
    padding: 0 2px;
    font-weight: 500;
}
