@mixin normalize-product-input {
	height: 2em !important;
	line-height: 1.9 !important;
	vertical-align: top;
	box-sizing: border-box !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

@mixin button {
	text-align: center;
	white-space: nowrap !important;
}

@mixin add-to-cart-item {
	margin: 0 0 5px 3px !important;
}

// Cart messages
#{$wrapper-class} {

	.cart-success,
	.cart-error {
		font-weight: bold;
		font-size: inherit;
		margin-bottom: 5px;
		line-height: 1.4;
		white-space: normal;
		color: #0f834d;

		a.wc-forward,
		a.wc-forward {
			display: none !important; // Hide 'View cart' link in message
		}
	}

	.cart-error {
		color: #e2401c;
	}

	.wc-forward {
		display: block;
		background-color: transparent;
		color: inherit;
		text-decoration: none;
		border: none;
		outline: none;
		box-shadow: none;
		padding: 0;

		&::after {
			@include icon;
			content: "\ea3c" !important; /* right arrow */
			margin-left: 0.3em !important;
			position: relative;
			top: 2px;
		}

		&:hover,
		&:focus {
			background-color: transparent; // TO
		}
	}

	.added_to_cart {
		display: block;
		text-align: right;
		position: static;
		float: none;
		text-decoration: none !important;
		margin: 0;
		line-height: inherit;
		width: auto;
		height: auto;
	}

}

#{$table-class} {

	// Buttons
	.single_add_to_cart_button,
	.product-details-button,
	a.button {
		@include reset-form-input;
		@include normalize-product-input;
		@include button;

		&.disabled, &[disabled] {
			cursor: not-allowed;
			opacity: 0.6;
		}
	}

	button.loading,
	.button.loading {
		position: relative;
		opacity: 0.7;

		&::before {
			content: '' !important;
			-webkit-animation: none 0s;
			animation: none 0s;
		}

		&::after {
			@include spinner-icon(20px);
		}
	}

	.button.added::after {
		@include icon;
		content: "\ea10"; // checkmark
		margin-left: 0.5em;
		font-size: 0.9em;
		display: inline; // TO
	}

	// Align the add to cart column right (but not in child rows)
	thead .col-buy,
	.product-row .col-buy,
	.product-row .col-button:last-child {
		text-align: right;
	}

	// Add to cart form
	.cart {
		border: none !important;
		padding: 0 !important;
		margin: 0 !important;

		.cart-error {
			margin-top: 2px;
		}

		.price .amount {
			font-size: inherit; // TO
		}

		// The wrapper around quantity and cart button
		.add-to-cart-button {
			display: inline-block;
			vertical-align: top;
			background-color: transparent;

			@media screen and (min-width: $medium-breakpoint) {
				white-space: nowrap;
			}

		}

		.quantity,
		select {
			@include reset-form-input;
			@include normalize-product-input;
		}

		.quantity,
		select,
		.single_add_to_cart_button {
			@include add-to-cart-item;
		}

		.single_add_to_cart_button + a.added_to_cart {
			display: block !important;
		}

		select {
			@include select;
		}

		.quantity {
			opacity: 1;
			position: relative;
			width: auto !important;
			display: inline-flex !important;

			.qty {
				box-sizing: border-box;
				padding: 4px 3px !important;
				margin: 0;
				line-height: 1 !important;
				vertical-align: top !important;
				text-align: center;
				min-width: 3em;
				min-height: 0 !important;
				height: 100% !important;
				max-height: 100%;
				float: none;
			}

			.minus,
			.plus {
				width: 30px !important;
				min-height: 0;
				height: 100% !important;
				line-height: 25px !important;
				text-align: center;
				padding: 0;
				font-size: inherit !important;
				position: static !important;
				display: inline;
				vertical-align: top;
			}

			.minus ~ .qty {
				display: inline;
				width: auto;
			}

			&.buttons_added {
				display: inline-flex !important;
			}

			&:not(.buttons_added) .qty {
				max-width: 4em;
			}

			br {
				display: none;
			}
		}

		> .add-to-cart-button:first-child .quantity {
			margin-left: 0 !important;
		}

		.quantity_label {
			// Hide quantity labels
			display: none !important;
		}

	}

	// .cart

	.no-cart-button .cart .single_add_to_cart_button {
		display: none !important;
	}

	.no-quantity .cart .quantity,
	.cart .hidden.quantity {
		display: none !important;
	}

	// Variations
	.wpt_variations_form {
		background-color: transparent; // TO

		.variations,
		.single_variation_wrap {
			display: inline-block;
			vertical-align: top;
			background-color: transparent;
		}

		.wc-no-matching-variations {
			display: none !important;
			margin-bottom: 0 !important;
		}

		.single_variation_wrap {
			width: auto;
			margin: 0;
		}

		.woocommerce-variation-add-to-cart {
			margin: 0; // TO
		}

		.single_variation {
			line-height: 1.4;
			margin-top: 0;
			margin-bottom: 0;
			padding: 0 !important;
			border: none;
			height: auto !important;
			float: none;

			p {
				text-align: right;
			}
		}

		.woocommerce-variation-availability,
		.woocommerce-variation-price {
			display: block !important;
			padding: 0;
			margin: 0;
		}

		.woocommerce-variation-price .price,
		.single_variation p {
			margin: 2px 0;
			padding: 0;
			display: block;
			line-height: inherit;
		}

		@media screen and (max-width: $medium-breakpoint - 1) {
			.variations,
			.quantity {
				margin-bottom: 2px;
			}

			.single_variation {
				margin-top: 0;
			}
		}

	}

	// .wpt_variations_form

}

// Multi-select cart form
.wc-product-table-multi-form {

	form {
		margin: 0 !important; // TO
		padding: 0;
	}

	input[type="submit"] {
		padding: 0.6em 1.5em;
		margin: 0;
		cursor: pointer;
		line-height: 1.2;
		font-size: 1em;
	}

	input[type="checkbox"] {
		// For IE and browsers with no 'form' attribute support - hide the checkboxes we add on multi-form submit
		display: none !important;
	}

}

#{$controls-class} {

	.multi-cart-message {
		text-align: right;
		width: 100%;

		p {
			margin: 5px 0;
			padding: 0;
		}
	}

}

#{$table-class} {

	.multi-cart {
		position: relative;
		min-height: 28px;
		padding-right: 32px;

		.multi-cart-check {
			position: absolute;
			top: 4px;
			right: 6px;
			display: none;
		}

		&.purchasable .multi-cart-check {
			display: block;
		}

		input[type="checkbox"] {
			margin: 0;

			&[disabled] {
				cursor: not-allowed;
			}
		}

	}

	.child .multi-cart {
		padding-left: 0;
		padding-right: 0;

		&.purchasable {
			padding-left: 25px;
		}

		.multi-cart-check {
			left: 0;
			right: auto;
		}
	}

}

// Responsive modal
#{$table-class}.dtr-details {

	.multi-cart {
		padding-right: 0;
	}

	// Always show the cart button and hide the checkbox inside the responsive modal
	.no-cart-button .single_add_to_cart_button {
		display: inline-block !important;
	}

	.multi-cart-check {
		display: none;
	}

}
