/* NaturalChat public floating widget styles. Branding colours are set with CSS variables from plugin settings. */

.naturalchat-widget {
	--naturalchat-primary: #2271b1;
	--naturalchat-header-text: #ffffff;
	--naturalchat-bot-bubble: #f0f0f1;
	--naturalchat-user-bubble: #dbeafe;
	--naturalchat-border: #dcdcde;
	--naturalchat-text: #1d2327;
	--naturalchat-muted: #646970;
	font-size: 16px;
	line-height: 1.45;
}

.naturalchat-floating-widget {
	--naturalchat-widget-bottom-offset: 0px;
	bottom: calc(24px + var(--naturalchat-widget-bottom-offset));
	position: fixed;
	right: 24px;
	z-index: 99999;
}

.naturalchat-floating-widget.naturalchat-position-bottom-left {
	left: 24px;
	right: auto;
}

.naturalchat-launcher {
	align-items: center;
	background: var(--naturalchat-primary);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
	color: var(--naturalchat-header-text);
	cursor: pointer;
	display: flex;
	height: 64px;
	justify-content: center;
	padding: 0;
	width: 64px;
}

.naturalchat-launcher:hover,
.naturalchat-launcher:focus {
	filter: brightness(0.96);
	outline: 2px solid color-mix(in srgb, var(--naturalchat-primary), #ffffff 45%);
	outline-offset: 3px;
}

.naturalchat-launcher-icon,
.naturalchat-avatar {
	align-items: center;
	background: rgba(255, 255, 255, 0.18);
	border-radius: 50%;
	color: inherit;
	display: inline-flex;
	flex: 0 0 auto;
	height: 34px;
	justify-content: center;
	overflow: hidden;
	width: 34px;
}

.naturalchat-launcher-icon {
	height: 38px;
	width: 38px;
}

.naturalchat-launcher-icon img,
.naturalchat-avatar img {
	height: 100%;
	object-fit: cover;
	width: 100%;
}

.naturalchat-default-icon svg {
	fill: currentColor;
	height: 22px;
	width: 22px;
}

.naturalchat-window {
	background: #ffffff;
	border: 1px solid var(--naturalchat-border);
	border-radius: 16px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
	color: var(--naturalchat-text);
	display: flex;
	flex-direction: column;
	height: min(620px, calc(100vh - 120px));
	overflow: hidden;
	width: min(390px, calc(100vw - 32px));
}

.naturalchat-floating-widget .naturalchat-window {
	bottom: 82px;
	position: absolute;
	right: 0;
}

.naturalchat-floating-widget.naturalchat-position-bottom-left .naturalchat-window {
	left: 0;
	right: auto;
}

.naturalchat-inline-widget .naturalchat-window {
	box-shadow: none;
	height: 520px;
	max-width: 620px;
	width: 100%;
}

.naturalchat-window[hidden] {
	display: none;
}

.naturalchat-window-header {
	align-items: center;
	background: var(--naturalchat-primary);
	color: var(--naturalchat-header-text);
	display: flex;
	justify-content: space-between;
	min-height: 64px;
	padding: 14px 16px;
}

.naturalchat-window-title {
	align-items: center;
	display: flex;
	gap: 10px;
}

.naturalchat-window-title strong {
	display: block;
	font-size: 16px;
	font-weight: 700;
}

.naturalchat-window-title span:not(.naturalchat-avatar) {
	display: block;
	font-size: 12px;
	opacity: 0.9;
}

.naturalchat-window-close {
	background: transparent;
	border: 0;
	color: var(--naturalchat-header-text);
	cursor: pointer;
	font-size: 26px;
	line-height: 1;
	padding: 2px 6px;
}

.naturalchat-messages {
	background: #ffffff;
	flex: 1 1 auto;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 16px;
}

.naturalchat-message {
	display: flex;
	gap: 10px;
	margin: 0 0 12px;
	min-width: 0;
}

.naturalchat-message-user {
	justify-content: flex-end;
}

.naturalchat-message-bubble {
	border-radius: 14px;
	box-sizing: border-box;
	max-width: 82%;
	min-width: 0;
	overflow-wrap: anywhere;
	padding: 10px 12px;
	word-break: break-word;
}

.naturalchat-message-assistant .naturalchat-message-bubble {
	background: var(--naturalchat-bot-bubble);
	border-top-left-radius: 4px;
}

.naturalchat-message-user .naturalchat-message-bubble {
	background: var(--naturalchat-user-bubble);
	border-top-right-radius: 4px;
}

.naturalchat-message-bubble p {
	margin: 0 0 0.5em;
	overflow-wrap: anywhere;
	word-break: break-word;
}

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

.naturalchat-safety-note,
.naturalchat-related-links-label {
	color: var(--naturalchat-muted);
	font-size: 12px;
}

.naturalchat-related-links {
	margin-top: 8px;
}

.naturalchat-related-links-list {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;
}

.naturalchat-related-links-list li {
	margin: 0 0 4px;
}

.naturalchat-related-links-list a {
	color: var(--naturalchat-primary);
	font-weight: 600;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.naturalchat-contact-link {
	margin: 12px 0 0;
}

.naturalchat-contact-button {
	align-items: center;
	background: var(--naturalchat-primary);
	border-radius: 999px;
	box-sizing: border-box;
	color: var(--naturalchat-header-text);
	display: inline-flex;
	font-weight: 600;
	justify-content: center;
	line-height: 1.2;
	min-height: 40px;
	overflow-wrap: anywhere;
	padding: 10px 14px;
	text-align: center;
	text-decoration: none;
	width: 100%;
	word-break: break-word;
}

.naturalchat-status {
	box-sizing: border-box;
	color: var(--naturalchat-muted);
	flex: 0 0 auto;
	font-size: 12px;
	line-height: 1.35;
	min-height: 22px;
	padding: 4px 16px 6px;
}

.naturalchat-status:empty {
	min-height: 0;
	padding-bottom: 0;
	padding-top: 0;
}

.naturalchat-notice {
	background: #fff8e5;
	border-left: 4px solid #dba617;
	border-radius: 8px;
	color: var(--naturalchat-text);
	font-size: 13px;
	line-height: 1.35;
	margin: 0 0 12px;
	padding: 9px 10px;
}

.naturalchat-notice-error {
	background: #fcf0f1;
	border-left-color: #d63638;
}

.naturalchat-form {
	align-items: flex-end;
	border-top: 1px solid var(--naturalchat-border);
	display: flex;
	flex: 0 0 auto;
	gap: 8px;
	padding: 12px;
	position: relative;
	z-index: 1;
}

.naturalchat-form textarea {
	border: 1px solid var(--naturalchat-border);
	border-radius: 12px;
	box-sizing: border-box;
	flex: 1 1 auto;
	font: inherit;
	max-height: 120px;
	min-height: 44px;
	min-width: 0;
	padding: 10px 12px;
	resize: none;
}

.naturalchat-form textarea:focus {
	border-color: var(--naturalchat-primary);
	box-shadow: 0 0 0 1px var(--naturalchat-primary);
	outline: none;
}

.naturalchat-submit {
	align-items: center;
	background: var(--naturalchat-primary);
	border: 0;
	border-radius: 12px;
	color: var(--naturalchat-header-text);
	cursor: pointer;
	display: inline-flex;
	flex: 0 0 44px;
	height: 44px;
	justify-content: center;
	padding: 0;
}

.naturalchat-submit:disabled,
.naturalchat-form textarea:disabled {
	cursor: not-allowed;
	opacity: 0.65;
}

@media screen and (max-width: 480px) {
	.naturalchat-floating-widget {
		bottom: calc(16px + var(--naturalchat-widget-bottom-offset));
		right: 16px;
	}

	.naturalchat-floating-widget.naturalchat-position-bottom-left {
		left: 16px;
		right: auto;
	}

	.naturalchat-floating-widget .naturalchat-window {
		bottom: 74px;
		right: -8px;
	}

	.naturalchat-floating-widget.naturalchat-position-bottom-left .naturalchat-window {
		left: -8px;
		right: auto;
	}
}

.naturalchat-widget {
	--naturalchat-link: #2271b1;
}

.naturalchat-message-bubble,
.naturalchat-form textarea {
	color: var(--naturalchat-text);
}

.naturalchat-related-links-list a,
.naturalchat-welcome-button {
	color: var(--naturalchat-link);
	text-decoration: none;
}

.naturalchat-related-links-list a:hover,
.naturalchat-related-links-list a:focus,
.naturalchat-welcome-button:hover,
.naturalchat-welcome-button:focus {
	text-decoration: none;
}

.naturalchat-contact-button:hover,
.naturalchat-contact-button:focus {
	color: var(--naturalchat-header-text);
	filter: brightness(0.96);
	text-decoration: none;
}

.naturalchat-welcome-buttons {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 12px;
}

.naturalchat-welcome-button {
	align-items: center;
	background: var(--naturalchat-primary);
	border-radius: 999px;
	box-sizing: border-box;
	color: var(--naturalchat-header-text);
	display: inline-flex;
	font-weight: 600;
	justify-content: center;
	line-height: 1.2;
	min-height: 40px;
	padding: 10px 14px;
	text-align: center;
}

.naturalchat-welcome-button:hover,
.naturalchat-welcome-button:focus {
	color: var(--naturalchat-header-text);
	filter: brightness(0.96);
}
