/**
 * FEATURE-025-A: Knowledge Base Core CSS
 * 
 * Two-column layout (like Ideation view) with tree on left of content area.
 */

/* Override content-body padding when KB container is displayed */
.content-body:has(.kb-container) {
    padding: 0;
}

/* Override content-area background when KB is displayed to avoid white gap */
.content-area:has(.kb-container) {
    background-color: var(--bg-primary, #1e1e1e);
}

/* KB Container - Two column layout */
.kb-container {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--bg-primary, #1e1e1e);
}

/* KB Sidebar (within content area, not main sidebar) */
.kb-sidebar {
    width: 280px;
    min-width: 240px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary, #252526);
    border-right: 1px solid var(--border-color, #3d3d3d);
}

.kb-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color, #3d3d3d);
}

.kb-sidebar-title {
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    font-size: 0.875rem;
}

.kb-refresh-btn {
    background: transparent;
    border: none;
    color: var(--text-muted, #808080);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    transition: all 0.15s;
}

.kb-refresh-btn:hover {
    color: var(--text-primary, #e0e0e0);
    background: var(--bg-hover, #2a2a2a);
}

.kb-search-box {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color, #3d3d3d);
}

.kb-search-input {
    width: 100%;
    padding: 0.375rem 0.75rem;
    background: var(--bg-darker, #1e1e1e);
    border: 1px solid var(--border-color, #3d3d3d);
    border-radius: 4px;
    color: var(--text-primary, #e0e0e0);
    font-size: 0.813rem;
}

.kb-search-input::placeholder {
    color: var(--text-muted, #808080);
}

.kb-search-input:focus {
    outline: none;
    border-color: var(--accent-color, #0d6efd);
}

/* KB Tree */
.kb-tree {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.kb-loading {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted, #808080);
}

/* KB Folder */
.kb-folder {
    margin-bottom: 0.25rem;
}

.kb-folder-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    color: var(--text-secondary, #cccccc);
    font-size: 0.875rem;
    transition: background-color 0.15s;
}

.kb-folder-header:hover {
    background: var(--bg-hover, #2a2a2a);
}

.kb-folder-header i:first-child {
    font-size: 0.75rem;
    color: var(--text-muted, #808080);
    width: 12px;
}

.kb-folder-files {
    padding-left: 1.5rem;
}

.kb-folder.collapsed .kb-folder-files {
    display: none;
}

/* KB File Item */
.kb-file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.813rem;
    color: var(--text-primary, #e0e0e0);
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.15s;
}

.kb-file-item:hover {
    background: var(--bg-hover, #2a2a2a);
}

.kb-file-item.active {
    background: var(--accent-color-dim, rgba(13, 110, 253, 0.2));
    color: var(--accent-color, #0d6efd);
}

.kb-file-item i {
    font-size: 0.875rem;
    width: 16px;
    text-align: center;
}

.kb-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kb-empty {
    padding: 0.5rem 0.75rem;
    font-size: 0.813rem;
    color: var(--text-muted, #808080);
    font-style: italic;
}

.kb-empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted, #808080);
}

.kb-empty-state i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* KB Content (right side) */
.kb-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg-primary, #1e1e1e);
}

.kb-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted, #808080);
}

.kb-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.kb-placeholder h5 {
    color: var(--text-secondary, #cccccc);
}

/* KB Welcome/Stats View */
.kb-welcome {
    max-width: 800px;
}

.kb-stats {
    display: flex;
    align-items: center;
}

.kb-section h6 {
    color: var(--text-secondary, #cccccc);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.kb-landing-list {
    border: 1px solid var(--border-color, #3d3d3d);
    border-radius: 4px;
    background: var(--bg-darker, #252526);
}

.kb-landing-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color, #3d3d3d);
    color: var(--text-primary, #e0e0e0);
    font-size: 0.875rem;
}

.kb-landing-file:last-child {
    border-bottom: none;
}

.kb-topics-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.kb-topic-card {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg-darker, #252526);
    border: 1px solid var(--border-color, #3d3d3d);
    border-radius: 4px;
    color: var(--text-primary, #e0e0e0);
    font-size: 0.875rem;
    transition: border-color 0.15s;
}

.kb-topic-card:hover {
    border-color: var(--accent-color, #0d6efd);
}

/* KB File Preview */
.kb-file-preview {
    background: var(--bg-darker, #252526);
    border: 1px solid var(--border-color, #3d3d3d);
    border-radius: 6px;
    padding: 1.5rem;
}

.kb-file-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.kb-file-info h6 {
    color: var(--text-primary, #e0e0e0);
}

.kb-file-meta .badge {
    font-weight: 400;
}

.kb-error {
    padding: 2rem;
    text-align: center;
    color: var(--text-danger, #dc3545);
}
