/**
 * Floating Bar Online — frontend bar only.
 * Pill buttons: đồng kích thước, bo góc, icon + chữ căn giữa (tham chiếu UI hiện đại).
 */

.fcb-widget {
	position: fixed;
	z-index: 99998;
	bottom: var(--fcb-bottom, 24px);
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	width: max-content;
	max-width: min(320px, calc(100vw - 32px));
	pointer-events: none;
}

.fcb-widget > a {
	pointer-events: auto;
	align-self: center;
}

.fcb-widget--right {
	right: 16px;
	left: auto;
	align-items: flex-end;
}

.fcb-widget--left {
	left: 16px;
	right: auto;
	align-items: flex-start;
}

.fcb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: max-content;
	max-width: 100%;
	min-height: 44px;
	height: 44px;
	padding: 0 14px;
	border-radius: 14px;
	color: #fff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: -0.01em;
	text-decoration: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.fcb-btn:link,
.fcb-btn:visited,
.fcb-btn:hover,
.fcb-btn:active,
.fcb-btn:focus {
	color: #fff;
	text-decoration: none;
	outline: none;
}

.fcb-btn__inner {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: auto;
	max-width: 100%;
	min-height: 100%;
	pointer-events: none;
}

.fcb-btn:hover,
.fcb-btn:focus-visible {
	transform: translateY(-1px) scale(1.01);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.26);
	outline: none;
}

.fcb-btn__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	line-height: 0;
	pointer-events: none;
}

.fcb-btn__icon svg {
	display: block;
}

/* Zalo (remote SVG), Messenger (Bootstrap Icons SVG) */
.fcb-btn__icon .fcb-channel-icon--zalo,
.fcb-btn__icon .fcb-channel-icon--messenger {
	display: block;
	width: 20px;
	height: 20px;
	object-fit: contain;
	flex-shrink: 0;
}

.fcb-btn--facebook .fcb-channel-icon--messenger {
	filter: brightness(0) invert(1);
}

/* Font Awesome: phone \f095, SMS \f4ad */
.fcb-channel-icon--fa {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: inherit;
	font-style: normal;
	font-variant: normal;
	line-height: 1;
	font-size: 18px;
	-webkit-font-smoothing: antialiased;
}

.fcb-channel-icon--fa.fcb-channel-icon--phone::before,
.fcb-channel-icon--fa.fcb-channel-icon--sms::before {
	font-family: "Font Awesome 6 Free";
	font-weight: 900;
	display: inline-block;
}

.fcb-channel-icon--fa.fcb-channel-icon--phone::before {
	content: "\f095";
}

.fcb-channel-icon--fa.fcb-channel-icon--sms::before {
	content: "\f4ad";
}

.fcb-btn--zalo {
	background: #007bff;
}

.fcb-btn--zalo:hover,
.fcb-btn--zalo:focus-visible {
	background: #0069d9;
}

.fcb-btn--phone {
	background: #3a7d8c;
}

.fcb-btn--phone:hover,
.fcb-btn--phone:focus-visible {
	background: #2f6a76;
}

.fcb-btn--facebook {
	background: #0084ff;
}

.fcb-btn--facebook:hover,
.fcb-btn--facebook:focus-visible {
	background: #0073e6;
}

.fcb-btn--sms {
	background: #ff5722;
}

.fcb-btn--sms:hover,
.fcb-btn--sms:focus-visible {
	background: #f4511e;
}

/* Chỉ icon (không chữ): nút vuông bo góc, cùng chiều cao */
.fcb-btn:not(.fcb-btn--with-text) {
	width: 44px;
	min-width: 44px;
	max-width: 44px;
	height: 44px;
	padding: 0;
	align-self: center;
}

.fcb-btn:not(.fcb-btn--with-text) .fcb-btn__inner {
	gap: 0;
	width: auto;
}

.fcb-btn:not(.fcb-btn--with-text) .fcb-btn__icon {
	width: 24px;
	height: 24px;
}

.fcb-btn:not(.fcb-btn--with-text) .fcb-btn__icon .fcb-channel-icon--zalo,
.fcb-btn:not(.fcb-btn--with-text) .fcb-btn__icon .fcb-channel-icon--messenger {
	width: 22px;
	height: 22px;
}

.fcb-btn:not(.fcb-btn--with-text) .fcb-channel-icon--fa {
	font-size: 20px;
}

/* Có chữ: rộng theo nội dung, không kéo full cột */
.fcb-btn--with-text {
	width: max-content;
	max-width: min(320px, calc(100vw - 48px));
	min-width: 0;
}

.fcb-btn--with-text .fcb-btn__icon .fcb-channel-icon--zalo,
.fcb-btn--with-text .fcb-btn__icon .fcb-channel-icon--messenger {
	width: 20px;
	height: 20px;
}

.fcb-btn--with-text .fcb-btn__icon .fcb-channel-icon--fa {
	font-size: 17px !important;
}

.fcb-btn__icon img {
	pointer-events: none;
}

.fcb-btn__text {
	font-size: 13px;
	font-weight: 500;
	letter-spacing: -0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: min(240px, calc(100vw - 120px));
	pointer-events: none;
	color: inherit;
	text-decoration: none;
	cursor: inherit;
	user-select: none;
	-webkit-user-select: none;
}

.fcb-btn--with-text .fcb-btn__icon svg {
	width: 18px;
	height: 18px;
}

.fcb-live-test {
	position: fixed;
	z-index: 99999;
	left: 12px;
	bottom: 12px;
	max-width: 280px;
	max-height: 160px;
	overflow-y: auto;
	padding: 8px 10px;
	font-size: 11px;
	line-height: 1.35;
	font-family: ui-monospace, monospace;
	color: #fff;
	background: rgba(17, 17, 17, 0.92);
	border-radius: 6px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
	pointer-events: none;
}

.fcb-live-test div {
	margin-top: 4px;
	word-break: break-word;
}

.fcb-live-test div:first-child {
	margin-top: 0;
}

/* Logged-in WP admin bar */
body.admin-bar .fcb-widget {
	bottom: calc(var(--fcb-bottom, 24px) + 32px);
}

@media screen and (max-width: 782px) {
	body.admin-bar .fcb-widget {
		bottom: calc(var(--fcb-bottom, 24px) + 46px);
	}
}

@media (max-width: 480px) {
	.fcb-widget {
		max-width: min(300px, calc(100vw - 24px));
	}

	.fcb-btn {
		min-height: 42px;
		height: 42px;
		font-size: 12px;
		border-radius: 13px;
		padding: 0 12px;
	}

	.fcb-btn:not(.fcb-btn--with-text) {
		width: 42px;
		min-width: 42px;
		max-width: 42px;
		height: 42px;
	}

	.fcb-btn__text {
		font-size: 12px;
		max-width: 170px;
	}

	.fcb-widget--right {
		right: 12px;
	}

	.fcb-widget--left {
		left: 12px;
	}
}
