/* CHXN component: flying cart — slide-in drawer from the right, replaces
   the standalone /gio-hang/ page in the site's flow. Loaded site-wide
   (add-to-cart can happen from the shop archive, home, related products,
   or the single product page). Markup lives in footer.php; opened/closed
   by modules/flying-cart.js. */

/* ".single_add_to_cart_button.loading" (modules/flying-cart.js's
   setupAjaxAddToCart(), toggled for the whole AJAX round-trip) had no
   THEME css at all for it — but WooCommerce's own core "woocommerce.css"
   already ships a bare, unscoped ".loading{opacity:.25}" rule (plus a
   "::after" spinner using its own icon font, positioned "absolute" with no
   "position:relative" anchor anywhere on this button, so it rendered
   off in a corner instead of visibly on the button) — between the two,
   clicking "Thêm vào giỏ" just quietly faded the button with no visible
   spinner, feeling stuck/unresponsive for the ~1 second the request takes
   (especially noticeable in quick view, which has no other on-page
   feedback the way the single product page still does). Text/icon hidden
   in place (not removed, so the button doesn't reflow/change size) behind
   a proper spinner instead, with WC's own opacity dim cancelled out. */
.single_add_to_cart_button.loading {
	position: relative;
	color: transparent !important;
	opacity: 1 !important;
	pointer-events: none;
}
.single_add_to_cart_button.loading img {
	opacity: 0;
}
.single_add_to_cart_button.loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	border: 2.5px solid rgba(255, 255, 255, .45);
	border-top-color: #fff;
	border-radius: 50%;
	animation: chxn-cart-btn-spin .6s linear infinite;
}
@keyframes chxn-cart-btn-spin {
	to { transform: rotate(360deg); }
}

.chxn-flying-cart-overlay {
	position: fixed;
	inset: 0;
	background: rgba(13, 30, 22, .45);
	z-index: 900;
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility 0s linear .25s;
}
.chxn-flying-cart {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: 400px;
	max-width: 92vw;
	background: var(--chxn-card);
	z-index: 901;
	display: flex;
	flex-direction: column;
	box-shadow: -12px 0 34px rgba(0, 0, 0, .18);
	transform: translateX(100%);
	transition: transform .28s ease;
}
body.chxn-flying-cart-open .chxn-flying-cart-overlay {
	opacity: 1;
	visibility: visible;
	transition: opacity .25s ease;
}
body.chxn-flying-cart-open .chxn-flying-cart {
	transform: translateX(0);
}
body.chxn-flying-cart-open {
	overflow: hidden;
}

.chxn-flying-cart-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 22px;
	border-bottom: 1px solid var(--chxn-line);
	flex: none;
}
.chxn-flying-cart-head h2 {
	font-size: 17px;
	font-weight: 800;
	margin: 0;
}
.chxn-flying-cart-close {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 0;
	background: var(--chxn-bg);
	color: var(--chxn-ink-2);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.chxn-flying-cart-close:hover {
	background: var(--chxn-line);
	color: var(--chxn-ink);
}

/* the coupon box / subtotal / checkout button (".chxn-flying-cart-footer"
   below) stay fixed at the bottom of the drawer, with only the item list
   itself scrolling underneath them — so ".chxn-flying-cart-body" is just
   a flex column holding those 2 pieces, not the scroll container itself. */
.chxn-flying-cart-body {
	flex: 1;
	min-height: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.chxn-flying-cart-empty {
	color: var(--chxn-ink-2);
	font-size: 14px;
	text-align: center;
	margin: 40px 22px;
}
.chxn-flying-cart-items-scroll {
	flex: 1;
	overflow-y: auto;
	padding: 18px 22px;
}
/* the individual pieces below (coupons list, form, total, checkout
   button) each used to carry their own "margin-top" tuned for sitting
   inline among the scrolling items — now that they're grouped in their
   own fixed footer, a single flex "gap" replaces that so the spacing
   stays consistent regardless of which pieces are present (e.g. no
   coupons applied yet). */
.chxn-flying-cart-footer {
	flex: none;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px 22px 22px;
	border-top: 1px solid var(--chxn-line);
}
.chxn-flying-cart-footer .chxn-flying-cart-coupons,
.chxn-flying-cart-footer .chxn-flying-cart-coupon-form,
.chxn-flying-cart-footer .chxn-flying-cart-coupon-msg,
.chxn-flying-cart-footer .chxn-flying-cart-total {
	margin-top: 0;
}
/* an empty ".chxn-flying-cart-coupon-msg" (no message yet) would still
   claim a "gap" slot in the footer's flex column otherwise, showing as a
   stray blank gap between the form and the total. */
.chxn-flying-cart-coupon-msg:empty {
	display: none;
}

.chxn-flying-cart-items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.chxn-flying-cart-item {
	position: relative;
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding-right: 20px;
}
.chxn-flying-cart-item-remove {
	position: absolute;
	top: 0;
	right: 0;
	width: 20px;
	height: 20px;
	border: 0;
	background: none;
	color: var(--chxn-ink-2);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	font-family: inherit;
	display: flex;
	align-items: center;
	justify-content: center;
}
.chxn-flying-cart-item-remove:hover {
	color: var(--chxn-red);
}
.chxn-flying-cart-item-thumb img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 10px;
	border: 1px solid var(--chxn-line);
	display: block;
}
.chxn-flying-cart-item-body {
	flex: 1;
	min-width: 0;
}
.chxn-flying-cart-item-name {
	display: block;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--chxn-ink);
	text-decoration: none;
	line-height: 1.35;
}
.chxn-flying-cart-item-meta {
	font-size: 12.5px;
	color: var(--chxn-ink-2);
	margin-top: 4px;
	display: flex;
	gap: 6px;
}
.chxn-flying-cart-item-subtotal {
	font-size: 13.5px;
	font-weight: 800;
	color: var(--chxn-red);
	flex: none;
}

.chxn-flying-cart-item-qty {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
}
.chxn-flying-cart-qty-btn {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 1.5px solid var(--chxn-green);
	background: var(--chxn-green-l);
	color: var(--chxn-green-d);
	font-weight: 800;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	font-family: inherit;
}
.chxn-flying-cart-qty-btn:hover {
	background: var(--chxn-green);
	color: #fff;
}
.chxn-flying-cart-qty-btn:disabled {
	opacity: .4;
	cursor: not-allowed;
}
.chxn-flying-cart-qty-val {
	min-width: 18px;
	text-align: center;
	font-weight: 700;
	font-size: 13px;
	color: var(--chxn-ink);
}

.chxn-flying-cart-coupons {
	list-style: none;
	margin: 16px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.chxn-flying-cart-coupons li {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--chxn-green-l);
	color: var(--chxn-green-d);
	font-size: 12.5px;
	font-weight: 700;
	padding: 7px 10px;
	border-radius: var(--chxn-radius-pill);
}
.chxn-flying-cart-coupon-remove {
	margin-left: auto;
	border: 0;
	background: none;
	color: var(--chxn-green-d);
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	font-family: inherit;
}

.chxn-flying-cart-coupon-form {
	display: flex;
	gap: 8px;
	margin-top: 16px;
}
.chxn-flying-cart-coupon-form input {
	flex: 1;
	border: 1.5px solid var(--chxn-line);
	border-radius: var(--chxn-radius-input);
	padding: 10px 14px;
	font-size: 13px;
	font-family: inherit;
	min-width: 0;
}
.chxn-flying-cart-coupon-form button {
	flex: none;
	border: 0;
	border-radius: var(--chxn-radius-input) !important;
	background: var(--chxn-ink);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	padding: 10px 16px;
	cursor: pointer;
	font-family: inherit;
}
.chxn-flying-cart-coupon-form button:hover {
	background: var(--chxn-green-d);
}
.chxn-flying-cart-coupon-msg {
	font-size: 12.5px;
	margin-top: 8px;
}
.chxn-flying-cart-coupon-msg .woocommerce-message {
	color: var(--chxn-green-d);
}
.chxn-flying-cart-coupon-msg .woocommerce-error {
	color: var(--chxn-red);
}

.chxn-flying-cart-total {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px dashed var(--chxn-line);
	font-size: 14px;
}
.chxn-flying-cart-total strong {
	color: var(--chxn-red);
	font-size: 19px;
}

.chxn-flying-cart-checkout {
	display: block;
	text-align: center;
	margin-top: 18px;
	background: var(--chxn-green);
	color: #fff;
	text-decoration: none;
	border-radius: var(--chxn-radius-pill);
	padding: 15px;
	font-size: 15px;
	font-weight: 700;
}
.chxn-flying-cart-checkout:hover {
	background: var(--chxn-green-d);
}
