.ai-chat-layout {
	margin-right: 360px;
}

.ai-chat-layout--chat-hidden {
	margin-right: 0;
}

@media only screen and (min-width: 721px) {
	.ai-chat-layout.ai-chat-layout--chat-animated {
		transition: margin-right 0.3s ease;
	}

	.ai-chat-layout--chat-animated .top-menu-background {
		transition: top 0.4s linear, right 0.3s ease;
	}

	.ai-chat-layout:not(.ai-chat-layout--chat-hidden) .top-menu-background {
		right: 360px;
	}

	.ai-chat-layout--chat-animated .ai-chat-form {
		transition: transform 0.3s ease, visibility 0s linear;
	}

	.ai-chat-layout--chat-animated .ai-chat-form[hidden] {
		display: block;
		visibility: hidden;
		pointer-events: none;
		transform: translateX(100%);
		transition: transform 0.3s ease, visibility 0s linear 0.3s;
	}
}

.ai-chat-form {
	position: fixed;
	top: 0;
	right: 0;
	z-index: 91;
	box-sizing: border-box;
	width: 360px;
	height: 100vh;
	height: 100dvh;
	padding: 12px;
	background: var(--startpack-main-surface-color, #ffffff);
	border: 0;
	border-left: 1px solid var(--startpack-main-tertiary-color, #a3a3a3);
}

.ai-chat-form[hidden] {
	display: none;
}

nav.top-menu ul.top-menu-right {
	display: inline-flex;
	align-items: center;
	width: max-content;
}

nav.top-menu ul.top-menu-right > li.top-menu-ai-chat-item {
	width: auto;
}

nav.top-menu .menu-right:not(.notauth) ul.top-menu-right > li.top-menu-ai-chat-item {
	margin-right: 18px;
}

.top-menu-ai-chat-toggle {
	width: 174px;
	height: 40px;
	padding: 0;
	overflow: hidden;
	white-space: nowrap;
	vertical-align: middle;
	background-color: transparent;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	border: 0;
	-webkit-transition: none;
	-moz-transition: none;
	-o-transition: none;
	transition: none;
	cursor: pointer;
}

.top-menu-ai-chat-toggle:hover {
	border: 0;
}

.top-menu-ai-chat-toggle:active {
	background-color: transparent;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	border: 0;
}

.top-menu-ai-chat-toggle[aria-expanded="false"] {
	background-image: url("/img/icon/svg/ask-startpack.svg#open-ai-chat");
}

.top-menu-ai-chat-toggle[aria-expanded="true"] {
	background-image: url("/img/icon/svg/ask-startpack-min.svg#close-ai-chat");
}

.top-menu-background.ai-chat-compact .top-menu-ai-chat-toggle {
	width: 40px;
}

.top-menu-background.ai-chat-compact nav.top-menu ul.top-menu-right > li.top-menu-ai-chat-item {
	padding-left: 0;
	margin-right: 0;
	margin-left: 0;
}

.top-menu-background.ai-chat-compact nav.top-menu .menu-right:not(.notauth) ul.top-menu-right > li.top-menu-ai-chat-item:not(:last-child) {
	margin-right: 18px;
}

.top-menu-background.ai-chat-compact .top-menu-ai-chat-toggle[aria-expanded="false"] {
	background-image: url("/img/icon/svg/ask-startpack-min.svg#open-ai-chat");
}

.top-menu-background.ai-chat-compact .top-menu-ai-chat-toggle[aria-expanded="true"] {
	background-image: url("/img/icon/svg/ask-startpack-min.svg#close-ai-chat");
}

.top-menu-ai-chat-toggle-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

#hidden-menu ul li > .top-menu-ai-chat-toggle {
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: auto;
	padding: 15px;
	color: #FFF;
	text-align: left;
	text-decoration: none;
	background: transparent;
	border: 0;
	border-radius: 0;
}

#hidden-menu .top-menu-ai-chat-toggle-text {
	position: static;
	width: auto;
	height: auto;
	padding: 0;
	margin: 0;
	overflow: visible;
	clip: auto;
	white-space: inherit;
	border: 0;
}

#hidden-menu ul li > .top-menu-ai-chat-toggle:hover {
	color: #FFF;
	background: rgba(255, 255, 255, 0.3);
	border: 0;
}

.ai-chat-form__body {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
}

.ai-chat-form__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 8px;
}

.ai-chat-form__title {
	color: var(--startpack-main-brand-color, #00a0ee);
	font-size: 24px;
	font-weight: 600;
	text-align: left;
}

.ai-chat-form__close {
	display: inline-flex;
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	padding: 0;
	background: transparent;
	border: 0;
	cursor: pointer;
}

.ai-chat-form__close:hover {
	border: 0;
}

.ai-chat-form__close svg {
	display: block;
}

.ai-chat-form__history,
.ai-chat-form__message {
	display: block;
	width: 100%;
}

.ai-chat-form__history {
	display: flex;
	position: relative;
	box-sizing: border-box;
	flex: 1 1 auto;
	flex-direction: column;
	height: auto;
	min-height: 0;
	padding: 8px;
	margin-bottom: 8px;
	overflow-y: auto;
	overflow-wrap: anywhere;
}

.ai-chat-form__history-welcome {
	position: absolute;
	top: 50%;
	left: 50%;
	width: calc(100% - 16px);
	color: var(--startpack-main-secondary-color);
	font-size: 24px;
	text-align: center;
	transform: translate(-50%, -50%);
}

.ai-chat-form__history-loader {
	display: block;
	flex: 0 0 auto;
	margin: auto auto 0;
}

.ai-chat-form__history-message {
	box-sizing: border-box;
	flex: 0 0 auto;
	width: fit-content;
	max-width: 85%;
	margin-bottom: 8px;
	padding: 8px;
	border-radius: 4px;
}

.ai-chat-form__history-message:last-child {
	margin-bottom: 0;
}

.ai-chat-form__history-message > :first-child {
	margin-top: 0;
}

.ai-chat-form__history-message > :last-child {
	margin-bottom: 0;
}

.ai-chat-form__history-message--assistant {
	margin-right: auto;
}

.ai-chat-form__history-message--user {
	margin-left: auto;
	background: color-mix(in srgb, var(--startpack-main-brand-color) 10%, transparent);
}

.ai-chat-form__composer {
	position: relative;
	flex: 0 0 auto;
}

.ai-chat-form__message {
	box-sizing: border-box;
	border-color: var(--startpack-main-tertiary-color, #a3a3a3);
	min-height: 80px;
	padding-right: 56px;
	resize: none;
	background: var(--startpack-main-surface-color, #ffffff);
}

.ai-chat-form__message:hover {
	border-color: var(--startpack-form-fields-border-hover-color);
}

.ai-chat-form__message:focus {
	border-color: var(--startpack-form-fields-border-focus-color);
}

.ai-chat-form__submit {
	position: absolute;
	top: 50%;
	right: 8px;
	width: 40px;
	height: 40px;
	padding: 0;
	background: transparent;
	border: 0;
	cursor: pointer;
	transform: translateY(-50%);
}

.ai-chat-form__submit:hover,
.ai-chat-form__submit:active {
	background: transparent;
	border: 0;
	box-shadow: none;
}

.ai-chat-form__submit img {
	display: block;
	width: 100%;
	height: 100%;
}

.ai-chat-form__disclaimer {
	flex: 0 0 auto;
	margin: 1em 0 1.5em;
	color: var(--startpack-main-tertiary-color, #a3a3a3);
	font-size: 12px;
	text-align: center;
}

@media only screen and (max-width: 720px) {
	.ai-chat-layout,
	.ai-chat-layout--chat-hidden {
		margin-right: 0;
	}

	.ai-chat-layout:not(.ai-chat-layout--chat-hidden) {
		height: 100vh;
		height: 100dvh;
		overflow: hidden;
	}

	.ai-chat-layout:not(.ai-chat-layout--chat-hidden) .top-menu-background.hidden {
		top: 0;
	}

	.ai-chat-form {
		top: 76px;
		width: 100%;
		height: calc(100vh - 76px);
		height: calc(100dvh - 76px);
		border-top: 1px solid var(--startpack-main-tertiary-color, #a3a3a3);
		border-left: 0;
	}
}
