:root {
	--primary-color: #000000;
	--primary-dark: #000000;
	--text-color: #000000;
	--light-gray: #f5f5f5;
	--mid-gray: #e0e0e0;
	--half-gray: #b6b6b6;
	--dark-gray: #666;
	--border-color: #ededed;
	--success-color: #000000;
	--error-color: #000000;
	--warning-color: #000000;
	--bot-message-bg: #e0e0e0;
	--user-message-bg: #fff1ee;
	--research-active: #f44336;
	--research-active-bg: #fff6f5;
	--research-inactive: #6b7280;
	--research-inactive-bg: #f9fafb;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: "Open Sans", sans-serif;
	font-style: normal;
	line-height: 1.6;
	color: var(--text-color);
	background-color: #ffffff;
	height: 100vh;
	text-rendering: optimizeLegibility;
	font-size: 1.05em;
	padding: 0;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	-webkit-font-smoothing: antialiased;
	overflow: hidden;
}

.app-container {
	width: 800px;
	max-width: 100vw;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	height: 100vh;
	transition: all 0.3s ease;
	padding: 0;
}

/* Header Styles */
.app-header {
	padding: 10px;
	text-align: center;
	transition: all 0.3s ease;
}

/* Hide header when chat has started */
.app-container.chat-started .app-header {
	opacity: 0;
	transform: translateY(-20px);
	height: 0;
	padding: 0;
	overflow: hidden;
<<<<<<< HEAD
	min-height: max-content;
=======
	margin: 0;
>>>>>>> b93adbe3e565c96bbb06e6a6356cc9f037ee5396
}

.logo-container {
	margin-top: 20px;
}

.logo-container h1 {
	font-size: clamp(32px, 8vw, 60px); /* Responsive font size */
	line-height: 1.05em;
}

.logo-container h1 span {
	font-style: italic;
}

.logo-container p,
.chat-subtitle p {
	line-height: 1.4em;
	margin: 20px 0 0; /* Reduced margin for mobile */
	font-size: clamp(16px, 4vw, 20px); /* Responsive font size */
}

.chat-subtitle p a {
	color: var(--research-active);
	text-decoration: none;
	font-weight: 600;
}

.status-badge {
	font-size: 1em;
	padding: 5px 15px;
	border-radius: 30px;
	background-color: var(--mid-gray);
	text-transform: capitalize;
	font-weight: 500;
}

.status-badge.ready {
	background-color: #e1f5e1;
	color: var(--success-color);
}

.status-badge.not-ready {
	background-color: #ffebee;
	color: var(--error-color);
}

.status-badge.loading {
	background-color: #fff8e1;
	color: var(--warning-color);
}

/* Button Styles */
.btn {
	padding: 12px 20px; /* Increased padding for mobile */
	font-size: 1.05em;
	cursor: pointer;
	transition: all 0.2s;
	font-weight: 700;
	text-transform: capitalize;
	font-family: inherit;
	border-radius: 10px;
	background-color: #e9e9e9;
	border: 1px solid #e3e3e3;
	min-height: 44px; /* Apple's recommended touch target */
}

.btn.primary {
	background-color: var(--primary-color);
	color: white;
	border-color: var(--primary-color);
}

.btn.primary:hover {
	background-color: var(--primary-dark);
}

/* Chat Container */
.chat-container {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	border-radius: 0 0 8px 8px;
	overflow: hidden;
	padding: 0;
	position: relative;
	transition: all 0.3s ease;
}

/* Initial state: Prompt section at center */
.prompt-section {
	padding: 40px 0; /* Reduced padding for mobile */
	background-color: white;
	border-radius: 10px;
	transition: all 0.3s ease;
	z-index: 10;
}

/* Chat started state: Prompt section fixed at bottom */
.app-container.chat-started .prompt-section {
	position: fixed;
	bottom: 0;
	left: 0; /* Mobile friendly positioning */
	transform: none;
	width: 100vw;
	padding: 15px;
	background: linear-gradient(-180deg, #ffffffb0, #ffffff);
	border-radius: 0;
}

.app-container .prompt-section .input-area {
	box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
	border-radius: 10px;
	max-width: 800px;
	margin: 0 auto;
}

/* Messages container */
.messages {
	flex-grow: 1;
	overflow-y: auto;
	padding: 0;
	background-color: white;
	border-radius: 10px;
	display: none;
	transition: all 0.3s ease;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* Internet Explorer 10+ */
}

.messages::-webkit-scrollbar {
	display: none; /* Chrome, Safari, Edge */
}

/* Show messages when chat has started */
.app-container.chat-started .messages {
	display: block;
	padding: 15px 0;
	margin-bottom: 160px;
	height: calc(100vh - 160px);
}

.message {
	margin-bottom: 20px;
	max-width: 100%;
	width: max-content;
	min-width: 50px;
}

.message.user {
	margin-left: auto;
}

.message.user .message-content {
	padding: 12px 18px;
	border-radius: 20px 20px 0 20px;
	font-weight: 500;
	width: 100%;
	max-width: unset;
}

.message-content {
	line-height: 1.4em;
}

.message-content ul,
.message-content ol {
	margin: 10px 10px 10px 20px;
}

/*.message-content ol {*/
/*	margin-left: 0;*/
/*	list-style: none;*/
/*	font-weight: 600;*/
/*}*/

.message-content li {
	margin-top: 3px;
	margin-bottom: 3px;
}

.message.bot .message-content p {
	position: relative;
	line-height: 1.45;
}

@keyframes blink {
	0%, 100% { opacity: 1; }
	50% { opacity: 0; }
}

.typing::after {
	content: '|';
	display: inline-block;
	margin-left: 2px;
	animation: blink 1s infinite;
	font-weight: normal;
	color: #333;
}

.message.user .message-content {
	background-color: var(--light-gray);
}

.message-content p {
	margin-bottom: 8px;
}

.message-content h2,
.message-content h3,
.message-content h4 {
	margin: 25px 0 15px;
	text-transform: capitalize;
	font-size: clamp(1.1em, 4vw, 1.4em);
}

.message-content h2 {
	font-size: 1.5em;
}

.message-content h3 {
	font-size: 1.3em;
}

.message-content h4 {
	font-size: 1.1em;
}

.message-content p:last-child {
	margin-bottom: 0;
}

.sources-list {
	list-style: auto;
}

.source-link {
	color: inherit;
	font-style: italic;
}

.message.bot .message-content {
	padding: 20px 0; /* Reduced padding for mobile */
}

/* Input Area */
.input-area {
	padding: 0;
}

.input-area form {
	display: flex;
	gap: 10px;
}

.input-area label {
	display: contents;
	position: relative;
}

.input-area form {
	position: relative;
}

.input-area button {
	position: absolute;
	bottom: 15px;
	right: 15px;
	font-size: 0.8em;
	min-height: 40px; /* Mobile touch target */
}

.research-button {
	padding: 8px 12px; /* Increased for mobile */
	border-radius: 8px;
	cursor: pointer;
	width: auto;
	white-space: nowrap;
	height: max-content;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid;
	position: absolute;
	bottom: 15px;
	left: 15px;
	font-size: 0.75em;
	transition: all 0.2s ease;
	user-select: none;
	min-height: 40px; /* Mobile touch target */
}

/* Inactive research mode */
.research-button:not(.active) {
	background-color: var(--research-inactive-bg);
	border-color: #d1d5db;
	color: var(--research-inactive);
}

.research-button:not(.active):hover {
	background-color: #f3f4f6;
	border-color: #9ca3af;
}

/* Active research mode */
.research-button.active {
	background-color: var(--research-active-bg);
	border-color: var(--research-active);
	color: var(--research-active);
}

.research-button.active:hover {
	background-color: #ffe9e7;
	border-color: #F44336;
}

/* Research mode indicator dot */
.research-button::before {
	content: '';
	width: 8px;
	height: 8px;
	border-radius: 50%;
	transition: background-color 0.2s ease;
}

.research-button:not(.active)::before {
	background-color: #d1d5db;
}

.research-button.active::before {
	background-color: var(--research-active);
}

.input-area textarea {
	flex-grow: 1;
	padding: 15px 15px 90px; /* Increased bottom padding for mobile buttons */
	border: 1px solid var(--half-gray);
	border-radius: 10px;
	font-size: 1em;
	font-family: inherit;
	line-height: 1.4em;
	resize: none;
	min-height: 80px; /* Minimum height for mobile */
}

.input-area textarea:focus {
	outline: none;
	border-color: #666;
}

/* Prompt Suggestions */
.prompt-suggestions {
	padding: 10px 0;
	text-align: center;
	transition: all 0.3s ease;
}

/* Hide prompt suggestions when chat has started */
.app-container.chat-started .prompt-suggestions {
	opacity: 0;
	height: 0;
	padding: 0;
	overflow: hidden;
}

.prompt-chip {
	padding: 8px 15px; /* Increased for mobile */
	border-radius: 10px;
	font-size: 0.85em;
	cursor: pointer;
	width: auto;
	white-space: nowrap;
	height: max-content;
	font-weight: 500;
	display: inline-block;
	margin: 4px;
	border: 1px solid var(--half-gray);
	background-color: transparent;
	opacity: 0.75;
	transition: all 0.2s ease;
	min-height: 36px; /* Mobile touch target */
}

.prompt-chip:hover {
	opacity: 1;
}

/* Research Visualizations */
.research-visualizations {
	margin: 15px 0; /* Reduced for mobile */
}

.metrics-section,
.table-section,
.insights-section,
.charts-section {
	margin: 25px 0; /* Reduced for mobile */
}

.metrics-section h4,
.table-section h4,
.insights-section h4,
.charts-section h4 {
	margin-bottom: 10px;
	color: var(--text-color);
	font-weight: 700;
	font-size: clamp(1.1em, 4vw, 1.3em);
}

.metrics-grid {
	display: flex;
	gap: 10px;
	margin: 10px 0;
	flex-direction: column;
}

.metric-title {
	font-size: 0.8em;
	color: var(--dark-gray);
	margin-bottom: 5px;
	font-weight: 500;
}

.metric-value {
	font-size: clamp(1.2em, 5vw, 1.6em); /* Responsive metric values */
	font-weight: bold;
	color: var(--text-color);
	margin-bottom: 5px;
}

.change {
	font-size: 0.65em;
	font-weight: 600;
	padding: 2px 5px;
	border-radius: 4px;
	margin-top: 5px;
	display: inline-block;
}

.change.positive {
	color: #16a085;
	background-color: #e8f5e8;
}

.change.negative {
	color: #e74c3c;
	background-color: #ffebee;
}

.metric-description {
	font-size: 0.8em;
	color: var(--dark-gray);
	margin-top: 5px;
}

.research-table {
	width: 100%;
	border-collapse: collapse;
	margin: 15px 0;
	background: white;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid #e0e0e0;
	font-size: 0.75em; /* Smaller for mobile */
	overflow-x: auto; /* Horizontal scroll on mobile */
}

.research-table th,
.research-table td {
	padding: 8px 6px; /* Adjusted for mobile */
	text-align: left;
	border-bottom: 1px solid #e0e0e0;
	min-width: 80px; /* Minimum width for readability */
}

.research-table th {
	background-color: #f8f9fa;
	font-weight: 600;
	color: var(--text-color);
	font-size: 0.8em;
}

.research-table tr:last-child td {
	border-bottom: none;
}

.research-table tr:hover {
	background-color: #f8f9fa;
}

/* Make tables scrollable on mobile */
.table-section {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.insights-list {
	list-style: auto;
	padding: 0;
	margin-left: 15px; /* Reduced for mobile */
}

.chart-container {
	margin: 15px 0;
	background: white;
	padding: 15px; /* Reduced for mobile */
	border-radius: 8px;
	border: 1px solid #e0e0e0;
}

.chart-canvas-container {
	position: relative;
	height: 250px; /* Reduced height for mobile */
	margin: 15px 0;
}

.chart-data-details {
	margin-top: 15px;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 10px;
}

.chart-data-details summary {
	cursor: pointer;
	font-weight: 600;
	padding: 5px;
	font-size: 0.9em;
}

.chart-data-details pre {
	background: #f8f9fa;
	padding: 10px;
	border-radius: 4px;
	font-size: 10px; /* Smaller for mobile */
	overflow-x: auto;
	margin: 10px 0 0 0;
}

.chart-error {
	background: #fff3cd;
	border: 1px solid #ffeaa7;
	border-radius: 4px;
	padding: 12px;
	text-align: center;
	color: #856404;
	font-size: 0.9em;
}

/* Modal Styles - Mobile Optimized */
.modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 100;
	padding: 20px; /* Mobile padding */
}

.modal-content {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background-color: white;
	padding: 20px;
	border-radius: 8px;
	width: 100%;
	max-width: 400px; /* Smaller max-width for mobile */
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	max-height: 90vh; /* Prevent modal from being too tall */
	overflow-y: auto;
}

.modal-content p {
	line-height: 1.3em;
	margin-bottom: 1em;
	font-size: 0.95em;
}

.modal h2 {
	margin-bottom: 15px;
	font-size: 1.3rem; /* Smaller for mobile */
	font-weight: 500;
}

.form-group {
	margin-bottom: 18px;
}

.form-group label {
	display: block;
	margin-bottom: 8px;
	font-weight: 500;
	font-size: 0.95em;
}

.form-group input[type="number"] {
	width: 100%;
	padding: 12px; /* Increased for mobile */
	border: 1px solid var(--border-color);
	border-radius: 4px;
	font-size: 16px; /* Prevent zoom on iOS */
	min-height: 44px;
}

.checkbox-label {
	display: flex;
	align-items: center;
	gap: 10px; /* Increased for mobile */
	cursor: pointer;
	min-height: 44px; /* Touch target */
}

.checkbox-label input[type="checkbox"] {
	width: 18px;
	height: 18px;
}

.form-group small {
	display: block;
	margin-top: 5px;
	color: var(--dark-gray);
	font-size: 0.8rem;
}

.form-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	margin-top: 20px;
	flex-wrap: wrap; /* Allow wrapping on very small screens */
}

.form-actions .btn {
	min-width: 80px;
}

/* Loading Overlay */
.loading-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(255, 255, 255, 0.9);
	z-index: 1000;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	padding: 20px;
}

.spinner {
	border: 4px solid rgba(0, 0, 0, 0.1);
	border-radius: 50%;
	border-top: 4px solid var(--primary-color);
	width: 40px;
	height: 40px;
	animation: spin 1s linear infinite;
	margin-bottom: 15px;
}

.message-sources {
	margin-top: 15px;
	/*font-size: 0.9em;*/
	color: black;
}

.message-sources > div {
	margin-bottom: 15px;
}

.message-sources ul {
	margin-left: 20px;
}

.message-sources li a {
	/*text-decoration: none;*/
	line-height: 1.2em;
}

.typing-indicator {
	display: flex;
	align-items: center;
	margin-bottom: 20px;
}


.typing-indicator .typing-text {
	font-weight: 600;
	margin-right: 8px;
	font-size: 0.9em; /* Smaller for mobile */
}

.typing-dots {
	display: flex;
	gap: 4px;
}

.typing-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background-color: #999;
	animation: typingPulse 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(1) {
	animation-delay: 0s;
}

.typing-dot:nth-child(2) {
	animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes typingPulse {
	0%, 60%, 100% {
		opacity: 0.3;
		transform: scale(0.8);
	}
	30% {
		opacity: 1;
		transform: scale(1.2);
	}
}

/* Alternative blinking cursor style */
.typing-cursor {
	display: inline-block;
	background-color: #333;
	width: 2px;
	height: 20px;
	margin-left: 2px;
	animation: blink 1s infinite;
}

.message-actions {
	display: flex;
	gap: 8px;
	margin-top: 15px;
	padding-top: 10px;
	border-top: none;
	opacity: 0;
	transition: opacity 0.2s ease;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.message.bot:hover .message-actions {
	opacity: 1;
}

.action-btn {
	padding: 8px 14px;
	font-size: 0.7em;
	border: none;
	/*border-radius: 6px;*/
	/*background-color: white;*/
	color: #374151;
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	gap: 6px;
	/*font-weight: 500;*/
	font-family: inherit;
	min-height: 36px;
	/* flex: 1; */
	justify-content: center;
	border-radius: 30px;
	background-color: #f5f5f5;
	font-weight: 600;
}

.action-btn:hover {
	background-color: #f3f4f6;
	border-color: #9ca3af;
}

.action-btn.success {
	background-color: #d1fae5;
	border-color: #10b981;
	color: #065f46;
}

.action-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* SVG icon styling */
.action-btn .icon {
	width: 14px;
	height: 14px;
	flex-shrink: 0; /* Prevent icon from shrinking */
	stroke: currentColor; /* Inherit text color */
}

/* Remove the old emoji pseudo-elements */
.action-btn.copy-btn::before,
.action-btn.download-btn::before,
.action-btn.success.copy-btn::before {
	content: none;
	display: none;
}

/* Optional: Add hover effects for icons */
.action-btn:hover .icon {
	transform: scale(1.05);
	transition: transform 0.1s ease;
}

/* Success state icon color */
.action-btn.success .icon {
	stroke: #065f46;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
	.action-btn {
		gap: 4px;
		font-size: 0.75em;
	}

	.action-btn .icon {
		width: 14px;
		height: 14px;
	}
}

@keyframes blink {
	0%, 50% { opacity: 1; }
	51%, 100% { opacity: 0; }
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Enhanced Mobile Responsive Adjustments */
@media (max-width: 768px) {
	body {
		font-size: 0.95em;
	}

	.app-container {
		width: 100%;
		padding: 0 10px;
	}

	.app-container.chat-started .prompt-section {
		width: 100%;
		left: 0;
		transform: none;
		padding: 15px;
	}

	.message.user .message-content {
		max-width: unset;
		padding: 10px 15px;
	}

	.message.bot .message-content {
		padding: 0;
	}

	.message-actions {
		opacity: 1;
	}

	.message.bot {
		margin-bottom: 40px;
	}

	.message-content ul,
	.message-content ol {
		margin: 10px 10px 10px 20px;
	}

	/*.message-content ol {*/
	/*	margin-left: 0;*/
	/*	list-style: none;*/
	/*	font-weight: 600;*/
	/*}*/

	.app-container.chat-started .messages {
		margin-bottom: 140px;
		height: calc(100vh - 140px);
		padding: 30px 0;
	}

	.app-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
		padding: 15px 10px;
	}

	.header-controls {
		width: 100%;
	}

	.btn {
		width: 100%;
		padding: 14px 20px;
		font-size: 1em;
	}

	.logo-container h1 {
		font-size: clamp(28px, 8vw, 45px);
		text-align: center;
	}

	.logo-container p,
	.chat-subtitle p {
		font-size: clamp(14px, 4vw, 18px);
		margin: 20px 0;
		text-align: center;
	}

	/* Mobile-specific research button adjustments */
	.research-button {
		font-size: 0.7em;
		padding: 6px 10px;
		min-height: 36px;
	}

	.input-area button {
		font-size: 0.75em;
		padding: 8px 12px;
		min-height: 36px;
	}

	/* Mobile table scrolling */
	.research-table {
		font-size: 0.7em;
		display: block;
		overflow-x: auto;
		white-space: nowrap;
	}

	.research-table thead,
	.research-table tbody,
	.research-table th,
	.research-table td,
	.research-table tr {
		display: block;
	}

	.research-table thead tr {
		position: absolute;
		top: -9999px;
		left: -9999px;
	}

	.research-table tr {
		border: 1px solid #ccc;
		margin-bottom: 10px;
		padding: 10px;
		border-radius: 8px;
		background: white;
	}

	.research-table td {
		border: none;
		position: relative;
		padding: 8px 8px 8px 50%;
		white-space: normal;
		text-align: left;
	}

	.research-table td:before {
		content: attr(data-label) ": ";
		position: absolute;
		left: 6px;
		width: 45%;
		white-space: nowrap;
		font-weight: bold;
	}

	/* Metrics grid mobile optimization */
	.metrics-grid {
		gap: 15px;
	}

	/* Chart mobile optimization */
	.chart-canvas-container {
		height: 200px;
	}

	/* Action buttons mobile optimization */
	/*.message-actions {*/
	/*	flex-direction: row;*/
	/*	gap: 8px;*/
	/*}*/

	.action-btn {
		font-size: 0.75em;
		padding: 7px 10px;
		min-height: unset;
	}
}

/* Extra small mobile devices */
@media (max-width: 480px) {
	.app-container {
		padding: 0 10px;
	}

	.logo-container h1 {
		font-size: clamp(24px, 8vw, 40px);
	}

	.logo-container p,
	.chat-subtitle p {
		font-size: clamp(13px, 4vw, 16px);
		margin: 15px 0;
	}

	.input-area textarea {
		transition: all 0.3s ease;
		padding: 10px 10px 40px;
	}

	.prompt-suggestions {
		padding: 20px 0;
		text-align: left;
	}

	.input-area textarea:focus {
		min-height: 150px;
	}

	.prompt-section {
		padding: 20px 0 40px;
	}

	.message-actions {
		margin-top: 0;
		padding-top: 0;
	}

	.research-button {
		font-size: 0.8em;
		bottom: 10px;
		left: 10px;
		padding: 7px 12px;
		min-height: 30px;
	}

	.input-area button {
		font-size: 0.8em;
		width: auto;
		min-height: 30px;
		bottom: 10px;
		right: 10px;
	}

	.prompt-chip {
		font-size: 0.8em;
		font-weight: 600;
		padding: 5px 10px;
		border-radius: 10px;
		margin: 4px 0;
		min-height: unset;
	}

	.modal-content {
		padding: 15px;
		margin: 10px;
	}

	.form-actions {
		flex-direction: column;
	}

	.form-actions .btn {
		width: 100%;
		margin-bottom: 8px;
	}
}
