/**
 * ND Custom Price - Frontend Styles
 */

.nd-custom-price .nd-custom-price-wrapper,
.nd-custom-price button.single_add_to_cart_button {
	max-width: 500px;
}

.nd-custom-price-wrapper {
	margin: 10px 0;
	padding: 0px;
	background: #111;
	border: 0;
	border-radius: 2px;
	display: block;
}

.nd-custom-price-input-wrapper {
	display: flex;
	align-items: center;
	gap: 10px;
}

input[type=number].nd-custom-price-input {
	flex: 1;
	padding: 1rem;
	font-size: 1rem;
	border: 1px solid #111;
	border-radius: 2px;
}

.nd-custom-price-input:focus {
}

.nd-custom-price-symbol {
	font-size: 18px;
	font-weight: 600;
	color: #fff;
	padding-right: 10px;
	min-width: 27px;
}

/* Hide quantity input when custom price is enabled */
.nd-custom-price-hide-quantity,
.quantity.nd-custom-price-hide-quantity,
form.cart .quantity input.nd-custom-price-hide-quantity,
form.cart:has(.nd-custom-price-wrapper) .quantity label[for*="quantity"],
form.cart:has(.nd-custom-price-wrapper) .quantity .qty,
form.cart:has(.nd-custom-price-wrapper) .quantity-input {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
	height: 0 !important;
	width: 0 !important;
	overflow: hidden !important;
}

/* Hide quantity wrapper when custom price is active */
.single-product form.cart:has(.nd-custom-price-wrapper) .quantity,
.single-product form.cart .nd-custom-price-wrapper ~ .quantity,
.single-product form.cart .quantity:has(.nd-custom-price-hide-quantity),
.single-product form.cart:has(.nd-custom-price-wrapper) label[for*="quantity"],
.single-product form.cart:has(.nd-custom-price-wrapper) .quantity-input-wrapper {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
	height: 0 !important;
	width: 0 !important;
	overflow: hidden !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* Fallback for browsers without :has() support */
.single-product form.cart .nd-custom-price-wrapper + .quantity,
.single-product form.cart .nd-custom-price-wrapper ~ .quantity {
	display: none !important;
}

/* Hide price in summary when custom price is enabled */
.single-product .summary:has(.nd-custom-price-wrapper) .price,
.single-product .product-summary:has(.nd-custom-price-wrapper) .price,
.single-product .nd-custom-price-wrapper ~ .price {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
	height: 0 !important;
	width: 0 !important;
	overflow: hidden !important;
	margin: 0 !important;
	padding: 0 !important;
	line-height: 0 !important;
}

/* Fallback for browsers without :has() support */
.single-product .summary .nd-custom-price-wrapper + .price,
.single-product .summary .nd-custom-price-wrapper ~ .price,
.single-product .product-summary .nd-custom-price-wrapper + .price,
.single-product .product-summary .nd-custom-price-wrapper ~ .price {
	display: none !important;
}

/* Ensure custom price wrapper and add to cart button are in separate rows */
form.cart:has(.nd-custom-price-wrapper) {
	display: flex;
	flex-direction: column;
}

form.cart:has(.nd-custom-price-wrapper) .nd-custom-price-wrapper {
	order: 1;
}

form.cart:has(.nd-custom-price-wrapper) .single_add_to_cart_button,
form.cart:has(.nd-custom-price-wrapper) button.single_add_to_cart_button {
	order: 2;
	display: block;
	width: 100%;
	margin-top: 15px;
}

/* Fallback for browsers without :has() support */
form.cart .nd-custom-price-wrapper {
	display: block;
	width: 100%;
}

form.cart .nd-custom-price-wrapper ~ button.single_add_to_cart_button,
form.cart .nd-custom-price-wrapper ~ .single_add_to_cart_button {
	display: block;
	width: 100%;
	margin-top: 15px;
	clear: both;
}

/* Responsive */
@media (max-width: 768px) {
	.nd-custom-price-input-wrapper {
		flex-direction: column;
		align-items: stretch;
	}
	
	.nd-custom-price-symbol {
		text-align: center;
		padding: 5px 0;
	}
}

