/**
 * UMS Chat widget. Uses the launcher color as a CSS variable set inline
 * by ums-chat.php so an admin's color choice needs no extra stylesheet.
 */
.umschat {
	--umschat-color: #0ea5e9;
	position: fixed;
	/* Sit above a cookie-consent bar when the theme publishes its height (UMS Super Theme sets --ust-cookie-h). */
	bottom: calc(var(--ust-cookie-h, 0px) + var(--ust-bottomnav-h, 0px) + 20px);
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.umschat.is-right { right: 20px; }
.umschat.is-left { left: 20px; }

.umschat__launcher {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	border: none;
	background: var(--umschat-color);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0,0,0,.22);
}
.umschat__launcher:hover { filter: brightness(1.05); }

.umschat__panel {
	position: absolute;
	bottom: 72px;
	width: 320px;
	max-width: calc(100vw - 40px);
	max-height: 70vh;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 20px 60px rgba(0,0,0,.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
/* The widget shows/hides its parts with the hidden attribute; the display:flex rules
   here would otherwise beat it (panel stuck open after Close, an empty thread and a
   second message box showing beside the welcome form). */
.umschat [hidden] { display: none !important; }
.umschat.is-right .umschat__panel { right: 0; }
.umschat.is-left .umschat__panel { left: 0; }

.umschat__header {
	background: var(--umschat-color);
	color: #fff;
	padding: 12px 14px;
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.umschat__close {
	background: none;
	border: none;
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}

.umschat__body {
	flex: 1;
	overflow-y: auto;
	padding: 12px 14px;
	min-height: 120px;
}

.umschat__welcome {
	margin: 0 0 10px;
	color: #444;
	font-size: 13px;
}

.umschat__input {
	width: 100%;
	box-sizing: border-box;
	margin-bottom: 8px;
	padding: 8px 10px;
	border: 1px solid #ddd;
	border-radius: 8px;
	font-size: 13px;
}
.umschat__textarea { resize: vertical; min-height: 60px; }
.umschat__hp { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }

.umschat__send {
	background: var(--umschat-color);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 8px 14px;
	cursor: pointer;
	font-size: 13px;
}

.umschat__thread {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.umschat__msg {
	max-width: 85%;
	padding: 8px 11px;
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.4;
	white-space: pre-wrap;
	word-break: break-word;
}
.umschat__msg.is-visitor {
	align-self: flex-end;
	background: var(--umschat-color);
	color: #fff;
	border-bottom-right-radius: 3px;
}
.umschat__msg.is-agent {
	align-self: flex-start;
	background: #f0f1f4;
	color: #222;
	border-bottom-left-radius: 3px;
}
.umschat__msg.is-ai {
	align-self: flex-start;
	background: #eef6ff;
	color: #1c3a5e;
	border: 1px dashed #b7d7f5;
	border-bottom-left-radius: 3px;
}

.umschat__footer {
	display: flex;
	gap: 6px;
	padding: 10px 12px;
	border-top: 1px solid #eee;
}
.umschat__footer .umschat__textarea {
	min-height: 36px;
	margin-bottom: 0;
}

.umschat__notice {
	padding: 6px 12px;
	margin: 0;
	font-size: 12px;
	color: #b3261e;
}

@media (max-width: 480px) {
	.umschat.is-right { right: 12px; }
	.umschat.is-left { left: 12px; }
	.umschat__panel { width: calc(100vw - 24px); }
}
