.mdh-chat-widget {
	position: fixed;
	right: 1.25rem;
	bottom: 1.25rem;
	z-index: 9999;
	font-family: system-ui, -apple-system, sans-serif;
}

.mdh-chat-widget__toggle {
	width: 3.5rem;
	height: 3.5rem;
	border-radius: 50%;
	border: none;
	background: var(--wp--preset--color--navy, #1d3557);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease;
}

.mdh-chat-widget__toggle:hover {
	transform: scale(1.05);
}

.mdh-chat-widget.is-open .mdh-chat-widget__toggle {
	display: none;
}

.mdh-chat-widget__panel {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 22rem;
	max-width: calc(100vw - 2.5rem);
	height: 30rem;
	max-height: calc(100vh - 2.5rem);
	background: #fff;
	border-radius: 1rem;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	flex-direction: column;
	overflow: hidden;
}

/* Без :not([hidden]) авторський display:flex вище переважає стандартну поведінку атрибута
   hidden (author stylesheet завжди виграє в UA), тож панель лишалась видимою навіть після
   panel.hidden = true при закритті — той самий баг, що раніше знайдено й виправлено на
   .mdh-places-map__open. */
.mdh-chat-widget__panel:not([hidden]) {
	display: flex;
}

.mdh-chat-widget__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.9rem 1rem;
	background: var(--wp--preset--color--navy, #1d3557);
	color: #fff;
	font-weight: 600;
	font-size: 0.9rem;
}

.mdh-chat-widget__close {
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	font-size: 0.9rem;
}

.mdh-chat-widget__transcript {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.mdh-chat-widget__msg {
	max-width: 85%;
	padding: 0.5rem 0.75rem;
	border-radius: 0.75rem;
	font-size: 0.85rem;
	line-height: 1.4;
	white-space: pre-wrap;
	overflow-wrap: break-word;
}

.mdh-chat-widget__msg a {
	color: inherit;
	text-decoration: underline;
}

.mdh-chat-widget__msg--bot {
	align-self: flex-start;
	background: #f1f5f9;
	color: #1e293b;
}

.mdh-chat-widget__msg--user {
	align-self: flex-end;
	background: var(--wp--preset--color--navy, #1d3557);
	color: #fff;
}

.mdh-chat-widget__msg--pending {
	opacity: 0.6;
	font-style: italic;
}

.mdh-chat-widget__form {
	display: flex;
	gap: 0.5rem;
	padding: 0.75rem;
	border-top: 1px solid #e2e8f0;
}

.mdh-chat-widget__input {
	flex: 1;
	border: 1px solid #cbd5e1;
	border-radius: 0.5rem;
	padding: 0.5rem 0.75rem;
	font-size: 0.85rem;
}

.mdh-chat-widget__send {
	border: none;
	background: var(--wp--preset--color--navy, #1d3557);
	color: #fff;
	border-radius: 0.5rem;
	padding: 0.5rem 1rem;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
}

.mdh-chat-widget__send:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}
