/*
 * Custom DTC Cart Drawer — product card styling.
 * Covers both the cart line-item card (.cdc-item) and the recommendation /
 * carousel card (.cdc-carousel-card) used by "Others Also Bought" and the
 * empty-cart bestsellers list. Loaded alongside cart-drawer.css, which owns
 * the --cdc-* token definitions.
 */

/* ---------------------------------------------------------- Shared media */

/*
 * Every product thumbnail sits on a uniform grey tile (--cdc-img-tile) so no
 * product photo floats as a harsh white square, regardless of whether its
 * background is transparent or an opaque white.
 *
 *  - Transparent PNGs: empty pixels show the grey tile through object-fit.
 *  - OPAQUE white backgrounds: a plain tile can't help — the white pixels
 *    cover it. mix-blend-mode:multiply is what fixes those: white (1.0) x
 *    tile-grey ~= tile-grey, so the white background blends into the tile,
 *    while the (darker) product itself is essentially unchanged.
 *
 * isolation:isolate scopes the blend to each tile's own background, so the
 * multiply never reaches through to the drawer's white panel behind it. The
 * only cross-browser wrinkle is the anti-aliased edge of a transparent PNG,
 * which is a minor, acceptable trade for a consistent grey backdrop on every
 * product image.
 */
.cdc-item-thumb,
.cdc-carousel-card__thumb,
.cdc-gift-card-thumb {
	background: var(--cdc-img-tile);
	overflow: hidden;
	flex-shrink: 0;
	isolation: isolate;
}
.cdc-item-thumb img,
.cdc-carousel-card__thumb img,
.cdc-gift-card-thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
	display: block;
	mix-blend-mode: multiply;
}

/* ------------------------------------------------------ Cart line items */

.cdc-item {
	position: relative;
	display: grid;
	grid-template-columns: 76px 1fr;
	gap: 14px;
	padding: 16px 0;
	border-bottom: 1px solid var(--cdc-border);
}
.cdc-item-thumb {
	width: 76px;
	height: 76px;
	border-radius: var(--cdc-radius);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px;
}
.cdc-item-info { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding-right: 28px; }
.cdc-item-name { font-size: 14px; font-weight: 600; margin: 0 0 2px; color: var(--cdc-dark); line-height: 1.3; }
/*
 * Remove/bin — a separate, quiet control from the qty pill (see
 * cart-drawer.js renderItem()), top-right of the row so it never competes
 * visually with the price/qty hierarchy below it. Deliberately subtle
 * (muted grey, no border/background) until hovered — this is a destructive
 * action but a low-stakes, instantly-reversible one (re-adding the product
 * is one tap away), so it doesn't need the weight of a confirm dialog or a
 * loud icon the way "Clear cart" does.
 */
.cdc-cart-root .cdc-item-remove {
	position: absolute;
	top: 16px;
	right: 0;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 24px !important;
	height: 24px !important;
	border: none !important;
	background: transparent !important;
	color: var(--cdc-muted) !important;
	border-radius: 50% !important;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
.cdc-cart-root .cdc-item-remove:hover { background: var(--cdc-tile) !important; color: var(--cdc-dark) !important; }
.cdc-cart-root .cdc-item-remove svg { width: 14px; height: 14px; }
/*
 * Variant pill (e.g. "2.01KG / BANANA CREAM") — real WooCommerce variation
 * attribute text (get_attribute_summary(), untouched), just presented as a
 * small filled badge instead of plain text, matching the reference design.
 * !important on font-weight/size/spacing: the shared Elementor "Meta
 * Typography" control (widgets/trait-cdc-typography-controls.php) targets
 * this selector too, at a higher specificity than this base stylesheet, and
 * its 400/normal-spacing default is right for `.cdc-subscribe-row`'s plain
 * text but wrong for this pill's bolder, uppercase treatment — the pill
 * needs its own explicit weight regardless of that shared setting.
 */
.cdc-item-attrs {
	display: inline-block;
	margin: 0 0 8px;
	padding: 4px 10px;
	background: var(--cdc-tile);
	border-radius: 999px;
	color: var(--cdc-muted);
	font-size: 11px !important;
	font-weight: 700 !important;
	letter-spacing: 0.03em !important;
	text-transform: uppercase;
	line-height: 1.4;
}
.cdc-item-bottom-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cdc-item-price { font-size: 14px; font-weight: 600; color: var(--cdc-dark); }

/*
 * "Was / now" sale pricing — shared by the cart line-item price
 * (CDC_Cart_Data::get_item_price_html(), custom <del>/<ins> markup) and
 * every recommendation/gift card price (WooCommerce's own get_price_html(),
 * which already emits the same <del>/<ins> structure when a product is on
 * sale). One rule set covers both without either PHP path needing to know
 * about the other's markup.
 */
/*
 * !important on color/text-decoration: WooCommerce ships its own global
 * `.price del`/`.price ins` rules (and many themes add their own on top),
 * which can carry equal-or-higher specificity than a plain two-class
 * selector and load after this stylesheet depending on the page — the same
 * "something else out-ranks a plain selector" problem documented at the top
 * of this file for buttons, just via `del`/`ins` instead of the plugin's
 * own classes this time.
 */
.cdc-item-price del,
.cdc-rec-price del {
	color: var(--cdc-muted) !important;
	font-weight: 500 !important;
	font-size: 0.85em;
	text-decoration: line-through !important;
	margin-right: 4px;
}
.cdc-item-price ins,
.cdc-rec-price ins {
	color: var(--cdc-accent) !important;
	font-weight: 700 !important;
	text-decoration: none !important;
}

/*
 * Single pill: [decrement/remove][qty][increment] — no separate trash
 * button. The decrement button's own icon swaps to a trash glyph once
 * quantity is 1 (cart-drawer.js renderItem()), since decrementing further
 * removes the line anyway.
 */
.cdc-item-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--cdc-border);
	border-radius: 999px;
	background: var(--cdc-bg);
}
.cdc-cart-root .cdc-item-qty button {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 30px !important;
	height: 30px !important;
	border: none !important;
	background: transparent !important;
	cursor: pointer;
	font-size: 14px;
	color: var(--cdc-dark) !important;
	border-radius: 50% !important;
	transition: background-color .15s ease;
}
.cdc-cart-root .cdc-item-qty button:hover { background: var(--cdc-tile) !important; }
.cdc-item-qty button svg { width: 14px; height: 14px; flex-shrink: 0; }
.cdc-item-qty span { width: 22px; text-align: center; font-size: 13px; font-weight: 600; }

/* Badge — matches .cepg-badge (product-grid.css): solid pill, uppercase, brand accent */
.cdc-item-gift-badge {
	display: inline-block;
	align-self: flex-start;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #fff;
	background: var(--cdc-accent);
	padding: 5px 10px;
	border-radius: 6px;
	margin-bottom: 6px;
	line-height: 1.2;
}

/* Subscribe & save (dormant placeholder) */
.cdc-subscribe-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--cdc-muted); }
.cdc-toggle { position: relative; width: 32px; height: 18px; border-radius: 999px; background: var(--cdc-border); flex-shrink: 0; cursor: pointer; transition: background-color .15s ease; }
.cdc-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.cdc-toggle.is-on { background: var(--cdc-accent); }
.cdc-toggle.is-on::after { transform: translateX(14px); }

@media (prefers-reduced-motion: reduce) {
	.cdc-toggle, .cdc-toggle::after { transition: none; }
}

/* ------------------------------------------------- Recommendation cards */

/* Plain vertical stack — empty-cart bestsellers. No carousel: this is the
   only content in the drawer at that point, so there's nothing to swipe
   between vs. simply scrolling the list. */
.cdc-rec-list { display: flex; flex-direction: column; gap: 14px; }

/*
 * Bordered white card, matching the checkout page's own "You may also like"
 * upsell cards (.rf-checkout-upsell__item) exactly — same white background
 * + light grey border treatment, rather than this component's previous
 * solid-grey-fill/no-border look, so the two touchpoints read as one
 * consistent design rather than two different card styles. Thumbnail left,
 * name/price/flavour middle, a black-outline pill button on the right. Used
 * both inside the "Others Also Bought" carousel and the empty-cart list, so
 * the card styling itself carries no scroll assumptions.
 */
/*
 * Flat grey fill (#f4f5f7, same as --cdc-tile), no border — smaller/less
 * "chunky" than the previous white+bordered card: less padding, tighter
 * gap, smaller radius, smaller thumbnail. Confirmed by the user live that
 * the bordered white version (matching checkout's upsell cards) read as
 * too heavy for this narrower drawer context.
 */
.cdc-carousel-card {
	display: flex;
	align-items: center;
	gap: 10px;
	height: 100%;
	min-width: 0;
	padding: 8px;
	background: #f4f5f7;
	border: none;
	border-radius: 12px;
}

.cdc-carousel-card__thumb {
	width: 56px;
	height: 56px;
	flex-shrink: 0;
	border-radius: calc(var(--cdc-radius) - 4px);
	/* Card and thumb are now the same flat grey by design (#f4f5f7 on both)
	   — a plain product photo still reads fine without a separate tile
	   boundary at this smaller size. */
	background: var(--cdc-tile);
}

.cdc-carousel-card__body { display: flex; flex-direction: column; flex: 1 1 auto; gap: 3px; min-width: 0; }
.cdc-rec-name {
	font-size: 13px;
	font-weight: 600;
	margin: 0;
	color: var(--cdc-dark);
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
/*
 * 500, matching checkout's .rf-checkout-upsell__price — was 700 here, which
 * read noticeably heavier/bolder side by side with the checkout version.
 * !important: the Elementor "Price Typography" control (widgets/trait-cdc-
 * typography-controls.php) shares ONE font-weight setting across BOTH
 * .cdc-item-price and .cdc-rec-price — bumped to 700 to correctly match
 * checkout's cart-item price weight (see cart-drawer.css's own note), which
 * would otherwise drag this recommendation-card price to 700 right along
 * with it. This override keeps the two prices at the two different weights
 * checkout actually uses for each.
 */
.cdc-rec-price { font-size: 13px; font-weight: 500 !important; color: var(--cdc-dark); margin: 0; }

.cdc-rec-flavor {
	width: auto;
	max-width: 100%;
	font-size: 11px;
	font-family: inherit;
	border: 1px solid var(--cdc-border);
	border-radius: 6px;
	padding: 5px 24px 5px 8px;
	background-color: var(--cdc-bg);
	color: var(--cdc-dark);
	margin-top: 4px;
}

/*
 * Add — a plain black-outline pill (not a filled brand-colour button): the
 * reference design keeps recommendation-row CTAs minimal and lets the
 * checkout button carry the only filled/brand-coloured action in the
 * drawer. Inverts to a solid fill on hover for feedback. !important on the
 * core visual properties for the same theme-override reason as every other
 * button in this plugin — see the note at the top of cart-drawer.css.
 */
.cdc-cart-root .cdc-rec-add {
	flex-shrink: 0;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	height: auto !important;
	width: auto !important;
	border: 1.5px solid var(--cdc-dark) !important;
	background: transparent !important;
	color: var(--cdc-dark) !important;
	border-radius: 999px !important;
	padding: 0 20px;
	font-size: 11px;
	font-family: inherit;
	font-weight: 600;
	white-space: nowrap !important;
	letter-spacing: .06em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
.cdc-cart-root .cdc-rec-add:hover { background: var(--cdc-dark) !important; color: #fff !important; }
.cdc-rec-add[disabled] { opacity: .6; cursor: not-allowed; }

@media (max-width: 380px) {
	.cdc-carousel-card { gap: 10px; }
	.cdc-rec-add { padding: 0 14px; font-size: 10px; }
}

/* ------------------------------------------------------- Free gift picker */

/*
 * Collapsed behind a button by default (auto-expanded once a gift has
 * actually been chosen) — same grid-template-rows collapse technique as the
 * discount-code toggle in cart-drawer.css, but styled boldly in the accent
 * colour rather than muted: unlike the coupon link, this is a positive,
 * high-value action worth surfacing rather than downplaying.
 */
.cdc-gift-picker { padding: 18px 0; border-bottom: 1px solid var(--cdc-border); }

/*
 * The toggle reads as a section heading (matching "Your Cart" weight/scale),
 * not a small inline link — a free gift is a high-value reward worth
 * presenting prominently. A pure-CSS chevron driven off aria-expanded (which
 * the JS already toggles) gives an open/close affordance with no markup change.
 */
.cdc-cart-root .cdc-gift-toggle {
	display: flex !important;
	align-items: center;
	gap: 10px;
	width: 100% !important;
	height: auto !important;
	background: none !important;
	border: none !important;
	padding: 0;
	font-family: var(--cdc-font) !important;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.01em;
	white-space: nowrap !important;
	color: var(--cdc-accent) !important;
	cursor: pointer;
}
.cdc-gift-toggle-icon { font-size: 18px; line-height: 1; }
.cdc-cart-root .cdc-gift-toggle::after {
	content: "";
	margin-left: auto;
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
	transition: transform .2s ease;
	opacity: .85;
}
.cdc-cart-root .cdc-gift-toggle[aria-expanded="true"]::after {
	transform: rotate(-135deg) translateY(-2px);
}

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

.cdc-gift-list { display: flex; flex-direction: column; gap: 10px; }

/*
 * Gift cards mirror the cart line-item language — same grey image tile, same
 * name weight, same radius — but sit in a bordered card that lifts on hover,
 * so the reward reads as selectable and distinct from the items being bought.
 */
.cdc-gift-card {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px;
	background: var(--cdc-card-bg);
	border: 1px solid var(--cdc-border);
	border-radius: var(--cdc-radius);
	transition: border-color .15s ease, box-shadow .15s ease;
}
.cdc-gift-card:hover {
	border-color: var(--cdc-accent);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}
.cdc-gift-card-thumb {
	width: 64px;
	height: 64px;
	flex-shrink: 0;
	border-radius: calc(var(--cdc-radius) - 2px);
	overflow: hidden;
	padding: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.cdc-gift-card-body { flex: 1 1 auto; min-width: 0; }
.cdc-gift-card-name { margin: 0; font-size: 14px; font-weight: 600; color: var(--cdc-dark); line-height: 1.35; }

/*
 * Flavour choice as tap-pills, not a second <select> — one native form
 * control's inconsistent cross-browser rendering was already the reason the
 * product list above isn't a <select>; a flavour dropdown nested inside it
 * would just reintroduce the exact same problem one level down.
 */
.cdc-gift-card-flavors { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.cdc-pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cdc-cart-root .cdc-pill {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: auto !important;
	height: auto !important;
	border: 1px solid var(--cdc-border) !important;
	background: var(--cdc-bg) !important;
	color: var(--cdc-dark) !important;
	border-radius: 999px !important;
	padding: 5px 12px;
	font-size: 11px;
	font-family: inherit;
	font-weight: 600;
	white-space: nowrap !important;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.cdc-cart-root .cdc-pill.is-active {
	background: var(--cdc-dark) !important;
	border-color: var(--cdc-dark) !important;
	color: #fff !important;
}

.cdc-cart-root .cdc-gift-card-select {
	flex-shrink: 0;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	height: auto !important;
	width: auto !important;
	min-height: 38px;
	border: 1.5px solid var(--cdc-accent) !important;
	background: var(--cdc-accent) !important;
	color: var(--cdc-btn-color) !important;
	border-radius: 999px !important;
	padding: 0 20px;
	font-size: 11px;
	font-family: inherit;
	font-weight: 700;
	white-space: nowrap !important;
	letter-spacing: .06em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.cdc-cart-root .cdc-gift-card-select:hover:not(:disabled) {
	background: var(--cdc-btn-hover-bg) !important;
	border-color: var(--cdc-btn-hover-bg) !important;
	color: #fff !important;
}
/* Chosen gift: settled dark state, clearly different from the accent CTA. */
.cdc-cart-root .cdc-gift-card-select.is-selected {
	background: var(--cdc-dark) !important;
	border-color: var(--cdc-dark) !important;
	color: #fff !important;
	cursor: default;
}
.cdc-gift-card.is-chosen,
.cdc-gift-card:has(.cdc-gift-card-select.is-selected) {
	border-color: var(--cdc-dark);
}

@media (prefers-reduced-motion: reduce) {
	.cdc-gift-collapse { transition: none; }
}
