/**
 * IGSHOP Shop Kit — combo chip, combo box, and the flash sale sold bar.
 *
 * Only this plugin's own classes are styled here, so the file changes
 * nothing on a page that shows none of them.
 *
 * Colours are read in this order:
 *   1. The plugin's own settings (IGSHOP: Combo & Flash Sale), printed on
 *      :root as --qav-combo-accent and --qav-sold-color when set.
 *   2. The IGSHOP Store theme's brand colours (--igs-accent, --igs-sale,
 *      --igs-soft, --igs-lines, --igs-text).
 *   3. The built-in hex, for a site with neither.
 *
 * Every value worth changing is a custom property. Example override:
 *
 *   .qav-combo-chip { --qav-combo-chip-bottom: 16px; }
 *   .qav-sold-bar   { --qav-sold-bar-height: 8px; }
 */

/* ---------------------------------------------------------------------------
   Combo chip — on the product card photo
   Printed inside the .qav-thumb box around the image, so it is positioned
   against the photo itself, never the whole card.
   --------------------------------------------------------------------------- */

.qav-combo-chip {
	--qav-combo-chip-bottom: 12px;

	position: absolute;
	left: 50%;
	bottom: var(--qav-combo-chip-bottom);
	z-index: 3;
	max-width: calc(100% - 16px);
	padding: 3px 8px;
	overflow: hidden;
	transform: translateX(-50%);
	font-size: 10.5px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.06em;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: var(--qav-combo-chip-color, var(--igs-text, #3a332b));
	background: var(--qav-combo-chip-bg, rgba(255, 255, 255, 0.92));
	border: 1px solid rgba(0, 0, 0, 0.06);
	/* A label only: taps still reach the product link underneath. */
	pointer-events: none;
}

/* Size pills along the bottom of the same photo: sit the chip just above
   one row of them instead of on top of them. */
.qav-sizes--bottom-left ~ .qav-combo-chip,
.qav-sizes--bottom-center ~ .qav-combo-chip,
.qav-sizes--bottom-right ~ .qav-combo-chip {
	--qav-combo-chip-bottom: calc(var(--qav-inset, 0.625rem) + 26px);
}

@media (max-width: 767px) {
	.qav-combo-chip {
		--qav-combo-chip-bottom: 8px;

		padding: 2px 6px;
		font-size: 9.5px;
	}
}

/* ---------------------------------------------------------------------------
   Combo box — above the add to cart form on the product page
   --------------------------------------------------------------------------- */

.qav-combo-box {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin: 18px 0 20px;
	padding: 12px 14px;
	color: var(--qav-combo-box-color, var(--igs-text, inherit));
	background: var(--qav-combo-box-bg, var(--igs-soft, #f7f5f2));
	border: 1px solid var(--qav-combo-box-border, var(--igs-lines, #e6e1d9));
}

.qav-combo-box__icon {
	flex: none;
	margin-top: 1px;
	line-height: 0;
	color: var(--qav-combo-accent, var(--igs-accent, var(--qav-brand-accent, var(--e-global-color-accent, #8c6a36))));
}

.qav-combo-box__text {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.5;
}

.qav-combo-box__title {
	display: block;
	font-weight: 600;
}

/* During a flash sale the box says the combo does not apply; the icon
   takes the sale colour so it reads as a notice, not an offer. */
.qav-combo-box--flash .qav-combo-box__icon {
	color: var(--qav-sold-color, var(--igs-sale, #d0021b));
}

/* ---------------------------------------------------------------------------
   Flash sale sold bar — "65% sold" / "Only 3 left"
   The label and the fill both use currentColor, so one colour setting
   (Sold bar colour) drives the whole bar.
   --------------------------------------------------------------------------- */

.qav-sold-bar {
	--qav-sold-bar-height: 6px;

	display: flex;
	gap: 8px;
	align-items: center;
	max-width: 220px;
	margin: 7px auto 0;
	font-size: 11.5px;
	font-weight: 500;
	line-height: 1.3;
	font-variant-numeric: tabular-nums;
	color: var(--qav-sold-color, var(--igs-sale, #d0021b));
}

.qav-sold-bar__track {
	flex: 1 1 auto;
	height: var(--qav-sold-bar-height);
	overflow: hidden;
	border-radius: 999px;
	/* A pale tint of the bar colour; the plain grey is for browsers without
	   color-mix(). */
	background: rgba(0, 0, 0, 0.08);
	background: color-mix(in srgb, currentColor 16%, transparent);
}

.qav-sold-bar__fill {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: currentColor;
}

.qav-sold-bar__label {
	flex: none;
	white-space: nowrap;
}

/* Product page: left-aligned under the price, a little larger. */
.qav-sold-bar--single {
	--qav-sold-bar-height: 7px;

	max-width: 320px;
	margin: 10px 0 0;
	font-size: 12.5px;
}

/* Stock is low: bold the "Only N left" nudge. */
.qav-sold-bar--low .qav-sold-bar__label {
	font-weight: 700;
}
