﻿/* Chat button */
.chat-button {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: #1565c0;
	border: none;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	z-index: 1000;
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	will-change: transform;
}

	.chat-button:hover {
		transform: scale(1.1);
		box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
	}

	.chat-button:focus-visible {
		outline: 3px solid #4A9FD8;
		outline-offset: 2px;
	}

	.chat-button svg {
		fill: white;
		transform: scaleX(-1);
	}

/* Chat widget */
.chat-widget {
	position: fixed;
	bottom: 90px;
	right: 20px;
	width: 480px;
	max-width: 90vw;
	height: 500px;
	background: white;
	border-radius: 15px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
	display: none;
	flex-direction: column;
	z-index: 99999999999;
	overflow: hidden;
	animation: slideUp 0.3s ease;
}

	.chat-widget.active {
		display: flex;
	}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.chat-widget {
		animation: none;
	}

	.chat-button {
		transition: none;
	}

		.chat-button:hover {
			transform: none;
		}
}

/* Chat header */
.chat-header {
	background: #ffffff;
	color: black;
	padding: 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	/*box-shadow: offset-x offset-y blur-radius spread-radius color inset;*/
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
	z-index: 2;
}

	.chat-header h5 {
		margin: 0;
		font-weight: bold;
		font-size: 20px;
	}

	.chat-header h5 img {
		margin-right: 16px;
	}

.chat-header-button {
	background: none;
	border: none;
	color: dimgray;
	font-size: 24px;
	cursor: pointer;
	padding: 0;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.8;
	transition: opacity 0.2s;
	border-radius: 4px;
}

	.chat-header-button:hover {
		opacity: 1;
	}

	.chat-header-button:focus-visible {
		outline: 2px solid white;
		outline-offset: 2px;
	}

/* Chat body */
.chat-body {
	flex: 1; /* expand body to fit widget */
	padding: 5px 20px;
	overflow-y: auto; /* scroll */
	scroll-behavior: smooth;
	scrollbar-width: thin;
	scrollbar-color: #cbd5e0 #f8f9fa;
}

	.chat-body::-webkit-scrollbar {
		width: 8px;
	}

	.chat-body::-webkit-scrollbar-track {
		background: #f8f9fa;
	}

	.chat-body::-webkit-scrollbar-thumb {
		background: #cbd5e0;
		border-radius: 4px;
	}

		.chat-body::-webkit-scrollbar-thumb:hover {
			background: #a0aec0;
		}

.chat-privacy {
	opacity: 0.8;
	justify-content: center;
	font-size: 0.85em;
	padding: 0;
	text-align: center;
	margin-bottom: 15px;
}
	.chat-privacy a {
		font-size: 0.90em;
		text-decoration: underline;
	}
	/* Chat messages */
	.chat-message {
		margin-bottom: 15px;
		display: flex;
	}

	.chat-message p:last-of-type {
		margin-bottom: 0;
	}

	.chat-message.assistant {
		justify-content: flex-start;
	}

	.chat-message.user {
		justify-content: flex-end;
	}

	.chat-message.assistant .chat-message-title {
		font-weight: bold;
	}

	.chat-message.assistant .chat-message-content {
		background: #F6F6F6;
		color: #333;
		border-bottom-left-radius: 5px;
	}

	.chat-message.assistant .chat-message-time {
		color: #666;
		text-align: left;
	}

	.chat-message.user .chat-message-content {
		background: #DCF6FF;
		border-bottom-right-radius: 5px;
		display: flex;
	}

	.chat-message.user .chat-message-time {
		color: #333;
		text-align: right;
	}

.vote-buttons button {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 15px;
	padding-left: 0;
}

.vote-buttons button i {
	color: gray;
}

.vote-buttons button:focus {
	outline: none;
	box-shadow: none;
}

.chat-message-time {
	font-size: 0.75em;
	color: #888;
	margin-top: 4px;
	opacity: 0.7;
}


.chat-message-content {
	max-width: 90%;
	padding: 12px 16px;
	border-radius: 15px;
	word-wrap: break-word;
	line-height: 1.5;
}

	.chat-message-content > h1 {
		font-size: 1.3em;
		margin: 0.5em 0;
	}

	.chat-message-content > h2 {
		font-size: 1.2em;
		margin: 0.5em 0;
	}

	.chat-message-content > h3 {
		font-size: 1.1em;
		margin: 0.5em 0;
	}

	.chat-message-content > h4 {
		font-size: 1em;
		margin: 0.5em 0;
	}

/* Loading indicator */
.chat-message.loading .chat-message-content {
	padding: 16px 20px;
}

	.chat-message.loading .chat-message-content::after {
		content: '...';
		animation: ellipsis 1.5s infinite;
	}

@keyframes ellipsis {
	0% {
		content: '.';
	}

	33% {
		content: '..';
	}

	66% {
		content: '...';
	}
}

/* Chat footer */
.chat-footer {
	padding: 15px;
	background: white;
	border-top: 1px solid #cecece;
}

.chat-input-group {
	display: flex;
	gap: 10px;
}

.chat-input-group textarea {
	max-height: 100px;
}

.chat-input {
	flex: 1;
	border: none;
	padding: 10px 20px;
	outline: none;
	transition: border-color 0.2s;
	font-family: inherit;
	font-size: 14px;
}

.chat-send {
	background: #0079C1;
	border: none;
	color: white;
	border-radius: 50%;
	width: 45px;
	height: 45px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform 0.2s;
	flex-shrink: 0;
}

	.chat-send:hover:not(:disabled) {
		transform: scale(1.05);
	}

	.chat-send:focus-visible {
		outline: 3px solid #4A9FD8;
		outline-offset: 2px;
	}

	.chat-send:disabled {
		opacity: 0.5;
		cursor: not-allowed;
	}

/* Mobile responsive */
@media (max-width: 576px) {
	.chat-widget {
		width: calc(100vw - 40px);
		height: calc(100vh - 110px);
		right: 20px;
		bottom: 90px;
	}

	.chat-button {
		bottom: 20px;
		right: 20px;
	}
}

@media (max-width: 400px) {
	.chat-widget {
		width: calc(100vw - 20px);
	}

	.chat-button {
		right: 10px;
	}
}


@media (max-width: 767px) {
	.chat-widget {
		width: 100vw !important;
		position: fixed;
		height: 100vh;
		padding: 0;
		margin: 0;
		left: 0;
		right: auto;
		top: 0;
		bottom: auto;
		max-width: 100vw;
		border-radius: 0;
	}
	.chat-footer {
		padding-bottom: 60px;
	}
}