/**
 * 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;
	/* Khoảng cách dọc giữa các nút như margin-bottom: 18px của mẫu */
	gap: 18px;
	width: max-content;
	max-width: min(320px, calc(100vw - 5% - 24px));
	pointer-events: none;
}

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

.fcb-widget--right {
	right: calc(5% + env(safe-area-inset-right, 0px));
	left: auto;
	align-items: flex-end;
}

.fcb-widget--left {
	left: calc(5% + env(safe-area-inset-left, 0px));
	right: auto;
	align-items: flex-start;
}

.fcb-btn {
	position: relative;
	display: flex;
	box-sizing: border-box;
	width: unset;
	min-width: fit-content;
	max-width: none !important;
	height: 50px;
	min-height: 50px;
	margin: 0;
	margin-left: 0;
	margin-right: 0;
	padding: 0 20px;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.22);
	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-align: center;
	text-decoration: none;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	outline: none !important;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
	-webkit-user-select: none;
	visibility: visible;
	background-size: cover;
	background-image: none;
	background-repeat: no-repeat;
	background-position: center center;
	/* Trạng thái thường: nổi khối (highlight + bóng đậm) */
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.32) inset,
		0 3px 0 rgba(0, 0, 0, 0.12),
		0 6px 14px rgba(0, 0, 0, 0.22),
		0 14px 36px rgba(0, 0, 0, 0.28);
	transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, background-color 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 !important;
}

.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(-2px) scale(1.02);
	filter: brightness(1.03);
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.38) inset,
		0 4px 0 rgba(0, 0, 0, 0.1),
		0 10px 22px rgba(0, 0, 0, 0.28),
		0 22px 48px rgba(0, 0, 0, 0.32);
	outline: none !important;
}

.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;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.32) inset,
		0 3px 0 rgba(0, 0, 0, 0.12),
		0 6px 14px rgba(0, 0, 0, 0.22),
		0 14px 36px rgba(0, 0, 0, 0.28),
		0 10px 32px rgba(0, 123, 255, 0.42);
}

.fcb-btn--zalo:hover,
.fcb-btn--zalo:focus-visible {
	background: #0069d9;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.38) inset,
		0 4px 0 rgba(0, 0, 0, 0.1),
		0 10px 22px rgba(0, 0, 0, 0.28),
		0 22px 48px rgba(0, 0, 0, 0.32),
		0 14px 40px rgba(0, 123, 255, 0.5);
}

.fcb-btn--phone {
	background: #3a7d8c;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.28) inset,
		0 3px 0 rgba(0, 0, 0, 0.12),
		0 6px 14px rgba(0, 0, 0, 0.22),
		0 14px 36px rgba(0, 0, 0, 0.28),
		0 10px 32px rgba(58, 125, 140, 0.45);
}

.fcb-btn--phone:hover,
.fcb-btn--phone:focus-visible {
	background: #2f6a76;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.35) inset,
		0 4px 0 rgba(0, 0, 0, 0.1),
		0 10px 22px rgba(0, 0, 0, 0.28),
		0 22px 48px rgba(0, 0, 0, 0.32),
		0 14px 40px rgba(58, 125, 140, 0.52);
}

.fcb-btn--facebook {
	background: #0084ff;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.3) inset,
		0 3px 0 rgba(0, 0, 0, 0.12),
		0 6px 14px rgba(0, 0, 0, 0.22),
		0 14px 36px rgba(0, 0, 0, 0.28),
		0 10px 32px rgba(0, 132, 255, 0.4);
}

.fcb-btn--facebook:hover,
.fcb-btn--facebook:focus-visible {
	background: #0073e6;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.36) inset,
		0 4px 0 rgba(0, 0, 0, 0.1),
		0 10px 22px rgba(0, 0, 0, 0.28),
		0 22px 48px rgba(0, 0, 0, 0.32),
		0 14px 40px rgba(0, 132, 255, 0.48);
}

.fcb-btn--sms {
	background: #ff5722;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.28) inset,
		0 3px 0 rgba(0, 0, 0, 0.14),
		0 6px 14px rgba(0, 0, 0, 0.22),
		0 14px 36px rgba(0, 0, 0, 0.28),
		0 10px 32px rgba(255, 87, 34, 0.42);
}

.fcb-btn--sms:hover,
.fcb-btn--sms:focus-visible {
	background: #f4511e;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.34) inset,
		0 4px 0 rgba(0, 0, 0, 0.12),
		0 10px 22px rgba(0, 0, 0, 0.28),
		0 22px 48px rgba(0, 0, 0, 0.32),
		0 14px 40px rgba(255, 87, 34, 0.52);
}

/* 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: 50px;
	min-width: 50px;
	max-width: 50px !important;
	height: 50px;
	min-height: 50px;
	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 (mẫu: max-width none) */
.fcb-btn--with-text {
	width: max-content;
	max-width: none !important;
	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 - 5% - 140px));
	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 - 5% - 16px));
		gap: 16px;
	}

	.fcb-btn {
		min-height: 46px;
		height: 46px;
		font-size: 12px;
		border-radius: 10px;
		padding: 0 16px;
	}

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

	.fcb-btn__text {
		font-size: 12px;
		max-width: min(200px, calc(100vw - 5% - 100px));
	}
}
