.chat-history-sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 65px;
    height: calc(100vh - 65px);
    overflow: hidden;
}

.chat-history-header {
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--background);
    flex-shrink: 0;
}

.chat-history-header h3 {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.new-chat-btn {
    padding: 6px 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition);
}

.new-chat-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.chat-history-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.chat-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    cursor: pointer;
    transition: var(--transition);
}

.chat-item {
    position: relative;
}

.chat-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.chat-item.active {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.delete-chat-btn {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: #999;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: var(--transition);
}

.delete-chat-btn:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.chat-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chat-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 500;
    background: var(--primary-light);
    color: var(--primary-color);
}

.document-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.document-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.document-item.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.document-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--background);
}

.document-item.uploading,
.document-item.processing {
    opacity: 0.7;
    cursor: wait;
}

.document-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}


.document-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.document-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.document-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.status-finished {
    background: #d1fae5;
    color: #065f46;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: var(--spacing-lg);
}

.document-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
