// Woo - Single Product
// Extracted from pp-woocommerce.css so a page using only this widget does not
// have to load the styles for every other WooCommerce widget. The values are
// carried over unchanged; vendor prefixes are left to autoprefixer.

// Rules the widget reached through the shared stylesheet without being scoped
// to it. Scoped copies are carried here so the widget still gets them when
// pp-woocommerce.css is not loaded; the originals stay put for the other
// widgets that share them.
.pp-single-product {
	position: relative;

	// The star font and its two overlaid rows come from `.pp-woocommerce
	// .star-rating`. Without them wc_get_rating_html() renders as bare text.
	.star-rating {
		display: block;
		float: none;
		overflow: hidden;
		position: relative;
		height: 1em;
		margin: 0 auto 0.5em 0;
		// WooCommerce ships and names this font, so neither the quoting nor the
		// absence of a fallback is ours to change - a generic fallback here
		// would render digits in place of stars.
		/* stylelint-disable-next-line font-family-name-quotes, font-family-no-missing-generic-family-keyword */
		font-family: 'star';
		font-size: 0.857em;
		line-height: 1;
		backface-visibility: hidden;
		width: 5.4em;

		&::before {
			content: '\73\73\73\73\73';
			color: #d3ced2;
			float: left;
			top: 0;
			left: 0;
			position: absolute;
		}

		span {
			overflow: hidden;
			float: left;
			top: 0;
			left: 0;
			position: absolute;
			padding-top: 1.5em;

			&::before {
				content: '\53\53\53\53\53';
				top: 0;
				position: absolute;
				left: 0;
			}
		}
	}

	span.onsale {
		text-align: center;
	}

	a.button,
	button.button,
	input.button {
		transition: 0.3s ease-in-out;
	}

	// Page Builder Framework's quantity stepper, and the variation form's own
	// quantity input, both sit inside the add to cart form this widget renders.
	.woocommerce-variation-add-to-cart .quantity input,
	.wpbf-quantity .wpbf-qty-decrease,
	.wpbf-quantity .wpbf-qty-increase {
		height: 100%;
	}

	a {
		text-decoration: none;
		position: relative;
	}

	.pp-product-title {
		margin-top: 0;
	}

	.single-product-image {
		position: relative;
		display: inline-block;
	}

	.onsale {
		position: absolute;
		padding: 5px 10px;
	}

	.summary.entry-summary {
		width: 100% !important;
		float: none !important;
	}

	.woocommerce-product-rating .star-rating {
		float: none;
	}

	.price ins,
	.price ins .amount {
		text-decoration: none;
	}
}

// Single Product Widget
.pp-single-product-skin-3,
.pp-single-product-skin-4 {
	text-align: center;
}

.pp-single-product-skin-3 .woocommerce-product-rating,
.pp-single-product-skin-4 .woocommerce-product-rating {
	// Not a prefixed property but a non-standard value, so autoprefixer leaves
	// it alone. The centring that actually matters is the margin rule below.
	text-align: -webkit-center;
}

.pp-single-product.woocommerce .woocommerce-product-rating .star-rating {
	margin-top: 0;
}

// Unscoped in the shared stylesheet, and carried over as-is so nothing that
// relied on it changes. Worth scoping to .pp-single-product separately: as a
// bare class it also styles any theme or plugin markup using the same name.
.product-content {
	padding: 0 10px;
}

.pp-single-product .woocommerce-product-add-to-cart {

	.quantity {
		float: left;
		margin-right: 5px;
		vertical-align: top;
	}

	.variations {
		margin-top: 30px;
		margin-bottom: 15px;

		td label {
			margin: 0;
			margin-right: 30px;
			vertical-align: middle;
			font-size: 15px;
		}

		tr select {
			margin-right: 10px;
		}
	}

	form.cart,
	form.cart .single_variation_wrap .woocommerce-variation-add-to-cart {
		width: 100%;
	}

	.variations_form.cart {
		display: block;

		.single_variation_wrap {
			margin-top: 5px;
		}
	}

	.woocommerce-variation {
		margin-bottom: 10px;
	}

	a:not(.reset_variations),
	.button,
	.button.disabled,
	.button.alt.disabled,
	.button.single_add_to_cart_button.alt {
		transition: 0.2s ease-in-out;
	}
}

// Alignment
.pp-single-product-align-center .pp-single-product .woocommerce-product-rating .star-rating {
	margin: 0 auto;
}

.pp-single-product-align-right .pp-single-product .woocommerce-product-rating .star-rating {
	float: right;
}

.pp-single-product-align-center .pp-single-product-skin-3.pp-single-product .woocommerce-product-add-to-cart .variations,
.pp-single-product-align-center .pp-single-product-skin-4.pp-single-product .woocommerce-product-add-to-cart .variations {
	margin-left: auto;
	margin-right: auto;
}

// Carried over verbatim: the left variant sets margin-left, same as the right
// variant, which looks like it was meant to be margin-right. Left alone here so
// this change does not alter any existing layout.
.pp-single-product-align-right .pp-single-product .woocommerce-product-add-to-cart .variations,
.pp-single-product-align-left .pp-single-product .woocommerce-product-add-to-cart .variations {
	margin-left: auto;
}

// Sale badge position
.pp-badge-position-align-top-left .pp-single-product .onsale {
	top: 0 !important;
	left: 0 !important;
	bottom: auto !important;
	right: auto !important;
}

.pp-badge-position-align-top-center .pp-single-product .onsale {
	top: 0 !important;
	left: 50% !important;
	bottom: auto !important;
	right: auto !important;
	transform: translateX(-50%);
}

.pp-badge-position-align-top-right .pp-single-product .onsale {
	top: 0 !important;
	left: auto !important;
	bottom: auto !important;
	right: 0 !important;
}

.pp-badge-position-align-bottom-left .pp-single-product .onsale {
	top: auto !important;
	left: 0 !important;
	bottom: 0 !important;
	right: auto !important;
}

.pp-badge-position-align-bottom-center .pp-single-product .onsale {
	top: auto !important;
	left: 50% !important;
	bottom: 0 !important;
	right: auto !important;
	transform: translateX(-50%);
}

.pp-badge-position-align-bottom-right .pp-single-product .onsale {
	top: auto !important;
	left: auto !important;
	bottom: 0 !important;
	right: 0 !important;
}

// Variation table
.pp-variation-table-width-full .woocommerce .pp-product-action .variations_form table {
	width: 100%;
}

.woocommerce .pp-product-action .variations_form {

	.label {
		color: inherit;

		label {
			font-size: 12px;
		}
	}

	.reset_variations {
		margin-left: 5px;
	}

	.woocommerce-variation-price {
		margin-top: 5px;

		.price {
			font-size: 14px;
		}
	}

	table tr > td {
		display: table-cell;
		vertical-align: middle;

		&.label label {
			margin-bottom: 0;
		}

		&.value,
		&.value * {
			text-align: left;
		}
	}
}

// Button width
.pp-single-product-buttons-full-width .pp-single-product .woocommerce-product-add-to-cart {

	a:not(.reset_variations),
	.button,
	.button.disabled,
	.button.alt.disabled,
	.button.single_add_to_cart_button.alt {
		width: 100%;
	}
}

// Skins 1 and 2 put the image and the content side by side.
.pp-single-product-skin-1.pp-single-product,
.pp-single-product-skin-2.pp-single-product {

	.summary {
		display: flex;
		justify-content: space-evenly;
		flex-direction: row;
	}

	.single-product-image {
		width: 30%;
	}

	.product-content {
		width: 70%;
	}
}

.pp-single-product-skin-1.pp-single-product .product-content {
	float: left;
}

.pp-single-product-skin-2.pp-single-product .product-content {
	float: right;
}

@media only screen and (max-width: 480px) {

	.pp-single-product .single-product-image {
		float: none;
		display: block;

		img {
			width: 100%;
		}
	}

	.pp-single-product .product-content {
		width: 100% !important;
		float: none;
	}
}
