/* Blueky Support – nút Live chat nổi + bảng chọn kênh (includes/chat.php).
   Di động (≤767px): bảng trượt từ đáy, kéo xuống để đóng. Máy tính: thẻ nổi ngay trên nút.
   Chỉ animate transform / opacity (GPU). Nền sáng, theo chế độ tối của theme (Blocksy data-color-mode, .dark…) qua biến --bkc-bg….
   Reset kiểu nút của theme bằng bộ chọn 2 lớp. */

.bkc {
	--bkc-px: var(--bkc-x, 24px);
	--bkc-py: var(--bkc-y, 24px);
	--bkc-s: 60px;
	--bkc-ease: cubic-bezier(.32, .72, 0, 1);
	--bkc-ink: var(--bk-zinc-900);
	--bkc-sub: var(--bk-zinc-600);
	--bkc-line: var(--bk-zinc-200);
	--bkc-bg: #fff;
	--bkc-bg2: var(--bk-zinc-100);
	--bkc-hover: var(--bk-zinc-50);
	--bkc-bd: var(--bk-zinc-300);
	--bkc-xc: var(--bk-zinc-700);
	--bkc-mute: var(--bk-zinc-500);
}
/* Chế độ tối của theme: Blocksy (data-color-mode), theme dùng .dark / data-theme="dark" */
:root[data-color-mode*="dark"] .bkc, :root.dark .bkc, :root[data-theme="dark"] .bkc, body.dark-mode .bkc, body.is-dark-theme .bkc {
	--bkc-ink: var(--bk-zinc-100);
	--bkc-sub: var(--bk-zinc-400);
	--bkc-line: #2e2e33;
	--bkc-bg: #1c1c1f;
	--bkc-bg2: #2a2a2f;
	--bkc-hover: #242428;
	--bkc-bd: var(--bk-zinc-700);
	--bkc-xc: var(--bk-zinc-300);
	--bkc-mute: var(--bk-zinc-400);
	color-scheme: dark;
}
.bkc, .bkc * { box-sizing: border-box; }
.bkc :where(button, a) {
	-webkit-appearance: none; appearance: none; margin: 0; padding: 0; border: 0; background: none; color: inherit;
	font: inherit; letter-spacing: normal; text-transform: none; text-decoration: none; line-height: 1.3;
	cursor: pointer; -webkit-tap-highlight-color: transparent; box-shadow: none; min-height: 0; min-width: 0;
}
.bkc svg { display: block; flex: none; }
.bkc :focus { outline: none; }
.bkc :focus-visible { outline: var(--bk-ring-w) solid var(--bkc-accent); outline-offset: 3px; }
.bkc .bkc-sheet:focus-visible { outline: none; }

/* ---------- Nút nổi ---------- */
.bkc .bkc-dock {
	position: fixed; z-index: 99990;
	bottom: calc(var(--bkc-py) + env(safe-area-inset-bottom, 0px));
	right: calc(var(--bkc-px) + env(safe-area-inset-right, 0px));
	display: flex; flex-direction: row-reverse; align-items: center; gap: 12px;
	animation: bkc-in .5s var(--bkc-ease) .25s both;
	transition: opacity .25s ease, transform .35s var(--bkc-ease);
}
.bkc--left .bkc-dock { right: auto; left: calc(var(--bkc-px) + env(safe-area-inset-left, 0px)); flex-direction: row; }
@keyframes bkc-in { from { opacity: 0; transform: translateY(16px) scale(.9); } }

.bkc .bkc-main {
	position: relative; display: grid; place-items: center;
	width: var(--bkc-s); height: var(--bkc-s); border-radius: 50%;
	background: var(--bkc-c); color: var(--bkc-on, #fff);
	box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--bkc-c) 60%, transparent), 0 2px 6px rgb(0 0 0 / .14);
	transition: transform .25s var(--bkc-ease), box-shadow .25s ease;
}
.bkc .bkc-main svg { width: 32px; height: 32px; }
.bkc .bkc-main--chat svg { width: 28px; height: 28px; }
/* Nút có chữ (cài đặt "Chữ trên nút"): biểu tượng + chữ, dạng viên thuốc. */
.bkc .bkc-main--text { display: inline-flex; align-items: center; gap: 10px; width: auto; max-width: calc(100vw - 2 * var(--bkc-px) - 64px); padding: 0 22px 0 18px; border-radius: var(--bk-r-pill); }
.bkc .bkc-main--text svg { width: 24px; height: 24px; }
.bkc .bkc-main__t { font-size: 16px; font-weight: 650; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Một vòng sóng nhẹ hai lần lúc vừa hiện, gợi ý "bấm vào đây". */
.bkc .bkc-main::after {
	content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--bkc-c);
	z-index: -1; opacity: 0; animation: bkc-ring 1.6s ease-out 1.4s 2;
}
@keyframes bkc-ring { 0% { opacity: .45; transform: scale(1); } 100% { opacity: 0; transform: scale(1.55); } }
/* Hiệu ứng nút (Nút › Hiệu ứng): pulse = sóng lúc vừa hiện và 3 nhịp khi lời mời hiện; shake = rung nhẹ khi lời mời hiện; none. */
.bkc--fx-none .bkc-main::after, .bkc--fx-shake .bkc-main::after { animation: none; }
.bkc--fx-pulse.is-nudge .bkc-main::after { animation: bkc-ring 1.6s ease-out 0s 3; }
.bkc--fx-shake.is-nudge .bkc-main { animation: bkc-shake .9s ease-in-out 2; }
@keyframes bkc-shake { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-12deg); } 30% { transform: rotate(10deg); } 45% { transform: rotate(-7deg); } 60% { transform: rotate(5deg); } 75% { transform: rotate(-2deg); } }

.bkc .bkc-more {
	display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
	background: var(--bkc-bg); color: var(--bkc-ink);
	box-shadow: 0 6px 18px -4px rgb(0 0 0 / .18), 0 0 0 1px rgb(0 0 0 / .05);
	transition: transform .25s var(--bkc-ease), box-shadow .25s ease;
}
.bkc .bkc-more svg { width: 24px; height: 24px; }
.bkc .bkc-more--label { width: auto; height: 44px; padding: 0 18px; border-radius: var(--bk-r-pill); font-size: 15px; font-weight: 600; white-space: nowrap; }

@media (hover: hover) {
	.bkc .bkc-main:hover, .bkc .bkc-more:hover { transform: translateY(-2px); }
}
.bkc .bkc-main:active, .bkc .bkc-more:active { transform: scale(.92); transition-duration: .1s; }

/* Đang gõ vào ô nhập (bàn phím ảo mở) trên di động: tạm ẩn nút để không che ô nhập. */
.bkc.is-typing .bkc-dock { opacity: 0; transform: translateY(12px) scale(.9); pointer-events: none; }

/* ---------- Nền mờ ---------- */
.bkc .bkc-scrim {
	position: fixed; inset: 0; z-index: 99991; background: rgb(9 9 11 / .48);
	opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s linear .35s;
	-webkit-tap-highlight-color: transparent;
}
.bkc.is-open .bkc-scrim { opacity: 1; visibility: visible; transition: opacity .35s ease, visibility 0s; }

/* ---------- Bảng chọn: di động = bảng trượt từ đáy ---------- */
.bkc .bkc-sheet {
	position: fixed; z-index: 99992; left: 0; right: 0; bottom: 0;
	max-height: min(85vh, 85dvh); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
	padding: 8px 20px calc(24px + env(safe-area-inset-bottom, 0px));
	padding-left: calc(20px + env(safe-area-inset-left, 0px)); padding-right: calc(20px + env(safe-area-inset-right, 0px));
	background: var(--bkc-bg); color: var(--bkc-ink); border-radius: 24px 24px 0 0;
	box-shadow: 0 -12px 40px rgb(0 0 0 / .18);
	font-size: 16px; line-height: 1.4; text-align: left;
	transform: translate3d(0, calc(100% + 32px), 0); visibility: hidden;
	transition: transform .45s var(--bkc-ease), visibility 0s linear .45s;
}
.bkc.is-open .bkc-sheet {
	transform: translate3d(0, var(--bkc-drag, 0px), 0); visibility: visible;
	transition: transform .45s var(--bkc-ease), visibility 0s;
}
.bkc.is-drag .bkc-sheet { transition: none; }
.bkc.is-open .bkc-dock { opacity: 0; transform: scale(.85); pointer-events: none; }

.bkc .bkc-grip { width: 40px; height: 5px; margin: 2px auto 14px; border-radius: 3px; background: var(--bkc-bd); }
.bkc .bkc-grip, .bkc .bkc-head { touch-action: none; }
.bkc .bkc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.bkc .bkc-title {
	margin: 0; padding: 0; font-family: inherit; font-size: 20px; font-weight: 700; line-height: 1.3;
	letter-spacing: -.01em; text-transform: none; color: var(--bkc-ink);
}
.bkc .bkc-title::before, .bkc .bkc-title::after { content: none; }
.bkc .bkc-x {
	display: grid; place-items: center; flex: none; width: 40px; height: 40px; margin-right: -8px; border-radius: 50%;
	color: var(--bkc-xc); transition: background .15s ease;
}
.bkc .bkc-x svg { width: 22px; height: 22px; }
.bkc .bkc-x:hover { background: var(--bkc-bg2); }

.bkc .bkc-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.bkc .bkc-list li { margin: 0; padding: 0; list-style: none; min-width: 0; }
.bkc .bkc-list li::before { content: none; }
.bkc .bkc-item {
	display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px;
	border: 1px solid var(--bkc-line); border-radius: 18px; background: var(--bkc-bg); color: var(--bkc-ink);
	transition: background .15s ease, border-color .15s ease, transform .2s var(--bkc-ease);
}
.bkc .bkc-item:hover { background: var(--bkc-hover); color: var(--bkc-ink); }
.bkc .bkc-item:active { transform: scale(.98); transition-duration: .08s; }
.bkc .bkc-item.is-hl { background: color-mix(in srgb, var(--bkc-c) 11%, var(--bkc-bg)); border-color: color-mix(in srgb, var(--bkc-c) 16%, var(--bkc-bg)); }
.bkc .bkc-item.is-hl:hover { background: color-mix(in srgb, var(--bkc-c) 16%, var(--bkc-bg)); }
.bkc .bkc-ic {
	display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 50%;
	background: var(--bkc-c); color: #fff;
}
.bkc .bkc-ic svg { width: 26px; height: 26px; }
.bkc .bkc-item.is-soft .bkc-ic { background: color-mix(in srgb, var(--bkc-c) 12%, var(--bkc-bg)); color: var(--bkc-c); }
.bkc .bkc-item.is-soft .bkc-ic svg { width: 22px; height: 22px; }
.bkc .bkc-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.bkc .bkc-txt strong { font-size: 17px; font-weight: 650; line-height: 1.3; color: var(--bkc-ink); }
.bkc .bkc-txt small { font-size: 15px; line-height: 1.35; color: var(--bkc-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lời mời đúng lúc: bong bóng chữ ngay trên nút */
.bkc .bkc-inv {
	position: fixed; z-index: 99990; display: flex; align-items: flex-start; gap: 2px; max-width: min(280px, calc(100vw - 2 * var(--bkc-px)));
	bottom: calc(var(--bkc-py) + var(--bkc-s) + 14px + env(safe-area-inset-bottom, 0px));
	right: calc(var(--bkc-px) + env(safe-area-inset-right, 0px));
	padding: 4px 4px 4px 14px; border-radius: 18px 18px 6px 18px; background: var(--bkc-bg); color: var(--bkc-ink);
	box-shadow: 0 12px 32px -8px rgb(0 0 0 / .25), 0 0 0 1px rgb(0 0 0 / .05);
	opacity: 0; transform: translateY(8px) scale(.96); transform-origin: 100% 100%;
	transition: opacity .25s ease, transform .35s var(--bkc-ease);
}
.bkc--left .bkc-inv { right: auto; left: calc(var(--bkc-px) + env(safe-area-inset-left, 0px)); border-radius: 18px 18px 18px 6px; transform-origin: 0 100%; padding: 4px 4px 4px 14px; }
.bkc .bkc-inv.is-in { opacity: 1; transform: none; }
.bkc .bkc-inv[hidden] { display: none; }
.bkc .bkc-inv__t { flex: 1; padding: 8px 0; text-align: left; font-size: 15px; font-weight: 550; line-height: 1.35; color: var(--bkc-ink); }
.bkc .bkc-inv__x { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; color: var(--bkc-sub); }
.bkc .bkc-inv__x:hover { background: var(--bkc-bg2); }
.bkc .bkc-inv__x svg { width: 16px; height: 16px; }
.bkc.is-open .bkc-inv, .bkc.is-typing .bkc-inv { display: none; }
/* Màn cảm ứng: nút chữ và nút đóng của lời mời đủ vùng chạm 44 px. */
@media (pointer: coarse) {
	.bkc .bkc-inv__t { display: flex; align-items: center; min-height: 44px; padding-top: 0; padding-bottom: 0; }
	.bkc .bkc-inv__x { width: 44px; height: 44px; }
}

/* ---------- Di động ---------- */
@media (max-width: 767px) {
	.bkc { --bkc-px: var(--bkc-xm, 16px); --bkc-py: var(--bkc-ym, 16px); --bkc-s: 56px; }
	.bkc .bkc-main svg { width: 30px; height: 30px; }
	.bkc .bkc-main--text { padding: 0 18px 0 15px; gap: 8px; }
	.bkc .bkc-main--text svg { width: 22px; height: 22px; }
	.bkc .bkc-main__t { font-size: 15px; }
	.bkc .bkc-more { width: 44px; height: 44px; }
	.bkc .bkc-more--label { width: auto; height: 44px; padding: 0 16px; font-size: 14px; }
	.bkc--on-desktop { display: none; }
}
html.bkc-lock, html.bkc-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
	.bkc *, .bkc .bkc-dock { animation: none !important; transition-duration: .01ms !important; }
}
@media print { .bkc { display: none !important; } }

.bkc [hidden] { display: none !important; }
