/* unified_frontend/css/components/list.css - REPLACEMENT */

/* --- General List & Item Styles --- */
.clickable-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.project-list-item,
.artifact-list-item,
.document-list-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    transition: background-color 0.2s ease;
    border-radius: var(--border-radius-md);
    margin: var(--spacing-xxxs) 0;
    background-color: transparent;
    cursor: pointer;
}

.project-list-item:hover,
.artifact-list-item:hover,
.document-list-item:hover {
    background-color: var(--bg-surface-hover);
}

.project-list-item.selected,
.artifact-list-item.selected {
    background-color: var(--bg-surface);
    color: var(--primary-color);
}

.project-item-info,
.artifact-item-info,
.document-item-info {
    flex-grow: 1;
    margin-right: var(--spacing-xs);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.project-name,
.artifact-title,
.document-filename {
    font-weight: 400;
    color: inherit;
    font-size: var(--font-size-sm);
}

.artifact-type {
    font-size: var(--font-size-xxs);
    color: var(--text-secondary);
    background-color: var(--secondary-bg);
    padding: var(--spacing-xxxs) var(--spacing-xs);
    border-radius: var(--border-radius-pill);
    display: inline-block;
    margin-left: auto;
    font-weight: 500;
}

/* Type Badges */
.artifact-type.type-source {
    background-color: #e2e8f0;
    color: #475569;
}

.artifact-type.type-outcome {
    background-color: #dcfce7;
    color: #166534;
}

.artifact-type.type-memo {
    background-color: #fef9c3;
    color: #854d0e;
}

.artifact-type.type-data {
    background-color: #e0f2fe;
    color: #075985;
}

/* Excalidraw Badge Style */
.artifact-type.type-excalidraw {
    background-color: #fef0f0;
    color: #9f1239;
    border: 1px solid #fecdd3;
}

.project-id,
.artifact-id,
.document-id {
    display: none !important;
}

/* Document list specific */
.document-list-item .edit-doc-icon-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.document-list-item:hover .edit-doc-icon-btn {
    opacity: 1;
}

/* --- Search Results List --- */
.search-results-list {
    list-style: none;
    padding: 0;
    margin-top: var(--spacing-xs);
}

#rag-search-results {
    margin-top: var(--spacing-sm);
    max-height: 300px;
    overflow-y: auto;
}

#rag-search-results li {
    padding: var(--spacing-sm);
    cursor: pointer;
    border-radius: var(--border-radius-md);
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-xxs);
    background-color: var(--bg-surface-alt);
    border: var(--border-width-sm) var(--border-light);
}

#rag-search-results li:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-medium);
}

#rag-search-results li strong {
    color: var(--text-primary);
    font-weight: 500;
    display: block;
    margin-bottom: var(--spacing-xxs);
    font-size: var(--font-size-sm);
}

#rag-search-results .search-result-id,
#rag-search-results .snippet {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.5;
    display: block;
}

#rag-search-results .snippet {
    margin-top: var(--spacing-xxs);
}

/* --- Modal Project List --- */
#modal-project-list {
    flex-grow: 1;
    margin-bottom: var(--spacing-md);
    border: var(--border-width-sm) solid var(--border-light);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-xs);
    background-color: var(--bg-surface-alt);
    max-height: 400px;
    overflow-y: auto;
}

#modal-project-list .project-list-item {
    background-color: var(--bg-surface);
    margin-bottom: var(--spacing-xxs);
}

#modal-project-list .project-list-item:last-child {
    margin-bottom: 0;
}

#modal-project-list .project-list-item:hover {
    background-color: var(--bg-surface-hover);
}

/* Focus and accessibility improvements */
.project-list-item:focus,
.document-list-item:focus {
    outline: var(--border-width-md) var(--primary-color);
    outline-offset: -2px;
}

/* --- Version Badge --- */
.artifact-version-badge {
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    font-size: 10px;
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 600;
}

/* --- Project List Styles --- */
#rag-project-list {
    min-height: 40px;
    transition: max-height 0.3s ease;
}

/* Vollansicht: alle Projekte mit Scroll */
.rag-section[data-section="project"]:not(.section-collapsed) #rag-project-list {
    max-height: 300px;
    overflow-y: auto;
}

/* Preview: nur Top 3 Projekte, kein Scroll */
.rag-section[data-section="project"].section-collapsed #rag-project-list {
    max-height: 105px;
    overflow: hidden;
}

#rag-project-list .project-list-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    margin-bottom: 2px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background-color 0.2s;
    border-left: 3px solid transparent; /* Platzhalter für Active-Indicator */
}

#rag-project-list .project-list-item:hover {
    background-color: var(--bg-surface-hover);
}

#rag-project-list .project-list-item.active {
    background-color: var(--bg-surface);
    border-left-color: var(--text-secondary);
    font-weight: 500;
    color: var(--text-primary);
}

#rag-project-list .project-item-icon {
    margin-right: 8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

#rag-project-list .project-list-item.active .project-item-icon {
    color: var(--primary-color);
}

#rag-project-list .project-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--font-size-sm);
}

#rag-project-list .project-count-badge {
    font-size: 10px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    padding: 0 6px;
    color: var(--text-secondary);
}

/* --- Epic List Styles --- */
#rag-epic-list {
    min-height: 40px;
    transition: max-height 0.3s ease;
}

/* Vollansicht: alle Epics mit Scroll */
.rag-section[data-section="epics"]:not(.section-collapsed) #rag-epic-list {
    max-height: 300px;
    overflow-y: auto;
}

/* Preview: nur Top 3 Epics, kein Scroll */
.rag-section[data-section="epics"].section-collapsed #rag-epic-list {
    max-height: 105px;
    overflow: hidden;
}

#rag-epic-list .epic-list-item {
    display: flex;
    align-items: center;
    padding: 4px 8px; /* Etwas kompakter als Projekte */
    margin-bottom: 2px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

#rag-epic-list .epic-list-item:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

#rag-epic-list .epic-list-item.active {
    background-color: var(--bg-surface);
    border-left-color: var(--text-secondary);
    font-weight: 500;
    color: var(--text-primary);
}

#rag-epic-list .epic-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Style für den "Global Context" Eintrag */
#rag-epic-list .epic-list-item.is-global {
    font-style: italic;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
    padding-bottom: 6px;
}

/* Epic list item layout for edit button */
#rag-epic-list .epic-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#rag-epic-list .epic-list-item .epic-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Epic edit button - hidden by default, shows on hover */
#rag-epic-list .epic-list-item .epic-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
    margin-left: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    color: var(--text-secondary);
}

#rag-epic-list .epic-list-item:hover .epic-edit-btn {
    opacity: 0.6;
    visibility: visible;
}

#rag-epic-list .epic-list-item .epic-edit-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    color: var(--text-primary);
}

/* Epic list styles are now part of the separate Epics section */

/* ===========================================
   Artifact List Active State (from artifactIntegration.css)
   =========================================== */

.artifact-list-item.artifact-item-active {
    background-color: var(--primary-bg);
    border-color: var(--primary-color);
}

.artifact-list-item.artifact-item-active .artifact-title {
    color: var(--primary-color);
    font-weight: 500;
}

.artifact-list-item:focus {
    outline: var(--border-width-md) solid var(--primary-color);
    outline-offset: -2px;
}

.artifact-list-item[aria-current="true"] {
    background-color: var(--primary-bg);
}