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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, render_template, request, jsonify, send_file
|
2 |
+
import ollama
|
3 |
+
import json
|
4 |
+
import re
|
5 |
+
from duckduckgo_search import DDGS
|
6 |
+
import requests
|
7 |
+
from bs4 import BeautifulSoup
|
8 |
+
import fitz # PyMuPDF
|
9 |
+
import urllib3
|
10 |
+
import pandas as pd
|
11 |
+
import io
|
12 |
+
import ast
|
13 |
+
|
14 |
+
|
15 |
+
app = Flask(__name__)
|
16 |
+
|
17 |
+
search_prompt = """
|
18 |
+
The user will provide a detailed description of a technical problem they are trying to solve in the context of intellectual property (IP) and patents. Your task is to generate some (2 to 5) highly specific and relevant search queries for Google, aimed at finding research papers closely related to the user's problem. Each search query should:
|
19 |
+
1. Be crafted to find research papers, articles, or academic resources that address similar issues or solutions.
|
20 |
+
2. Be focused and precise, avoiding generic or overly broad terms.
|
21 |
+
Provide the search queries in the following **JSON format**. There should be no extra text, only the search queries as values.
|
22 |
+
**Example Output:**
|
23 |
+
```json
|
24 |
+
{
|
25 |
+
"1": "user authentication 5G cryptographic keys identity management",
|
26 |
+
"2": "5G authentication security issues cryptography 3GPP key management"
|
27 |
+
}
|
28 |
+
```
|
29 |
+
"""
|
30 |
+
|
31 |
+
infringement_prompt = """You are an expert assistant designed to evaluate the novelty and inventiveness of patents by comparing them with existing documents. Your task is to analyze the background of a given patent and the first page of a related document to determine how well the document covers the problems mentioned in the patent.
|
32 |
+
# Instructions:
|
33 |
+
Understand the Patent Background: Carefully read and comprehend the background information provided for the patent. Identify the key problems that the patent aims to address.
|
34 |
+
Analyze the Document: Review the provided document. Focus on identifying any problems that are similar to those mentioned in the patent background.
|
35 |
+
Evaluate Coverage: Assess how well the document covers the problems mentioned in the patent. Use the following scoring system:
|
36 |
+
Score 5: The document explicitly discusses the same problems as the patent, indicating that the problems are not novel.
|
37 |
+
Score 4: The document discusses problems that are very similar to those in the patent, significantly impacting the novelty of the patent's problems.
|
38 |
+
Score 3: The document mentions problems that are somewhat similar to those in the patent, but the coverage is not extensive enough to fully block the novelty of the patent's problems.
|
39 |
+
Score 2: The document mentions problems that are similar in some ways but are clearly different from those in the patent.
|
40 |
+
Score 1: The document touches upon related problems but does not directly address the specific problems mentioned in the patent.
|
41 |
+
Score 0: The document does not discuss any problems related to those in the patent.
|
42 |
+
Provide a Score: Based on your analysis, provide a score from 0 to 5 indicating how well the document covers the problems mentioned in the patent.
|
43 |
+
Justify Your Score: Briefly explain the reasoning behind your score, highlighting specific similarities or differences between the problems discussed in the patent and the document.
|
44 |
+
# Output Format:
|
45 |
+
No details or explanations are required, just the results in the required **JSON** format with no additional word.
|
46 |
+
{
|
47 |
+
'score': [Your Score],
|
48 |
+
'justification': "[Your Justification]"
|
49 |
+
}
|
50 |
+
"""
|
51 |
+
|
52 |
+
insight_prompt = """Analyze the technical document and extract key insights that could enhance the patent problem. Focus on identifying security vulnerabilities, technical problems, innovative technologies, research questions, and protocols mentioned in the document.
|
53 |
+
# Instructions:
|
54 |
+
1. Identify 3-5 key insights from the document that could enhance or inform the patent problem.
|
55 |
+
2. Each insight should be concise (max 10 words) but informative.
|
56 |
+
3. Focus on technical elements that could be valuable for improving the patent.
|
57 |
+
# Output Format:
|
58 |
+
Return only a JSON object with insights as an array, with no additional text:
|
59 |
+
{
|
60 |
+
"insights": [
|
61 |
+
"Security vulnerability in authentication handshake",
|
62 |
+
"Novel quantum encryption protocol",
|
63 |
+
"Lightweight implementation for IoT devices",
|
64 |
+
"Privacy-preserving key exchange mechanism",
|
65 |
+
"Real-time threat detection algorithm"
|
66 |
+
]
|
67 |
+
}
|
68 |
+
"""
|
69 |
+
|
70 |
+
refine_problem_prompt = """You are an expert consultant specializing in enhancing and refining technical problems to make them more sophisticated, novel, and inventive. Your task is to transform an initial technical problem description into two improved versions by integrating selected insights from technical documents.
|
71 |
+
# Instructions:
|
72 |
+
1. Carefully review the initial technical problem.
|
73 |
+
2. Consider the selected insights from technical documents that could enhance the problem formulation.
|
74 |
+
3. If any user comments are provided, incorporate those suggestions into your refinement process.
|
75 |
+
4. Generate TWO distinct refined problem statements that:
|
76 |
+
- Integrate the selected insights in a meaningful way
|
77 |
+
- Make the problem more sophisticated and technically interesting
|
78 |
+
- Increase the novelty and inventive potential of any solution
|
79 |
+
- Add appropriate constraints and technical requirements
|
80 |
+
- Maintain coherence and technical feasibility
|
81 |
+
- Suggest innovative directions without fully solving the problem
|
82 |
+
# Output Format:
|
83 |
+
Return the results in **strictly valid JSON** format with no additional text.
|
84 |
+
All string values (especially multiline descriptions) must:
|
85 |
+
- Be enclosed in double quotes
|
86 |
+
- Escape internal double quotes with backslashes (e.g., \")
|
87 |
+
- Replace newline characters with "\\n" (double backslash-n for JSON)
|
88 |
+
- Avoid unescaped Markdown if it breaks JSON syntax
|
89 |
+
Reference json:
|
90 |
+
{
|
91 |
+
"refined_problem_1": {
|
92 |
+
"title": "Brief descriptive title for the first refined problem",
|
93 |
+
"description": "Comprehensive description of the first refined problem that integrates insights and adds sophistication"
|
94 |
+
},
|
95 |
+
"refined_problem_2": {
|
96 |
+
"title": "Brief descriptive title for the second refined problem",
|
97 |
+
"description": "Alternative comprehensive description that takes a different approach to refining the problem"
|
98 |
+
}
|
99 |
+
}
|
100 |
+
"""
|
101 |
+
|
102 |
+
def ask_ollama(user_message, model='gemma3:1b', system_prompt=search_prompt):
|
103 |
+
response = ollama.chat(model=model, messages=[
|
104 |
+
{
|
105 |
+
"role": "system",
|
106 |
+
"content": system_prompt
|
107 |
+
},
|
108 |
+
{
|
109 |
+
"role": "user",
|
110 |
+
"content": user_message
|
111 |
+
}
|
112 |
+
])
|
113 |
+
ai_reply = response['message']['content']
|
114 |
+
print(f"AI REPLY json:\n{ai_reply}")
|
115 |
+
|
116 |
+
# Process the response to ensure we return valid JSON
|
117 |
+
try:
|
118 |
+
# First, try to parse it directly in case it's already valid JSON
|
119 |
+
print(f"AI REPLY:\n{ai_reply}")
|
120 |
+
return ast.literal_eval(ai_reply.replace('json\n', '').replace('```', ''))
|
121 |
+
except:
|
122 |
+
print(f"ERROR:\n{e}")
|
123 |
+
# If it's not valid JSON, try to extract JSON from the text
|
124 |
+
return {
|
125 |
+
"1": "Error parsing response. Please try again.",
|
126 |
+
"2": "Error parsing response. Please try again."
|
127 |
+
}
|
128 |
+
def search_web(topic, max_references=5, data_type="pdf"):
|
129 |
+
"""Search the web using DuckDuckGo and return results."""
|
130 |
+
doc_list = []
|
131 |
+
with DDGS(verify=False) as ddgs:
|
132 |
+
i = 0
|
133 |
+
for r in ddgs.text(topic, region='wt-wt', safesearch='On', timelimit='n'):
|
134 |
+
if i >= max_references:
|
135 |
+
break
|
136 |
+
doc_list.append({"type": data_type, "title": r['title'], "body": r['body'], "url": r['href']})
|
137 |
+
i += 1
|
138 |
+
return doc_list
|
139 |
+
|
140 |
+
def analyze_pdf_novelty(patent_background, url, data_type="pdf"):
|
141 |
+
"""Extract full document text from PDF or background from patent and evaluate novelty"""
|
142 |
+
try:
|
143 |
+
# Disable SSL warnings
|
144 |
+
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
145 |
+
# Extract text based on the type
|
146 |
+
if data_type == "pdf":
|
147 |
+
headers = {
|
148 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
149 |
+
"Accept": "application/pdf"
|
150 |
+
}
|
151 |
+
|
152 |
+
response = requests.get(url, headers=headers, timeout=20, verify=False)
|
153 |
+
if response.status_code != 200:
|
154 |
+
print(f"Failed to download PDF (status code: {response.status_code})")
|
155 |
+
return {"error": f"Failed to download PDF (status code: {response.status_code})"}
|
156 |
+
|
157 |
+
# Extract full document text (limited to 6000 characters)
|
158 |
+
try:
|
159 |
+
pdf_document = fitz.open(stream=response.content, filetype="pdf")
|
160 |
+
if pdf_document.page_count == 0:
|
161 |
+
return {"error": "PDF has no pages"}
|
162 |
+
|
163 |
+
text = ""
|
164 |
+
for page_num in range(min(5, pdf_document.page_count)): # Limit to first 5 pages
|
165 |
+
page = pdf_document.load_page(page_num)
|
166 |
+
text += page.get_text() + " "
|
167 |
+
if len(text) >= 6000:
|
168 |
+
break
|
169 |
+
|
170 |
+
text = text[:6000] # Limit to 6000 characters
|
171 |
+
except Exception as e:
|
172 |
+
return {"error": f"Error processing PDF: {str(e)}"}
|
173 |
+
|
174 |
+
elif data_type == "patent":
|
175 |
+
# Extract background from patent
|
176 |
+
print("extract from patent")
|
177 |
+
try:
|
178 |
+
response = requests.get(url, timeout=20, verify=False)
|
179 |
+
if response.status_code != 200:
|
180 |
+
print(f"Failed to access patent (status code: {response.status_code})")
|
181 |
+
return {"error": f"Failed to access patent (status code: {response.status_code})"}
|
182 |
+
content = response.content.decode('utf-8').replace("\n", "")
|
183 |
+
soup = BeautifulSoup(content, 'html.parser')
|
184 |
+
section = soup.find('section', itemprop='description', itemscope='')
|
185 |
+
matches = re.findall(r"background(.*?)(?:summary|description of the drawing)", str(section), re.DOTALL | re.IGNORECASE)
|
186 |
+
if matches:
|
187 |
+
text = BeautifulSoup(matches[0], "html.parser").get_text(separator=" ").strip()
|
188 |
+
else:
|
189 |
+
text = "Background section not found in patent."
|
190 |
+
except Exception as e:
|
191 |
+
return {"error": f"Error processing patent: {str(e)}"}
|
192 |
+
elif data_type == "web":
|
193 |
+
try:
|
194 |
+
headers = {
|
195 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
196 |
+
"Accept": "application/pdf"
|
197 |
+
}
|
198 |
+
response = requests.get(url, headers=headers, timeout=20, verify=False)
|
199 |
+
response.raise_for_status()
|
200 |
+
soup = BeautifulSoup(response.text, 'html.parser')
|
201 |
+
full_text = soup.get_text()
|
202 |
+
text = re.sub(r'\n+', ' ', full_text)[:5000]
|
203 |
+
except requests.RequestException as e:
|
204 |
+
return {"error": f"Error fetching the page: {str(e)}"}
|
205 |
+
else:
|
206 |
+
return {"error": "Unknown document type"}
|
207 |
+
|
208 |
+
# Analyze with Ollama for novelty assessment
|
209 |
+
result = ask_ollama(
|
210 |
+
user_message=f"Patent background:\n{patent_background}\n\nDocument content:\n{text}",
|
211 |
+
system_prompt=infringement_prompt
|
212 |
+
)
|
213 |
+
|
214 |
+
# # Extract insights
|
215 |
+
# insights = ask_ollama(
|
216 |
+
# user_message=f"Document content:\n{text}",
|
217 |
+
# system_prompt=insight_prompt
|
218 |
+
# )
|
219 |
+
|
220 |
+
# # Combine results
|
221 |
+
# result['insights'] = insights.get('insights', [])
|
222 |
+
|
223 |
+
return result
|
224 |
+
|
225 |
+
except Exception as e:
|
226 |
+
return {"error": f"Error: {str(e)}"}
|
227 |
+
|
228 |
+
|
229 |
+
def extract_insights(patent_background, url, data_type="pdf"):
|
230 |
+
"""Extract full document text from PDF or background from patent and evaluate novelty"""
|
231 |
+
try:
|
232 |
+
# Disable SSL warnings
|
233 |
+
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
234 |
+
# Extract text based on the type
|
235 |
+
if data_type == "pdf":
|
236 |
+
headers = {
|
237 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
238 |
+
"Accept": "application/pdf"
|
239 |
+
}
|
240 |
+
|
241 |
+
response = requests.get(url, headers=headers, timeout=20, verify=False)
|
242 |
+
if response.status_code != 200:
|
243 |
+
print(f"Failed to download PDF (status code: {response.status_code})")
|
244 |
+
return {"error": f"Failed to download PDF (status code: {response.status_code})"}
|
245 |
+
|
246 |
+
# Extract full document text (limited to 6000 characters)
|
247 |
+
try:
|
248 |
+
pdf_document = fitz.open(stream=response.content, filetype="pdf")
|
249 |
+
if pdf_document.page_count == 0:
|
250 |
+
return {"error": "PDF has no pages"}
|
251 |
+
|
252 |
+
text = ""
|
253 |
+
for page_num in range(min(5, pdf_document.page_count)): # Limit to first 5 pages
|
254 |
+
page = pdf_document.load_page(page_num)
|
255 |
+
text += page.get_text() + " "
|
256 |
+
if len(text) >= 6000:
|
257 |
+
break
|
258 |
+
|
259 |
+
text = text[:6000] # Limit to 6000 characters
|
260 |
+
except Exception as e:
|
261 |
+
return {"error": f"Error processing PDF: {str(e)}"}
|
262 |
+
|
263 |
+
elif data_type == "patent":
|
264 |
+
# Extract background from patent
|
265 |
+
print("extract from patent")
|
266 |
+
try:
|
267 |
+
response = requests.get(url, timeout=20, verify=False)
|
268 |
+
if response.status_code != 200:
|
269 |
+
print(f"Failed to access patent (status code: {response.status_code})")
|
270 |
+
return {"error": f"Failed to access patent (status code: {response.status_code})"}
|
271 |
+
content = response.content.decode('utf-8').replace("\n", "")
|
272 |
+
soup = BeautifulSoup(content, 'html.parser')
|
273 |
+
section = soup.find('section', itemprop='description', itemscope='')
|
274 |
+
matches = re.findall(r"background(.*?)(?:summary|description of the drawing)", str(section), re.DOTALL | re.IGNORECASE)
|
275 |
+
if matches:
|
276 |
+
text = BeautifulSoup(matches[0], "html.parser").get_text(separator=" ").strip()
|
277 |
+
else:
|
278 |
+
text = "Background section not found in patent."
|
279 |
+
except Exception as e:
|
280 |
+
return {"error": f"Error processing patent: {str(e)}"}
|
281 |
+
elif data_type == "web":
|
282 |
+
try:
|
283 |
+
headers = {
|
284 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
285 |
+
"Accept": "application/pdf"
|
286 |
+
}
|
287 |
+
response = requests.get(url, headers=headers, timeout=20, verify=False)
|
288 |
+
response.raise_for_status()
|
289 |
+
soup = BeautifulSoup(response.text, 'html.parser')
|
290 |
+
full_text = soup.get_text()
|
291 |
+
text = re.sub(r'\n+', ' ', full_text)[:5000]
|
292 |
+
except requests.RequestException as e:
|
293 |
+
return {"error": f"Error fetching the page: {str(e)}"}
|
294 |
+
else:
|
295 |
+
return {"error": "Unknown document type"}
|
296 |
+
|
297 |
+
# Extract insights
|
298 |
+
insights = ask_ollama(
|
299 |
+
user_message=f"Document content:\n{text}",
|
300 |
+
system_prompt=insight_prompt
|
301 |
+
)
|
302 |
+
|
303 |
+
return insights
|
304 |
+
|
305 |
+
except Exception as e:
|
306 |
+
return {"error": f"Error: {str(e)}"}
|
307 |
+
|
308 |
+
@app.route('/')
|
309 |
+
def home():
|
310 |
+
return render_template('index.html')
|
311 |
+
|
312 |
+
@app.route('/chat', methods=['POST'])
|
313 |
+
def chat():
|
314 |
+
user_message = request.form.get('message')
|
315 |
+
ai_reply = ask_ollama(user_message)
|
316 |
+
return jsonify({'reply': ai_reply})
|
317 |
+
|
318 |
+
@app.route('/search', methods=['POST'])
|
319 |
+
def search():
|
320 |
+
query = request.form.get('query')
|
321 |
+
pdf_checked = request.form.get('pdfOption') == 'true'
|
322 |
+
patent_checked = request.form.get('patentOption') == 'true'
|
323 |
+
web_checked = request.form.get('webOption') == 'true' or request.form.get('webOption') == 'on'
|
324 |
+
|
325 |
+
if not query:
|
326 |
+
return jsonify({'error': 'No query provided', 'results': []})
|
327 |
+
|
328 |
+
all_results = []
|
329 |
+
|
330 |
+
try:
|
331 |
+
# Handle various combinations
|
332 |
+
if pdf_checked:
|
333 |
+
pdf_query = f"{query} filetype:pdf"
|
334 |
+
pdf_results = search_web(pdf_query, max_references=5, data_type="pdf")
|
335 |
+
all_results.extend(pdf_results)
|
336 |
+
|
337 |
+
if patent_checked:
|
338 |
+
patent_query = f"{query} site:patents.google.com"
|
339 |
+
patent_results = search_web(patent_query, max_references=5, data_type="patent")
|
340 |
+
all_results.extend(patent_results)
|
341 |
+
|
342 |
+
if web_checked:
|
343 |
+
# For web, we don't add anything to the query
|
344 |
+
web_results = search_web(query, max_references=5, data_type="web")
|
345 |
+
all_results.extend(web_results)
|
346 |
+
|
347 |
+
# If nothing is checked, default to web search
|
348 |
+
if not (pdf_checked or patent_checked or web_checked):
|
349 |
+
web_results = search_web(query, max_references=5, data_type="web")
|
350 |
+
all_results.extend(web_results)
|
351 |
+
|
352 |
+
return jsonify({'results': all_results})
|
353 |
+
except Exception as e:
|
354 |
+
print(f"Error performing search: {e}")
|
355 |
+
return jsonify({'error': str(e), 'results': []})
|
356 |
+
|
357 |
+
@app.route('/analyze', methods=['POST'])
|
358 |
+
def analyze():
|
359 |
+
data = request.json
|
360 |
+
if not data or 'patent_background' not in data or 'pdf_url' not in data:
|
361 |
+
return jsonify({'error': 'Missing required parameters', 'result': None})
|
362 |
+
|
363 |
+
try:
|
364 |
+
patent_background = data['patent_background']
|
365 |
+
url = data['pdf_url']
|
366 |
+
data_type = data.get('data_type', 'pdf') # Default to pdf if not specified
|
367 |
+
|
368 |
+
result = analyze_pdf_novelty(patent_background, url, data_type)
|
369 |
+
return jsonify({'result': result})
|
370 |
+
except Exception as e:
|
371 |
+
print(f"Error analyzing document: {e}")
|
372 |
+
return jsonify({'error': str(e), 'result': None})
|
373 |
+
|
374 |
+
@app.route('/post_insights', methods=['POST'])
|
375 |
+
def post_insights():
|
376 |
+
data = request.json
|
377 |
+
if not data or 'patent_background' not in data or 'pdf_url' not in data:
|
378 |
+
return jsonify({'error': 'Missing required parameters', 'result': None})
|
379 |
+
|
380 |
+
try:
|
381 |
+
patent_background = data['patent_background']
|
382 |
+
url = data['pdf_url']
|
383 |
+
data_type = data.get('data_type', 'pdf') # Default to pdf if not specified
|
384 |
+
|
385 |
+
result = extract_insights(patent_background, url, data_type)
|
386 |
+
return jsonify({'result': result})
|
387 |
+
except Exception as e:
|
388 |
+
print(f"Error analyzing document: {e}")
|
389 |
+
return jsonify({'error': str(e), 'result': None})
|
390 |
+
|
391 |
+
@app.route('/refine-problem', methods=['POST'])
|
392 |
+
def refine_problem():
|
393 |
+
data = request.json
|
394 |
+
if not data or 'original_problem' not in data or 'insights' not in data:
|
395 |
+
return jsonify({'error': 'Missing required parameters', 'result': None})
|
396 |
+
|
397 |
+
try:
|
398 |
+
original_problem = data['original_problem']
|
399 |
+
insights = data['insights']
|
400 |
+
user_comments = data.get('user_comments', '')
|
401 |
+
|
402 |
+
# Prepare the message for the LLM
|
403 |
+
message = f"""Initial Technical Problem:
|
404 |
+
{original_problem}
|
405 |
+
Selected Insights:
|
406 |
+
{', '.join(insights)}
|
407 |
+
User Comments/Suggestions:
|
408 |
+
{user_comments}
|
409 |
+
"""
|
410 |
+
|
411 |
+
# Get refined problem suggestions from the LLM
|
412 |
+
result = ask_ollama(
|
413 |
+
user_message=message,
|
414 |
+
system_prompt=refine_problem_prompt
|
415 |
+
)
|
416 |
+
|
417 |
+
return jsonify({'result': result})
|
418 |
+
except Exception as e:
|
419 |
+
print(f"Error refining problem: {e}")
|
420 |
+
return jsonify({'error': str(e), 'result': None})
|
421 |
+
|
422 |
+
@app.route('/export-excel', methods=['POST'])
|
423 |
+
def export_excel():
|
424 |
+
try:
|
425 |
+
data = request.json
|
426 |
+
if not data or 'tableData' not in data:
|
427 |
+
return jsonify({'error': 'No table data provided'})
|
428 |
+
|
429 |
+
# Create pandas DataFrame from the data
|
430 |
+
df = pd.DataFrame(data['tableData'])
|
431 |
+
|
432 |
+
# Get the user query
|
433 |
+
user_query = data.get('userQuery', 'No query provided')
|
434 |
+
|
435 |
+
# Get problem versions if available
|
436 |
+
problem_versions = data.get('problemVersions', {})
|
437 |
+
|
438 |
+
# Create a BytesIO object to store the Excel file
|
439 |
+
output = io.BytesIO()
|
440 |
+
|
441 |
+
# Create Excel file with xlsxwriter engine
|
442 |
+
with pd.ExcelWriter(output, engine='xlsxwriter') as writer:
|
443 |
+
# Write the data to a sheet named 'Results'
|
444 |
+
df.to_excel(writer, sheet_name='Results', index=False)
|
445 |
+
|
446 |
+
# Get workbook and worksheet objects
|
447 |
+
workbook = writer.book
|
448 |
+
worksheet = writer.sheets['Results']
|
449 |
+
|
450 |
+
# Add a sheet for the query
|
451 |
+
query_sheet = workbook.add_worksheet('Query')
|
452 |
+
query_sheet.write(0, 0, 'Patent Query')
|
453 |
+
query_sheet.write(1, 0, user_query)
|
454 |
+
|
455 |
+
# Add a sheet for problem versions if available
|
456 |
+
if problem_versions:
|
457 |
+
versions_sheet = workbook.add_worksheet('Problem Versions')
|
458 |
+
versions_sheet.write(0, 0, 'Version')
|
459 |
+
versions_sheet.write(0, 1, 'Problem Statement')
|
460 |
+
|
461 |
+
row = 1
|
462 |
+
for version, text in problem_versions.items():
|
463 |
+
versions_sheet.write(row, 0, version)
|
464 |
+
versions_sheet.write(row, 1, text)
|
465 |
+
row += 1
|
466 |
+
|
467 |
+
# Set column width for problem versions
|
468 |
+
versions_sheet.set_column(0, 0, 20)
|
469 |
+
versions_sheet.set_column(1, 1, 100)
|
470 |
+
|
471 |
+
# Adjust column widths
|
472 |
+
for i, col in enumerate(df.columns):
|
473 |
+
# Get maximum column width
|
474 |
+
max_len = max(
|
475 |
+
df[col].astype(str).map(len).max(),
|
476 |
+
len(col)
|
477 |
+
) + 2
|
478 |
+
# Set column width (limit to 100 to avoid issues)
|
479 |
+
worksheet.set_column(i, i, min(max_len, 100))
|
480 |
+
|
481 |
+
# Seek to the beginning of the BytesIO object
|
482 |
+
output.seek(0)
|
483 |
+
|
484 |
+
# Return the Excel file
|
485 |
+
return send_file(
|
486 |
+
output,
|
487 |
+
mimetype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
488 |
+
as_attachment=True,
|
489 |
+
download_name='patent_search_results.xlsx'
|
490 |
+
)
|
491 |
+
|
492 |
+
except Exception as e:
|
493 |
+
print(f"Error exporting Excel: {e}")
|
494 |
+
return jsonify({'error': str(e)})
|
495 |
+
|
496 |
+
@app.route('/ai-select-insights', methods=['POST'])
|
497 |
+
def ai_select_insights():
|
498 |
+
data = request.json
|
499 |
+
if not data or 'patent_background' not in data or 'insights' not in data:
|
500 |
+
return jsonify({'error': 'Missing required parameters', 'selected_insights': []})
|
501 |
+
|
502 |
+
try:
|
503 |
+
patent_background = data['patent_background']
|
504 |
+
insights = data['insights']
|
505 |
+
|
506 |
+
if not insights or len(insights) == 0:
|
507 |
+
return jsonify({'error': 'No insights provided', 'selected_insights': []})
|
508 |
+
|
509 |
+
# Prepare the prompt for the LLM
|
510 |
+
ai_select_prompt = """You are an expert in patent analysis and technology innovation. Your task is to select the most relevant insights from a list that would help enhance the patentability of an invention.
|
511 |
+
|
512 |
+
INSTRUCTIONS:
|
513 |
+
|
514 |
+
1. Review the patent background description carefully.
|
515 |
+
|
516 |
+
2. Analyze each insight in the provided list and determine its relevance to the patent background.
|
517 |
+
|
518 |
+
3. Select ONLY THE MOST RELEVANT insights that are:
|
519 |
+
- Directly relevant to the patent's technical area
|
520 |
+
- Provide unique perspectives or identify novel challenges
|
521 |
+
- Could significantly enhance the patentability or scope of the invention
|
522 |
+
- Are technically substantive and not obvious
|
523 |
+
|
524 |
+
4. Ignore insights that are generic, obvious, or would weaken the patent case.
|
525 |
+
|
526 |
+
5. SELECT A MAXIMUM OF 7 INSIGHTS, even fewer if only a few are truly relevant.
|
527 |
+
|
528 |
+
6. Return ONLY the selected insights in a valid JSON array.
|
529 |
+
|
530 |
+
OUTPUT FORMAT:
|
531 |
+
Return only a valid JSON array of strings, each containing the exact text of a selected insight.
|
532 |
+
Example: ["Insight 1", "Insight 3", "Insight 5"]"""
|
533 |
+
|
534 |
+
# Prepare message content
|
535 |
+
message = f"""PATENT BACKGROUND:
|
536 |
+
{patent_background}
|
537 |
+
|
538 |
+
ALL AVAILABLE INSIGHTS:
|
539 |
+
{json.dumps(insights)}"""
|
540 |
+
|
541 |
+
# Call Ollama with the message and prompt
|
542 |
+
response = ollama.chat(model='gemma3:1b', messages=[
|
543 |
+
{
|
544 |
+
"role": "system",
|
545 |
+
"content": ai_select_prompt
|
546 |
+
},
|
547 |
+
{
|
548 |
+
"role": "user",
|
549 |
+
"content": message
|
550 |
+
}
|
551 |
+
])
|
552 |
+
|
553 |
+
ai_reply = response['message']['content']
|
554 |
+
print(f"AI SELECTION RESPONSE: {ai_reply}")
|
555 |
+
|
556 |
+
# Parse the JSON array from the response
|
557 |
+
# First strip markdown code blocks if present
|
558 |
+
cleaned_reply = ai_reply.replace('```json', '').replace('```', '').strip()
|
559 |
+
|
560 |
+
try:
|
561 |
+
selected_insights = json.loads(cleaned_reply)
|
562 |
+
|
563 |
+
# Validate that the response is a list
|
564 |
+
if not isinstance(selected_insights, list):
|
565 |
+
return jsonify({'error': 'Invalid response format from AI', 'selected_insights': []})
|
566 |
+
|
567 |
+
# Make sure all selected insights actually exist in the original list
|
568 |
+
validated_insights = [insight for insight in selected_insights if insight in insights]
|
569 |
+
|
570 |
+
return jsonify({'selected_insights': validated_insights})
|
571 |
+
|
572 |
+
except json.JSONDecodeError as e:
|
573 |
+
print(f"JSON parsing error: {e}")
|
574 |
+
return jsonify({'error': f'Failed to parse AI response: {e}', 'selected_insights': []})
|
575 |
+
|
576 |
+
except Exception as e:
|
577 |
+
print(f"Error in AI insight selection: {e}")
|
578 |
+
return jsonify({'error': str(e), 'selected_insights': []})
|
579 |
+
|
580 |
+
@app.route('/generate-key-issues', methods=['POST'])
|
581 |
+
def generate_key_issues():
|
582 |
+
data = request.json
|
583 |
+
if not data or 'query' not in data:
|
584 |
+
return jsonify({'error': 'No query provided', 'key_issues': []})
|
585 |
+
|
586 |
+
try:
|
587 |
+
query = data['query']
|
588 |
+
|
589 |
+
# Make a request to the external API
|
590 |
+
API_URL = "https://organizedprogrammers-fastapi-kig.hf.space/"
|
591 |
+
endpoint = f"{API_URL}/key-issue-format"
|
592 |
+
api_data = {"query": query}
|
593 |
+
|
594 |
+
response = requests.post(endpoint, json=api_data, verify=False)
|
595 |
+
if response.status_code == 200:
|
596 |
+
result = response.json()
|
597 |
+
return jsonify(result)
|
598 |
+
else:
|
599 |
+
return jsonify({
|
600 |
+
'error': f"API Error: {response.status_code}",
|
601 |
+
'key_issues': []
|
602 |
+
})
|
603 |
+
|
604 |
+
except Exception as e:
|
605 |
+
print(f"Error generating key issues: {e}")
|
606 |
+
return jsonify({'error': str(e), 'key_issues': []})
|
607 |
+
|
608 |
+
if __name__ == '__main__':
|
609 |
+
app.run(debug=True)
|
requirements.txt
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
annotated-types==0.7.0
|
2 |
+
anyio==4.9.0
|
3 |
+
beautifulsoup4==4.13.3
|
4 |
+
blinker==1.9.0
|
5 |
+
certifi==2025.1.31
|
6 |
+
charset-normalizer==3.4.1
|
7 |
+
click==8.1.8
|
8 |
+
duckduckgo_search==7.5.2
|
9 |
+
Flask==3.1.0
|
10 |
+
h11==0.14.0
|
11 |
+
httpcore==1.0.7
|
12 |
+
httpx==0.28.1
|
13 |
+
idna==3.10
|
14 |
+
itsdangerous==2.2.0
|
15 |
+
Jinja2==3.1.6
|
16 |
+
lxml==5.3.1
|
17 |
+
MarkupSafe==3.0.2
|
18 |
+
numpy==2.2.4
|
19 |
+
ollama==0.4.7
|
20 |
+
pandas==2.2.3
|
21 |
+
primp==0.14.0
|
22 |
+
pydantic==2.10.6
|
23 |
+
pydantic_core==2.27.2
|
24 |
+
PyMuPDF==1.25.4
|
25 |
+
python-dateutil==2.9.0.post0
|
26 |
+
pytz==2025.1
|
27 |
+
requests==2.32.3
|
28 |
+
six==1.17.0
|
29 |
+
sniffio==1.3.1
|
30 |
+
soupsieve==2.6
|
31 |
+
typing_extensions==4.12.2
|
32 |
+
tzdata==2025.1
|
33 |
+
urllib3==2.3.0
|
34 |
+
Werkzeug==3.1.3
|
35 |
+
XlsxWriter==3.2.2
|
static/style.css
ADDED
@@ -0,0 +1,1175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
4 |
+
--primary-dark: #1d4ed8;
|
5 |
+
--danger: #ef4444;
|
6 |
+
--success: #10b981;
|
7 |
+
--warning: #f59e0b;
|
8 |
+
--gray-100: #f3f4f6;
|
9 |
+
--gray-200: #e5e7eb;
|
10 |
+
--gray-300: #d1d5db;
|
11 |
+
--gray-400: #9ca3af;
|
12 |
+
--gray-500: #6b7280;
|
13 |
+
--gray-600: #4b5563;
|
14 |
+
--gray-700: #374151;
|
15 |
+
--gray-800: #1f2937;
|
16 |
+
--gray-900: #111827;
|
17 |
+
--transition: all 0.2s ease;
|
18 |
+
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
19 |
+
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
20 |
+
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
21 |
+
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
22 |
+
}
|
23 |
+
|
24 |
+
* {
|
25 |
+
box-sizing: border-box;
|
26 |
+
margin: 0;
|
27 |
+
padding: 0;
|
28 |
+
}
|
29 |
+
|
30 |
+
body {
|
31 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
32 |
+
line-height: 1.6;
|
33 |
+
color: var(--gray-800);
|
34 |
+
background-color: #f8fafc;
|
35 |
+
max-width: 1200px;
|
36 |
+
margin: 0 auto;
|
37 |
+
padding: 2rem;
|
38 |
+
}
|
39 |
+
|
40 |
+
@media (max-width: 768px) {
|
41 |
+
body {
|
42 |
+
padding: 1rem;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
.container {
|
47 |
+
max-width: 1000px;
|
48 |
+
margin: 0 auto;
|
49 |
+
}
|
50 |
+
|
51 |
+
.header {
|
52 |
+
margin-bottom: 2.5rem;
|
53 |
+
text-align: center;
|
54 |
+
}
|
55 |
+
|
56 |
+
.logo {
|
57 |
+
display: flex;
|
58 |
+
align-items: center;
|
59 |
+
justify-content: center;
|
60 |
+
margin-bottom: 1rem;
|
61 |
+
}
|
62 |
+
|
63 |
+
.logo-icon {
|
64 |
+
width: 40px;
|
65 |
+
height: 40px;
|
66 |
+
background-color: var(--primary);
|
67 |
+
border-radius: 8px;
|
68 |
+
color: white;
|
69 |
+
display: flex;
|
70 |
+
align-items: center;
|
71 |
+
justify-content: center;
|
72 |
+
font-weight: bold;
|
73 |
+
font-size: 1.5rem;
|
74 |
+
margin-right: 10px;
|
75 |
+
}
|
76 |
+
|
77 |
+
h1 {
|
78 |
+
font-size: 2rem;
|
79 |
+
font-weight: 700;
|
80 |
+
color: var(--gray-900);
|
81 |
+
margin-bottom: 0.5rem;
|
82 |
+
}
|
83 |
+
|
84 |
+
h2 {
|
85 |
+
font-size: 1.5rem;
|
86 |
+
font-weight: 600;
|
87 |
+
color: var(--gray-800);
|
88 |
+
margin-bottom: 1.5rem;
|
89 |
+
}
|
90 |
+
|
91 |
+
p {
|
92 |
+
color: var(--gray-600);
|
93 |
+
margin-bottom: 1rem;
|
94 |
+
}
|
95 |
+
|
96 |
+
.card {
|
97 |
+
background-color: white;
|
98 |
+
border-radius: 0.75rem;
|
99 |
+
box-shadow: var(--shadow);
|
100 |
+
padding: 2rem;
|
101 |
+
margin-bottom: 2rem;
|
102 |
+
}
|
103 |
+
|
104 |
+
.form-group {
|
105 |
+
margin-bottom: 1.5rem;
|
106 |
+
}
|
107 |
+
|
108 |
+
label {
|
109 |
+
display: block;
|
110 |
+
margin-bottom: 0.5rem;
|
111 |
+
font-weight: 500;
|
112 |
+
color: var(--gray-700);
|
113 |
+
}
|
114 |
+
|
115 |
+
#userInput {
|
116 |
+
width: 100%;
|
117 |
+
padding: 0.75rem;
|
118 |
+
border: 1px solid var(--gray-300);
|
119 |
+
border-radius: 0.5rem;
|
120 |
+
min-height: 150px;
|
121 |
+
font-family: inherit;
|
122 |
+
resize: vertical;
|
123 |
+
transition: var(--transition);
|
124 |
+
}
|
125 |
+
|
126 |
+
#userInput:focus {
|
127 |
+
outline: none;
|
128 |
+
border-color: var(--primary);
|
129 |
+
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
|
130 |
+
}
|
131 |
+
|
132 |
+
.btn {
|
133 |
+
display: inline-flex;
|
134 |
+
align-items: center;
|
135 |
+
justify-content: center;
|
136 |
+
padding: 0.625rem 1.25rem;
|
137 |
+
border: none;
|
138 |
+
border-radius: 0.5rem;
|
139 |
+
font-weight: 500;
|
140 |
+
font-size: 0.875rem;
|
141 |
+
cursor: pointer;
|
142 |
+
transition: var(--transition);
|
143 |
+
gap: 0.5rem;
|
144 |
+
}
|
145 |
+
|
146 |
+
.btn-primary {
|
147 |
+
background-color: var(--primary);
|
148 |
+
color: white;
|
149 |
+
}
|
150 |
+
|
151 |
+
.btn-primary:hover {
|
152 |
+
background-color: var(--primary-dark);
|
153 |
+
}
|
154 |
+
|
155 |
+
.btn-secondary {
|
156 |
+
background-color: var(--gray-100);
|
157 |
+
color: var(--gray-700);
|
158 |
+
}
|
159 |
+
|
160 |
+
.btn-secondary:hover {
|
161 |
+
background-color: var(--gray-200);
|
162 |
+
}
|
163 |
+
|
164 |
+
.btn-danger {
|
165 |
+
background-color: var(--danger);
|
166 |
+
color: white;
|
167 |
+
}
|
168 |
+
|
169 |
+
.btn-danger:hover {
|
170 |
+
background-color: #dc2626;
|
171 |
+
}
|
172 |
+
|
173 |
+
.btn-success {
|
174 |
+
background-color: var(--success);
|
175 |
+
color: white;
|
176 |
+
}
|
177 |
+
|
178 |
+
.btn-success:hover {
|
179 |
+
background-color: #059669;
|
180 |
+
}
|
181 |
+
|
182 |
+
.btn-warning {
|
183 |
+
background-color: var(--warning);
|
184 |
+
color: white;
|
185 |
+
}
|
186 |
+
|
187 |
+
.btn-warning:hover {
|
188 |
+
background-color: #d97706;
|
189 |
+
}
|
190 |
+
|
191 |
+
.btn-info {
|
192 |
+
background-color: #0dcaf0;
|
193 |
+
color: white;
|
194 |
+
}
|
195 |
+
|
196 |
+
.btn-info:hover {
|
197 |
+
background-color: #0aa2c0;
|
198 |
+
}
|
199 |
+
|
200 |
+
.btn-info.disabled {
|
201 |
+
opacity: 0.6;
|
202 |
+
cursor: not-allowed;
|
203 |
+
}
|
204 |
+
|
205 |
+
.btn-group-insights {
|
206 |
+
background-color: #8e44ad;
|
207 |
+
color: white;
|
208 |
+
}
|
209 |
+
|
210 |
+
.btn-group-insights:hover {
|
211 |
+
background-color: #7d3c98;
|
212 |
+
}
|
213 |
+
|
214 |
+
.query-item {
|
215 |
+
background-color: white;
|
216 |
+
border-radius: 0.75rem;
|
217 |
+
box-shadow: var(--shadow);
|
218 |
+
padding: 1.5rem;
|
219 |
+
margin-bottom: 1.5rem;
|
220 |
+
}
|
221 |
+
|
222 |
+
.query-container {
|
223 |
+
display: flex;
|
224 |
+
margin-bottom: 1rem;
|
225 |
+
align-items: center;
|
226 |
+
gap: 0.5rem;
|
227 |
+
}
|
228 |
+
|
229 |
+
.query-field {
|
230 |
+
flex-grow: 1;
|
231 |
+
padding: 0.625rem 0.75rem;
|
232 |
+
border: 1px solid var(--gray-300);
|
233 |
+
border-radius: 0.5rem;
|
234 |
+
transition: var(--transition);
|
235 |
+
}
|
236 |
+
|
237 |
+
.query-field:focus {
|
238 |
+
outline: none;
|
239 |
+
border-color: var(--primary);
|
240 |
+
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
|
241 |
+
}
|
242 |
+
|
243 |
+
.action-button {
|
244 |
+
background-color: hsl(192, 83%, 66%);
|
245 |
+
color: white;
|
246 |
+
padding: 8px 12px;
|
247 |
+
border: none;
|
248 |
+
border-radius: 4px;
|
249 |
+
cursor: pointer;
|
250 |
+
margin-right: 5px;
|
251 |
+
}
|
252 |
+
.delete-button {
|
253 |
+
background-color: #f44336;
|
254 |
+
}
|
255 |
+
.search-button {
|
256 |
+
background-color: #2196F3;
|
257 |
+
}
|
258 |
+
button:hover {
|
259 |
+
opacity: 0.9;
|
260 |
+
}
|
261 |
+
|
262 |
+
#resultsContainer {
|
263 |
+
margin-top: 20px;
|
264 |
+
display: none;
|
265 |
+
}
|
266 |
+
#queriesContainer {
|
267 |
+
margin-bottom: 15px;
|
268 |
+
}
|
269 |
+
#loadingIndicator {
|
270 |
+
display: none;
|
271 |
+
margin-top: 20px;
|
272 |
+
text-align: center;
|
273 |
+
color: #666;
|
274 |
+
}
|
275 |
+
.button-container {
|
276 |
+
margin-top: 15px;
|
277 |
+
}
|
278 |
+
.results-table {
|
279 |
+
width: 100%;
|
280 |
+
border-collapse: collapse;
|
281 |
+
margin-top: 10px;
|
282 |
+
display: none;
|
283 |
+
}
|
284 |
+
.results-table th, .results-table td {
|
285 |
+
border: 1px solid #ddd;
|
286 |
+
padding: 8px;
|
287 |
+
text-align: left;
|
288 |
+
}
|
289 |
+
.results-table th {
|
290 |
+
background-color: #f2f2f2;
|
291 |
+
}
|
292 |
+
.results-table tr:nth-child(even) {
|
293 |
+
background-color: #f9f9f9;
|
294 |
+
}
|
295 |
+
.results-table tr:hover {
|
296 |
+
background-color: #f1f1f1;
|
297 |
+
}
|
298 |
+
.search-loading {
|
299 |
+
display: none;
|
300 |
+
margin: 10px 0;
|
301 |
+
font-style: italic;
|
302 |
+
color: #666;
|
303 |
+
}
|
304 |
+
.url-link {
|
305 |
+
color: #0066cc;
|
306 |
+
text-decoration: none;
|
307 |
+
word-break: break-all;
|
308 |
+
}
|
309 |
+
.url-link:hover {
|
310 |
+
text-decoration: underline;
|
311 |
+
}
|
312 |
+
|
313 |
+
.analyze-button {
|
314 |
+
margin-top: 5px;
|
315 |
+
padding: 3px 8px;
|
316 |
+
font-size: 0.8em;
|
317 |
+
}
|
318 |
+
|
319 |
+
.loading-spinner {
|
320 |
+
border: 4px solid #f3f3f3;
|
321 |
+
border-top: 4px solid #3498db;
|
322 |
+
border-radius: 50%;
|
323 |
+
width: 20px;
|
324 |
+
height: 20px;
|
325 |
+
animation: spin 2s linear infinite;
|
326 |
+
margin: 0 auto;
|
327 |
+
}
|
328 |
+
|
329 |
+
@keyframes spin {
|
330 |
+
0% { transform: rotate(0deg); }
|
331 |
+
100% { transform: rotate(360deg); }
|
332 |
+
}
|
333 |
+
|
334 |
+
.score-cell, .justification-cell {
|
335 |
+
max-width: 150px;
|
336 |
+
overflow: hidden;
|
337 |
+
text-overflow: ellipsis;
|
338 |
+
}
|
339 |
+
|
340 |
+
.score-cell {
|
341 |
+
font-weight: bold;
|
342 |
+
text-align: center;
|
343 |
+
}
|
344 |
+
|
345 |
+
.floating-buttons {
|
346 |
+
position: fixed;
|
347 |
+
bottom: 2rem;
|
348 |
+
right: 2rem;
|
349 |
+
display: flex;
|
350 |
+
flex-direction: column;
|
351 |
+
gap: 0.75rem;
|
352 |
+
z-index: 100;
|
353 |
+
}
|
354 |
+
|
355 |
+
.floating-button {
|
356 |
+
padding: 0.75rem;
|
357 |
+
border-radius: 0.5rem;
|
358 |
+
box-shadow: var(--shadow-md);
|
359 |
+
transition: all 0.3s ease;
|
360 |
+
display: flex;
|
361 |
+
align-items: center;
|
362 |
+
justify-content: center;
|
363 |
+
gap: 0.5rem;
|
364 |
+
width: auto;
|
365 |
+
white-space: nowrap;
|
366 |
+
}
|
367 |
+
|
368 |
+
.floating-button:hover {
|
369 |
+
transform: translateY(-2px);
|
370 |
+
box-shadow: var(--shadow-lg);
|
371 |
+
}
|
372 |
+
|
373 |
+
.loading-overlay {
|
374 |
+
position: fixed;
|
375 |
+
top: 0;
|
376 |
+
left: 0;
|
377 |
+
width: 100%;
|
378 |
+
height: 100%;
|
379 |
+
background-color: rgba(0, 0, 0, 0.5);
|
380 |
+
display: none;
|
381 |
+
justify-content: center;
|
382 |
+
align-items: center;
|
383 |
+
z-index: 1000;
|
384 |
+
}
|
385 |
+
|
386 |
+
.loading-content {
|
387 |
+
background-color: white;
|
388 |
+
padding: 2rem;
|
389 |
+
border-radius: 0.75rem;
|
390 |
+
text-align: center;
|
391 |
+
box-shadow: var(--shadow-lg);
|
392 |
+
max-width: 80%;
|
393 |
+
}
|
394 |
+
|
395 |
+
.loading-content .loading-spinner {
|
396 |
+
width: 40px;
|
397 |
+
height: 40px;
|
398 |
+
border-width: 4px;
|
399 |
+
margin-bottom: 1rem;
|
400 |
+
}
|
401 |
+
|
402 |
+
.progress-text {
|
403 |
+
font-size: 1rem;
|
404 |
+
margin-top: 0.75rem;
|
405 |
+
color: var(--gray-700);
|
406 |
+
}
|
407 |
+
|
408 |
+
.button-container {
|
409 |
+
margin-top: 1.5rem;
|
410 |
+
display: flex;
|
411 |
+
justify-content: flex-start;
|
412 |
+
gap: 0.75rem;
|
413 |
+
}
|
414 |
+
|
415 |
+
/* Add icons for better UX */
|
416 |
+
.icon {
|
417 |
+
display: inline-block;
|
418 |
+
width: 20px;
|
419 |
+
height: 20px;
|
420 |
+
background-size: contain;
|
421 |
+
background-repeat: no-repeat;
|
422 |
+
background-position: center;
|
423 |
+
}
|
424 |
+
|
425 |
+
.table-container {
|
426 |
+
margin-top: 1rem;
|
427 |
+
overflow-x: auto;
|
428 |
+
border-radius: 0.5rem;
|
429 |
+
border: 1px solid var(--gray-200);
|
430 |
+
}
|
431 |
+
|
432 |
+
/* Responsive adjustments */
|
433 |
+
@media (max-width: 768px) {
|
434 |
+
.query-container {
|
435 |
+
flex-direction: column;
|
436 |
+
align-items: stretch;
|
437 |
+
}
|
438 |
+
|
439 |
+
.query-container .btn {
|
440 |
+
margin-top: 0.5rem;
|
441 |
+
}
|
442 |
+
|
443 |
+
.floating-buttons {
|
444 |
+
bottom: 1rem;
|
445 |
+
right: 1rem;
|
446 |
+
}
|
447 |
+
}
|
448 |
+
|
449 |
+
.search-options {
|
450 |
+
margin-bottom: 20px;
|
451 |
+
text-align: center;
|
452 |
+
}
|
453 |
+
|
454 |
+
.checkbox-group {
|
455 |
+
display: flex;
|
456 |
+
gap: 15px;
|
457 |
+
margin-top: 5px;
|
458 |
+
justify-content: center; /* This centers the checkboxes horizontally */
|
459 |
+
}
|
460 |
+
|
461 |
+
.checkbox-item {
|
462 |
+
display: flex;
|
463 |
+
align-items: center;
|
464 |
+
gap: 5px;
|
465 |
+
}
|
466 |
+
|
467 |
+
/* Adding styles for insights feature */
|
468 |
+
.insights-container {
|
469 |
+
margin-top: 10px;
|
470 |
+
border-top: 1px dashed #ccc;
|
471 |
+
padding-top: 10px;
|
472 |
+
}
|
473 |
+
|
474 |
+
.insights-header {
|
475 |
+
display: flex;
|
476 |
+
justify-content: space-between;
|
477 |
+
align-items: center;
|
478 |
+
margin-bottom: 8px;
|
479 |
+
}
|
480 |
+
|
481 |
+
.insights-title {
|
482 |
+
font-weight: bold;
|
483 |
+
color: #333;
|
484 |
+
}
|
485 |
+
|
486 |
+
.insights-actions {
|
487 |
+
display: flex;
|
488 |
+
gap: 8px;
|
489 |
+
}
|
490 |
+
|
491 |
+
.insights-button {
|
492 |
+
font-size: 12px;
|
493 |
+
padding: 2px 6px;
|
494 |
+
background-color: #4CAF50;
|
495 |
+
color: white;
|
496 |
+
border: none;
|
497 |
+
border-radius: 3px;
|
498 |
+
cursor: pointer;
|
499 |
+
}
|
500 |
+
|
501 |
+
.insights-list {
|
502 |
+
display: flex;
|
503 |
+
flex-wrap: wrap;
|
504 |
+
gap: 8px;
|
505 |
+
margin-top: 8px;
|
506 |
+
}
|
507 |
+
|
508 |
+
.insight-tag {
|
509 |
+
background-color: #f1f1f1;
|
510 |
+
border: 1px solid #ddd;
|
511 |
+
border-radius: 15px;
|
512 |
+
padding: 4px 12px;
|
513 |
+
font-size: 12px;
|
514 |
+
cursor: pointer;
|
515 |
+
transition: all 0.2s ease;
|
516 |
+
user-select: none;
|
517 |
+
}
|
518 |
+
|
519 |
+
.insight-tag.selected {
|
520 |
+
background-color: #4CAF50;
|
521 |
+
color: white;
|
522 |
+
border-color: #4CAF50;
|
523 |
+
}
|
524 |
+
|
525 |
+
/* Styles for problem refinement functionality */
|
526 |
+
.problem-history {
|
527 |
+
position: relative;
|
528 |
+
margin-bottom: 10px;
|
529 |
+
}
|
530 |
+
|
531 |
+
.problem-history-nav {
|
532 |
+
display: flex;
|
533 |
+
align-items: center;
|
534 |
+
margin-bottom: 5px;
|
535 |
+
}
|
536 |
+
|
537 |
+
.history-arrow {
|
538 |
+
padding: 2px 8px;
|
539 |
+
background-color: var(--gray-200);
|
540 |
+
border-radius: 3px;
|
541 |
+
cursor: pointer;
|
542 |
+
margin-right: 5px;
|
543 |
+
font-size: 14px;
|
544 |
+
color: var(--gray-700);
|
545 |
+
}
|
546 |
+
|
547 |
+
.history-arrow:hover {
|
548 |
+
background-color: var(--gray-300);
|
549 |
+
}
|
550 |
+
|
551 |
+
.history-arrow.disabled {
|
552 |
+
opacity: 0.5;
|
553 |
+
cursor: not-allowed;
|
554 |
+
}
|
555 |
+
|
556 |
+
.history-status {
|
557 |
+
font-size: 12px;
|
558 |
+
color: var(--gray-600);
|
559 |
+
}
|
560 |
+
|
561 |
+
.insight-comment-area {
|
562 |
+
margin-top: 10px;
|
563 |
+
width: 100%;
|
564 |
+
}
|
565 |
+
|
566 |
+
.insight-comment-textarea {
|
567 |
+
width: 100%;
|
568 |
+
padding: 8px;
|
569 |
+
border: 1px solid var(--gray-300);
|
570 |
+
border-radius: 4px;
|
571 |
+
font-size: 14px;
|
572 |
+
resize: vertical;
|
573 |
+
min-height: 60px;
|
574 |
+
}
|
575 |
+
|
576 |
+
.refined-problem-container {
|
577 |
+
margin-top: 20px;
|
578 |
+
border: 1px solid var(--gray-300);
|
579 |
+
border-radius: 8px;
|
580 |
+
overflow: hidden;
|
581 |
+
}
|
582 |
+
|
583 |
+
.refined-problem-tabs {
|
584 |
+
display: flex;
|
585 |
+
background-color: var(--gray-100);
|
586 |
+
border-bottom: 1px solid var(--gray-300);
|
587 |
+
}
|
588 |
+
|
589 |
+
.refined-problem-tab {
|
590 |
+
padding: 10px 15px;
|
591 |
+
cursor: pointer;
|
592 |
+
font-weight: 500;
|
593 |
+
border-right: 1px solid var(--gray-300);
|
594 |
+
}
|
595 |
+
|
596 |
+
.refined-problem-tab.active {
|
597 |
+
background-color: white;
|
598 |
+
border-bottom: 2px solid var(--primary);
|
599 |
+
}
|
600 |
+
|
601 |
+
.refined-problem-content {
|
602 |
+
padding: 15px;
|
603 |
+
background-color: white;
|
604 |
+
}
|
605 |
+
|
606 |
+
.refined-problem {
|
607 |
+
display: none;
|
608 |
+
}
|
609 |
+
|
610 |
+
.refined-problem.active {
|
611 |
+
display: block;
|
612 |
+
}
|
613 |
+
|
614 |
+
.refined-problem-title {
|
615 |
+
font-weight: 600;
|
616 |
+
margin-bottom: 10px;
|
617 |
+
color: var(--primary-dark);
|
618 |
+
}
|
619 |
+
|
620 |
+
.refined-problem-description {
|
621 |
+
line-height: 1.5;
|
622 |
+
}
|
623 |
+
|
624 |
+
.apply-problem-btn {
|
625 |
+
margin-top: 10px;
|
626 |
+
background-color: var(--primary);
|
627 |
+
color: white;
|
628 |
+
border: none;
|
629 |
+
border-radius: 4px;
|
630 |
+
padding: 5px 10px;
|
631 |
+
cursor: pointer;
|
632 |
+
font-size: 14px;
|
633 |
+
}
|
634 |
+
|
635 |
+
.apply-problem-btn:hover {
|
636 |
+
background-color: var(--primary-dark);
|
637 |
+
}
|
638 |
+
|
639 |
+
.enhance-problem-button {
|
640 |
+
background-color: var(--warning);
|
641 |
+
color: white;
|
642 |
+
}
|
643 |
+
|
644 |
+
.enhance-problem-button:hover {
|
645 |
+
background-color: #d97706;
|
646 |
+
}
|
647 |
+
|
648 |
+
.enhance-problem-button.disabled {
|
649 |
+
opacity: 0.6;
|
650 |
+
cursor: not-allowed;
|
651 |
+
}
|
652 |
+
|
653 |
+
/* Accordion styles for collapsible search results */
|
654 |
+
.accordion-section {
|
655 |
+
margin-bottom: 20px;
|
656 |
+
border: 1px solid var(--gray-300);
|
657 |
+
border-radius: 8px;
|
658 |
+
overflow: hidden;
|
659 |
+
background-color: white;
|
660 |
+
}
|
661 |
+
|
662 |
+
.accordion-header {
|
663 |
+
background-color: var(--gray-100);
|
664 |
+
padding: 10px 15px;
|
665 |
+
cursor: pointer;
|
666 |
+
display: flex;
|
667 |
+
justify-content: space-between;
|
668 |
+
align-items: center;
|
669 |
+
font-weight: 500;
|
670 |
+
border-bottom: 1px solid var(--gray-300);
|
671 |
+
}
|
672 |
+
|
673 |
+
.accordion-header:hover {
|
674 |
+
background-color: var(--gray-200);
|
675 |
+
}
|
676 |
+
|
677 |
+
.accordion-header .toggle-icon {
|
678 |
+
transition: transform 0.3s ease;
|
679 |
+
}
|
680 |
+
|
681 |
+
.accordion-header.collapsed .toggle-icon {
|
682 |
+
transform: rotate(-90deg);
|
683 |
+
}
|
684 |
+
|
685 |
+
.accordion-body {
|
686 |
+
transition: max-height 0.5s ease;
|
687 |
+
max-height: none; /* Changed from 2000px to none to allow full height */
|
688 |
+
overflow: hidden;
|
689 |
+
}
|
690 |
+
|
691 |
+
.accordion-body.collapsed {
|
692 |
+
max-height: 0;
|
693 |
+
padding: 0;
|
694 |
+
border-top: none;
|
695 |
+
}
|
696 |
+
|
697 |
+
/* Add padding to accordion content for better readability */
|
698 |
+
.accordion-content {
|
699 |
+
padding: 15px;
|
700 |
+
}
|
701 |
+
|
702 |
+
.query-timestamp {
|
703 |
+
font-size: 12px;
|
704 |
+
color: var(--gray-500);
|
705 |
+
margin-left: 10px;
|
706 |
+
}
|
707 |
+
|
708 |
+
.grouped-insights-container {
|
709 |
+
background-color: white;
|
710 |
+
border-radius: 8px;
|
711 |
+
border: 1px solid var(--gray-300);
|
712 |
+
margin-top: 20px;
|
713 |
+
margin-bottom: 20px;
|
714 |
+
box-shadow: var(--shadow);
|
715 |
+
overflow: hidden;
|
716 |
+
display: none;
|
717 |
+
}
|
718 |
+
|
719 |
+
.grouped-insights-header {
|
720 |
+
display: flex;
|
721 |
+
justify-content: space-between;
|
722 |
+
padding: 15px;
|
723 |
+
background-color: var(--primary-light);
|
724 |
+
color: white;
|
725 |
+
font-weight: 600;
|
726 |
+
align-items: center;
|
727 |
+
}
|
728 |
+
|
729 |
+
.grouped-insights-close {
|
730 |
+
cursor: pointer;
|
731 |
+
font-size: 20px;
|
732 |
+
font-weight: bold;
|
733 |
+
margin-left: 8px;
|
734 |
+
}
|
735 |
+
|
736 |
+
.grouped-insights-content {
|
737 |
+
padding: 0;
|
738 |
+
}
|
739 |
+
|
740 |
+
.score-group {
|
741 |
+
margin-bottom: 10px;
|
742 |
+
border-bottom: 1px solid var(--gray-300);
|
743 |
+
}
|
744 |
+
|
745 |
+
.score-group-header {
|
746 |
+
padding: 10px 15px;
|
747 |
+
background-color: var(--gray-100);
|
748 |
+
font-weight: 500;
|
749 |
+
display: flex;
|
750 |
+
justify-content: space-between;
|
751 |
+
border-bottom: 1px solid var(--gray-200);
|
752 |
+
}
|
753 |
+
|
754 |
+
.score-group-actions {
|
755 |
+
display: flex;
|
756 |
+
gap: 8px;
|
757 |
+
}
|
758 |
+
|
759 |
+
.score-insights-list {
|
760 |
+
padding: 10px 15px;
|
761 |
+
}
|
762 |
+
|
763 |
+
.grouped-insight-tag {
|
764 |
+
background-color: #f1f1f1;
|
765 |
+
border: 1px solid #ddd;
|
766 |
+
border-radius: 15px;
|
767 |
+
padding: 4px 12px;
|
768 |
+
font-size: 12px;
|
769 |
+
cursor: pointer;
|
770 |
+
transition: all 0.2s ease;
|
771 |
+
user-select: none;
|
772 |
+
margin: 4px;
|
773 |
+
display: inline-flex;
|
774 |
+
align-items: center;
|
775 |
+
}
|
776 |
+
|
777 |
+
.grouped-insight-tag.selected {
|
778 |
+
background-color: #4CAF50;
|
779 |
+
color: white;
|
780 |
+
border-color: #4CAF50;
|
781 |
+
}
|
782 |
+
|
783 |
+
.insight-source {
|
784 |
+
font-size: 9px;
|
785 |
+
background-color: var(--primary-dark);
|
786 |
+
color: white;
|
787 |
+
border-radius: 10px;
|
788 |
+
padding: 1px 6px;
|
789 |
+
margin-left: 5px;
|
790 |
+
display: inline-block;
|
791 |
+
text-decoration: none;
|
792 |
+
}
|
793 |
+
|
794 |
+
.insight-source:hover {
|
795 |
+
background-color: var(--primary);
|
796 |
+
}
|
797 |
+
|
798 |
+
.grouped-insights-actions {
|
799 |
+
display: flex;
|
800 |
+
align-items: center;
|
801 |
+
gap: 8px;
|
802 |
+
}
|
803 |
+
|
804 |
+
/* AI Select Button Styling */
|
805 |
+
.ai-select-btn {
|
806 |
+
background: linear-gradient(135deg, #4b6cb7, #8e44ad);
|
807 |
+
color: white;
|
808 |
+
border: none;
|
809 |
+
padding: 8px 16px;
|
810 |
+
border-radius: 4px;
|
811 |
+
font-weight: 500;
|
812 |
+
cursor: pointer;
|
813 |
+
display: flex;
|
814 |
+
align-items: center;
|
815 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
816 |
+
transition: all 0.3s ease;
|
817 |
+
}
|
818 |
+
|
819 |
+
.ai-select-btn:before {
|
820 |
+
content: "🧠";
|
821 |
+
margin-right: 6px;
|
822 |
+
font-size: 14px;
|
823 |
+
}
|
824 |
+
|
825 |
+
.ai-select-btn:hover {
|
826 |
+
transform: translateY(-2px);
|
827 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
828 |
+
}
|
829 |
+
|
830 |
+
.ai-select-btn:active {
|
831 |
+
transform: translateY(0);
|
832 |
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
833 |
+
}
|
834 |
+
|
835 |
+
.ai-select-btn:disabled {
|
836 |
+
background: linear-gradient(135deg, #a0a0a0, #7a7a7a);
|
837 |
+
cursor: wait;
|
838 |
+
transform: none;
|
839 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
840 |
+
}
|
841 |
+
|
842 |
+
@keyframes pulse {
|
843 |
+
0% {
|
844 |
+
box-shadow: 0 0 0 0 rgba(142, 68, 173, 0.7);
|
845 |
+
}
|
846 |
+
70% {
|
847 |
+
box-shadow: 0 0 0 10px rgba(142, 68, 173, 0);
|
848 |
+
}
|
849 |
+
100% {
|
850 |
+
box-shadow: 0 0 0 0 rgba(142, 68, 173, 0);
|
851 |
+
}
|
852 |
+
}
|
853 |
+
|
854 |
+
.pulse {
|
855 |
+
animation: pulse 2s infinite;
|
856 |
+
}
|
857 |
+
|
858 |
+
/* Existing styles continue below */
|
859 |
+
.ai-select-btn {
|
860 |
+
background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
|
861 |
+
color: white;
|
862 |
+
font-weight: 600;
|
863 |
+
padding: 6px 12px;
|
864 |
+
border-radius: 6px;
|
865 |
+
border: none;
|
866 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
867 |
+
display: flex;
|
868 |
+
align-items: center;
|
869 |
+
transition: all 0.3s ease;
|
870 |
+
position: relative;
|
871 |
+
overflow: hidden;
|
872 |
+
}
|
873 |
+
|
874 |
+
.ai-select-btn::before {
|
875 |
+
content: "🧠";
|
876 |
+
margin-right: 6px;
|
877 |
+
font-size: 14px;
|
878 |
+
}
|
879 |
+
|
880 |
+
.ai-select-btn:hover {
|
881 |
+
transform: translateY(-2px);
|
882 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
883 |
+
background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
|
884 |
+
}
|
885 |
+
|
886 |
+
.ai-select-btn:active {
|
887 |
+
transform: translateY(1px);
|
888 |
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
889 |
+
}
|
890 |
+
|
891 |
+
/* Add pulsing effect to draw attention */
|
892 |
+
@keyframes pulse {
|
893 |
+
0% {
|
894 |
+
box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7);
|
895 |
+
}
|
896 |
+
70% {
|
897 |
+
box-shadow: 0 0 0 6px rgba(139, 92, 246, 0);
|
898 |
+
}
|
899 |
+
100% {
|
900 |
+
box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
|
901 |
+
}
|
902 |
+
}
|
903 |
+
|
904 |
+
.ai-select-btn.pulse {
|
905 |
+
animation: pulse 2s infinite;
|
906 |
+
}
|
907 |
+
|
908 |
+
.key-issues-container {
|
909 |
+
margin-top: 20px;
|
910 |
+
padding: 15px;
|
911 |
+
background-color: #f9f9f9;
|
912 |
+
border-radius: 8px;
|
913 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
914 |
+
}
|
915 |
+
|
916 |
+
.key-issues-container {
|
917 |
+
margin-top: 2rem;
|
918 |
+
border-radius: 0.5rem;
|
919 |
+
overflow: hidden;
|
920 |
+
}
|
921 |
+
|
922 |
+
.key-issues-list {
|
923 |
+
display: grid;
|
924 |
+
grid-template-columns: 1fr;
|
925 |
+
gap: 1rem;
|
926 |
+
margin-top: 1rem;
|
927 |
+
}
|
928 |
+
|
929 |
+
@media (min-width: 768px) {
|
930 |
+
.key-issues-list {
|
931 |
+
grid-template-columns: repeat(2, 1fr);
|
932 |
+
}
|
933 |
+
}
|
934 |
+
|
935 |
+
.key-issue-card {
|
936 |
+
background-color: white;
|
937 |
+
border: 1px solid var(--gray-300);
|
938 |
+
border-radius: 0.75rem;
|
939 |
+
padding: 1.5rem;
|
940 |
+
box-shadow: var(--shadow-sm);
|
941 |
+
cursor: pointer;
|
942 |
+
transition: var(--transition);
|
943 |
+
}
|
944 |
+
|
945 |
+
.key-issue-card:hover {
|
946 |
+
border-color: var(--primary-light);
|
947 |
+
box-shadow: var(--shadow-md);
|
948 |
+
}
|
949 |
+
|
950 |
+
.key-issue-card.selected {
|
951 |
+
border: 2px solid var(--primary);
|
952 |
+
background-color: rgba(37, 99, 235, 0.05);
|
953 |
+
}
|
954 |
+
|
955 |
+
.key-issue-title {
|
956 |
+
font-weight: 600;
|
957 |
+
font-size: 1.125rem;
|
958 |
+
color: var(--gray-800);
|
959 |
+
margin-bottom: 0.5rem;
|
960 |
+
}
|
961 |
+
|
962 |
+
.key-issue-description {
|
963 |
+
color: var(--gray-600);
|
964 |
+
margin-bottom: 1rem;
|
965 |
+
font-size: 0.9375rem;
|
966 |
+
}
|
967 |
+
|
968 |
+
.key-issue-challenges {
|
969 |
+
margin: 0.75rem 0;
|
970 |
+
padding-left: 1.5rem;
|
971 |
+
}
|
972 |
+
|
973 |
+
.key-issue-challenges li {
|
974 |
+
margin-bottom: 0.5rem;
|
975 |
+
font-size: 0.875rem;
|
976 |
+
color: var(--gray-700);
|
977 |
+
}
|
978 |
+
|
979 |
+
.key-issue-impact {
|
980 |
+
font-size: 0.875rem;
|
981 |
+
color: var(--gray-700);
|
982 |
+
font-style: italic;
|
983 |
+
margin-top: 0.75rem;
|
984 |
+
}
|
985 |
+
|
986 |
+
.key-issues-container h3 {
|
987 |
+
margin-top: 0;
|
988 |
+
color: #333;
|
989 |
+
font-size: 18px;
|
990 |
+
font-weight: 600;
|
991 |
+
margin-bottom: 15px;
|
992 |
+
border-bottom: 1px solid #ddd;
|
993 |
+
padding-bottom: 8px;
|
994 |
+
}
|
995 |
+
|
996 |
+
.key-issues-list {
|
997 |
+
display: grid;
|
998 |
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
999 |
+
gap: 15px;
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
.key-issue-card {
|
1003 |
+
background-color: white;
|
1004 |
+
border: 1px solid #e0e0e0;
|
1005 |
+
border-radius: 6px;
|
1006 |
+
padding: 15px;
|
1007 |
+
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05);
|
1008 |
+
transition: all 0.3s ease;
|
1009 |
+
cursor: pointer;
|
1010 |
+
}
|
1011 |
+
|
1012 |
+
.key-issue-card:hover {
|
1013 |
+
transform: translateY(-3px);
|
1014 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
1015 |
+
border-color: #ccc;
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
.key-issue-card.selected {
|
1019 |
+
border: 2px solid #4b6cb7;
|
1020 |
+
background-color: rgba(75, 108, 183, 0.05);
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
.key-issue-title {
|
1024 |
+
font-weight: 600;
|
1025 |
+
color: #333;
|
1026 |
+
margin-bottom: 10px;
|
1027 |
+
font-size: 16px;
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
.key-issue-description {
|
1031 |
+
color: #555;
|
1032 |
+
font-size: 14px;
|
1033 |
+
line-height: 1.5;
|
1034 |
+
margin-bottom: 12px;
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
.key-issue-challenges {
|
1038 |
+
padding-left: 18px;
|
1039 |
+
margin: 10px 0;
|
1040 |
+
}
|
1041 |
+
|
1042 |
+
.key-issue-challenges li {
|
1043 |
+
font-size: 13px;
|
1044 |
+
color: #666;
|
1045 |
+
margin-bottom: 5px;
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
.key-issue-impact {
|
1049 |
+
font-size: 13px;
|
1050 |
+
color: #d32f2f;
|
1051 |
+
font-style: italic;
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
/* Accordion Ribbon Styles */
|
1055 |
+
.ribbon-accordion {
|
1056 |
+
position: fixed;
|
1057 |
+
bottom: 2rem;
|
1058 |
+
right: 2rem;
|
1059 |
+
z-index: 100;
|
1060 |
+
width: 320px;
|
1061 |
+
background-color: #fff;
|
1062 |
+
border-radius: 0.75rem 0.75rem 0 0;
|
1063 |
+
box-shadow: var(--shadow-lg);
|
1064 |
+
overflow: hidden;
|
1065 |
+
transition: transform 0.3s ease;
|
1066 |
+
transform-origin: bottom center;
|
1067 |
+
}
|
1068 |
+
|
1069 |
+
.ribbon-accordion.collapsed {
|
1070 |
+
transform: translateY(calc(100% - 50px));
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
.ribbon-header {
|
1074 |
+
background-color: #8e44ad;
|
1075 |
+
color: white;
|
1076 |
+
padding: 15px;
|
1077 |
+
display: flex;
|
1078 |
+
justify-content: space-between;
|
1079 |
+
align-items: center;
|
1080 |
+
cursor: pointer;
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
.ribbon-title {
|
1084 |
+
font-weight: 600;
|
1085 |
+
font-size: 1rem;
|
1086 |
+
display: flex;
|
1087 |
+
align-items: center;
|
1088 |
+
gap: 8px;
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
.ribbon-icon {
|
1092 |
+
font-size: 1.25rem;
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
.ribbon-toggle {
|
1096 |
+
transition: transform 0.3s ease;
|
1097 |
+
}
|
1098 |
+
|
1099 |
+
.collapsed .ribbon-toggle {
|
1100 |
+
transform: rotate(180deg);
|
1101 |
+
}
|
1102 |
+
|
1103 |
+
.ribbon-content {
|
1104 |
+
padding: 1rem;
|
1105 |
+
display: flex;
|
1106 |
+
flex-direction: column;
|
1107 |
+
gap: 0.75rem;
|
1108 |
+
max-height: 400px;
|
1109 |
+
overflow-y: auto;
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
.auto-run-btn {
|
1113 |
+
background: linear-gradient(135deg, #ff9966, #ff5e62);
|
1114 |
+
color: white;
|
1115 |
+
border: none;
|
1116 |
+
border-radius: 0.5rem;
|
1117 |
+
padding: 0.75rem;
|
1118 |
+
font-weight: 600;
|
1119 |
+
cursor: pointer;
|
1120 |
+
display: flex;
|
1121 |
+
align-items: center;
|
1122 |
+
justify-content: center;
|
1123 |
+
gap: 0.5rem;
|
1124 |
+
box-shadow: var(--shadow);
|
1125 |
+
transition: all 0.3s ease;
|
1126 |
+
position: relative;
|
1127 |
+
overflow: hidden;
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
.auto-run-btn::before {
|
1131 |
+
content: "🚀";
|
1132 |
+
font-size: 1.25rem;
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
.auto-run-btn:hover {
|
1136 |
+
transform: translateY(-2px);
|
1137 |
+
box-shadow: var(--shadow-lg);
|
1138 |
+
background: linear-gradient(135deg, #ff5e62, #ff9966);
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
.auto-run-btn:active {
|
1142 |
+
transform: translateY(0);
|
1143 |
+
box-shadow: var(--shadow);
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
/* Progress bar for auto-run */
|
1147 |
+
.progress-bar-container {
|
1148 |
+
height: 6px;
|
1149 |
+
background-color: #f0f0f0;
|
1150 |
+
border-radius: 3px;
|
1151 |
+
margin-top: 0.75rem;
|
1152 |
+
overflow: hidden;
|
1153 |
+
display: none;
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
.progress-bar {
|
1157 |
+
height: 100%;
|
1158 |
+
background: linear-gradient(90deg, #8e44ad, #3498db);
|
1159 |
+
width: 0%;
|
1160 |
+
transition: width 0.3s ease;
|
1161 |
+
}
|
1162 |
+
|
1163 |
+
.progress-step {
|
1164 |
+
font-size: 0.75rem;
|
1165 |
+
color: var(--gray-600);
|
1166 |
+
margin-top: 0.25rem;
|
1167 |
+
display: none;
|
1168 |
+
}
|
1169 |
+
|
1170 |
+
/* Hide original floating buttons when using ribbon */
|
1171 |
+
.ribbon-mode .floating-buttons {
|
1172 |
+
display: none;
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
/* Existing styles continue below */
|
templates/index.html
ADDED
The diff for this file is too large to render.
See raw diff
|
|