.ai-chat-widget {
	position: fixed;
	right: 24px;
	bottom: 100px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ai-chat-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #1a1a2e;
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 12px 20px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ai-chat-bar:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.ai-chat-bar__icon {
	font-size: 16px;
	line-height: 1;
}

.ai-chat-widget.is-open .ai-chat-bar {
	display: none;
}

.ai-chat-panel {
	position: absolute;
	right: 0;
	bottom: calc(100% + 12px); /* expands upward from the bar */
	width: 340px;
	max-width: calc(100vw - 48px);
	height: 460px;
	max-height: calc(100vh - 180px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform-origin: bottom right;
	animation: ai-chat-expand 0.18s ease-out;
}

@keyframes ai-chat-expand {
	from { opacity: 0; transform: scale(0.92) translateY(12px); }
	to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.ai-chat-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: #1a1a2e;
	color: #fff;
	font-weight: 600;
	font-size: 14px;
}

.ai-chat-panel__close {
	background: none;
	border: none;
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}

.ai-chat-panel__messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f7f7fb;
}

.ai-chat-msg {
	max-width: 85%;
	padding: 9px 13px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.4;
	word-wrap: break-word;
}

.ai-chat-msg--user {
	align-self: flex-end;
	background: #1a1a2e;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.ai-chat-msg--assistant {
	align-self: flex-start;
	background: #fff;
	color: #222;
	border: 1px solid #e4e4ee;
	border-bottom-left-radius: 4px;
}

.ai-chat-msg--error {
	align-self: center;
	background: #fdecea;
	color: #a02622;
	font-size: 12.5px;
}

.ai-chat-msg--typing {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e4e4ee;
	color: #999;
	font-style: italic;
}

.ai-chat-panel__form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #eee;
	background: #fff;
}

.ai-chat-panel__form input {
	flex: 1;
	border: 1px solid #ddd;
	border-radius: 999px;
	padding: 8px 14px;
	font-size: 13.5px;
	outline: none;
}

.ai-chat-panel__form input:focus {
	border-color: #1a1a2e;
}

.ai-chat-panel__form button {
	background: #1a1a2e;
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 8px 16px;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
}

.ai-chat-panel__form button:disabled {
	opacity: 0.5;
	cursor: default;
}

@media (max-width: 480px) {
	.ai-chat-widget {
		right: 12px;
		bottom: 90px;
	}
	.ai-chat-panel {
		width: calc(100vw - 24px);
	}
}
