/* ==========================================================================
   PremiumKey — component riêng (lưới nhà cung cấp, trang nhà cung cấp, tra cứu
   đơn, key đã giao) + chế độ tối. Nạp sau style.css, trước theme.css (bảng màu,
   header/footer, trang chủ — xem layouts/main.php).
   ========================================================================== */

:root {
	--pk-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
	--pk-shadow: 0 10px 30px -12px rgba(15, 23, 42, .18);
	--pk-success: #16a34a;
	--pk-danger: #dc2626;
	--pk-warning: #d97706;
}

/* ----- Chế độ tối (biến màu ở theme.css) ----- */
[data-theme="dark"] body { background: var(--pk-bg); color: var(--pk-ink); }
[data-theme="dark"] .card, [data-theme="dark"] .dropdown-menu, [data-theme="dark"] .modal-content, [data-theme="dark"] .accordion-item,
[data-theme="dark"] .list-group-item { background: var(--pk-surface); color: var(--pk-ink); border-color: var(--pk-border); }
[data-theme="dark"] .text-muted { color: var(--pk-muted) !important; }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select { background-color: var(--pk-surface-2); border-color: var(--pk-border); color: var(--pk-ink); }
[data-theme="dark"] .bg-white, [data-theme="dark"] .bg-light { background: var(--pk-surface) !important; }
[data-theme="dark"] .table { --bs-table-bg: transparent; color: var(--pk-ink); }
[data-theme="dark"] .trust-strip { background: var(--pk-surface); border-color: var(--pk-border); }

.pk-theme-toggle .pk-theme-icon-light { display: none; }
[data-theme="dark"] .pk-theme-toggle .pk-theme-icon-dark { display: none; }
[data-theme="dark"] .pk-theme-toggle .pk-theme-icon-light { display: inline-block; }

/* ----- Chung ----- */
.pk-gradient-text { background: var(--pk-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pk-section { padding: 56px 0; }
.pk-section-alt { background: var(--pk-surface-2); }
.pk-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.pk-section-title { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); font-weight: 800; letter-spacing: -.02em; margin: 0; }
.pk-section-subtitle { color: var(--pk-muted); margin: 6px 0 0; }
.pk-block-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 6px; }
.pk-link-arrow { font-weight: 700; color: var(--pk-primary); white-space: nowrap; }
.pk-link-arrow:hover { color: var(--pk-primary-dark); }
.pk-chip { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
	background: var(--pk-surface); border: 1px solid var(--pk-border); color: var(--pk-ink); transition: border-color .15s, color .15s; }
.pk-chip:hover { border-color: var(--pk-primary); color: var(--pk-primary); }
.pk-empty { text-align: center; padding: 56px 16px; color: var(--pk-muted); background: var(--pk-surface); border: 1px dashed var(--pk-border); border-radius: var(--radius-lg); }
.pk-empty i { font-size: 2.2rem; display: block; margin-bottom: 8px; }
.pk-stars { color: #f59e0b; font-weight: 700; white-space: nowrap; }

/* Logo nhà cung cấp (partials/supplier-logo.php) */
.pk-logo { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
	background: var(--logo-color, var(--pk-primary)); color: #fff; font-weight: 800; letter-spacing: .02em; border-radius: 12px;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.pk-logo.has-image { background: #fff; box-shadow: inset 0 0 0 1px var(--pk-border); }
.pk-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.pk-logo-sm { width: 28px; height: 28px; font-size: 10.5px; border-radius: 8px; }
.pk-logo-md { width: 40px; height: 40px; font-size: 13px; border-radius: 10px; }
.pk-logo-lg { width: 56px; height: 56px; font-size: 17px; border-radius: 14px; }
.pk-logo-xl { width: 84px; height: 84px; font-size: 26px; border-radius: 20px; }

.pk-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #fff; vertical-align: middle; }
.pk-badge-hot { background: #ef4444; }
.pk-badge-sale { background: #f59e0b; }
.pk-badge-new { background: #10b981; }
.pk-badge-best_value { background: var(--pk-gradient); }

/* ----- Header bổ sung ----- */
.brand-logo { background: var(--pk-gradient) !important; }
.pk-nav-track { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--pk-primary); padding: 8px 12px; border-radius: 999px; }
.pk-nav-track:hover { background: var(--pk-primary-light); }
.pk-mega-menu { padding: 12px; min-width: min(720px, 92vw); border-radius: var(--radius-lg); border: 1px solid var(--pk-border); box-shadow: var(--pk-shadow); }
.pk-mega-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.pk-mega-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--pk-ink); }
.pk-mega-item:hover { background: var(--pk-primary-light); color: var(--pk-ink); }
.pk-mega-name { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-mega-price { font-size: 12px; color: var(--pk-muted); font-weight: 600; }
.pk-mega-all { display: block; text-align: center; margin-top: 8px; padding: 8px; border-top: 1px solid var(--pk-border); font-weight: 700; color: var(--pk-primary); }
@media (max-width: 991.98px) {
	.pk-mega-menu { min-width: 0; box-shadow: none; }
	.pk-mega-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tìm kiếm có gợi ý (premiumgo.js) */
.pk-search { position: relative; }
.pk-search-results { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; inset-inline-end: 0; z-index: 1060; background: var(--pk-surface); border: 1px solid var(--pk-border);
	border-radius: 14px; box-shadow: var(--pk-shadow); padding: 6px; max-height: 420px; overflow-y: auto; }
.pk-search-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--pk-ink); }
.pk-search-item:hover, .pk-search-item.is-active { background: var(--pk-primary-light); color: var(--pk-ink); }
.pk-search-item-name { font-weight: 600; flex: 1; }
.pk-search-item-price { font-size: 12.5px; color: var(--pk-muted); font-weight: 600; }
.pk-search-empty { padding: 12px; color: var(--pk-muted); font-size: 14px; text-align: center; }
.pk-search-all { display: block; text-align: center; padding: 8px; font-size: 13px; font-weight: 700; color: var(--pk-primary); border-top: 1px solid var(--pk-border); margin-top: 4px; }

/* ----- Lưới nhà cung cấp ----- */
.pk-supplier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.pk-supplier-card { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 14px 18px;
	background: var(--pk-surface); border: 1px solid var(--pk-border); border-radius: 18px; color: var(--pk-ink); box-shadow: var(--pk-shadow-sm);
	transition: transform .18s, box-shadow .18s, border-color .18s; }
.pk-supplier-card:hover { transform: translateY(-3px); box-shadow: var(--pk-shadow); border-color: var(--logo-color, var(--pk-primary)); color: var(--pk-ink); }
.pk-supplier-card .pk-badge { position: absolute; top: 10px; inset-inline-end: 10px; }
.pk-supplier-card .pk-logo { margin-bottom: 6px; }
.pk-supplier-name { font-weight: 800; font-size: 1rem; }
.pk-supplier-meta { font-size: 12.5px; color: var(--pk-muted); }
.pk-supplier-price { margin-top: 4px; font-weight: 800; color: var(--pk-primary); }
.pk-supplier-price small { font-weight: 600; color: var(--pk-muted); font-size: 12px; }

/* ----- Top sản phẩm ----- */
.pk-tabs { display: inline-flex; padding: 4px; background: var(--pk-surface); border: 1px solid var(--pk-border); border-radius: 999px; }
.pk-tab { border: 0; background: transparent; padding: 6px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--pk-muted); }
.pk-tab.is-active { background: var(--pk-primary); color: #fff; }
.pk-top-list { display: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pk-top-list.is-active { display: grid; }
@media (max-width: 767.98px) { .pk-top-list.is-active { grid-template-columns: 1fr; } }
.pk-top-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--pk-surface); border: 1px solid var(--pk-border);
	border-radius: 14px; color: var(--pk-ink); transition: border-color .15s, box-shadow .15s; }
.pk-top-item:hover { border-color: var(--pk-primary); box-shadow: var(--pk-shadow-sm); color: var(--pk-ink); }
.pk-top-rank { width: 24px; text-align: center; font-weight: 800; color: var(--pk-muted); }
.pk-top-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pk-top-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-top-plan { font-size: 13px; color: var(--pk-muted); }
.pk-top-meta { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; color: var(--pk-muted); }
.pk-top-price { font-weight: 800; color: var(--pk-primary); min-width: 72px; text-align: end; }

/* ----- FAQ / CTA trang chủ ----- */
.pk-faq .accordion-item { border: 1px solid var(--pk-border); border-radius: 14px !important; overflow: hidden; margin-bottom: 10px; background: var(--pk-surface); }
.pk-faq .accordion-button { font-weight: 700; background: var(--pk-surface); color: var(--pk-ink); box-shadow: none; }
.pk-faq .accordion-button:not(.collapsed) { color: var(--pk-primary); }
.pk-faq .accordion-body { color: var(--pk-muted); }

/* ----- Trang danh sách / tiêu đề trang ----- */
.pk-page-head { padding: 28px 0 8px; }
.pk-page-title { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.2rem); font-weight: 800; letter-spacing: -.02em; }
.pk-page-subtitle { color: var(--pk-muted); }
.pk-breadcrumb { font-size: 13px; margin-bottom: 12px; }
.pk-breadcrumb a { color: var(--pk-muted); }
.pk-inline-search { display: flex; align-items: center; gap: 8px; background: var(--pk-surface); border: 1px solid var(--pk-border); border-radius: 12px; padding-block: 6px 6px; padding-inline: 12px 6px; min-width: min(360px, 100%); }
.pk-inline-search input { border: 0; outline: 0; background: transparent; flex: 1; color: var(--pk-ink); min-width: 0; }

/* ----- Trang nhà cung cấp ----- */
.pk-supplier-hero { padding: 28px 0 20px; background: linear-gradient(180deg, color-mix(in srgb, var(--logo-color) 12%, transparent), transparent); }
.pk-supplier-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.pk-supplier-facts { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--pk-muted); }
.pk-supplier-facts a { color: var(--pk-muted); }
.pk-supplier-facts a:hover { color: var(--pk-primary); }

.pk-package { background: var(--pk-surface); border: 1px solid var(--pk-border); border-radius: 18px; padding: 20px; margin-bottom: 18px; box-shadow: var(--pk-shadow-sm); }
.pk-package-name { font-size: 1.15rem; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pk-package-desc { color: var(--pk-muted); margin: 6px 0 0; font-size: 14px; }
.pk-features { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; }
.pk-features i { color: var(--pk-success); }
.pk-plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.pk-plan { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 12px 12px; border: 2px solid var(--pk-border); border-radius: 14px;
	background: var(--pk-surface); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pk-plan:hover { border-color: color-mix(in srgb, var(--pk-primary) 50%, var(--pk-border)); transform: translateY(-1px); }
.pk-plan input { position: absolute; opacity: 0; pointer-events: none; }
.pk-plan:has(input:checked) { border-color: var(--pk-primary); box-shadow: 0 0 0 4px var(--pk-primary-light); }
.pk-plan:has(input:checked)::after { content: "\F26E"; font-family: "bootstrap-icons"; position: absolute; top: 8px; inset-inline-end: 10px; color: var(--pk-primary); font-size: 1.1rem; }
.pk-plan.is-disabled { opacity: .55; cursor: not-allowed; }
.pk-plan-badge { position: absolute; top: -10px; inset-inline-start: 10px; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; color: #fff; }
.pk-plan-duration { font-weight: 800; font-size: 1.05rem; }
.pk-plan-specs { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--pk-muted); min-height: 20px; }
.pk-plan-price { font-size: 1.2rem; font-weight: 800; color: var(--pk-primary); margin-top: 4px; }
.pk-plan-price del { font-size: 12px; font-weight: 600; color: var(--pk-muted); margin-inline-start: 4px; }
.pk-plan-stock { font-size: 11.5px; font-weight: 700; color: var(--pk-success); }
.pk-plan-stock.is-out { color: var(--pk-danger); }

.pk-buy-box { position: sticky; top: 140px; padding: 20px; background: var(--pk-surface); border: 1px solid var(--pk-border); border-radius: 18px; box-shadow: var(--pk-shadow); }
.pk-buy-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--pk-muted); }
.pk-buy-selected { font-weight: 800; font-size: 1.05rem; margin: 6px 0 16px; min-height: 2.6em; }
.pk-buy-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pk-buy-total { padding-top: 14px; border-top: 1px dashed var(--pk-border); }
.pk-buy-total strong { font-size: 1.5rem; color: var(--pk-primary); }
.pk-qty { display: inline-flex; align-items: center; border: 1px solid var(--pk-border); border-radius: 12px; overflow: hidden; }
.pk-qty button { border: 0; background: var(--pk-surface-2); width: 36px; height: 38px; color: var(--pk-ink); }
.pk-qty input { width: 52px; border: 0; text-align: center; font-weight: 700; background: var(--pk-surface); color: var(--pk-ink); -moz-appearance: textfield; }
.pk-qty input::-webkit-outer-spin-button, .pk-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pk-guarantees { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--pk-muted); }
.pk-guarantees i { color: var(--pk-primary); margin-inline-end: 6px; }
@media (max-width: 991.98px) { .pk-buy-box { position: static; } }

.pk-pills { gap: 6px; border-bottom: 1px solid var(--pk-border); padding-bottom: 10px; }
.pk-pills .nav-link { border-radius: 999px; font-weight: 700; color: var(--pk-muted); background: transparent; }
.pk-pills .nav-link.active { background: var(--pk-primary); color: #fff; }
.pk-tab-content { padding: 20px 4px; }
.pk-prose { color: var(--pk-ink); line-height: 1.75; max-width: 860px; }
.pk-steps-list { counter-reset: step; list-style: none; padding: 0; max-width: 760px; }
.pk-steps-list li { counter-increment: step; position: relative; padding-block: 4px 14px; padding-inline: 44px 0; }
.pk-steps-list li::before { content: counter(step); position: absolute; inset-inline-start: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
	background: var(--pk-primary-light); color: var(--pk-primary); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.pk-faq-item { max-width: 860px; margin-bottom: 18px; }
.pk-faq-item h3 { font-size: 1rem; font-weight: 800; margin-bottom: 4px; }
.pk-faq-item p { color: var(--pk-muted); margin: 0; }

/* ----- Tra cứu đơn / thẻ hẹp ----- */
.pk-narrow-card { max-width: 520px; margin: 0 auto; padding: 32px; background: var(--pk-surface); border: 1px solid var(--pk-border); border-radius: 22px; box-shadow: var(--pk-shadow); }

/* ----- Key đã giao (checkout/result.php, email không dùng file này) ----- */
.pk-keys { display: flex; flex-direction: column; gap: 12px; }
.pk-key-card { padding: 16px; border: 1px solid var(--pk-border); border-radius: 16px; background: var(--pk-surface); }
.pk-key-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pk-key-card-title { font-weight: 800; }
.pk-key-value { display: flex; align-items: stretch; gap: 8px; }
.pk-key-value code { flex: 1; display: flex; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--pk-surface-2); color: var(--pk-ink);
	font-size: 15px; font-weight: 700; letter-spacing: .03em; word-break: break-all; border: 1px dashed var(--pk-border); }
.pk-key-guide { margin-top: 10px; font-size: 13.5px; color: var(--pk-muted); }
.pk-key-guide summary { cursor: pointer; font-weight: 700; color: var(--pk-primary); }
.pk-key-guide ol { margin: 8px 0 0; padding-inline-start: 20px; }

/* ----- Footer ----- */
.pk-pay-logos { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-pay-logo { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 8px; background: rgba(255, 255, 255, .1); color: #fff; font-weight: 700; font-size: 12.5px; }


/* ==========================================================================
   Live chat — khung góc phải dưới (partials/livechat.php + livechat.js).
   Thanh thu gọn + header màu xanh ngọc, bong bóng khách xanh lá (giống JivoChat).
   z-index dưới modal Bootstrap (1055) để popup đăng nhập nổi trên khung chat.
   ========================================================================== */
.pk-chat {
	--chat-teal: #0b9785;
	--chat-teal-dark: #087a6c;
	--chat-green: #2fc552;
	--chat-green-dark: #1fae43;
	--chat-agent-bg: var(--pk-surface-2);
	position: fixed;
	inset-inline-end: 1.5rem;
	bottom: 0;
	z-index: 1045;
	font-size: 0.92rem;
}
.pk-chat ~ .btn-back-to-top { bottom: 5.25rem; }

.pk-chat-avatar {
	position: relative;
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	border: 2px solid rgba(255, 255, 255, .85);
	border-radius: 50%;
	background: linear-gradient(135deg, #f9a8d4, #8b5cf6);
	color: #fff;
	font-weight: 800;
	font-size: 1.05rem;
}
.pk-chat-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.pk-chat-dot { position: absolute; inset-inline-end: -1px; bottom: -1px; width: 0.7rem; height: 0.7rem; border: 2px solid var(--chat-teal); border-radius: 50%; background: #94a3b8; }
.pk-chat.is-online .pk-chat-dot { background: #4ade80; }

/* Thanh thu gọn */
.pk-chat-launcher {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	width: 21rem;
	max-width: calc(100vw - 2rem);
	padding: 0.8rem 1rem;
	border: 0;
	border-radius: 18px 18px 0 0;
	background: linear-gradient(135deg, var(--chat-teal), var(--chat-teal-dark));
	color: #fff;
	text-align: start;
	box-shadow: 0 -6px 24px rgba(8, 122, 108, .3);
	overflow: hidden;
	transition: padding-bottom .15s;
}
.pk-chat-launcher::after { /* góc trang trí xanh lá như mẫu */
	content: "";
	position: absolute;
	top: -1.6rem;
	inset-inline-end: -1.6rem;
	width: 3.2rem;
	height: 3.2rem;
	border-radius: 50%;
	background: var(--chat-green);
}
.pk-chat-launcher[hidden] { display: none; }
.pk-chat-launcher:hover { padding-bottom: 1rem; }
.pk-chat-launcher:focus-visible { outline: 3px solid #fde047; outline-offset: 2px; }
.pk-chat-launcher-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pk-chat-launcher-text strong { font-size: 1rem; }
.pk-chat-launcher-text small, .pk-chat-head-text small { color: rgba(255, 255, 255, .78); font-size: 0.8rem; }
.pk-chat-launcher-icon { margin-inline-start: auto; position: relative; z-index: 1; font-size: 1rem; opacity: .85; }
.pk-chat-badge {
	position: absolute;
	top: 0.45rem;
	inset-inline-start: 2.6rem;
	min-width: 1.25rem;
	height: 1.25rem;
	padding: 0 0.35rem;
	border-radius: 999px;
	background: #ef4444;
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 1.25rem;
	text-align: center;
}
.pk-chat-badge[hidden] { display: none; }

/* Khung mở */
.pk-chat-panel {
	display: flex;
	flex-direction: column;
	width: 22.5rem;
	max-width: calc(100vw - 2rem);
	height: min(35rem, calc(100vh - 6rem));
	border: 1px solid var(--pk-border);
	border-bottom: 0;
	border-radius: 18px 18px 0 0;
	background: var(--pk-surface);
	color: var(--pk-ink);
	box-shadow: 0 -10px 40px rgba(15, 23, 42, .25);
	overflow: hidden;
}
.pk-chat-panel[hidden] { display: none; }
.pk-chat-head { position: relative; display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; background: linear-gradient(135deg, var(--chat-teal), var(--chat-teal-dark)); color: #fff; overflow: hidden; }
.pk-chat-head::after { content: ""; position: absolute; top: -1.6rem; inset-inline-end: -1.6rem; width: 3.2rem; height: 3.2rem; border-radius: 50%; background: var(--chat-green); }
.pk-chat-head-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pk-chat-head-text strong { font-size: 1rem; }
.pk-chat-close {
	position: relative;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	margin-inline-start: auto;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .15);
	color: #fff;
}
.pk-chat-close:hover { background: rgba(255, 255, 255, .28); }
.pk-chat-sound + .pk-chat-close { margin-inline-start: 0.4rem; }

.pk-chat-body { flex: 1; min-height: 0; padding: 0.9rem 0.85rem; overflow-y: auto; overscroll-behavior: contain; }
.pk-chat-row { display: flex; margin-bottom: 0.45rem; }
.pk-chat-row.is-mine { justify-content: flex-end; }
.pk-chat-bubble {
	max-width: 82%;
	padding: 0.5rem 0.75rem;
	border-start-start-radius: 16px; border-start-end-radius: 16px; border-end-end-radius: 16px; border-end-start-radius: 4px;
	background: var(--chat-agent-bg);
	color: var(--pk-ink);
	line-height: 1.4;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.pk-chat-row.is-mine .pk-chat-bubble { border-start-start-radius: 16px; border-start-end-radius: 16px; border-end-end-radius: 4px; border-end-start-radius: 16px; background: linear-gradient(135deg, var(--chat-green), var(--chat-green-dark)); color: #fff; }
.pk-chat-bubble a { color: inherit; text-decoration: underline; }
.pk-chat-meta { float: inline-end; display: inline-flex; align-items: center; gap: 0.2rem; margin-block: 0.35rem -0.15rem; margin-inline: 0.6rem 0; font-size: 0.68rem; opacity: .75; white-space: nowrap; }
.pk-chat-tick { font-size: 0.85rem; }
.pk-chat-tick.is-seen { opacity: 1; }
.pk-chat-day { margin: 0.8rem 0 0.6rem; color: var(--pk-muted); font-size: 0.78rem; text-align: center; }
.pk-chat-note { margin: 0.2rem 0 0.6rem; padding: 0.55rem 0.75rem; border-radius: 10px; background: rgba(245, 158, 11, .12); color: var(--pk-ink); font-size: 0.82rem; }
.pk-chat-note[hidden] { display: none; }

.pk-chat-login { margin-top: 0.75rem; padding: 1rem; border: 1px dashed var(--pk-border); border-radius: 14px; text-align: center; }
.pk-chat-login > .bi { display: block; margin-bottom: 0.3rem; color: var(--chat-teal); font-size: 1.6rem; }
[data-theme="dark"] .pk-chat-login > .bi { color: #5eead4; }
.pk-chat-login strong { display: block; margin-bottom: 0.25rem; }
.pk-chat-login p { margin-bottom: 0.75rem; color: var(--pk-muted); font-size: 0.82rem; }

.pk-chat-form { border-top: 1px solid var(--pk-border); padding: 0.55rem 0.75rem 0.75rem; }
.pk-chat-error { margin-bottom: 0.45rem; color: #dc2626; font-size: 0.8rem; }
[data-theme="dark"] .pk-chat-error { color: #f87171; }
.pk-chat-error[hidden] { display: none; }
.pk-chat-compose { display: flex; align-items: flex-end; gap: 0.5rem; }
.pk-chat-compose textarea {
	flex: 1;
	min-height: 2.5rem;
	max-height: 120px;
	padding: 0.55rem 0.25rem;
	border: 0;
	background: transparent;
	color: var(--pk-ink);
	line-height: 1.4;
	resize: none;
	outline: none;
}
.pk-chat-compose textarea::placeholder { color: var(--pk-muted); }
.pk-chat-compose textarea[readonly] { cursor: pointer; }
.pk-chat-send {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	border: 0;
	border-radius: 50%;
	background: var(--chat-teal);
	color: #fff;
	transition: background .15s, opacity .15s;
}
.pk-chat-send:hover { background: var(--chat-teal-dark); }
.pk-chat-send:disabled { opacity: .5; }

/* Bảng emoji (chat-emoji.js) nổi trên ô nhập + tin chỉ có 1–3 emoji vẽ to (docs/plans-done/livechat-plan.md mục 3.5) */
.pk-chat-form { position: relative; }
.pk-chat .chat-emoji {
	position: absolute; inset-inline-start: 0.5rem; inset-inline-end: 0.5rem; bottom: calc(100% + 0.35rem); z-index: 5;
	display: flex; flex-direction: column; height: 15.5rem;
	border: 1px solid var(--pk-border); border-radius: 14px; background: var(--pk-surface);
	box-shadow: 0 10px 30px rgba(15, 23, 42, .2); overflow: hidden;
}
.pk-chat .chat-emoji[hidden] { display: none; }
.pk-chat .chat-emoji-tabs { display: flex; flex-shrink: 0; border-bottom: 1px solid var(--pk-border); }
.pk-chat .chat-emoji-tabs button { flex: 1; padding: 0.4rem 0; border: 0; border-bottom: 2px solid transparent; background: none; font-size: 1.05rem; line-height: 1.3; opacity: .55; }
.pk-chat .chat-emoji-tabs button:hover { opacity: .85; }
.pk-chat .chat-emoji-tabs button.is-active { opacity: 1; border-bottom-color: var(--chat-teal); }
.pk-chat .chat-emoji-grid { flex: 1; display: grid; grid-template-columns: repeat(8, 1fr); align-content: start; gap: 2px; padding: 0.4rem; overflow-y: auto; overscroll-behavior: contain; }
.pk-chat .chat-emoji-item { aspect-ratio: 1; padding: 0; border: 0; border-radius: 8px; background: none; font-size: 1.35rem; line-height: 1; }
.pk-chat .chat-emoji-item:hover, .pk-chat .chat-emoji-item:focus-visible { background: var(--pk-surface-2); }
.pk-chat .chat-emoji-tabs button, .pk-chat .chat-emoji-item, .pk-chat-bubble.is-emoji-only .pk-chat-text { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.pk-chat-emoji-btn[aria-expanded="true"] { color: var(--chat-teal); }
.pk-chat-row .pk-chat-bubble.is-emoji-only { padding: 0; background: none; color: var(--pk-ink); }
.pk-chat-bubble.is-emoji-only .pk-chat-text { font-size: 2.25rem; line-height: 1.15; }
.pk-chat-bubble.is-emoji-only .pk-chat-meta { color: var(--pk-muted); opacity: 1; }

/* "Alissa is typing…" — bong bóng 3 chấm nhấp nhô (livechat.js showTyping(), docs/plans-done/livechat-plan.md mục 3.4) */
.pk-chat-typing[hidden] { display: none; }
.pk-chat-typing .pk-chat-bubble { display: inline-flex; align-items: center; gap: 4px; padding: 0.7rem 0.85rem; }
.pk-chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .35; animation: pk-chat-typing 1.2s infinite ease-in-out; }
.pk-chat-typing span:nth-child(2) { animation-delay: .15s; }
.pk-chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes pk-chat-typing { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .pk-chat-typing span { animation: none; opacity: .6; } }

/* Ảnh trong tin + nút gửi ảnh + ảnh xem trước (livechat.js, docs/plans-done/livechat-plan.md mục 3.1) */
.pk-chat-bubble.has-image { padding: 0.3rem; }
.pk-chat-bubble.has-image > .pk-chat-meta { margin-inline-end: 0.4rem; }
.pk-chat-image { display: block; margin-bottom: 0.2rem; }
.pk-chat-bubble.has-image > .pk-chat-text { padding: 0 0.45rem; }
.pk-chat-image img { display: block; max-width: 100%; max-height: 240px; border-radius: 12px; background: rgba(0, 0, 0, .05); }
.pk-chat-attach {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.5rem;
	border: 0;
	background: transparent;
	color: var(--pk-muted);
	font-size: 1.15rem;
}
.pk-chat-attach:hover { color: var(--chat-teal); }
.pk-chat-preview { position: relative; display: inline-block; margin-bottom: 0.45rem; }
.pk-chat-preview[hidden] { display: none; }
.pk-chat-preview img { display: block; max-width: 120px; max-height: 90px; border: 1px solid var(--pk-border); border-radius: 10px; }
/* Đang gửi: ảnh xem trước mờ đi + vòng xoay, nút gửi thành vòng xoay (livechat.js setSending()). */
.pk-chat-preview.is-sending img { opacity: .45; }
.pk-chat-preview.is-sending::after,
.pk-chat-send.is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	inset-inline-start: 50%;
	width: 1.4rem;
	height: 1.4rem;
	margin-block: -0.7rem 0; margin-inline: -0.7rem 0;
	border: 2px solid rgba(255, 255, 255, .45);
	border-top-color: #fff;
	border-radius: 50%;
	animation: pk-chat-spin .8s linear infinite;
}
.pk-chat-preview.is-sending::after { border-color: rgba(13, 148, 136, .25); border-top-color: var(--chat-teal); }
.pk-chat-preview.is-sending .pk-chat-preview-remove { display: none; }
.pk-chat-send { position: relative; }
.pk-chat-send.is-loading { opacity: 1; }
.pk-chat-send.is-loading > .bi { visibility: hidden; }
.pk-chat-attach:disabled { opacity: .4; }
/* Modal xem ảnh lớn (livechat.js openLightbox()) — trên cả khung chat và popup đăng nhập. */
.pk-chat-lightbox {
	position: fixed;
	inset: 0;
	z-index: 1080;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 3.5rem 1rem 1rem;
	background: rgba(0, 0, 0, .85);
	cursor: zoom-out;
}
.pk-chat-lightbox[hidden] { display: none; }
.pk-chat-lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); cursor: default; }
.pk-chat-lightbox-close {
	position: absolute;
	top: 0.75rem;
	inset-inline-end: 0.75rem;
	width: 2.5rem;
	height: 2.5rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .15);
	color: #fff;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}
.pk-chat-lightbox-close:hover { background: rgba(255, 255, 255, .3); }
.pk-chat-image { cursor: zoom-in; }
@keyframes pk-chat-spin { to { transform: rotate(360deg); } }
.pk-chat-preview-remove {
	position: absolute;
	top: -0.45rem;
	inset-inline-end: -0.45rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.4rem;
	height: 1.4rem;
	border: 0;
	border-radius: 50%;
	background: #475569;
	color: #fff;
	font-size: 0.65rem;
}

/* Mobile: khung mở chiếm toàn màn hình, khoá cuộn trang phía sau. */
@media (max-width: 575.98px) {
	.pk-chat { inset-inline-end: 1rem; }
	.pk-chat-launcher { width: auto; padding: 0.65rem 0.9rem; }
	.pk-chat.is-open { inset: 0; inset-inline-end: 0; }
	.pk-chat-panel { width: 100%; max-width: none; height: 100%; border: 0; border-radius: 0; }
	.pk-chat-compose textarea { font-size: 16px; } /* < 16px thì iOS tự zoom khi focus */
	html.pk-chat-locked { overflow: hidden; }
	.pk-chat ~ .btn-back-to-top { bottom: 4.75rem; }
}


/* ==========================================================================
   Thanh điều hướng mobile (partials/mobile-bar.php): hiện ở gần đầu trang, .is-hidden khi đã cuộn
   (premiumgo.js). z-index dưới live chat và modal Bootstrap. Phần đệm footer để khỏi che nội dung
   ở trang ngắn nằm trong theme.css vì file đó đặt padding footer và nạp sau file này.
   ========================================================================== */
.pk-mobile-bar {
	position: fixed;
	inset-inline-end: 12px;
	bottom: calc(12px + env(safe-area-inset-bottom));
	inset-inline-start: 12px;
	z-index: 1040;
	display: flex;
	align-items: stretch;
	padding: 8px 4px;
	border: 1px solid var(--pk-border);
	border-radius: 24px;
	background: var(--pk-surface);
	box-shadow: var(--pk-shadow);
	transition: transform .25s ease, opacity .25s ease, visibility .25s;
}
.pk-mobile-bar.is-hidden,
html.pk-chat-locked .pk-mobile-bar {
	visibility: hidden;
	opacity: 0;
	transform: translateY(calc(100% + 24px));
}
.pk-mobile-bar-item {
	position: relative;
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	gap: 3px;
	min-width: 0;
	padding: 2px 2px 6px;
	border: 0;
	background: none;
	color: var(--pk-muted);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
}
.pk-mobile-bar-item:hover { color: var(--pk-muted); }
.pk-mobile-bar-item > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-mobile-bar-item > .bi,
.pk-mobile-bar-icon { position: relative; font-size: 20px; line-height: 1; }
.pk-mobile-bar-item.is-active { color: var(--pk-primary); }
.pk-mobile-bar-item.is-active::after {
	content: "";
	position: absolute;
	bottom: 0;
	left: 50%;
	width: 22px;
	height: 3px;
	border-radius: 3px;
	background: var(--pk-primary);
	transform: translateX(-50%);
}
.pk-mobile-bar-cart-icon {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin-top: -32px;
	border: 3px solid #fff;
	border-radius: 50%;
	background: #ffc928;
	box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
	color: #16133a;
	font-size: 22px;
	line-height: 1;
}
.pk-mobile-bar-count {
	position: absolute;
	top: -6px;
	inset-inline-end: -8px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}
.pk-mobile-bar-cart-icon .pk-mobile-bar-count { top: -3px; inset-inline-end: -3px; }
.pk-mobile-bar-count[hidden] { display: none; }
.pk-mobile-bar-dot {
	position: absolute;
	top: -2px;
	inset-inline-end: -3px;
	width: 10px;
	height: 10px;
	border: 2px solid var(--pk-surface);
	border-radius: 50%;
	background: #94a3b8;
}
.pk-mobile-bar-chat.is-online .pk-mobile-bar-dot { background: #22c55e; }

@media (max-width: 767.98px) {
	/* Ô Chat trên thanh thay nút thu gọn live chat: cùng nằm ở đáy màn hình nên không hiện cùng lúc. */
	.pk-mobile-bar:not(.is-hidden) ~ .pk-chat .pk-chat-launcher { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.pk-mobile-bar { transition: none; }
}
