/* ==========================================================
   King Coffee — Header (format kingaffiliate-uat.tnicorporation.com)
   ========================================================== */

.kch-hd {
	--hd-gold: #B67B35;
	--hd-gold-2: #A96F2E;
	--hd-gold-ink: #986426;
	--hd-red: #950B18;
	--hd-ink: #292421;
	--hd-muted: #77716B;
	--hd-line: rgba(0, 0, 0, .07);
	--hd-top: 0px;
	font-family: Inter, "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	color: var(--hd-ink);
	-webkit-font-smoothing: antialiased;
}
body.admin-bar .kch-hd { --hd-top: 32px; }

.kch-hd *, .kch-hd *::before, .kch-hd *::after { box-sizing: border-box; }
.kch-hd a { text-decoration: none; color: inherit; transition: color .25s, background .25s, border-color .25s, box-shadow .25s, transform .25s; }
.kch-hd a:hover { color: inherit; }
.kch-hd button { font-family: inherit; cursor: pointer; }
.kch-hd img { max-width: 100%; height: auto; display: block; }
.kch-hd p, .kch-hd ul { margin: 0; padding: 0; list-style: none; }
.kch-hd .kch-ic { flex: none; }
.kch-hd [hidden] { display: none !important; }
.kch-hd small { font-size: inherit; }

.kch-hd__two { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.kch-hd__two small { font-size: 9px; font-weight: 500; line-height: 12px; color: rgba(0,0,0,.4); white-space: nowrap; }
.kch-hd__two strong { max-width: 110px; font-size: 11px; font-weight: 700; line-height: 15px; color: #322B25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kch-hd__two strong .amount, .kch-hd__two strong bdi { color: inherit; font-weight: inherit; }

.kch-hd-spacer { height: 100px; }
body.home .kch-hd-spacer { height: 92px; background: #F6F3F0; }

/* ---------- Desktop ---------- */
.kch-hd__desk { position: fixed; left: 0; right: 0; top: var(--hd-top); z-index: 999; padding: 12px 16px 0; pointer-events: none; }
.kch-hd__bar {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(240px, 1fr) auto;
	align-items: center;
	gap: 16px;
	max-width: 1320px;
	min-height: 72px;
	margin: 0 auto;
	padding: 0 18px 0 22px;
	border: 1px solid rgba(255,255,255,.8);
	border-radius: 26px;
	background: rgba(255,252,248,.9);
	-webkit-backdrop-filter: blur(24px);
	backdrop-filter: blur(24px);
	box-shadow: 0 12px 42px rgba(45,34,24,.12);
	pointer-events: auto;
	transition: box-shadow .4s, background .4s;
}
.kch-hd.is-scrolled .kch-hd__bar { background: rgba(255,252,248,.96); box-shadow: 0 14px 44px rgba(45,34,24,.16); }

.kch-hd__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kch-hd__logo { display: inline-flex; align-items: center; height: 52px; padding: 0 4px; }
.kch-hd__logo-img { width: auto !important; height: 46px !important; object-fit: contain; }
.kch-hd__logo-text { font-weight: 700; font-size: 18px; color: var(--hd-red); }
.kch-hd__sep { width: 1px; height: 28px; margin: 0 4px; background: rgba(0,0,0,.08); flex: none; }

.kch-hd__cat { position: relative; }
.kch-hd__cat-btn {
	position: relative; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 8px;
	border: 1px solid rgba(182,123,53,.15); border-radius: 999px; background: var(--hd-gold); color: #fff;
	font-size: 12px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap;
	box-shadow: 0 6px 18px rgba(139,92,38,.2); transition: background .3s, box-shadow .3s;
}
.kch-hd__cat-btn:hover, .kch-hd__cat-btn[aria-expanded="true"] { background: var(--hd-gold-2); box-shadow: 0 9px 24px rgba(139,92,38,.27); }
.kch-hd__cat-ic { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.12); }
.kch-hd__cat-btn > .kch-ic:last-child { margin-left: -2px; opacity: .65; transition: transform .3s, opacity .3s; }
.kch-hd__cat-btn:hover > .kch-ic:last-child { transform: translateX(2px); opacity: 1; }
.kch-hd__cat-btn[aria-expanded="true"] > .kch-ic:last-child { transform: rotate(90deg); opacity: 1; }

.kch-hd__panel {
	position: absolute; left: -8px; top: calc(100% + 18px); z-index: 5;
	display: flex; gap: 8px; min-width: 300px; padding: 12px;
	border: 1px solid var(--hd-line); border-radius: 20px; background: #fff;
	box-shadow: 0 24px 60px -12px rgba(45,34,24,.25);
	animation: kchHdIn .22s ease;
}
@keyframes kchHdIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.kch-hd__panel-col { display: flex; flex-direction: column; width: 290px; }
.kch-hd__panel-col--menu { width: 230px; padding-left: 12px; border-left: 1px solid var(--hd-line); }
.kch-hd__panel-t { padding: 6px 10px 8px; font-size: 10px !important; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--hd-red) !important; }
.kch-hd__panel-col > a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; font-size: 13px; font-weight: 600; }
.kch-hd__panel-col > a:hover { background: #FBF6EF; color: var(--hd-red); }
.kch-hd__panel-col > a > span:nth-child(2) { flex: 1; }
.kch-hd__panel-col > a small { font-size: 11px; font-weight: 500; color: #aaa; }
.kch-hd__panel-ic { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; background: #FBF6EF; color: #7a5a45; flex: none; }
.kch-hd__panel .kch-hd__panel-all { margin-top: 6px; border-top: 1px solid var(--hd-line); border-radius: 0 0 12px 12px; padding-top: 12px; color: var(--hd-gold-ink); font-size: 12.5px; }

.kch-hd__menu, .kch-hd__menu ul { list-style: none; margin: 0; padding: 0; }
.kch-hd__menu a { display: block; padding: 9px 10px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--hd-ink); }
.kch-hd__menu a:hover, .kch-hd__menu .current-menu-item > a { background: #FBF6EF; color: var(--hd-red); }
.kch-hd__menu .sub-menu { padding-left: 12px; }
.kch-hd__menu .sub-menu a { font-weight: 500; font-size: 12.5px; color: #5F5751; }

.kch-hd__mid { display: flex; justify-content: center; min-width: 0; padding: 0 8px; }
.kch-hd__search {
	position: relative; display: flex; align-items: center; width: 100%; max-width: 520px; height: 48px; margin: 0;
	border: 1px solid var(--hd-line); border-radius: 999px; background: rgba(255,255,255,.76);
	box-shadow: 0 4px 16px rgba(45,34,24,.055); overflow: hidden; transition: border-color .3s, background .3s;
}
.kch-hd__search:hover { border-color: rgba(0,0,0,.11); background: rgba(255,255,255,.92); }
.kch-hd__search:focus-within { border-color: rgba(182,123,53,.45); background: #fff; }
.kch-hd__search-ic { display: flex; align-items: center; justify-content: center; width: 48px; height: 100%; color: #746C64; flex: none; }
.kch-hd__search input[type="search"] {
	flex: 1; min-width: 0; height: 100% !important; margin: 0 !important; padding: 0 !important;
	border: 0 !important; background: transparent !important; box-shadow: none !important; outline: 0 !important;
	font-family: inherit; font-size: 13px !important; font-weight: 500; line-height: 1; color: #2E2924; letter-spacing: -.01em;
}
.kch-hd__search input::placeholder { color: rgba(0,0,0,.35); font-weight: 400; }
.kch-hd__search input::-webkit-search-cancel-button { display: none; }
.kch-hd__search button {
	display: flex; align-items: center; gap: 6px; height: 40px; margin-right: 4px; padding: 0 16px; flex: none;
	border: 0; border-radius: 999px; background: var(--hd-gold); color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap;
	box-shadow: 0 5px 14px rgba(139,92,38,.2); transition: background .3s;
}
.kch-hd__search button:hover { background: var(--hd-gold-2); }
.kch-hd__search button .kch-ic { opacity: .75; }

.kch-hd__right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.kch-hd__phone { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px 0 8px; border: 1px solid rgba(182,123,53,.15); border-radius: 16px; background: #FFF8EF; box-shadow: 0 4px 16px rgba(45,34,24,.045); flex: none; }
.kch-hd__phone:hover { border-color: rgba(182,123,53,.3); background: #FFF3E2; }
.kch-hd__phone-ic { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(182,123,53,.1); color: var(--hd-gold-ink); }
.kch-hd__phone .kch-hd__two strong { color: var(--hd-gold-ink); }

.kch-hd__pill { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px 0 6px; border: 1px solid var(--hd-line); border-radius: 999px; background: rgba(255,255,255,.72); box-shadow: 0 4px 16px rgba(45,34,24,.055); flex: none; }
.kch-hd__pill:hover { border-color: rgba(182,123,53,.25); background: #fff; box-shadow: 0 8px 22px rgba(45,34,24,.1); }
.kch-hd__pill:hover .kch-hd__two strong { color: var(--hd-gold-ink); }
.kch-hd__acc-ic { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: #F3E4CE; color: var(--hd-gold-ink); flex: none; }
.kch-hd__acc-arrow { color: rgba(0,0,0,.25); transition: transform .3s, color .3s; }
.kch-hd__pill:hover .kch-hd__acc-arrow { transform: translateX(2px); color: #A86F28; }
.kch-hd__cart-ic { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: #625A52; }
.kch-hd__cart:hover .kch-hd__cart-ic { background: rgba(243,228,206,.7); color: var(--hd-gold-ink); }
.kch-hd-cart-count { position: absolute; top: -3px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid #fff; border-radius: 999px; background: var(--hd-red); color: #fff; font-size: 9px; font-weight: 700; line-height: 13px; text-align: center; }

/* GTranslate trong header */
.kch-hd__lang { flex: none; font-size: 12px; }
.kch-hd__lang select { height: 36px; max-width: 130px; padding: 0 8px; border: 1px solid var(--hd-line); border-radius: 999px; background: #fff; font-size: 12px; }
.kch-hd__lang .gt_selector { margin: 0; }
.kch-hd__lang .gt_switcher { width: 132px !important; font-family: inherit !important; }
.kch-hd__lang .gt_switcher .gt_selected { background: rgba(255,255,255,.72) !important; border: 1px solid var(--hd-line) !important; border-radius: 999px !important; box-shadow: 0 4px 16px rgba(45,34,24,.055); overflow: hidden; }
.kch-hd__lang .gt_switcher .gt_selected a { width: auto !important; border: 0 !important; padding: 10px 28px 10px 10px !important; font-size: 12px !important; font-weight: 600; color: #322B25 !important; background-position: right 10px center !important; }
.kch-hd__lang .gt_switcher .gt_selected a:hover { background-color: #fff !important; }
.kch-hd__lang .gt_switcher .gt_option { width: 180px !important; margin-top: 6px; border: 1px solid var(--hd-line) !important; border-radius: 14px; background: #fff !important; box-shadow: 0 18px 40px -12px rgba(45,34,24,.25); }
.kch-hd__lang .gt_switcher .gt_option a { padding: 8px 12px !important; font-size: 12.5px !important; color: var(--hd-ink) !important; }
.kch-hd__lang .gt_switcher .gt_option a:hover { background: #FBF6EF !important; }
.kch-hd__lang img { display: inline-block !important; width: 20px !important; height: 20px !important; border-radius: 50%; vertical-align: middle; }

/* Ẩn nút giỏ hàng nổi của ShopBuilder (đã có giỏ hàng trên header) */
body #rtsb-cart-float-menu.rtsb-flying-cart,
body .rtsb-cart-float-menu.rtsb-flying-cart { display: none !important; }

/* ---------- Mobile ---------- */
.kch-hd__mob, .kch-hd__tab, .kch-hd__drawer { display: none; }

.kch-hd__icbtn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--hd-ink); flex: none; -webkit-tap-highlight-color: transparent; }
.kch-hd__icbtn:hover { background: #F5F2EE; }
.kch-hd__icbtn .kch-hd-cart-count { top: 3px; right: 1px; }

@media (max-width: 1279px) {
	.kch-hd__phone, .kch-hd__sep--xl { display: none; }
	.kch-hd__two--xl { display: none; }
	.kch-hd__cart { padding-right: 6px; }
}
@media (max-width: 1535px) {
	.kch-hd__two--2xl, .kch-hd__acc-arrow { display: none; }
	.kch-hd__acc { padding-right: 6px; }
}

@media (max-width: 1023px) {
	.kch-hd__desk { display: none; }
	.kch-hd__mob { display: block; position: fixed; left: 0; right: 0; top: var(--hd-top); z-index: 999; background: #fff; }
	.kch-hd__mob-top { display: flex; align-items: center; justify-content: space-between; height: 58px; padding: 0 12px; border-bottom: 1px solid var(--hd-line); background: rgba(255,255,255,.95); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
	.kch-hd__mob-l, .kch-hd__mob-r { display: flex; align-items: center; gap: 6px; min-width: 0; }
	.kch-hd__mob-r { gap: 2px; }
	.kch-hd__mob-logo { display: flex; align-items: center; }
	.kch-hd__mob-logo-img { width: auto !important; height: 32px !important; object-fit: contain; }

	.kch-hd__mob-search { display: flex; align-items: center; gap: 10px; height: 42px; margin: 10px 12px 12px; padding: 0 14px; border: 1px solid var(--hd-line); border-radius: 12px; background: #F7F5F2; color: #8A817A; }
	.kch-hd__mob-search input[type="search"] { flex: 1; min-width: 0; height: 100% !important; margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; outline: 0; font-family: inherit; font-size: 13px; color: var(--hd-ink); }
	.kch-hd__mob-search input::placeholder { font-size: 12px; font-weight: 500; color: #8A817A; }

	.kch-hd__mob-links { display: flex; gap: 20px; min-height: 38px; padding: 0 16px; overflow-x: auto; border-top: 1px solid var(--hd-line); border-bottom: 1px solid rgba(0,0,0,.05); scrollbar-width: none; }
	.kch-hd__mob-links::-webkit-scrollbar { display: none; }
	.kch-hd__mob-links a { position: relative; display: flex; align-items: center; height: 38px; flex: none; font-size: 11.5px; font-weight: 500; color: #5F5751; white-space: nowrap; }
	.kch-hd__mob-links a.is-on { color: var(--hd-red); font-weight: 600; }
	.kch-hd__mob-links a.is-on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--hd-red); }

	.kch-hd-spacer, body.home .kch-hd-spacer { height: 152px; }
	/* Trang khác không có menu danh mục nhanh / ô tìm kiếm → header chỉ còn thanh trên. */
	body:not(.home) .kch-hd-spacer { height: 58px; }
	body.search:not(.home) .kch-hd-spacer { height: 122px; }

	/* bottom tab bar */
	.kch-hd__tab { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 998; padding: 0 12px max(8px, env(safe-area-inset-bottom)); pointer-events: none; }
	.kch-hd__tab-in {
		position: relative; display: grid; grid-template-columns: repeat(5, 1fr); max-width: 520px; height: 68px; margin: 0 auto; padding: 0 6px;
		border: 1px solid rgba(0,0,0,.06); border-radius: 24px; background: rgba(255,255,255,.95);
		-webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
		box-shadow: 0 8px 30px rgba(45,34,24,.14); pointer-events: auto;
	}
	.kch-hd__tab-in::before { content: ""; position: absolute; left: 50%; top: 0; width: 32px; height: 3px; transform: translateX(-50%); border-radius: 0 0 3px 3px; background: var(--hd-gold); }
	.kch-hd__tab a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; border-radius: 18px; color: var(--hd-muted); -webkit-tap-highlight-color: transparent; }
	.kch-hd__tab a:active { background: #F7F2EC; }
	.kch-hd__tab a > .kch-ic { opacity: .8; }
	.kch-hd__tab span { max-width: 64px; font-size: 10px; font-weight: 500; line-height: 12px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.kch-hd__tab-home { position: relative; }
	.kch-hd__tab-home > span:last-child { margin-top: 38px; font-weight: 600; color: #9C682A; }
	.kch-hd__tab-king { position: absolute; top: -27px; left: 50%; display: flex; align-items: center; justify-content: center; width: 62px; height: 62px; max-width: none !important; transform: translateX(-50%); border: 4px solid #fff; border-radius: 50%; background: var(--hd-gold); color: #fff; box-shadow: 0 8px 22px rgba(119,77,31,.3); transition: transform .2s; }
	.kch-hd__tab-home:active .kch-hd__tab-king { transform: translateX(-50%) scale(.95); }
	.kch-hd__tab-king--logo { background: #fff; padding: 5px; overflow: hidden; }
	.kch-hd__tab-king--logo img { display: block; width: 100%; height: 100%; object-fit: contain; }

	body.kch-has-header { padding-bottom: 92px; }

	/* Đẩy các nút nổi (chat, recaptcha, scroll-top) lên trên thanh tab */
	body .gsb-buttons, html body #dify-chatbot-bubble-button, body .grecaptcha-badge, body .scroll-wrap { bottom: 100px !important; }
	html body #dify-chatbot-bubble-window { bottom: 160px !important; }

	/* drawer */
	.kch-hd__drawer { display: block; position: fixed; inset: 0; z-index: 100000; }
	.kch-hd__drawer-bg { position: absolute; inset: 0; background: rgba(20,14,10,.45); animation: kchFade .25s ease; }
	.kch-hd__drawer-in { position: absolute; left: 0; top: 0; bottom: 0; width: min(86vw, 340px); padding: 12px 14px 24px; overflow-y: auto; background: #fff; box-shadow: 20px 0 50px rgba(0,0,0,.2); animation: kchSlide .28s ease; }
	@keyframes kchFade { from { opacity: 0; } }
	@keyframes kchSlide { from { transform: translateX(-100%); } }
	.kch-hd__drawer-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
	.kch-hd__drawer-acc { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--hd-line); border-radius: 16px; background: #FFFCF8; }
	.kch-hd__drawer-acc .kch-hd__two { flex: 1; }
	.kch-hd__drawer-acc .kch-hd__two strong { max-width: none; font-size: 13px; }
	.kch-hd__drawer .kch-hd__panel-t { padding: 14px 4px 6px; }
	.kch-hd__drawer .kch-hd__menu a { padding: 10px 4px; font-size: 14px; border-radius: 0; border-bottom: 1px solid var(--hd-line); }
	.kch-hd__drawer-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
	.kch-hd__drawer-cats a { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--hd-line); border-radius: 12px; font-size: 12px; font-weight: 600; line-height: 1.3; }
	.kch-hd__phone--block { margin-top: 16px; height: 52px; }
	.kch-hd__lang--drawer { margin-top: 14px; }
	body.kch-drawer-open { overflow: hidden; }
}

@media (max-width: 782px) {
	body.admin-bar .kch-hd { --hd-top: 46px; }
}
@media (max-width: 600px) {
	body.admin-bar .kch-hd { --hd-top: 0px; }
}

@media (prefers-reduced-motion: reduce) {
	.kch-hd *, .kch-hd *::before, .kch-hd *::after { transition: none !important; animation: none !important; }
}
