/* =====================================================================
   VFGistics — Responsive chatbot widget (Phase 27)
   Additive styles only. Nothing here changes the existing layout; the
   widget floats above the existing scroll-to-top control on the right.
   ===================================================================== */

.vf-chat {
	position: fixed;
	right: calc(15px + env(safe-area-inset-right, 0px));
	bottom: calc(80px + env(safe-area-inset-bottom, 0px)); /* sits above .scroll-to-top (bottom:15px + 50px) */
	z-index: 1050;
	font-family: "Open Sans", Arial, Helvetica, sans-serif;
}

/* Launcher button -------------------------------------------------- */
.vf-chat-launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #eb0028;
	color: #ffffff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
	transition: transform 200ms ease, background 200ms ease;
}

.vf-chat-launcher:hover,
.vf-chat-launcher:focus-visible {
	background: #c40022;
	transform: translateY(-2px);
	outline: none;
}

.vf-chat-launcher:focus-visible {
	box-shadow: 0 0 0 3px rgba(235, 0, 40, 0.4), 0 6px 18px rgba(0, 0, 0, 0.25);
}

.vf-chat-launcher-close {
	display: none;
}

.vf-chat.is-open .vf-chat-launcher-icon {
	display: none;
}

.vf-chat.is-open .vf-chat-launcher-close {
	display: inline-block;
}

.vf-chat-launcher-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: #ffb400;
	color: #1a1a1a;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

/* Panel ------------------------------------------------------------ */
.vf-chat-panel {
	position: absolute;
	right: 0;
	bottom: calc(100% + 12px);
	display: flex;
	flex-direction: column;
	width: 360px;
	max-width: calc(100vw - 24px);
	height: 520px;
	max-height: calc(100vh - 160px);
	max-height: calc(100dvh - 160px);
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	transform-origin: bottom right;
	transition: opacity 180ms ease, transform 180ms ease;
}

.vf-chat-panel.is-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
}

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

.vf-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 14px 16px;
	background: #0a0a0a;
	color: #ffffff;
}

.vf-chat-header-info {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.vf-chat-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #eb0028;
	color: #ffffff;
	font-size: 17px;
	flex: 0 0 auto;
}

.vf-chat-header-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.vf-chat-title {
	font-size: 15px;
	line-height: 1.2;
}

.vf-chat-status {
	font-size: 12px;
	color: #b9f6ca;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.vf-chat-status.is-human {
	color: #ffd54f;
}

.vf-chat-status.is-closed {
	color: #bdbdbd;
}

.vf-chat-close {
	padding: 4px 8px;
	border: 0;
	background: transparent;
	color: #ffffff;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.85;
	flex: 0 0 auto;
}

.vf-chat-close:hover,
.vf-chat-close:focus-visible {
	opacity: 1;
	outline: none;
}

/* Messages --------------------------------------------------------- */
.vf-chat-messages {
	flex: 1 1 auto;
	padding: 14px;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: #f6f7f9;
}

.vf-chat-row {
	display: flex;
	margin-bottom: 10px;
}

.vf-chat-row.is-visitor {
	justify-content: flex-end;
}

.vf-chat-row.is-bot,
.vf-chat-row.is-admin {
	justify-content: flex-start;
}

.vf-chat-bubble {
	max-width: 82%;
	padding: 9px 12px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.45;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	white-space: pre-wrap;
}

.vf-chat-row.is-visitor .vf-chat-bubble {
	background: #eb0028;
	color: #ffffff;
	border-bottom-right-radius: 3px;
}

.vf-chat-row.is-bot .vf-chat-bubble {
	background: #ffffff;
	color: #2b2b2b;
	border: 1px solid #e4e6eb;
	border-bottom-left-radius: 3px;
}

.vf-chat-row.is-admin .vf-chat-bubble {
	background: #0a0a0a;
	color: #ffffff;
	border-bottom-left-radius: 3px;
}

.vf-chat-meta {
	display: block;
	margin-top: 4px;
	font-size: 10px;
	opacity: 0.65;
}

/* Inline lifecycle status pill (agent connected / chat closed) */
.vf-chat-system {
	display: table;
	max-width: 90%;
	margin: 6px auto 10px;
	padding: 5px 12px;
	border-radius: 12px;
	background: #eceff3;
	color: #555555;
	font-size: 12px;
	text-align: center;
}

/* Quick replies ---------------------------------------------------- */
.vf-chat-quick {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 8px 12px 0;
	background: #ffffff;
	border-top: 1px solid #eef0f3;
}

.vf-chat-chip {
	padding: 6px 12px;
	border: 1px solid #eb0028;
	border-radius: 16px;
	background: #ffffff;
	color: #eb0028;
	font-size: 12px;
	line-height: 1.2;
	cursor: pointer;
	transition: background 150ms ease, color 150ms ease;
}

.vf-chat-chip:hover,
.vf-chat-chip:focus-visible {
	background: #eb0028;
	color: #ffffff;
	outline: none;
}

/* Composer --------------------------------------------------------- */
.vf-chat-form {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px;
	background: #ffffff;
}

.vf-chat-form input[type="text"] {
	flex: 1 1 auto;
	min-width: 0;
	height: 42px;
	padding: 0 14px;
	border: 1px solid #d8dbe0;
	border-radius: 21px;
	background: #ffffff;
	color: #2b2b2b;
	font-size: 14px;
}

.vf-chat-form input[type="text"]:focus {
	border-color: #eb0028;
	outline: none;
	box-shadow: 0 0 0 2px rgba(235, 0, 40, 0.15);
}

.vf-chat-send {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 50%;
	background: #eb0028;
	color: #ffffff;
	font-size: 15px;
	cursor: pointer;
	flex: 0 0 auto;
	transition: background 150ms ease;
}

.vf-chat-send:hover,
.vf-chat-send:focus-visible {
	background: #c40022;
	outline: none;
}

.vf-chat-send[disabled] {
	opacity: 0.6;
	cursor: default;
}

.vf-chat-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.vf-chat-notice {
	padding: 8px 12px;
	background: #fff4f4;
	color: #b00020;
	font-size: 12px;
	border-top: 1px solid #f3d6d6;
}

.vf-chat-notice[hidden] {
	display: none;
}

/* Small / narrow viewports ---------------------------------------- */
@media (max-width: 480px) {
	.vf-chat {
		right: calc(10px + env(safe-area-inset-right, 0px));
		bottom: calc(74px + env(safe-area-inset-bottom, 0px));
	}

	.vf-chat-panel {
		position: fixed;
		right: calc(8px + env(safe-area-inset-right, 0px));
		left: calc(8px + env(safe-area-inset-left, 0px));
		bottom: calc(74px + env(safe-area-inset-bottom, 0px));
		width: auto;
		max-width: none;
		height: auto;
		max-height: calc(100vh - 96px);
		max-height: calc(100dvh - 96px);
		top: 64px;
		transform-origin: bottom center;
	}

	.vf-chat-bubble {
		max-width: 88%;
	}
}

/* Respect reduced-motion preferences while keeping the widget usable */
@media (prefers-reduced-motion: reduce) {
	.vf-chat-launcher,
	.vf-chat-panel {
		transition: none;
	}
}
