aside.chat { 
	margin-left: 0;
	background: white;
	border-radius: 1rem;
	box-shadow: 0px 0px 1rem 1px rgba(0,0,0,0.35);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	background: #f6f7f9;
	margin-bottom: 0;
	width: 100%;
	min-height: 200px;
	height: 600px;
	max-height: 75vh;
}

body > aside.chat {
	position: fixed;
	width: 30vw;
	min-width: 288px;
	bottom: 2rem;
	right: 1rem;
	z-index: 1;
	max-width: calc(100vw - 2rem);
}

main aside.chat {
	height: 800px;
	max-height: 65vh;
}

.chat .chat-titlebar {
	background: #fff;
	padding: 0.5rem 1rem;
	display: flex;
	align-items: center;
	box-shadow: 0px 4px 14px -10px rgba(0,0,0,0.75);
	gap: 0.75rem;
}
.chat .chat-titlebar h2 {
	margin-bottom: 0;
	font-size: 1.25rem;
}
.chat .chat-titlebar div {
	display: flex;
	flex-grow: 1;
	gap: 0.5rem;
	align-items: center;
	line-height: 1;
}
.chat .chat-titlebar a {
	text-decoration: none;
	font-size: 1.5rem;
	color: #282828;
}
.chat .chat-titlebar a:hover {
	color: var(--primary-color);
}
.chat .chat-titlebar button {
	background: none;
	border: none;
	outline: none;
	cursor: pointer;
	font-size: 1.5rem;
	color: #777;
}

.chat .chat-titlebar button:hover {
	color: #282828;
}

main .chat .chat-titlebar button.chat-close {
	display: none;
}

.chat .chat-messages { 
	flex-grow: 1;
	overflow: scroll;
	padding: 1rem 1rem 0;
	scroll-behavior: smooth;
}
.chat .chat-messages .chat-message {
	display: flex;
	margin-top: 0.75rem;
	gap: 0.5rem;
}
.chat .chat-messages .chat-message.hidden {
	display: none;
}
.chat .chat-messages .chat-message:first-child {
	margin-top: 0;
}
.chat .chat-messages .chat-message div {
	margin-bottom: 0;
	padding: 0.5rem 0.75rem;
	background: #e5e5e5;
	border-radius: 0.5rem;
	max-width: 90%;
	word-wrap: break-word;
}

.chat .chat-messages .chat-message div p,
.chat .chat-messages .chat-message div li,
.chat .chat-messages .chat-message div h1,
.chat .chat-messages .chat-message div h2,
.chat .chat-messages .chat-message div h3,
.chat .chat-messages .chat-message div h4 {
	margin-bottom: 1rem;
	font-size: 1rem;
}

.chat .chat-messages .chat-message div .chat-message-text > :last-child {
	margin-bottom: 0;
}

.chat .chat-messages .chat-message div ul {
	margin-left: 1rem;
}

.chat .chat-messages .chat-message > span {
	width: 20px;
	background: transparent url('../img/debatrijk-chatbot.svg?v2') center 0.4rem no-repeat;
	min-height: 30px;
}

.chat .chat-messages .chat-message > span i {
	display: none;
}

.chat .chat-messages .chat-message.media-message video {
	border-radius: 0.5rem;
}

.chat .chat-messages .chat-message.media-message video,
.chat .chat-messages .chat-message.media-message audio {
	max-width: 100%;
	max-height: 50vh;
	padding: 0.75rem;
	background: #e5e5e5;
	border-radius: 0.5rem;
}

.chat .chat-messages .chat-message.sent {
	justify-content: flex-end;
}
.chat .chat-messages .chat-message.sent div {
	background: var(--secondary-color);
	color: #fff;
}
.chat .chat-messages .chat-message div span.references {
	display: block;
	margin-top: 1rem;
	font-size: 0.75rem;
}
.chat .chat-messages .chat-message div span.references small {
	display: block;
	font-size: 0.75rem;
}

.chat .chat-messages .chat-message div span.references span.reference {
	flex-wrap: wrap;
}

.chat .chat-messages .chat-message div span.references span.reference, 
.chat .chat-messages .chat-message div span.references span.reference span.reference-file {
	display: flex;
	gap: 0 0.25rem;
	align-items: center;
}

.chat .chat-messages .chat-message div span.references span.reference a {
	text-decoration: none;
	color: var(--secondary-color);
}

.chat .chat-messages .chat-message div span.references span.reference a:hover {
	text-decoration: underline;
}

.chat .chat-messages .chat-message div span.references span.reference a.reference-media:hover {
	text-decoration: none;
	color: #282828;
}

.chat .chat-input { 
	margin: 1rem;
	border: 2px #eceef3 solid;
	border-radius: 0.5rem;
	overflow: hidden;
	display: flex;
	padding: 0.5rem;
	background: white;
	flex-shrink: 0;
}
.chat .chat-input.disabled {
	background: #eceef3;
	cursor: not-allowed;
}
.chat .chat-input input { 
	flex-grow: 1;
	background: transparent;
	width: calc(100% - 40px);
}
.chat .chat-input.disabled input {
	opacity: 0.25;
	cursor: not-allowed;
}
.chat .chat-input button { 
	background: none;
	border: none;
	outline: none;
	cursor: pointer;
	font-size: 1.5rem;
	padding: 0 0.5rem;
	color: #282828;
}
.chat .chat-input button.disabled {
	color: #ddd;
	cursor: not-allowed;
}
.chat .chat-input button:not(.disabled):hover {
	color: var(--primary-color);
}

.chat .chat-input .chat-type {
	display: flex;
	align-items: center;
	color: #282828;
	text-decoration: none;
	padding-left: 0.25rem;
	padding-right: 0.25rem;
}

.chat .chat-input:not(.disabled) .chat-type:hover {
	color: var(--primary-color);
}

.chat .chat-input.disabled .chat-type, .chat button.chat-restart.disabled {
	color: #ddd;
	cursor: not-allowed;
	pointer-events: none;
}

.chat .chat-messages .chat-message .typing {
	align-items: center;
	display: flex;
	gap: 0.25rem;
}

.chat .chat-messages .chat-message .typing .typing-dot {
	animation: typingAnimation 1.5s infinite ease-in-out;
	background-color: #282828;
	border-radius: 50%;
	height: 0.5rem;
	vertical-align: middle;
	width: 0.5rem;
	display: inline-block;
}
.chat .chat-messages .chat-message .typing .typing-dot:nth-child(1) {
	animation-delay: 200ms;
}
.chat .chat-messages .chat-message .typing .typing-dot:nth-child(2) {
	animation-delay: 300ms;
}
.chat .chat-messages .chat-message .typing .typing-dot:nth-child(3) {
	animation-delay: 400ms;
}

.chat .chat-messages .chat-message .typing:not(.thinking) .thinking-loader {
	display: none;
}
.chat .chat-messages .chat-message .typing.thinking .thinking-loader {
	width: 24px;
	height: 24px;
	border: 2px solid #666;
	border-bottom-color: transparent;
	border-radius: 50%;
	display: inline-block;
	box-sizing: border-box;
	animation: thinkingAnimation 1s linear infinite; 
}

.chat .chat-messages .chat-message .typing.thinking .typing-dot {
	display: none;
}

@media screen and (max-width: 599px) {
	body > aside.chat { 
		top: 1rem;
		left: 1rem;
		bottom: 1rem;
		right: 1rem;
		z-index: 999;
		width: auto;
		height: auto;
		max-height: 100vh;
	}
}

@media screen and (max-width: 369px) {
	.chat .chat-titlebar h2 {
		font-size: 1rem;
	}
}

@keyframes typingAnimation {
	0% {
		transform: translateY(0px);
		background-color:#282828;
	}
	28% {
		transform: translateY(-7px);
		background-color:#666;
	}
	44% {
		transform: translateY(0px);
		background-color: #aaa;
	}
}

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