/* Sectioned grouped product layout, see includes/class-clergy-extras-grouped-layout.php */

.woocommerce div.product form.cart.clergy-grouped-layout .group_table {
	width: 100%;
	border-collapse: collapse;
}

/* Section headings */
.woocommerce div.product form.cart.clergy-grouped-layout .group_table tr.clergy-grouped-section__header th {
	padding: 12px;
	background: #004f30;
	border: 1px solid #004f30;
	color: #fff;
	text-align: left;
	font-weight: 700;
}

.woocommerce div.product form.cart.clergy-grouped-layout .group_table tbody + tbody tr.clergy-grouped-section__header th {
	border-top: 16px solid #fff;
}

.clergy-grouped-section__title {
	font-size: 1.05em;
}

.clergy-grouped-section__note {
	display: block;
	margin-top: 2px;
	font-size: 0.85em;
	font-weight: 400;
	opacity: 0.9;
}

.clergy-grouped-section__toggle,
.clergy-grouped-section__toggle:hover,
.clergy-grouped-section__toggle:focus,
.clergy-grouped-section__toggle:active {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 0;
	margin: 0;
	background: none;
	border: 0;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.clergy-grouped-section__toggle:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.clergy-grouped-section__arrow {
	flex: 0 0 auto;
	width: 0.55em;
	height: 0.55em;
	margin-left: 1em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s ease;
}

.clergy-grouped-section__toggle[aria-expanded="false"] .clergy-grouped-section__arrow {
	transform: rotate(-45deg);
}

.woocommerce div.product form.cart.clergy-grouped-layout tbody:has(> tr.clergy-grouped-section__header .clergy-grouped-section__toggle[aria-expanded="false"]) > tr:not(.clergy-grouped-section__header) {
	display: none;
}

/* Product rows */
.woocommerce div.product form.cart.clergy-grouped-layout .group_table td.woocommerce-grouped-product-list-item__quantity {
	width: 1%;
	white-space: nowrap;
}

.woocommerce div.product form.cart.clergy-grouped-layout .group_table tr.is-selected > td {
	background-color: #eef8ec;
}

.clergy-grouped-badge {
	display: inline-block;
	margin-left: 0.4em;
	padding: 1px 8px;
	border-radius: 999px;
	background: #51b947;
	color: #fff;
	font-size: 0.75em;
	font-weight: 700;
	text-transform: uppercase;
	vertical-align: middle;
}

/* Quantity stepper */
.woocommerce div.product form.cart.clergy-grouped-layout div.quantity.clergy-qty-has-stepper {
	display: inline-flex;
	align-items: stretch;
	float: none;
	margin: 0;
}

.woocommerce div.product form.cart.clergy-grouped-layout div.quantity.clergy-qty-has-stepper input.qty {
	width: 3em;
	margin: 0;
	border-left: 0;
	border-right: 0;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.woocommerce div.product form.cart.clergy-grouped-layout div.quantity.clergy-qty-has-stepper input.qty::-webkit-inner-spin-button,
.woocommerce div.product form.cart.clergy-grouped-layout div.quantity.clergy-qty-has-stepper input.qty::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.clergy-qty-stepper,
.clergy-qty-stepper:hover,
.clergy-qty-stepper:focus {
	width: 2.2em;
	padding: 0;
	margin: 0;
	background: #fff;
	border: 2px solid #51b947;
	border-radius: 0;
	color: #004f30;
	font-size: 1.1em;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
}

.clergy-qty-stepper:hover {
	background: #51b947;
	color: #fff;
}

.clergy-qty-stepper:focus-visible {
	outline: 2px solid #004f30;
	outline-offset: 1px;
}

/* Live total + add to cart */
.woocommerce div.product form.cart.clergy-grouped-layout .clergy-grouped-summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 16px;
	padding: 12px 0;
	border-top: 2px solid #004f30;
}

.clergy-grouped-summary__label {
	margin-right: 0.5em;
	color: #004f30;
	font-weight: 700;
	text-transform: uppercase;
}

.clergy-grouped-summary__amount {
	color: #004f30;
	font-size: 1.35em;
}

.woocommerce div.product form.cart.clergy-grouped-layout .clergy-grouped-summary .single_add_to_cart_button {
	float: none;
	margin: 0;
}

@media (max-width: 767px) {
	.woocommerce div.product form.cart.clergy-grouped-layout .clergy-grouped-summary {
		position: sticky;
		bottom: 0;
		z-index: 10;
		padding: 12px;
		background: #fff;
		box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
	}
}
