/* =========================================================================
   Thomi Cart Drawer (tcd-) — drawer truot phai kieu klowerpandor
   ========================================================================= */

/* ---------- Overlay + scroll lock ---------- */
.tcd-overlay {
	position: fixed; inset: 0; background: rgba(20, 18, 16, 0.45);
	opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility .35s ease;
	z-index: 99998;
}
.tcd-overlay.is-open { opacity: 1; visibility: visible; }
body.tcd-locked { overflow: hidden !important; }

/* ---------- Panel ---------- */
.tcd-drawer {
	/* 2026-07-17: rong hon (410 -> 480) cho thoang, anh SP to hon. max-width 92vw giu an toan mobile. */
	position: fixed; top: 0; right: 0; height: 100%; width: 480px; max-width: 92vw;
	background: #F4EFE8; box-shadow: -8px 0 40px rgba(0, 0, 0, 0.16);
	transform: translateX(100%); transition: transform .38s cubic-bezier(.4, 0, .2, 1), visibility .38s ease;
	z-index: 99999; display: flex; flex-direction: column;
	font-family: "Jost", sans-serif;
	/* A11Y 2026-07-17 (aria-hidden-focus): drawer dong van co aria-hidden="true" NHUNG cac nut ben
	   trong VAN tab duoc (transform khong bo khoi focus order) -> loi axe + bay ban phim.
	   visibility:hidden go het con khoi focus order + a11y tree. Mo lai khi .is-open. */
	visibility: hidden;
}
.tcd-drawer.is-open { transform: translateX(0); visibility: visible; }

/* ---------- Header ---------- */
.tcd-head {
	flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
	padding: 20px 22px; border-bottom: 1px solid #E7DFD2; background: #F4EFE8;
}
.tcd-title { font-family: "Playfair Display", serif; font-size: 18px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: #1A1814; }
.tcd-count { font-weight: 400; color: #8A8276; }
.tcd-close { background: none; border: 0; font-size: 26px; line-height: 1; color: #5A5248; cursor: pointer; padding: 0 4px; transition: color .25s; }
.tcd-close:hover { color: #1A1814; }

/* ---------- Body (scroll) ---------- */
.tcd-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; padding: 20px 18px; }
.tcd-body::-webkit-scrollbar { width: 6px; }
.tcd-body::-webkit-scrollbar-thumb { background: #D8CDBB; border-radius: 6px; }

/* ---------- Freeship / tier bar ---------- */
.tcd-ship { flex: 0 0 auto; padding: 2px 6px 22px; }
.tcd-ship-text { font-size: 13px; text-align: center; color: #5A5248; margin: 0 0 14px; letter-spacing: .3px; }
.tcd-ship-text strong { color: #1A1814; font-weight: 600; }
.tcd-ship-track { position: relative; height: 4px; background: #E2D8C8; border-radius: 4px; margin: 22px 14px 0; }
.tcd-ship-fill { position: absolute; left: 0; top: 0; height: 4px; background: #B5A99A; border-radius: 4px; transition: width .45s ease; }
.tcd-ship-node {
	position: absolute; top: -13px; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%;
	background: #E2D8C8; color: #fff; display: flex; align-items: center; justify-content: center; transition: background .35s;
}
.tcd-ship-node.is-on { background: #B5A99A; }
.tcd-ship-labels { display: flex; justify-content: space-between; margin: 14px 0 0; padding: 0 2px; }
.tcd-ship-label { font-size: 10.5px; letter-spacing: .5px; color: #A99E8C; text-transform: uppercase; text-align: center; flex: 1; }
.tcd-ship-label.is-on { color: #1A1814; }

/* ---------- Item card ---------- */
.tcd-items { flex: 0 0 auto; }
.tcd-item {
	display: flex; align-items: center; gap: 15px; position: relative;
	background: #fff; border-radius: 2px; padding: 16px; margin: 0 0 12px; box-shadow: 0 2px 10px rgba(26, 24, 20, 0.05);
}
/* Anh SP: 58 -> 88px, vuong, co nen + vien mo de anh nen trang van noi khoi the */
.tcd-thumb { flex: 0 0 88px; display: block; }
.tcd-thumb img {
	width: 88px; height: 88px; border-radius: 0; display: block;
	object-fit: contain; background: #FAF8F5; border: 1px solid #EDE8E0; padding: 4px;
}
.tcd-info { flex: 1; min-width: 0; }
/* Ten SP: to hon + toi da 2 dong (ten dai khong lam vo the) */
.tcd-name {
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
	/* padding-right chua cho nut xoa (24px + 11px le) -> 38px de chu khong bao gio cham nut */
	font-size: 14px; line-height: 1.45; color: #2A2620; font-weight: 500; margin: 0 0 12px; padding-right: 38px; text-decoration: none;
}
.tcd-name:hover { color: #9C8E78; }
.tcd-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tcd-qty { display: inline-flex; align-items: center; border: 1px solid #E2D8C8; border-radius: 2px; overflow: hidden; }
.tcd-q { width: 32px; height: 34px; line-height: 32px; text-align: center; background: #fff; border: 0; color: #1A1814; font-size: 16px; cursor: pointer; padding: 0; transition: background .2s, color .2s; }
.tcd-q:hover { background: #FAF8F5; color: #9C8E78; }
.tcd-q-val { min-width: 38px; height: 34px; line-height: 34px; text-align: center; font-size: 13.5px; color: #1A1814; border-left: 1px solid #EDE8E0; border-right: 1px solid #EDE8E0; }
.tcd-qty-single { font-size: 13.5px; color: #8A8276; }
.tcd-price { font-size: 15px; font-weight: 700; color: #1A1814; white-space: nowrap; }
.tcd-trash { position: absolute; top: 11px; right: 11px; width: 24px; height: 24px; background: none; border: 0; color: #B5A99A; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; transition: color .25s; }
.tcd-trash:hover { color: #C0392B; }

/* ---------- Cross-sell ---------- */
.tcd-cross { flex: 0 0 auto; margin: 4px 0 14px; }
.tcd-cross-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: #5A5248; text-align: center; margin: 0 0 12px; }
.tcd-cross-item { display: flex; align-items: center; gap: 13px; background: #fff; border-radius: 2px; padding: 11px 13px; margin: 0 0 9px; }
.tcd-cross-thumb { flex: 0 0 60px; }
.tcd-cross-thumb img { width: 60px; height: 60px; border-radius: 0; display: block; object-fit: contain; background: #FAF8F5; border: 1px solid #EDE8E0; padding: 3px; }
.tcd-cross-info { flex: 1; min-width: 0; }
.tcd-cross-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.4; color: #2A2620; text-decoration: none; }
.tcd-cross-price { font-size: 13px; color: #9C8E78; }
.tcd-cross-add { flex: 0 0 auto; width: 34px; height: 34px; line-height: 32px; text-align: center; background: #1A1814; color: #fff; border: 0; border-radius: 50%; font-size: 18px; cursor: pointer; text-decoration: none; transition: background .25s; }
.tcd-cross-add:hover { background: #9C8E78; color: #fff; }

/* ---------- Coupon ---------- */
.tcd-coupon { flex: 0 0 auto; display: flex; align-items: stretch; gap: 8px; margin: 2px 0 14px; }
.tcd-coupon-input { flex: 1; min-width: 0; height: 46px; border: 1px solid #E2D8C8; border-radius: 2px; background: #fff; padding: 0 14px; font-family: "Jost", sans-serif; font-size: 13px; }
.tcd-coupon-input:focus { outline: none; border-color: #B5A99A; }
.tcd-coupon-apply { flex: 0 0 auto; height: 46px; padding: 0 18px; background: #2A2620; color: #fff; border: 0; border-radius: 2px; font-family: "Jost", sans-serif; font-size: 13px; cursor: pointer; transition: background .25s; }
.tcd-coupon-apply:hover { background: #9C8E78; }
.tcd-coupon-apply[disabled] { opacity: .6; cursor: default; }

/* ---------- Thong bao coupon (loi/thanh cong) ---------- */
.tcd-notice { margin: 0 0 14px; font-size: 12.5px; }
.tcd-notice .woocommerce-error,
.tcd-notice .woocommerce-message,
.tcd-notice ul { list-style: none; margin: 0; padding: 10px 14px; border-radius: 2px; font-family: "Jost", sans-serif; }
.tcd-notice .woocommerce-error { background: #FBEAE8; color: #C0392B; }
.tcd-notice .woocommerce-message { background: #EAF3EC; color: #2E7D46; }
.tcd-notice-error { padding: 10px 14px; border-radius: 2px; background: #FBEAE8; color: #C0392B; }

/* ---------- Footer (pin duoi) ---------- */
.tcd-foot { flex: 0 0 auto; margin-top: auto; position: sticky; bottom: -20px; background: #F4EFE8; padding: 12px 0 2px; }
.tcd-btn-main {
	display: flex; align-items: center; justify-content: space-between; width: 100%;
	background: #2A2620; color: #fff; border: 0; border-radius: 2px; padding: 16px 22px;
	font-family: "Jost", sans-serif; font-size: 14px; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; text-decoration: none; transition: background .25s;
}
.tcd-btn-main:hover { background: #9C8E78; color: #fff; }
.tcd-foot-total { font-weight: 600; }
.tcd-continue { display: block; text-align: center; margin-top: 14px; font-size: 12.5px; letter-spacing: 1px; color: #9C8E78; text-decoration: underline; }
.tcd-continue:hover { color: #1A1814; }

/* ---------- Empty ---------- */
.tcd-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; }
.tcd-empty-msg { color: #6B6357; font-size: 14px; margin: 0; }
.tcd-empty-shop { display: inline-flex; justify-content: center; padding: 14px 28px; }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
	.tcd-drawer { width: 100%; max-width: 100%; }
	.tcd-title { font-size: 16px; }
	/* Man hinh hep: anh nho lai chut de chua tram ten/gia (van to hon ban cu 58px) */
	.tcd-body { padding: 18px 14px; }
	.tcd-item { padding: 13px; gap: 12px; }
	.tcd-thumb { flex: 0 0 72px; }
	.tcd-thumb img { width: 72px; height: 72px; }
	.tcd-name { font-size: 13.5px; }
	.tcd-cross-thumb { flex: 0 0 54px; }
	.tcd-cross-thumb img { width: 54px; height: 54px; }
}

/* ---------- RTL ---------- */
.rtl .tcd-drawer { right: auto; left: 0; transform: translateX(-100%); box-shadow: 8px 0 40px rgba(0, 0, 0, 0.16); }
.rtl .tcd-drawer.is-open { transform: translateX(0); }
.rtl .tcd-trash { right: auto; left: 11px; }
.rtl .tcd-name { padding-right: 0; padding-left: 24px; }

/* ---------- Override 1 so theme/page ep button{...!important} (vd block trang chu) ---------- */
#tcd-drawer .tcd-close { background: transparent !important; border: 0 !important; border-radius: 0 !important; padding: 0 4px !important; color: #5A5248 !important; text-transform: none !important; box-shadow: none !important; }
#tcd-drawer .tcd-close:hover { color: #1A1814 !important; background: transparent !important; }
#tcd-drawer .tcd-q { background: #fff !important; border: 0 !important; border-radius: 0 !important; padding: 0 !important; color: #1A1814 !important; box-shadow: none !important; text-transform: none !important; }
#tcd-drawer .tcd-q:hover { background: #FAF8F5 !important; color: #9C8E78 !important; }
#tcd-drawer .tcd-trash { background: transparent !important; border: 0 !important; border-radius: 0 !important; padding: 0 !important; color: #B5A99A !important; box-shadow: none !important; }
#tcd-drawer .tcd-trash:hover { color: #C0392B !important; background: transparent !important; }
/* Coupon: ep input & button CUNG cao 46px + bo margin Flatsome tu dong chen (input bi ep 39px + margin-bottom -> lech) */
#tcd-drawer .tcd-coupon-input { height: 46px !important; min-height: 46px !important; margin: 0 !important; box-sizing: border-box !important; line-height: normal !important; border-radius: 2px !important; vertical-align: top !important; }
#tcd-drawer .tcd-coupon-apply { height: 46px !important; min-height: 46px !important; margin: 0 !important; box-sizing: border-box !important; padding: 0 18px !important; background: #2A2620 !important; border: 0 !important; border-radius: 2px !important; color: #fff !important; line-height: normal !important; }
#tcd-drawer .tcd-coupon-apply:hover { background: #9C8E78 !important; }
#tcd-drawer .tcd-cross-add { background: #1A1814 !important; border: 0 !important; border-radius: 50% !important; color: #fff !important; padding: 0 !important; }
#tcd-drawer .tcd-cross-add:hover { background: #9C8E78 !important; }
