/*
 * Internal Product Addons — checkout box and product page list.
 *
 * Restyle through the custom properties below; they fall back to the
 * Elementor kit's colours when the site has them.
 */

.internal-product-addons,
.internal-product-addons-info {
	--ipa-accent: var(--e-global-color-accent, #00caa4);
	--ipa-text: var(--e-global-color-primary, #023b4f);
	--ipa-muted: #5f7480;
	--ipa-border: var(--ipa-accent);
	--ipa-background: #fff;
	--ipa-heading-text: #fff;
	--ipa-radius: 6px;
}

/* ── Checkout box ─────────────────────────────────────────────────────────── */

.internal-product-addons {
	display: block;
	margin: 10px 0 4px;
	border: 1px solid var(--ipa-border);
	border-radius: var(--ipa-radius);
	background: var(--ipa-background);
	color: var(--ipa-text);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.4;
	overflow: hidden;
	white-space: normal;
	container-type: inline-size;
}

/* Give the product column of the checkout's order table room for the box. */
.woocommerce-checkout-review-order-table td.product-name:has(.internal-product-addons) {
	width: 70%;
}

/*
 * Elementor Pro's Checkout widget lays the order table out as a two-column grid (product, subtotal). On a narrow table
 * (phones) the box uses the table's full width and runs under the subtotal, which only takes the product name's line.
 * Without the widget the named container does not exist, so this does nothing.
 */
.e-checkout__order_review .woocommerce-checkout-review-order-table {
	container: ipa-order / inline-size;
}

@container ipa-order (max-width: 480px) {
	.woocommerce-checkout-review-order-table td.product-name .internal-product-addons {
		box-sizing: border-box;
		width: 100cqw;
	}
}

.internal-product-addons__heading {
	padding: 6px 12px;
	background: var(--ipa-accent);
	color: var(--ipa-heading-text);
	font-weight: 600;
}

.internal-product-addons ul.internal-product-addons__list {
	margin: 0;
	padding: 6px 12px 8px;
	list-style: none;
}

.internal-product-addons__group ul.internal-product-addons__list {
	padding: 0;
}

.internal-product-addons__group {
	margin: 2px 0;
	padding: 2px 0;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.internal-product-addons__group fieldset {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.internal-product-addons__option {
	margin: 0;
	padding: 0;
}

.internal-product-addons__option label {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: baseline;
	column-gap: 8px;
	margin: 0;
	padding: 3px 0;
	color: inherit;
	font-weight: 400;
	cursor: pointer;
}

.internal-product-addons__option input {
	margin: 0;
	accent-color: var(--ipa-accent);
}

.internal-product-addons__name {
	min-width: 0;
}

.internal-product-addons__desc {
	display: block;
	color: var(--ipa-muted);
	font-size: 12px;
}

.internal-product-addons__price {
	color: var(--ipa-muted);
	white-space: nowrap;
	text-align: right;
}

.internal-product-addons__each {
	font-size: 12px;
}

/* Narrow box (phones): the price goes under the name. */
@container (max-width: 240px) {
	.internal-product-addons__option label {
		grid-template-columns: auto minmax(0, 1fr);
	}

	.internal-product-addons__price {
		grid-column: 2;
		white-space: normal;
		text-align: left;
	}
}

.internal-product-addons__option--none .internal-product-addons__name {
	color: var(--ipa-muted);
}

/* ── Product page list ────────────────────────────────────────────────────── */

.internal-product-addons-info {
	color: var(--ipa-text);
}

.internal-product-addons-info__heading {
	margin: 0 0 8px;
	color: inherit;
}

.internal-product-addons-info ul.internal-product-addons-info__list {
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--ipa-border);
}

.internal-product-addons-info__item {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 12px;
	padding: 8px 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.internal-product-addons-info__name {
	flex: 1 1 auto;
	font-weight: 600;
}

.internal-product-addons-info__price {
	flex: 0 0 auto;
	white-space: nowrap;
}

.internal-product-addons-info__desc,
.internal-product-addons-info__note {
	flex: 1 1 100%;
	color: var(--ipa-muted);
	font-size: 13px;
}

.internal-product-addons-info__note {
	font-size: 12px;
}

.internal-product-addons-info__hint {
	margin: 8px 0 0;
	color: var(--ipa-muted);
	font-size: 13px;
}

.internal-product-addons-info--placeholder {
	padding: 12px;
	border: 1px dashed var(--ipa-border);
	border-radius: var(--ipa-radius);
}
