/* Informational "this product is part of a bundle group" box on the product page */
.rpb-group-info {
	margin: 12px 0;
}

.rpb-group-info-block {
	background: #f7fbf7;
	border: 1px solid #d7ead7;
	border-radius: 4px;
	padding: 10px 14px;
	margin-bottom: 8px;
}

.rpb-group-info-title {
	margin: 0 0 6px;
	font-weight: 600;
	color: #2e7d32;
}

.rpb-group-info-list {
	margin: 0;
	padding-left: 18px;
}

.rpb-group-info-list li {
	margin: 2px 0;
}

.rpb-group-info-list li.rpb-group-info-default {
	font-weight: 600;
}

.rpb-group-info-others-title {
	margin: 8px 0 4px;
	font-size: 0.88em;
	font-weight: 600;
	color: #555;
}

/* "N other items also qualify" disclosure on the cart page's "Bundle deal" line - a
   native <details>/<summary> element rather than a custom CSS :hover popup. Visibility
   is controlled entirely by the browser via the `open` attribute, not by any CSS state
   here, which is deliberate: an earlier CSS-:hover-based version (and, before that, a
   title-attribute tooltip) both had reliability problems on at least one real site, most
   likely because wc_get_formatted_cart_item_data() runs this value through kses/wpautop
   filtering in ways that disrupted custom nested-element/CSS-state approaches. A native
   disclosure widget has no such dependency, and - as a bonus - works by click/tap, which
   suits touch devices better than hover ever did anyway. */
.rpb-bundle-details {
	display: inline-block;
	margin-left: 4px;
}

.rpb-bundle-details summary {
	cursor: pointer;
	color: #2e7d32;
	font-weight: 600;
	font-size: 0.92em;
}

.rpb-bundle-links {
	margin: 4px 0 0 18px;
	padding: 0;
	font-size: 0.9em;
}

.rpb-bundle-links li {
	margin: 2px 0;
}

.rpb-bundle-links a {
	color: #2e7d32;
	text-decoration: underline;
}

/* Thumbnail grid of "other products in this bundle" on the product page - fixed 3
   columns, no title text (just the image, with the product name available via the
   link's title attribute and alt text for accessibility). */
.rpb-group-info-thumbs {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 8px;
	margin-top: 6px;
}

.rpb-group-info-thumb {
	display: block;
	text-decoration: none;
}

.rpb-group-info-thumb img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 4px;
	border: 1px solid #d7ead7;
}

.rpb-group-info-thumb:hover img {
	border-color: #2e7d32;
}

/* "You save £X (Y%)" appended to each group-tier price on the product-page info box */
.rpb-group-info-save {
	color: #2e7d32;
	font-weight: 600;
	font-size: 0.92em;
}

/* "From £X" lowest-possible-price label, replaces WooCommerce's own range/price
   wherever a price-break tier beats it */
.rpb-from-price {
	font-weight: 600;
}
.rpb-rrp-wrap {
	display: block;
	font-size: 0.85em;
	margin-top: 4px;
}

.rpb-rrp {
	color: #777;
	text-decoration: line-through;
}

.rpb-savings {
	color: #2e7d32;
	font-weight: 600;
	margin-left: 6px;
}

/* Price break table. Deliberately uses !important on the display/visibility rules
   below: many WooCommerce themes ship mobile-only CSS that hides generic <table>
   elements inside the product summary (most often aimed at the "Additional
   information" attributes table), and our table would get caught by the same broad
   selector. !important - plus loading this stylesheet as late as possible, see
   RPB_Frontend::enqueue_assets() - ensures our own display rules always win instead of
   silently losing to a same-specificity theme rule that happens to load afterwards. */
.rpb-breaks-container {
	margin: 16px 0;
	max-width: 100%;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.rpb-breaks-container.rpb-hidden {
	display: none !important;
}

/* Horizontal-scroll safety net at in-between widths (e.g. tablets), and it also stops
   a wide table from ever being silently clipped to zero width by a theme's mobile
   "overflow-x: hidden" wrapper - the table now scrolls within its own box instead. */
.rpb-table-scroll {
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	display: block !important;
}

.rpb-price-breaks-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92em;
	display: table !important;
	visibility: visible !important;
}

.rpb-price-breaks-table th,
.rpb-price-breaks-table td {
	padding: 8px 10px;
	border: 1px solid #e2e2e2;
	text-align: left;
	vertical-align: middle;
}

.rpb-price-breaks-table th {
	background: #f7f7f7;
	font-weight: 600;
}

.rpb-price-breaks-table tr.rpb-break-row {
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.rpb-price-breaks-table tr.rpb-break-row:hover {
	background-color: #fafafa;
}

.rpb-price-breaks-table tr.rpb-active {
	background-color: #eef7ee;
	box-shadow: inset 3px 0 0 #2e7d32;
}

/* Below this width, stack each row into a labelled card instead of a scrolling table -
   this is what actually fixes the table failing to display on phones: on very narrow
   viewports a 5-column table has no readable width to scroll within, so it's rebuilt as
   block-level rows using the data-label attributes each cell already carries. */
@media screen and (max-width: 782px) {
	.rpb-table-scroll {
		overflow-x: visible;
	}

	.rpb-price-breaks-table {
		display: block !important;
		width: 100%;
		border: 1px solid #e2e2e2;
	}

	.rpb-price-breaks-table thead {
		display: none !important;
	}

	.rpb-price-breaks-table tbody {
		display: block !important;
	}

	.rpb-price-breaks-table tr.rpb-break-row {
		display: block !important;
		padding: 8px 10px 10px;
		border-bottom: 1px solid #e2e2e2;
	}

	.rpb-price-breaks-table tr.rpb-break-row:last-child {
		border-bottom: 0;
	}

	.rpb-price-breaks-table td {
		display: flex !important;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 4px 0;
		border: 0;
	}

	.rpb-price-breaks-table td[data-label]::before {
		content: attr(data-label);
		font-weight: 600;
		color: #555;
		flex-shrink: 0;
	}

	.rpb-price-breaks-table td.rpb-select-cell {
		justify-content: flex-end;
		margin-top: 4px;
		width: auto;
		text-align: right !important;
	}

	.rpb-price-breaks-table td.rpb-select-cell::before {
		content: none;
	}
}

/* Screen-reader-only text (kept for accessibility, not shown visually) - defined
   locally in case the active theme doesn't already provide .screen-reader-text */
.rpb-price-breaks-table .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Bulk-buy % saved vs a single unit, shown right beside the per-unit price */
.rpb-unit-save-badge {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 7px;
	font-size: 0.82em;
	font-weight: 600;
	line-height: 1.6;
	color: #8a5a00;
	background: #fff1cf;
	border-radius: 10px;
	white-space: nowrap;
	vertical-align: middle;
}

/* Select column + stylised tick box (replaces the old radio + "Select" text) */
.rpb-select-th,
.rpb-select-cell {
	width: 44px;
	text-align: center !important;
}

.rpb-tick {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	cursor: pointer;
}

.rpb-price-breaks-table input.rpb-break-radio {
	/* !important throughout: WooCommerce/page-builder themes (Divi especially) often
	   ship their own global styling for form inputs, including radio buttons - without
	   !important here, a same-specificity theme rule loaded afterwards can silently
	   override our custom tick-box appearance, so a genuinely-checked default row can
	   render looking unticked even though the underlying radio state is correct. */
	appearance: none !important;
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	display: inline-block !important;
	width: 22px !important;
	height: 22px !important;
	min-width: 22px !important;
	margin: 0 !important;
	padding: 0 !important;
	background-color: #fff !important;
	background-image: none !important;
	box-shadow: none !important;
	border: 2px solid #c6c6c6 !important;
	border-radius: 5px !important;
	position: relative;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
	flex-shrink: 0;
	vertical-align: middle;
}

.rpb-price-breaks-table input.rpb-break-radio:hover {
	border-color: #2e7d32 !important;
}

.rpb-price-breaks-table input.rpb-break-radio:focus-visible {
	outline: 2px solid #2e7d32;
	outline-offset: 2px;
}

.rpb-price-breaks-table input.rpb-break-radio:checked {
	background-color: #2e7d32 !important;
	border-color: #2e7d32 !important;
}

.rpb-price-breaks-table input.rpb-break-radio:checked::after {
	content: "" !important;
	display: block !important;
	position: absolute;
	left: 6px;
	top: 2px;
	width: 6px;
	height: 11px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

/* Cart / checkout item-data rows (both classic cart page and the Cart/Checkout blocks
   render our messaging via WooCommerce's own item-data markup, so there's no custom
   wrapper to style here - this just nudges spacing/weight on the price figures within
   those rows). */
.woocommerce-cart-form .cart_item .variation-Savings dd,
.woocommerce-cart-form .cart_item .variation-Next-price-break dd,
.wc-block-components-product-metadata__variation dd {
	font-weight: 600;
}
