/* Marketplace floating chat (CHAT-3). Footer-mounted. z-index below auth (10030). */

.fg-mp-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.fg-mp-chat-contact {
	box-sizing: border-box;
	flex: 1 1 auto;
	min-width: min-content;
	min-height: 46px;
	height: 46px;
	margin: 0;
	padding: 9px 14px;
	border: 1px solid #fdba74;
	border-radius: 12px;
	background: #ffffff;
	color: #c2410c;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
	cursor: pointer;
	appearance: none;
	white-space: nowrap;
}

body.single-product .single-product-purchase-card .account-width__buy .fg-mp-chat-contact {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 46px;
	min-height: 46px;
	max-height: 46px;
}

@media (min-width: 641px) {
	body.single-product .single-product-purchase-card .account-width__buy:has(> .fg-mp-chat-contact) > .buy-now-button.single-product-buy-now.button__buy,
	body.single-product .single-product-purchase-card .account-width__buy:has(> .fg-mp-chat-contact) > .single-product-buy-now.button__buy:is(:disabled, .is-disabled):not(.buy-now-button),
	body.single-product .single-product-purchase-card .account-width__buy:has(> .fg-mp-chat-contact) > .fg-mp-chat-contact {
		flex: 1 1 0 !important;
		min-width: 0;
		max-width: none;
	}
}

.fg-mp-chat-contact:hover,
.fg-mp-chat-contact:focus-visible {
	background: #fff7ed;
	border-color: #ff7a00;
	outline: none;
}

.fg-mp-chat-contact:disabled,
.fg-mp-chat-contact[aria-disabled="true"],
.fg-mp-chat-contact.is-disabled {
	opacity: 0.55;
	cursor: not-allowed;
	background: #f8fafc;
	border-color: #e2e8f0;
	color: #94a3b8;
}

.fg-mp-chat-contact:disabled:hover,
.fg-mp-chat-contact.is-disabled:hover {
	background: #f8fafc;
	border-color: #e2e8f0;
}

.fg-mp-chat-float {
	--fg-mp-floating-chat-right-offset: 100px;
	position: fixed;
	right: var(--fg-mp-floating-chat-right-offset);
	bottom: 20px;
	z-index: 10020;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	width: 370px;
	max-width: calc(100vw - var(--fg-mp-floating-chat-right-offset) - 16px);
	height: 560px;
	max-height: min(560px, calc(100dvh - 40px));
	overflow: hidden;
	border: 1px solid #eef0f4;
	border-radius: 16px;
	background: #ffffff;
	box-shadow: 0 12px 40px rgba(17, 24, 39, 0.16);
}

html.fg-search-open .fg-mp-chat-float,
body.fg-search-open .fg-mp-chat-float,
body.search-open .fg-mp-chat-float,
html.fg-payment-modal-open .fg-mp-chat-float,
body.fg-payment-modal-open .fg-mp-chat-float,
html.remodal-is-locked .fg-mp-chat-float,
html.fg-news-modal-open .fg-mp-chat-float,
body.fg-news-modal-open .fg-mp-chat-float {
	z-index: 1100;
}

.fg-mp-chat-float[hidden] {
	display: none !important;
}

.fg-mp-chat-float__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	flex: 0 0 auto;
	padding: 10px 12px;
	border-bottom: 1px solid #eef0f4;
	background: #ffffff;
}

.fg-mp-chat-float__peer {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	flex: 1 1 auto;
}

.fg-mp-chat-float__avatar {
	box-sizing: border-box;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--fg-mp-avatar-fallback-bg, #fff4e8);
	border: 1px solid var(--fg-mp-avatar-fallback-border, #fed7aa);
	flex: 0 0 auto;
}

.fg-mp-chat-float__avatar.fg-mp-level-tier,
.fg-mp-chat-msg__avatar.fg-mp-level-tier {
	border: 2px solid var(--fg-level-accent, #94a3b8);
}

.fg-mp-chat-float__avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fg-mp-chat-float__avatar span {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: var(--fg-mp-avatar-fallback-fg, #ff7a00);
	font-size: 15px;
	font-weight: 700;
}

.fg-mp-chat-float__id {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	flex-wrap: nowrap;
	gap: 6px;
	min-width: 0;
	flex: 1 1 auto;
}

.fg-mp-chat-float__handle {
	margin: 0;
	min-width: 0;
	flex: 0 1 auto;
	color: #111827;
	font-size: 15px;
	font-weight: 700;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fg-mp-chat-float__handle a,
.fg-mp-chat-float__handle a:link,
.fg-mp-chat-float__handle a:visited,
.fg-mp-chat-float__handle a:active {
	color: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	text-decoration: none;
	cursor: pointer;
}

.fg-mp-chat-float__handle a:hover,
.fg-mp-chat-float__handle a:focus-visible {
	color: #c2410c;
}

.fg-mp-chat-float__level {
	flex: 0 0 auto;
	line-height: 0;
	overflow: visible;
}

/* Public Profile card CSS sizes every .fg-mp-profile-level__badge to 80px.
   Restore shared --xs on the floating header without touching the profile cards. */
body.fg-mp-seller-profile .fg-mp-chat-float .fg-mp-profile-level__badge--xs {
	width: 20px;
	height: 20px;
}

body.fg-mp-seller-profile .fg-mp-chat-float .fg-mp-profile-level__badge--xs .fg-mp-profile-level__number {
	padding: 0 1px;
	font-size: clamp(8px, 2vw, 10px);
	letter-spacing: -0.05em;
}

body.fg-mp-seller-profile .fg-mp-chat-float .fg-mp-profile-level__badge--xs .fg-mp-profile-level__diamond {
	filter: drop-shadow(0 0 3px var(--fg-level-glow));
}

@media (max-width: 480px) {
	body.fg-mp-seller-profile .fg-mp-chat-float .fg-mp-profile-level__badge--xs {
		width: 18px;
		height: 18px;
	}

	body.fg-mp-seller-profile .fg-mp-chat-float .fg-mp-profile-level__badge--xs .fg-mp-profile-level__number {
		font-size: clamp(7px, 2.4vw, 9px);
	}
}

.fg-mp-chat-float__actions {
	display: flex;
	gap: 4px;
	flex: 0 0 auto;
}

.fg-mp-chat-float__icon {
	box-sizing: border-box;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: #4b5563;
	cursor: pointer;
	appearance: none;
}

.fg-mp-chat-float__icon:hover,
.fg-mp-chat-float__icon:focus-visible {
	background: #fff7ed;
	color: #c2410c;
	outline: none;
}

.fg-mp-chat-float__unread {
	position: absolute;
	top: -2px;
	left: 28px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 999px;
	background: #ea580c;
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

.fg-mp-chat-float__unread[hidden] {
	display: none !important;
}

.fg-mp-chat-float.is-minimized {
	height: auto;
	max-height: none;
	width: min(320px, calc(100vw - var(--fg-mp-floating-chat-right-offset) - 24px));
	cursor: pointer;
}

.fg-mp-chat-float.is-minimized .fg-mp-chat-float__status,
.fg-mp-chat-float.is-minimized .fg-mp-chat-float__older,
.fg-mp-chat-float.is-minimized .fg-mp-chat-float__messages,
.fg-mp-chat-float.is-minimized .fg-mp-chat-float__jump,
.fg-mp-chat-float.is-minimized .fg-mp-chat-float__composer,
.fg-mp-chat-float.is-minimized .fg-mp-chat-float__error,
.fg-mp-chat-float.is-minimized [data-fg-mp-float-minimize] {
	display: none !important;
}

.fg-mp-chat-float.is-minimized .fg-mp-chat-float__head {
	border-bottom: 0;
}

.fg-mp-chat-float__status[hidden],
.fg-mp-chat-float__older[hidden],
[data-fg-mp-float-older][hidden],
.fg-mp-chat-float__jump[hidden],
.fg-mp-chat-float__composer[hidden],
.fg-mp-chat-float__error[hidden] {
	display: none !important;
}

.fg-mp-chat-float__status {
	margin: 0;
	padding: 12px 14px;
	color: #6b7280;
	font-size: 13px;
	font-weight: 600;
}

.fg-mp-chat-float__older,
.fg-mp-chat-float__jump {
	box-sizing: border-box;
	margin: 8px 12px;
	padding: 6px 10px;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	background: #ffffff;
	color: #374151;
	font-family: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	appearance: none;
}

.fg-mp-chat-float__older {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 7px 12px;
	line-height: 1.35;
	text-align: center;
}

.fg-mp-chat-float__jump {
	align-self: center;
}

.fg-mp-chat-float__messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 12px 12px 16px;
	background: #f9fafb;
}

.fg-mp-chat-float__messages.is-empty {
	display: flex;
	align-items: center;
	justify-content: center;
}

.fg-mp-chat-empty {
	margin: 0;
	padding: 0 12px;
	max-width: 22em;
	color: #9ca3af;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.45;
	text-align: center;
	border: 0;
	background: none;
	box-shadow: none;
}

.fg-mp-chat-msg {
	display: flex;
	margin: 0 0 10px;
}

.fg-mp-chat-msg--me {
	justify-content: flex-end;
}

.fg-mp-chat-msg--peer {
	justify-content: flex-start;
	align-items: flex-end;
	gap: 8px;
}

.fg-mp-chat-msg__avatar {
	box-sizing: border-box;
	flex: 0 0 32px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--fg-mp-avatar-fallback-bg, #fff4e8);
	border: 1px solid var(--fg-mp-avatar-fallback-border, #fed7aa);
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	color: inherit;
	flex-shrink: 0;
}

a.fg-mp-chat-msg__avatar {
	cursor: pointer;
}

.fg-mp-chat-msg__avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fg-mp-chat-msg__avatar span {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: var(--fg-mp-avatar-fallback-fg, #ff7a00);
	font-size: 13px;
	font-weight: 700;
}

.fg-mp-chat-msg--grouped .fg-mp-chat-msg__avatar {
	visibility: hidden;
	pointer-events: none;
}

.fg-mp-chat-bubble {
	box-sizing: border-box;
	max-width: 78%;
	min-width: 0;
	padding: 8px 12px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.45;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.fg-mp-chat-msg--peer:not(.fg-mp-chat-msg--image) .fg-mp-chat-bubble {
	max-width: min(78%, calc(100% - 40px));
}

.fg-mp-chat-msg--me .fg-mp-chat-bubble {
	background: #ffedd5;
	color: #111827;
	border-bottom-right-radius: 4px;
}

.fg-mp-chat-msg--peer .fg-mp-chat-bubble {
	background: #ffffff;
	border: 1px solid #eef0f4;
	color: #111827;
	border-bottom-left-radius: 4px;
}

.fg-mp-chat-msg--staff {
	justify-content: center;
}

.fg-mp-chat-msg--staff .fg-mp-chat-bubble {
	background: #eef2ff;
	border: 1px solid #c7d2fe;
	color: #1e1b4b;
	border-radius: 14px;
}

.fg-mp-chat-msg__staff-label {
	display: block;
	margin-bottom: 4px;
	color: #4338ca;
	font-size: 11px;
	font-weight: 700;
}

.fg-mp-chat-msg__time {
	display: block;
	margin-top: 4px;
	color: #9ca3af;
	font-size: 11px;
	font-weight: 700;
}

.fg-mp-chat-purchase {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 8px auto 14px;
	padding: 12px;
	border: 1px solid #eef0f4;
	border-radius: 12px;
	background: #ffffff;
}

.fg-mp-chat-purchase__head {
	margin: 0 0 8px;
	color: #111827;
	font-size: 13px;
	font-weight: 700;
}

.fg-mp-chat-purchase__body {
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr);
	gap: 8px;
}

.fg-mp-chat-purchase__thumb {
	width: 48px;
	height: 48px;
	border-radius: 8px;
	overflow: hidden;
	background: #f3f4f6;
	border: 1px solid #e5e7eb;
}

.fg-mp-chat-float__avatar > picture,
.fg-mp-chat-purchase__thumb > picture,
.fg-mp-chat-product__thumb > picture {
	display: contents;
}

.fg-mp-chat-purchase__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fg-mp-chat-purchase__name {
	margin: 0 0 4px;
	color: #111827;
	font-size: 13px;
	font-weight: 700;
}

.fg-mp-chat-purchase__meta {
	margin: 0;
	color: #6b7280;
	font-size: 11px;
	line-height: 1.4;
}

.fg-mp-chat-float__composer {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0;
	flex: 0 0 auto;
	padding: 10px 12px 16px;
	border-top: 1px solid #eef0f4;
	background: #ffffff;
}

.fg-mp-chat-float__input {
	box-sizing: border-box;
	flex: 1 1 auto;
	min-height: 44px;
	max-height: 96px;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	background: #ffffff;
	color: #111827;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	resize: none;
}

.fg-mp-chat-float__input:focus {
	border-color: #fdba74;
	outline: 2px solid rgba(255, 122, 0, 0.25);
}

.fg-mp-chat-float__send {
	box-sizing: border-box;
	flex: 0 0 auto;
	min-height: 44px;
	padding: 10px 14px;
	border: 0;
	border-radius: 12px;
	background: #ff7a00;
	color: #ffffff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	appearance: none;
}

.fg-mp-chat-float__send:hover,
.fg-mp-chat-float__send:focus-visible {
	background: #e86e00;
	outline: none;
}

.fg-mp-chat-float__send:disabled {
	opacity: 0.65;
	cursor: wait;
}

.fg-mp-chat-float__error {
	box-sizing: border-box;
	flex: 0 0 auto;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 10px 14px 16px;
	color: #b91c1c;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.45;
	text-align: center;
	white-space: normal;
	overflow-wrap: anywhere;
	word-break: break-word;
}

@media (max-width: 767px) {
	.fg-mp-chat-contact {
		white-space: normal;
		height: auto;
		min-height: 46px;
	}

	.fg-mp-chat-float {
		right: 0;
		bottom: 0;
		left: 0;
		top: 0;
		width: 100%;
		max-width: none;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
		border: 0;
	}

	.fg-mp-chat-float.is-minimized {
		top: auto;
		left: auto;
		right: 16px;
		bottom: 88px;
		width: min(320px, calc(100vw - 32px));
		max-width: calc(100vw - 32px);
		height: auto;
		max-height: none;
		border-radius: 16px;
		border: 1px solid #eef0f4;
	}

	html.fg-mp-chat-floating-mobile-open,
	body.fg-mp-chat-floating-mobile-open {
		overflow: hidden;
	}
}

@media (min-width: 768px) {
	.fg-mp-chat-float {
		right: var(--fg-mp-floating-chat-right-offset);
		bottom: 20px;
	}
}
