/**
 * Pharma Plus gift frontend styles.
 *
 * Theme friendly: the progress fill uses the active theme's primary color
 * via CSS variables (WoodMart exposes --wd-primary-color), falling back to a
 * neutral admin-ish blue otherwise. Layout uses logical properties so it
 * mirrors correctly in RTL storefronts.
 */

/* ---------------------------------------------------------------------------
 * Threshold progress bar (cart page + mini cart)
 * ------------------------------------------------------------------------- */
.pp-gift-progress {
	--pp-gift-accent: var(--wd-primary-color, #2271b1);
	--pp-gift-track: rgba(0, 0, 0, 0.07);
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 8px;
	padding: 12px 14px;
}

.pp-gift-progress--mini {
	padding: 10px 12px;
	border-radius: 6px;
	margin: 4px 0;
}

.pp-gift-progress--cart {
	margin: 0 0 22px;
}

.pp-gift-msg {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.6;
	margin: 0 0 8px;
	color: #1d2327;
}

.pp-gift-progress--mini .pp-gift-msg {
	font-size: 12px;
}

.pp-gift-track {
	background: var(--pp-gift-track);
	border-radius: 999px;
	height: 8px;
	overflow: hidden;
}

.pp-gift-progress--mini .pp-gift-track {
	height: 7px;
}

.pp-gift-fill {
	/* The width is the one value only PHP knows at render time, so it arrives as
	 * a custom property and the styling stays here. */
	width: var(--pp-gift-width, 0%);
	background: linear-gradient(90deg, var(--pp-gift-accent), color-mix(in srgb, var(--pp-gift-accent) 70%, #fff));
	border-radius: 999px;
	height: 100%;
	transition: width 0.35s ease;
}

@supports not (color: color-mix(in srgb, red, blue)) {
	.pp-gift-fill {
		background: var(--pp-gift-accent);
	}
}

.pp-gift-product {
	align-items: center;
	display: flex;
	gap: 10px;
	margin-top: 10px;
}

.pp-gift-product-thumb {
	display: inline-flex;
	flex: 0 0 auto;
}

.pp-gift-product-thumb img {
	border-radius: 6px;
	display: block;
	height: auto;
	max-width: 44px;
	object-fit: cover;
}

.pp-gift-product-name {
	color: #3f434a;
	font-size: 12px;
	line-height: 1.5;
}

/* ---------------------------------------------------------------------------
 * Product page notice: "free gift with this product"
 * ------------------------------------------------------------------------- */
.pp-gift-notice {
	align-items: flex-start;
	background: linear-gradient(180deg, #ffffff, #f8fafc);
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-inline-start: 3px solid var(--pp-gift-accent, #2271b1);
	border-radius: 10px;
	display: flex;
	gap: 12px;
	margin: 0 0 18px;
	padding: 14px 16px;
}

.pp-gift-notice-icon {
	font-size: 26px;
	line-height: 1;
	margin-top: 2px;
}

.pp-gift-notice-body {
	min-width: 0;
}

.pp-gift-notice-title {
	color: #1d2327;
	font-size: 14px;
	font-weight: 700;
	margin: 0 0 10px;
}

.pp-gift-notice-gift {
	align-items: center;
	display: flex;
	gap: 12px;
}

.pp-gift-notice-thumb {
	display: inline-flex;
	flex: 0 0 auto;
}

.pp-gift-notice-thumb img {
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 8px;
	display: block;
	height: auto;
	max-width: 64px;
	object-fit: cover;
}

.pp-gift-notice-meta {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.pp-gift-notice-name {
	color: #1d2327;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

.pp-gift-notice-name:hover {
	text-decoration: underline;
}

.pp-gift-notice-value {
	color: #3f434a;
	font-size: 12px;
}

.pp-gift-notice-rule {
	color: #8c8f94;
	font-size: 12px;
}

@media (max-width: 480px) {
	.pp-gift-notice-gift {
		align-items: flex-start;
		flex-direction: column;
		gap: 8px;
	}
}

/* ---------------------------------------------------------------------------
 * The gift line in the cart
 *
 * A gift is a line the engine added, not one the customer chose, so it says so
 * and its remove control is withheld. The marker replaces that control with a
 * muted dash rather than an empty cell: the column keeps its width, and a reader
 * can tell the difference between "deliberately withheld" and "failed to render".
 * ------------------------------------------------------------------------- */
.pp-gift-line-badge {
	display: inline-block;
	margin-inline-start: 6px;
	padding: 1px 8px;
	border: 1px solid #b8e0bf;
	border-radius: 999px;
	background: #f3fbf4;
	color: #1d5c28;
	font-size: 11px;
	line-height: 1.8;
	vertical-align: middle;
	white-space: nowrap;
}

.pp-gift-line-locked {
	display: inline-block;
	color: #a7aaad;
	cursor: default;
	font-size: 16px;
	line-height: 1;
}

/* The Cart block prints the same badge through the item-data filter; it has no
 * remove control for us to replace, so only the marker's spacing is adjusted
 * there. */
.wc-block-cart-item__info .pp-gift-line-badge {
	margin-inline-start: 0;
}

/* ---------------------------------------------------------------------------
 * The Cart block's gift line
 *
 * `pp-gift-line` is put on the row by pp-gift-cart.js, which finds it from the
 * badge above rather than from an assumed class path. The remove control goes and
 * a dash takes its place, matching what the classic cart does on the server, so a
 * customer on either cart sees the same thing.
 * ------------------------------------------------------------------------- */
.wc-block-cart .pp-gift-line .wc-block-cart-item__remove-link,
.wc-block-cart .pp-gift-line .wc-block-cart-item__save-for-later {
	display: none;
}

/* The dash takes the button's place rather than being appended to the row: the
 * remove control sits inside the quantity cell, so a marker there lands exactly
 * where the "×" was and the row keeps its shape. The quantity stepper stays — the
 * gift's quantity is the engine's business, but hiding the field would make the
 * row look half-rendered. */
.wc-block-cart .pp-gift-line .wc-block-cart-item__quantity::after {
	content: "—";
	display: block;
	color: #a7aaad;
	font-size: 16px;
	line-height: 1;
}

/* ---------------------------------------------------------------------------
 * Gift choice
 *
 * Only shown when more than one single-mode threshold gift is eligible. The
 * cards use the same neutral surface as the progress bar; the selected card
 * uses the theme's primary colour, with no product-page-specific styling.
 * ------------------------------------------------------------------------- */
.pp-gift-choice {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 8px;
	margin: 0 0 22px;
	padding: 14px;
}

.pp-gift-choice__title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.6;
	margin: 0 0 4px;
}

.pp-gift-choice__intro {
	color: #50575e;
	font-size: 13px;
	line-height: 1.7;
	margin: 0 0 12px;
}

.pp-gift-choice__options {
	display: grid;
	gap: 8px;
}

.pp-gift-choice__option {
	align-items: center;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 7px;
	cursor: pointer;
	display: flex;
	gap: 10px;
	padding: 9px 10px;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.pp-gift-choice__option:has(input:checked) {
	background: color-mix(in srgb, var(--pp-gift-accent) 5%, #fff);
	border-color: var(--pp-gift-accent);
}

.pp-gift-choice__option input {
	accent-color: var(--pp-gift-accent);
	flex: 0 0 auto;
	margin: 0;
}

.pp-gift-choice__thumb {
	display: inline-flex;
	flex: 0 0 auto;
}

.pp-gift-choice__img {
	border-radius: 5px;
	display: block;
	height: auto;
	max-width: 42px;
	object-fit: cover;
}

.pp-gift-choice__body {
	align-items: center;
	display: flex;
	flex: 1 1 auto;
	gap: 8px;
	justify-content: space-between;
	min-width: 0;
}

.pp-gift-choice__name {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.5;
	overflow-wrap: anywhere;
}

.pp-gift-choice__free {
	color: #16a34a;
	flex: 0 0 auto;
	font-size: 12px;
	font-weight: 700;
}

.pp-gift-choice__message {
	font-size: 12px;
	line-height: 1.6;
	margin: 8px 0 0;
	min-height: 1em;
}

.pp-gift-choice__message.is-error {
	color: #b3261e;
}

.pp-gift-choice.is-loading {
	opacity: 0.75;
}

.pp-gift-choice__noscript {
	font-size: 13px;
	margin: 10px 0 2px;
}

/* WoodMart/Elementor set img max-width:100% with a stronger selector; keep
   the choice thumbnail at the intended small size. */
.pp-gift-choice .pp-gift-choice__thumb .pp-gift-choice__img {
	height: 42px;
	max-width: 42px;
	width: 42px;
}

/* Some checkout themes hide every h3; the chooser's own heading must stay. */
.pp-gift-choice .pp-gift-choice__title {
	display: block !important;
}
