/* Blueky Support – khung chat mở ra (bảng chọn kênh, màn đầu, trợ lý AI, form). Tách khỏi chat.css để nút nổi và lời mời
   nạp nhanh; tệp này nạp không chặn hiển thị và chỉ cần khi người dùng mở khung (includes/chat.php, late style). */
/* Nguồn dưới câu trả lời của trợ lý AI */
.bkc .bkc-src { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid rgb(0 0 0 / .08); font-size: 13px; line-height: 1.45; color: var(--bkc-sub); }
.bkc .bkc-src span { font-weight: 600; }
.bkc .bkc-src a { color: var(--bkc-ink); text-decoration: underline; text-underline-offset: 2px; }

/* Ô nhận thư trong form gửi tin nhắn */
.bkc .bkc-optin { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 0; font-size: 14px; line-height: 1.4; color: var(--bkc-sub); cursor: pointer; }
.bkc .bkc-optin input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--bkc-accent); }

/* Thẻ nhận quà: đầu bảng chọn / màn đầu khung chat, nền nhạt màu chính. Một dòng: biểu tượng 32px · chữ (cắt …) · ›,
   cả thẻ là link (cao ≤ 64px). */
.bkc .bkc-gift {
	display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 10px 10px 10px 12px; border-radius: 16px;
	background: color-mix(in srgb, var(--bkc-accent) 10%, var(--bkc-bg)); color: var(--bkc-ink); text-decoration: none;
	border: 1px solid color-mix(in srgb, var(--bkc-accent) 18%, var(--bkc-bg)); transition: background .15s ease, transform .2s var(--bkc-ease);
}
.bkc .bkc-gift:hover { background: color-mix(in srgb, var(--bkc-accent) 15%, var(--bkc-bg)); color: var(--bkc-ink); }
.bkc .bkc-gift:active { transform: scale(.98); transition-duration: .08s; }
.bkc .bkc-gift__ic { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--bk-r); background: var(--bkc-accent); color: var(--bkc-on); }
.bkc .bkc-gift__ic svg { width: 18px; height: 18px; }
.bkc .bkc-gift .bkc-txt { flex: 1; min-width: 0; gap: 1px; }
.bkc .bkc-gift .bkc-txt strong, .bkc .bkc-card .bkc-txt strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bkc .bkc-gift .bkc-txt small { font-size: 13px; }
.bkc .bkc-gift .bkc-chev { color: var(--bkc-accent); }
.bkc .bkc-gift__btn {
	flex: none; padding: 8px 12px; border-radius: var(--bk-r-pill); background: var(--bkc-accent); color: var(--bkc-on);
	font-size: 14px; font-weight: 650; line-height: 1.2; white-space: nowrap;
}

/* ---------- Máy tính: thẻ nổi trên nút ---------- */
@media (min-width: 768px) {
	.bkc .bkc-scrim { background: transparent; }
	.bkc .bkc-sheet {
		left: auto; right: calc(var(--bkc-px) + env(safe-area-inset-right, 0px));
		bottom: calc(var(--bkc-py) + var(--bkc-s) + 16px);
		width: 380px; max-height: calc(100vh - var(--bkc-py) - var(--bkc-s) - 48px);
		padding: 20px; border-radius: 22px;
		box-shadow: 0 24px 60px -12px rgb(0 0 0 / .28), 0 0 0 1px rgb(0 0 0 / .05);
		transform-origin: 100% 100%; transform: translate3d(0, 12px, 0) scale(.95); opacity: 0;
		transition: transform .3s var(--bkc-ease), opacity .2s ease, visibility 0s linear .3s;
	}
	.bkc--left .bkc-sheet { right: auto; left: calc(var(--bkc-px) + env(safe-area-inset-left, 0px)); transform-origin: 0 100%; }
	.bkc.is-open .bkc-sheet { transform: none; opacity: 1; transition: transform .3s var(--bkc-ease), opacity .2s ease, visibility 0s; }
	.bkc.is-open .bkc-dock { opacity: 1; transform: none; pointer-events: auto; }
	.bkc .bkc-grip { display: none; }
	.bkc .bkc-head { margin-bottom: 16px; }
	.bkc .bkc-title { font-size: 18px; }
	.bkc .bkc-list { gap: 10px; }
	.bkc .bkc-item { padding: 14px; gap: 14px; border-radius: 16px; }
	.bkc .bkc-ic { width: 44px; height: 44px; }
	.bkc .bkc-ic svg { width: 24px; height: 24px; }
	.bkc .bkc-txt strong { font-size: 16px; }
	.bkc .bkc-txt small { font-size: 14px; }
	.bkc--on-mobile { display: none; }
}

/* ---------- Khung chat (chế độ "Khung chat"): màn đầu + danh sách kênh + trợ lý AI + form ----------
   Di động: bảng cao gần hết màn hình, co lên trên bàn phím ảo (--bkc-kb do chat.js đặt). Máy tính: thẻ 384px trên nút. */
.bkc--panel .bkc-sheet.bkc-panel {
	display: flex; flex-direction: column; padding: 0; overflow: hidden;
	bottom: var(--bkc-kb, 0px); height: auto; max-height: calc(min(92vh, 92dvh, 760px) - var(--bkc-kb, 0px));
}
/* Màn AI, form: cao cố định để danh sách tin nhắn / ô nhập có chỗ; màn đầu, danh sách kênh: cao theo nội dung */
.bkc--panel .bkc-sheet.bkc-panel[data-view="ai"], .bkc--panel .bkc-sheet.bkc-panel[data-view="form"] { height: calc(min(92vh, 92dvh, 760px) - var(--bkc-kb, 0px)); }
.bkc--panel .bkc-grip { margin: 8px auto 0; }
.bkc--panel .bkc-ph {
	flex: none; margin: 0; padding: 8px 10px 10px 16px; gap: 10px; justify-content: flex-start;
	border-bottom: 1px solid var(--bkc-line);
}
.bkc--panel .bkc-x { width: 36px; height: 36px; margin: 0; }
.bkc--panel .bkc-x svg { width: 20px; height: 20px; }
.bkc--panel .bkc-back { margin-left: -8px; }
.bkc .bkc-av {
	flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--bk-r); overflow: hidden;
	background: color-mix(in srgb, var(--bkc-accent) 12%, var(--bkc-bg)); color: var(--bkc-accent);
}
.bkc .bkc-av img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bkc .bkc-av svg { width: 20px; height: 20px; }
.bkc .bkc-av--ai { border-radius: 50%; }
.bkc .bkc-ph__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.bkc--panel .bkc-title { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bkc .bkc-ph__txt small { font-size: 13px; line-height: 1.3; color: var(--bkc-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bkc .bkc-v { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.bkc .bkc-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 20px; }

/* Màn đầu */
.bkc .bkc-eyebrow { margin: 4px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--bkc-sub); }
.bkc .bkc-hello {
	margin: 0 0 8px; padding: 0; font-family: inherit; font-size: 24px; font-weight: 700; line-height: 1.25;
	letter-spacing: -.015em; text-transform: none; color: var(--bkc-ink);
}
.bkc .bkc-hello::before, .bkc .bkc-hello::after { content: none; }
.bkc .bkc-intro { margin: 0 0 16px; font-size: 15px; line-height: 1.5; color: var(--bkc-sub); }
.bkc .bkc-cards { margin-top: 16px; gap: 8px; }
.bkc .bkc-gift + .bkc-cards, .bkc .bkc-quick + .bkc-cards { margin-top: 14px; }
/* Hỏi nhanh: ô hỏi ngay trên màn đầu (sang trợ lý AI, không có AI thì sang form) */
.bkc .bkc-quick {
	display: flex; align-items: center; gap: 8px; margin: 16px 0 14px; padding: 5px 5px 5px 14px;
	border: 1px solid var(--bkc-bd); border-radius: 22px; background: var(--bkc-bg);
}
.bkc .bkc-quick:focus-within { border-color: var(--bkc-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bkc-accent) 18%, transparent); }
.bkc .bkc-quick input {
	flex: 1; min-width: 0; min-height: 0; margin: 0; padding: 7px 0; border: 0; outline: 0; background: none; box-shadow: none;
	color: var(--bkc-ink); font: inherit; font-size: 16px; line-height: 1.4;
}
.bkc .bkc-card { text-align: left; gap: 12px; padding: 11px 10px 11px 12px; min-height: 0; }
.bkc .bkc-card .bkc-txt { flex: 1; gap: 1px; }
.bkc .bkc-card .bkc-txt small { font-size: 13px; }
.bkc .bkc-card .bkc-dot { flex: none; box-shadow: none; }
.bkc .bkc-card__ic { display: flex; flex: none; }
/* Bộ Lạc: link nhỏ cuối khung */
.bkc .bkc-tlink { display: flex; align-items: center; justify-content: center; gap: 2px; margin: 10px auto 0; padding: 4px 10px; font-size: 14px; font-weight: 600; color: var(--bkc-accent); }
.bkc .bkc-tlink:hover { color: var(--bkc-accent); text-decoration: underline; text-underline-offset: 3px; }
.bkc .bkc-tlink svg { width: 16px; height: 16px; }
.bkc .bkc-tlink.is-ext svg { width: 14px; height: 14px; margin-left: 2px; }
.bkc .bkc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bkc .bkc-dot {
	display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
	background: var(--bkc-c, var(--bkc-accent)); color: #fff; box-shadow: 0 0 0 2px var(--bkc-bg);
}
.bkc .bkc-dot + .bkc-dot { margin-left: -8px; }
.bkc .bkc-dot svg { width: 17px; height: 17px; }
.bkc .bkc-chev { flex: none; color: var(--bk-zinc-400); }
.bkc .bkc-chev svg { width: 18px; height: 18px; }

/* Trợ lý AI */
.bkc .bkc-msgs { display: flex; flex-direction: column; gap: 14px; padding: 16px 16px 12px; }
.bkc .bkc-m { max-width: 88%; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.bkc .bkc-m__t { padding: 10px 14px; }
.bkc .bkc-m p { margin: 0 0 8px; }
.bkc .bkc-m ul { margin: 0 0 8px; padding: 0 0 0 20px; list-style: disc; }
.bkc .bkc-m li { margin: 0 0 3px; padding: 0; }
.bkc .bkc-m li::before { content: none; }
.bkc .bkc-m__t > :last-child { margin-bottom: 0; }
.bkc .bkc-m a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--bkc-accent) 60%, transparent); text-underline-offset: 2px; font-weight: 600; }
.bkc .bkc-m.is-me { align-self: flex-end; }
.bkc .bkc-m.is-me .bkc-m__t { background: var(--bkc-accent); color: var(--bkc-on, #fff); border-radius: 18px 18px 4px 18px; }
.bkc .bkc-m.is-bot { align-self: flex-start; }
.bkc .bkc-m.is-bot .bkc-m__t { background: var(--bkc-bg2); color: var(--bkc-ink); border-radius: 4px 18px 18px 18px; }
.bkc .bkc-m.is-err .bkc-m__t { background: #fef2f2; color: #991b1b; }
.bkc .bkc-m__who { display: flex; align-items: center; gap: 6px; margin: 0 0 4px 2px; font-size: 12px; font-weight: 600; color: var(--bkc-sub); }
.bkc .bkc-m__who b { padding: 0 4px; border: 1px solid var(--bkc-bd); border-radius: 4px; font-size: 10px; font-weight: 600; line-height: 1.5; }
.bkc .bkc-m.is-wait { padding: 14px 16px; border-radius: 4px 18px 18px 18px; background: var(--bkc-bg2); }
.bkc .bkc-dots { display: flex; gap: 4px; }
.bkc .bkc-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--bk-zinc-400); animation: bkc-dot 1.2s ease-in-out infinite; }
.bkc .bkc-dots i:nth-child(2) { animation-delay: .15s; }
.bkc .bkc-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bkc-dot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.bkc .bkc-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -4px; }
.bkc .bkc-chip {
	padding: 8px 14px; border: 1px solid color-mix(in srgb, var(--bkc-accent) 35%, var(--bkc-bg)); border-radius: var(--bk-r-pill);
	background: var(--bkc-bg); color: var(--bkc-accent); font-size: 14px; font-weight: 600; transition: background .15s ease;
}
.bkc .bkc-chip:hover { background: color-mix(in srgb, var(--bkc-accent) 8%, var(--bkc-bg)); }

.bkc .bkc-compose {
	flex: none; display: flex; align-items: flex-end; gap: 8px; margin: 4px 12px 0; padding: 5px 5px 5px 14px;
	border: 1px solid var(--bkc-bd); border-radius: 22px; background: var(--bkc-bg); transition: border-color .15s ease, box-shadow .15s ease;
}
.bkc .bkc-compose:focus-within { border-color: var(--bkc-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bkc-accent) 18%, transparent); }
.bkc .bkc-compose textarea {
	flex: 1; width: auto; min-width: 0; min-height: 0; max-height: 140px; margin: 0; padding: 7px 0; border: 0; outline: 0;
	background: none; box-shadow: none; resize: none; overflow: hidden; color: var(--bkc-ink); font: inherit; font-size: 16px; line-height: 1.4;
}
.bkc .bkc-send { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--bkc-accent); color: var(--bkc-on, #fff); }
.bkc .bkc-send svg { width: 18px; height: 18px; }
.bkc .bkc-fine { flex: none; margin: 8px 16px calc(10px + env(safe-area-inset-bottom, 0px)); font-size: 12px; line-height: 1.4; color: var(--bkc-mute); text-align: center; }

/* Gửi tin nhắn */
.bkc .bkc-form { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0; }
.bkc .bkc-f { display: block; margin: 0 0 14px; }
.bkc .bkc-f > span { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--bkc-ink); }
.bkc .bkc-f input, .bkc .bkc-f textarea {
	display: block; width: 100%; min-height: 46px; margin: 0; padding: 10px 12px; border: 1px solid var(--bkc-bd); border-radius: 12px;
	background: var(--bkc-bg); box-shadow: none; color: var(--bkc-ink); font: inherit; font-size: 16px; line-height: 1.4; outline: 0;
}
.bkc .bkc-f textarea { resize: vertical; min-height: 110px; }
.bkc .bkc-f input:focus, .bkc .bkc-f textarea:focus { border-color: var(--bkc-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bkc-accent) 18%, transparent); }
.bkc .bkc-f [aria-invalid="true"] { border-color: #dc2626; }
.bkc .bkc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.bkc .bkc-err { margin: 0; font-size: 14px; color: #b91c1c; }
.bkc .bkc-attach {
	display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 6px 6px 6px 12px; border-radius: 12px;
	background: color-mix(in srgb, var(--bkc-accent) 8%, var(--bkc-bg)); color: var(--bkc-ink); font-size: 14px;
}
.bkc .bkc-attach > svg { width: 16px; height: 16px; color: var(--bkc-accent); }
.bkc .bkc-attach span { flex: 1; }
.bkc .bkc-attach .bkc-x { width: 30px; height: 30px; }
.bkc .bkc-attach .bkc-x svg { width: 16px; height: 16px; }
.bkc .bkc-foot { flex: none; padding: 12px 16px 0; border-top: 1px solid var(--bkc-line); }
.bkc .bkc-foot .bkc-fine { margin: 8px 0 calc(10px + env(safe-area-inset-bottom, 0px)); }
.bkc .bkc-btn {
	display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: 0 20px; border-radius: var(--bk-r-pill);
	background: var(--bkc-accent); color: var(--bkc-on, #fff); font-size: 16px; font-weight: 650; transition: filter .15s ease, opacity .15s ease;
}
.bkc .bkc-btn:hover { filter: brightness(1.06); color: var(--bkc-on, #fff); }
.bkc .bkc-btn.is-busy { opacity: .6; pointer-events: none; }
.bkc .bkc-done { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 48px; text-align: center; }
.bkc .bkc-done p { margin: 0; max-width: 300px; font-size: 16px; line-height: 1.5; color: var(--bkc-ink); }
.bkc .bkc-done .bkc-btn { width: auto; }
.bkc .bkc-done__ic { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: color-mix(in srgb, var(--bkc-accent) 12%, var(--bkc-bg)); color: var(--bkc-accent); }
.bkc .bkc-done__ic svg { width: 30px; height: 30px; }
.bkc .bkc-link { color: var(--bkc-sub); font-size: 14px; text-decoration: underline; text-underline-offset: 2px; }

@media (min-width: 768px) {
	.bkc--panel .bkc-sheet.bkc-panel {
		width: 384px; bottom: calc(var(--bkc-py) + var(--bkc-s) + 16px);
		height: auto; max-height: min(640px, calc(100vh - var(--bkc-py) - var(--bkc-s) - 48px));
	}
	.bkc--panel .bkc-sheet.bkc-panel[data-view="ai"], .bkc--panel .bkc-sheet.bkc-panel[data-view="form"] { height: min(640px, calc(100vh - var(--bkc-py) - var(--bkc-s) - 48px)); }
	.bkc--panel .bkc-ph { padding: 12px 10px 12px 16px; }
	.bkc .bkc-hello { font-size: 22px; }
	.bkc .bkc-card { padding: 11px 10px 11px 12px; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
	.bkc .bkc-dots i { animation: none; opacity: .6; }
}
/* Màn cảm ứng: nút đóng/quay lại/đoạn chat mới, nút gửi, nút bỏ tệp và gợi ý nhanh đạt 44px (biểu tượng giữ cỡ cũ) */
@media (hover: none) and (pointer: coarse) {
	.bkc--panel .bkc-x, .bkc .bkc-send { width: 44px; height: 44px; }
	.bkc .bkc-chip { min-height: 44px; }
	.bkc .bkc-attach .bkc-x { width: 44px; height: 44px; }
	.bkc .bkc-inv__x { width: 44px; height: 44px; }
	.bkc .bkc-tlink, .bkc .bkc-link { min-height: 44px; }
	.bkc .bkc-optin { min-height: 44px; align-items: center; }
}
