<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Deep Research System - Search Settings</title>
    <link rel="stylesheet" href="{{ url_for('research.serve_static', path='css/styles.css') }}">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <link rel="icon" type="image/png" href="{{ url_for('static', filename='favicon.ico') }}">
</head>
<body>
    <div class="app-container">
        <!-- Sidebar -->
        <aside class="sidebar">
            <!-- Sidebar content (keep as is) -->
        </aside>

        <!-- Main Content -->
        <main class="main-content">
            <div class="page active" id="settings">
                <div class="page-header">
                    <div class="results-header">
                        <h1>Search Settings</h1>
                        <div class="results-actions">
                            <a href="{{ url_for('research.settings_page') }}" class="btn btn-outline">
                                <i class="fas fa-arrow-left"></i> Back to Settings
                            </a>
                        </div>
                    </div>
                </div>
                
                <div class="card">
                    <div class="card-content">
                        <h2>Main Configuration File</h2>
                        <p>To edit your main configuration, open this file with your preferred text editor:</p>
                        <div class="file-path">{{ main_file_path }}</div>
                        
                        <button onclick="openFileLocation('{{ main_file_path }}')" class="btn btn-primary">
                            <i class="fas fa-folder-open"></i> Open Containing Folder
                        </button>
                        
                        <h3 class="mt-4">Default Configuration Example</h3>
                        <pre class="config-example">
[general]
output_dir = "research_outputs"
knowledge_accumulation = "ITERATION"
knowledge_accumulation_context_limit = 500000
enable_fact_checking = true

[search]
tool = "auto"
iterations = 3
questions_per_iteration = 3
searches_per_section = 2
max_results = 10
max_filtered_results = 5
region = "us"
time_period = "a"
search_language = "en"
safe_search = true
quality_check_urls = true
snippets_only = false
skip_relevance_filter = false
                        </pre>
                    </div>
                </div>
            </div>
        </main>
    </div>

    <script>
        function openFileLocation(filePath) {
            // Create a hidden form and submit it to a route that will open the file location
            const form = document.createElement('form');
            form.method = 'POST';
            form.action = "{{ url_for('research.open_file_location') }}";
            
            const input = document.createElement('input');
            input.type = 'hidden';
            input.name = 'file_path';
            input.value = filePath;
            
            form.appendChild(input);
            document.body.appendChild(form);
            form.submit();
        }
    </script>
</body>
</html>