/**
 * Bezz Product Builder - Frontend styles.
 *
 * All themeable values read from CSS custom properties emitted by the plugin's
 * dynamic CSS engine (:root { --bpb-* }). Fallbacks keep the layout usable even
 * before any settings are saved. RTL adjustments live in rtl.css.
 *
 * @package BezzProductBuilder
 */

/* -------------------------------------------------------------------------
 * Shell + layout
 * ---------------------------------------------------------------------- */
.bpb-single {
	max-width: var( --bpb-container, 1200px );
	margin-inline: auto;
	padding: var( --bpb-padding, 0 );
	font-size: var( --bpb-body-size, 15px );
	font-weight: var( --bpb-body-weight, 400 );
	line-height: var( --bpb-body-lh, 1.6 );
	box-sizing: border-box;
}

.bpb-single *,
.bpb-single *::before,
.bpb-single *::after {
	box-sizing: border-box;
}

.bpb-product-main {
	display: grid;
	grid-template-columns: minmax( 0, 1.1fr ) minmax( 0, 1fr );
	gap: var( --bpb-section-gap, 48px );
	align-items: start;
}

.bpb-col {
	min-width: 0;
}

/* -------------------------------------------------------------------------
 * Gallery (Layout 1)
 * ---------------------------------------------------------------------- */
.bpb-gallery {
	display: flex;
	gap: var( --bpb-gallery-gap, 14px );
}

.bpb-gallery-thumbs {
	display: flex;
	flex-direction: column;
	gap: var( --bpb-gallery-gap, 14px );
	flex: 0 0 var( --bpb-gallery-thumb-w, 84px );
	max-height: 560px;
	overflow: auto;
	scrollbar-width: thin;
}

.bpb-thumb {
	padding: 0;
	margin: 0;
	height: var( --bpb-gallery-thumb-h, auto );
	border: var( --bpb-gallery-border-w, 1px ) solid var( --bpb-gallery-border-color, #e5e5e5 );
	border-radius: var( --bpb-gallery-thumb-r, 8px );
	background: var( --bpb-gallery-bg, #fff );
	cursor: pointer;
	overflow: hidden;
	line-height: 0;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bpb-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

.bpb-thumb.is-active {
	border-color: var( --bpb-color-accent, #111 );
	box-shadow: 0 0 0 1px var( --bpb-color-accent, #111 );
}

.bpb-gallery-main {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
}

.bpb-gallery-figure {
	position: relative;
	margin: 0;
	border-radius: var( --bpb-gallery-img-r, 12px );
	overflow: hidden;
	background-color: var( --bpb-gallery-bg, transparent );
	background-size: 180%;
	background-repeat: no-repeat;
}

.bpb-gallery-image {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var( --bpb-gallery-img-r, 12px );
	transition: opacity 0.2s ease;
}

.bpb-gallery-figure[ data-zoom-enabled="1" ] {
	cursor: zoom-in;
}

.bpb-gallery-figure.is-zooming .bpb-gallery-image {
	opacity: 0;
}

.bpb-gallery-fs {
	position: absolute;
	inset-block-end: 12px;
	inset-inline-end: 12px;
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.6 );
	color: #fff;
	cursor: pointer;
	z-index: 2;
}

.bpb-gallery-fs .dashicons {
	width: 20px;
	height: 20px;
	font-size: 20px;
}

/* Thumbnail positions. */
.bpb-thumbs-right .bpb-gallery {
	flex-direction: row-reverse;
}

.bpb-thumbs-top .bpb-gallery,
.bpb-thumbs-bottom .bpb-gallery {
	flex-direction: column;
}

.bpb-thumbs-bottom .bpb-gallery {
	flex-direction: column-reverse;
}

.bpb-thumbs-top .bpb-gallery-thumbs,
.bpb-thumbs-bottom .bpb-gallery-thumbs {
	flex-direction: row;
	flex: 0 0 auto;
	max-height: none;
	max-width: 100%;
}

/* -------------------------------------------------------------------------
 * Lightbox
 * ---------------------------------------------------------------------- */
.bpb-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba( 0, 0, 0, 0.85 );
	opacity: 0;
	transition: opacity 0.2s ease;
	padding: 4vmin;
}

.bpb-lightbox.is-visible {
	opacity: 1;
}

.bpb-lightbox-img {
	max-width: 100%;
	max-height: 100%;
	border-radius: 6px;
}

.bpb-lightbox-close {
	position: absolute;
	inset-block-start: 16px;
	inset-inline-end: 20px;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.15 );
	color: #fff;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.bpb-no-scroll {
	overflow: hidden;
}

/* -------------------------------------------------------------------------
 * Summary
 * ---------------------------------------------------------------------- */
.bpb-summary {
	display: flex;
	flex-direction: column;
	gap: var( --bpb-summary-gap, 16px );
}

.bpb-title {
	margin: 0;
	color: var( --bpb-color-title, #111 );
	font-size: var( --bpb-title-size, 30px );
	font-weight: var( --bpb-title-weight, 700 );
	line-height: var( --bpb-title-lh, 1.2 );
	letter-spacing: var( --bpb-title-ls, 0 );
	text-transform: var( --bpb-title-transform, none );
}

.bpb-rating {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.85em;
	color: #555;
}

.bpb-rating .star-rating,
.bpb-rating .star-rating::before,
.bpb-rating .star-rating span::before {
	color: var( --bpb-rating-color, #f5a623 );
}

.bpb-price {
	color: var( --bpb-color-price, #111 );
	font-size: var( --bpb-price-size, 24px );
	font-weight: var( --bpb-price-weight, 600 );
}

.bpb-price del {
	color: #999;
	font-weight: 400;
	margin-inline-end: 8px;
}

.bpb-price ins {
	color: var( --bpb-color-sale, #d33 );
	text-decoration: none;
}

.bpb-promo {
	margin: 0;
	color: var( --bpb-color-promo, #128a4b );
	font-size: var( --bpb-subtext-size, 13px );
	font-weight: 600;
}

.bpb-installment {
	margin: 0;
	color: var( --bpb-subtext-color, #555 );
	font-size: var( --bpb-subtext-size, 13px );
}

/* Variation buttons. */
.bpb-variations {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.bpb-variation-label {
	display: block;
	margin-block-end: 6px;
	font-weight: 600;
	color: var( --bpb-color-title, #111 );
}

.bpb-variation-options {
	display: grid;
	grid-template-columns: repeat( var( --bpb-var-columns, 4 ), minmax( 0, max-content ) );
	gap: var( --bpb-var-gap, 8px );
}

.bpb-variation-btn {
	min-width: var( --bpb-var-min-width, 52px );
	height: var( --bpb-var-height, 44px );
	padding-inline: 14px;
	border: var( --bpb-var-border-w, 1px ) solid var( --bpb-var-border-color, #ccc );
	border-radius: var( --bpb-var-radius, 8px );
	background: var( --bpb-var-bg, #fff );
	color: var( --bpb-var-text, #222 );
	font: inherit;
	font-size: var( --bpb-var-font-size, 14px );
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.bpb-variation-btn:hover {
	border-color: var( --bpb-color-accent, #111 );
	background: var( --bpb-var-hover-bg, #f5f5f5 );
	color: var( --bpb-var-hover-text, #111 );
}

.bpb-variation-btn.is-active {
	border-color: var( --bpb-var-active, #111 );
	background: var( --bpb-var-active, #111 );
	color: var( --bpb-var-active-text, #fff );
}

.bpb-variation-error {
	margin: 0;
	color: #d33;
	font-size: 0.9em;
}

/* Quantity + add to cart. */
.bpb-cart-row {
	display: flex;
	gap: 12px;
	align-items: stretch;
	flex-wrap: wrap;
}

.bpb-quantity {
	display: inline-flex;
	align-items: stretch;
	height: var( --bpb-qty-height, 48px );
	border: var( --bpb-qty-border-w, 1px ) solid var( --bpb-qty-border-color, #ddd );
	border-radius: var( --bpb-qty-radius, 8px );
	overflow: hidden;
	background: var( --bpb-qty-bg, #fff );
}

.bpb-qty-minus,
.bpb-qty-plus {
	width: 42px;
	border: none;
	background: transparent;
	font-size: 18px;
	cursor: pointer;
	color: var( --bpb-qty-text, #333 );
}

.bpb-quantity .qty {
	width: var( --bpb-qty-width, 54px );
	border: none;
	border-inline: 1px solid var( --bpb-qty-border-color, #ddd );
	text-align: center;
	font: inherit;
	background: transparent;
	color: var( --bpb-qty-text, #111 );
	-moz-appearance: textfield;
}

.bpb-quantity .qty::-webkit-outer-spin-button,
.bpb-quantity .qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.bpb-add-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex: 1 1 auto;
	min-width: 180px;
	width: var( --bpb-btn-width, auto );
	height: var( --bpb-btn-height, 48px );
	padding-inline: 22px;
	border: var( --bpb-btn-border-w, 0px ) solid var( --bpb-btn-border-color, transparent );
	border-radius: var( --bpb-btn-radius, 8px );
	background: var( --bpb-btn-bg, #111 );
	color: var( --bpb-btn-text, #fff );
	font: inherit;
	font-size: var( --bpb-btn-font-size, 15px );
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, opacity 0.15s ease;
}

.bpb-add-btn:hover:not( :disabled ) {
	background: var( --bpb-btn-hover, #333 );
}

.bpb-add-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.bpb-add-btn .dashicons {
	width: 20px;
	height: 20px;
	font-size: 20px;
}

.bpb-add-btn-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: bpb-spin 0.7s linear infinite;
}

.bpb-add-btn.is-loading .bpb-add-btn-spinner {
	display: inline-block;
}

.bpb-add-btn.is-loading .bpb-add-btn-label,
.bpb-add-btn.is-loading .dashicons {
	visibility: hidden;
	position: absolute;
}

@keyframes bpb-spin {
	to {
		transform: rotate( 360deg );
	}
}

.bpb-cart-feedback {
	min-height: 1.2em;
	font-size: 0.9em;
}

.bpb-cart-feedback.is-success {
	color: #128a4b;
}

.bpb-cart-feedback.is-error {
	color: #d33;
}

.bpb-out-of-stock {
	color: #d33;
	font-weight: 600;
}

.bpb-ship-date {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	margin-block-start: var( --bpb-ship-margin, 0 );
	padding: var( --bpb-ship-padding, 0 );
	color: var( --bpb-ship-color, #555 );
	font-size: var( --bpb-ship-size, 0.92em );
}

.bpb-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	padding-block-start: 8px;
	border-block-start: 1px solid #eee;
	font-size: 0.88em;
	color: #666;
}

/* -------------------------------------------------------------------------
 * Accordion
 * ---------------------------------------------------------------------- */
.bpb-accordion {
	display: flex;
	flex-direction: column;
	border-block-start: 1px solid var( --bpb-acc-border, #e5e5e5 );
}

.bpb-accordion-item {
	border-block-end: 1px solid var( --bpb-acc-border, #e5e5e5 );
	border-radius: var( --bpb-acc-radius, 0 );
	overflow: hidden;
}

.bpb-accordion-header {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: var( --bpb-acc-padding, 16px ) 4px;
	border: none;
	background: var( --bpb-acc-bg, transparent );
	color: var( --bpb-acc-text, #111 );
	font: inherit;
	font-weight: 600;
	text-align: start;
	cursor: pointer;
}

.bpb-accordion-header .dashicons {
	color: var( --bpb-acc-icon, currentColor );
}

.bpb-accordion-title {
	flex: 1 1 auto;
}

.bpb-accordion-item.is-open .bpb-accordion-header {
	background: var( --bpb-acc-active-bg, var( --bpb-acc-bg, transparent ) );
	color: var( --bpb-acc-active-text, var( --bpb-acc-text, #111 ) );
}

.bpb-accordion-item.is-open .bpb-accordion-header .dashicons,
.bpb-accordion-item.is-open .bpb-accordion-arrow::before,
.bpb-accordion-item.is-open .bpb-accordion-arrow::after {
	color: var( --bpb-acc-active-text, currentColor );
	background: currentColor;
}

.bpb-accordion-item.is-open .bpb-accordion-header .dashicons {
	background: none;
}

.bpb-accordion-arrow {
	position: relative;
	width: 12px;
	height: 12px;
	flex: 0 0 auto;
	transition: transform 0.2s ease;
}

.bpb-accordion-arrow::before,
.bpb-accordion-arrow::after {
	content: "";
	position: absolute;
	inset-block-start: 5px;
	width: 8px;
	height: 2px;
	background: currentColor;
}

.bpb-accordion-arrow::before {
	inset-inline-start: 0;
	transform: rotate( 45deg );
}

.bpb-accordion-arrow::after {
	inset-inline-end: 0;
	transform: rotate( -45deg );
}

.bpb-accordion-item.is-open .bpb-accordion-arrow {
	transform: rotate( 180deg );
}

.bpb-accordion-content {
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.25s ease;
}

.bpb-accordion-inner {
	padding: 0 4px 16px;
	color: var( --bpb-acc-content, #333 );
}

/* -------------------------------------------------------------------------
 * Slider (Layout 2)
 * ---------------------------------------------------------------------- */
.bpb-slider {
	position: relative;
}

.bpb-slider-track {
	position: relative;
	border-radius: var( --bpb-gallery-img-r, 12px );
	overflow: hidden;
	background: #000;
	aspect-ratio: 4 / 3;
}

.bpb-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease;
}

.bpb-slide.is-active {
	position: relative;
	opacity: 1;
	visibility: visible;
}

.bpb-slide-img,
.bpb-slide-mp4,
.bpb-slide-iframe {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border: none;
}

.bpb-slide-video {
	position: relative;
	width: 100%;
	height: 100%;
}

.bpb-slide-poster {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.bpb-slide-play {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 72px;
	height: 72px;
	border: none;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.6 );
	cursor: pointer;
}

.bpb-slide-play::before {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 12px 0 12px 20px;
	border-color: transparent transparent transparent #fff;
	transform: translateX( 3px );
}

.bpb-slider-arrow {
	position: absolute;
	inset-block-start: 50%;
	transform: translateY( -50% );
	width: 42px;
	height: 42px;
	border: none;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.9 );
	color: #111;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	z-index: 3;
}

.bpb-slider-arrow.bpb-prev {
	inset-inline-start: 12px;
}

.bpb-slider-arrow.bpb-next {
	inset-inline-end: 12px;
}

.bpb-slider-thumbs {
	display: flex;
	gap: var( --bpb-gallery-gap, 12px );
	margin-block-start: 12px;
	overflow-x: auto;
	scrollbar-width: thin;
}

.bpb-slider-thumb {
	flex: 0 0 var( --bpb-gallery-thumb-w, 84px );
	height: var( --bpb-gallery-thumb-w, 84px );
	padding: 0;
	border: var( --bpb-gallery-border-w, 1px ) solid var( --bpb-gallery-border-color, #e5e5e5 );
	border-radius: var( --bpb-gallery-thumb-r, 8px );
	background: #f4f4f4;
	cursor: pointer;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.bpb-slider-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.bpb-slider-thumb.is-active {
	border-color: var( --bpb-color-accent, #111 );
	box-shadow: 0 0 0 1px var( --bpb-color-accent, #111 );
}

.bpb-thumb-video-icon {
	font-size: 26px;
	width: 26px;
	height: 26px;
	color: #555;
}

/* -------------------------------------------------------------------------
 * Related products
 * ---------------------------------------------------------------------- */
.bpb-related {
	margin-block-start: var( --bpb-section-gap, 48px );
}

.bpb-related-title {
	margin: 0 0 20px;
	color: var( --bpb-color-title, #111 );
	font-size: calc( var( --bpb-title-size, 30px ) * 0.75 );
	font-weight: var( --bpb-title-weight, 700 );
}

.bpb-related-grid {
	display: grid;
	grid-template-columns: repeat( var( --bpb-related-columns, 4 ), minmax( 0, 1fr ) );
	gap: var( --bpb-related-gap, 24px );
}

.bpb-related-item {
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: var( --bpb-related-bg, transparent );
	border-radius: var( --bpb-related-radius, 12px );
	overflow: hidden;
}

.bpb-related-item a {
	color: inherit;
	text-decoration: none;
}

.bpb-related-thumb img {
	width: 100%;
	height: auto;
	border-radius: var( --bpb-related-radius, 12px ) var( --bpb-related-radius, 12px ) 0 0;
	display: block;
}

.bpb-related-name {
	font-weight: 600;
	color: var( --bpb-color-title, #111 );
}

.bpb-related-price {
	color: var( --bpb-color-price, #111 );
}

/* -------------------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------------- */
@media ( max-width: 1024px ) {
	.bpb-product-main {
		gap: 32px;
	}

	.bpb-related-grid {
		--bpb-related-columns: 3;
	}
}

@media ( max-width: 782px ) {
	.bpb-product-main {
		grid-template-columns: 1fr;
		gap: 28px;
	}

	.bpb-thumbs-left .bpb-gallery,
	.bpb-thumbs-right .bpb-gallery {
		flex-direction: column;
	}

	.bpb-gallery-thumbs {
		flex-direction: row;
		flex: 0 0 auto;
		max-height: none;
		order: 2;
	}

	.bpb-thumbs-left .bpb-gallery-thumbs,
	.bpb-thumbs-right .bpb-gallery-thumbs {
		flex: 0 0 auto;
	}

	.bpb-related-grid {
		--bpb-related-columns: 2;
	}
}

@media ( max-width: 600px ) {
	.bpb-cart-row {
		flex-direction: column;
	}

	.bpb-add-btn {
		width: 100%;
	}

	.bpb-related-grid {
		--bpb-related-columns: 2;
		gap: 16px;
	}

	.bpb-slider-arrow {
		width: 36px;
		height: 36px;
	}
}
