/*
 * Custom DTC Cart Drawer — sticky footer: totals, coupon entry, checkout,
 * continue-shopping link, trust badges. Split out of cart-drawer.css purely
 * to keep both files a readable size; shares --cdc-* tokens defined there,
 * so this file must load after it (see PHP register_assets()).
 */

/*
 * Sticky footer — kept as compact as the primary actions allow (totals,
 * coupon link, checkout, continue-shopping, badges) since every pixel here
 * is pixel the scrollable item list above doesn't get.
 */
.cdc-footer {
	position: sticky;
	bottom: 0;
	z-index: 2;
	background: var(--cdc-bg);
	border-top: 1px solid var(--cdc-border);
	padding: 10px 20px 12px;
	flex-shrink: 0;
}

/*
 * Nothing to check out with an empty cart — the whole footer (subtotal,
 * coupon, checkout) hides rather than showing a £0.00 total and a button
 * with nowhere useful to go. The empty carousel container is hidden too so
 * clearing its content (cart-drawer.js afterCartChanged()) doesn't still
 * leave behind its own empty vertical padding.
 */
.cdc-cart-root.cdc-is-empty .cdc-footer,
.cdc-cart-root.cdc-is-empty .cdc-upsell {
	display: none;
}

/*
 * Coupon — collapsed by default behind a toggle link, and deliberately
 * low-contrast (muted grey, not the drawer's near-black text color): this
 * sits right beneath the subtotal so a shopper who already has a code can
 * still find it, but it shouldn't compete with the checkout button right
 * below for an impulsive buyer's attention.
 */
.cdc-cart-root .cdc-coupon-toggle {
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
	width: auto !important;
	height: auto !important;
	background: none !important;
	border: none !important;
	padding: 0;
	margin: 2px 0 10px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap !important;
	color: var(--cdc-muted) !important;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}
.cdc-cart-root .cdc-coupon-toggle:hover { color: var(--cdc-dark) !important; }
.cdc-coupon-toggle-icon {
	display: inline-block;
	transition: transform .2s ease;
}
.cdc-coupon-toggle[aria-expanded="true"] .cdc-coupon-toggle-icon { transform: rotate(45deg); }

.cdc-coupon-collapse {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows .25s ease;
}
.cdc-coupon-collapse.is-open { grid-template-rows: 1fr; }
.cdc-coupon-collapse-inner { overflow: hidden; }

.cdc-coupon-form { display: flex; gap: 8px; margin-bottom: 10px; padding-top: 2px; }
.cdc-cart-root .cdc-coupon-input {
	flex: 1;
	-webkit-appearance: none;
	appearance: none;
	border: 1px solid var(--cdc-border) !important;
	border-radius: 999px !important;
	padding: 10px 16px;
	font-size: 13px;
	font-family: inherit;
	color: var(--cdc-dark);
	background: var(--cdc-bg);
	box-shadow: none !important;
	outline: none !important;
	transition: border-color .15s ease;
}
/*
 * A border-color change reads as "focused" without the thick halo the
 * generic :focus-visible outline (cart-drawer.css) draws around every other
 * interactive element — a plain text field doesn't need that much emphasis.
 * Both :focus and :focus-visible are covered (not just the latter) since
 * :focus-visible support/matching behaviour still isn't fully consistent
 * across browser versions, and !important guarantees this wins over the
 * generic rule regardless of source order.
 */
.cdc-cart-root .cdc-coupon-input:focus,
.cdc-cart-root .cdc-coupon-input:focus-visible {
	outline: none !important;
	box-shadow: none !important;
	border-color: var(--cdc-accent) !important;
}
.cdc-cart-root .cdc-coupon-apply {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: auto !important;
	height: auto !important;
	border: 1px solid var(--cdc-dark) !important;
	background: transparent !important;
	color: var(--cdc-dark) !important;
	border-radius: 999px !important;
	padding: 0 18px;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap !important;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
.cdc-cart-root .cdc-coupon-apply:hover { background: var(--cdc-dark) !important; color: #fff !important; }
.cdc-coupon-error { color: #C0392B; font-size: 12px; margin: -4px 0 10px; }

/*
 * Totals box — bordered card: Subtotal, any Discount line(s), Shipping,
 * a divider, then Total. Kept visually distinct from the coupon-code
 * section above it so the two don't read as one long list.
 */
.cdc-totals-box {
	border: 1px solid var(--cdc-border);
	border-radius: var(--cdc-radius);
	padding: 8px 12px;
	margin-bottom: 8px;
}
.cdc-totals-line {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 10px;
	font-size: 12px;
	color: var(--cdc-dark);
	padding: 2px 0;
}
.cdc-totals-line--discount { color: #2E7D32; }
.cdc-totals-line--discount span:last-child { color: #2E7D32; font-weight: 600; }
.cdc-totals-shipping-free { color: var(--cdc-accent); font-weight: 700; }
.cdc-totals-divider { border-top: 1px solid var(--cdc-border); margin: 5px 0; }
.cdc-totals-line--total {
	font-size: 14px;
	font-weight: 600;
	padding: 1px 0;
}

/* Checkout button — bold, icon + label, matching the reference's emphasis on this being THE primary action in the footer, sized down from its original padding so the footer doesn't dominate the drawer */
.cdc-cart-root .cdc-checkout-btn {
	width: 100% !important;
	height: auto !important;
	background: var(--cdc-btn-bg) !important;
	color: var(--cdc-btn-color) !important;
	border: none !important;
	border-radius: var(--cdc-btn-radius) !important;
	padding: 12px 20px;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap !important;
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	gap: 10px;
	transition: background-color .2s ease, transform .15s ease;
}
.cdc-cart-root .cdc-checkout-btn:hover { background: var(--cdc-btn-hover-bg) !important; transform: translateY(-1px); }
.cdc-checkout-icon { flex-shrink: 0; }

/* Continue Shopping — plain underlined link below Checkout, always present (not just the empty-cart state) */
.cdc-cart-root .cdc-footer-continue {
	display: block !important;
	width: 100% !important;
	height: auto !important;
	margin: 8px 0 0;
	padding: 0 !important;
	background: none !important;
	border: none !important;
	color: var(--cdc-dark) !important;
	font-size: 12px;
	font-weight: 600;
	text-align: center;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}
.cdc-cart-root .cdc-footer-continue:hover { color: var(--cdc-accent) !important; }

/* Trust badges */
.cdc-trust-badges {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
}
.cdc-badge { display: inline-flex; line-height: 0; }
.cdc-badge svg { display: block; border-radius: 5px; }
/*
 * !important because an uploaded badge (a merchant's own gateway artwork,
 * arbitrary native resolution) otherwise renders at full size and blows out
 * the whole footer — the same "theme/global CSS can out-rank a plain
 * selector" problem cart-drawer.css documents for buttons, just triggered
 * here by the image's own intrinsic dimensions instead of a theme rule.
 */
.cdc-badge img {
	display: block !important;
	height: 26px !important;
	width: auto !important;
	max-width: 44px !important;
	object-fit: contain !important;
	border-radius: 5px !important;
}
.cdc-badge--text {
	line-height: 1.2;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .02em;
	color: var(--cdc-dark);
	border: 1px solid var(--cdc-border);
	border-radius: 5px;
	padding: 4px 8px;
	background: var(--cdc-tile);
}
