#aichat-container {
	position: fixed;
	bottom: 20px;
	right: 20px;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	z-index: 9999;
}

.aichat-toggle {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.3s, box-shadow 0.3s;
}

.aichat-toggle:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.aichat-notification {
	position: absolute;
	top: -4px;
	right: -4px;
	width: 12px;
	height: 12px;
	background-color: #ff3b30;
	border-radius: 50%;
	border: 2px solid white;
}

.aichat-widget {
	position: fixed;
	bottom: 90px;
	right: 20px;
	width: 400px;
	height: 500px;
	border-radius: 12px;
	box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: white;
}

.aichat-widget.dark {
	background: #1e1e1e;
	color: #e0e0e0;
}

.aichat-header {
	padding: 16px;
	color: white;
	font-weight: 600;
	font-size: 16px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	min-height: 60px;
}

.aichat-header-title {
	flex: 1;
}

.aichat-close {
	background: none;
	border: none;
	color: white;
	cursor: pointer;
	padding: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.aichat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: white;
}

.aichat-widget.dark .aichat-messages {
	background: #1e1e1e;
}

.aichat-message {
	display: flex;
	margin-bottom: 8px;
	word-wrap: break-word;
	max-width: 85%;
	animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.aichat-user {
	justify-content: flex-end;
	align-self: flex-end;
}

.aichat-user > * {
	background-color: #007AFF;
	color: white;
	padding: 10px 14px;
	border-radius: 18px;
	text-align: right;
}

.aichat-bot {
	justify-content: flex-start;
	align-self: flex-start;
}

.aichat-bot > * {
	background-color: #f0f0f0;
	color: #333;
	padding: 10px 14px;
	border-radius: 18px;
}

.aichat-widget.dark .aichat-bot > * {
	background-color: #333;
	color: #e0e0e0;
}

.aichat-typing {
	display: flex;
	gap: 4px;
	padding: 10px 14px !important;
}

.aichat-typing span {
	display: inline-block;
	width: 8px;
	height: 8px;
	background-color: #999;
	border-radius: 50%;
	animation: bounce 1.4s infinite;
}

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

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

@keyframes bounce {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 1;
	}
	30% {
		transform: translateY(-10px);
	}
}

.aichat-input-area {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #e0e0e0;
	background: white;
}

.aichat-widget.dark .aichat-input-area {
	background: #252525;
	border-top-color: #444;
}

.aichat-input {
	flex: 1;
	border: 1px solid #e0e0e0;
	border-radius: 20px;
	padding: 10px 16px;
	font-size: 14px;
	resize: none;
	max-height: 100px;
	font-family: inherit;
	outline: none;
}

.aichat-widget.dark .aichat-input {
	background: #333;
	border-color: #444;
	color: #e0e0e0;
}

.aichat-input:focus {
	border-color: #007AFF;
}

.aichat-send {
	width: 40px;
	height: 40px;
	border: none;
	border-radius: 50%;
	background-color: #007AFF;
	color: white;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s;
}

.aichat-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.aichat-send:hover:not(:disabled) {
	opacity: 0.9;
}

.aichat-quick-replies {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 8px 0;
}

.aichat-suggestion {
	background-color: #f5f5f5;
	border: 1px solid #e0e0e0;
	padding: 8px 12px;
	border-radius: 20px;
	cursor: pointer;
	font-size: 13px;
	transition: all 0.2s;
	text-align: left;
	max-width: 300px;
}

.aichat-suggestion:hover {
	background-color: #e8f4fd;
	border-color: #007AFF;
}

.aichat-gate-form, .aichat-inline-form {
	padding: 12px 0;
}

.aichat-gate-form input, .aichat-inline-form input {
	display: block;
	width: 100%;
	padding: 10px;
	margin-bottom: 8px;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	font-size: 14px;
	box-sizing: border-box;
}

.aichat-gate-form button, .aichat-inline-form button {
	width: 100%;
	padding: 10px;
	background-color: #007AFF;
	color: white;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
}

.aichat-gate-form button:hover, .aichat-inline-form button:hover {
	opacity: 0.9;
}

.aichat-error {
	background-color: #fee;
	color: #c33;
	padding: 10px;
	border-radius: 6px;
	font-size: 13px;
	margin-bottom: 8px;
}

/* Markdown rendering */
.aichat-message p {
	margin: 0;
	line-height: 1.4;
}

.aichat-message strong {
	font-weight: 600;
}

.aichat-message em {
	font-style: italic;
}

.aichat-message a {
	color: #007AFF;
	text-decoration: none;
}

.aichat-message code {
	background-color: #f0f0f0;
	padding: 2px 6px;
	border-radius: 3px;
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 12px;
}

.aichat-widget.dark .aichat-message code {
	background-color: #333;
	color: #e0e0e0;
}

.aichat-message pre {
	background-color: #f5f5f5;
	padding: 12px;
	border-radius: 6px;
	overflow-x: auto;
	font-size: 12px;
	margin: 4px 0;
}

.aichat-widget.dark .aichat-message pre {
	background-color: #333;
	color: #e0e0e0;
}

.aichat-message table {
	border-collapse: collapse;
	width: 100%;
	margin: 8px 0;
	font-size: 13px;
}

.aichat-message th, .aichat-message td {
	border: 1px solid #ddd;
	padding: 8px;
	text-align: left;
}

.aichat-message th {
	background-color: #f5f5f5;
	font-weight: 600;
}

.aichat-widget.dark .aichat-message th {
	background-color: #333;
}

.aichat-message ul, .aichat-message ol {
	margin: 4px 0;
	padding-left: 20px;
}

.aichat-message li {
	margin: 4px 0;
}

/* Mobile responsive */
@media (max-width: 600px) {
	#aichat-container {
		bottom: 10px;
		right: 10px;
	}

	.aichat-toggle {
		display: none;
	}

	.aichat-widget {
		position: fixed;
		bottom: 0;
		right: 0;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		border-radius: 0;
		bottom: auto;
	}

	.aichat-message {
		max-width: 90%;
	}
}

/* Inline widget mode */
#il-aichat-widget {
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
	height: 500px;
	display: flex;
	flex-direction: column;
}

#il-aichat-widget .il-aichat-header {
	padding: 16px;
	color: white;
	font-weight: 600;
	font-size: 16px;
}

#il-aichat-widget .il-aichat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

#il-aichat-widget .il-aichat-input-area {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #e0e0e0;
}
