/* =============================================================================
   BD Product Carousel — Carousel Widget Styles (T3.12, T3.13)
   BEM prefix: .bdpc-carousel
   Active state modifier: .bdpc-product--active  (on .bdpc-carousel__card)
   ============================================================================= */

/* --- Outer wrapper ---------------------------------------------------------- */

.bdpc-carousel {
	position: relative;
	width: 100%;
}

/* --- Swiper overrides ------------------------------------------------------- */

.bdpc-carousel__swiper {
	/* Give the Swiper container a stable height context. */
	padding-bottom: 40px; /* room for pagination dots */
}

/* --- Slide ------------------------------------------------------------------ */

.bdpc-carousel__slide {
	height: auto; /* let Swiper manage width; height follows content */
	box-sizing: border-box;
}

/* --- Card (T3.12) ---------------------------------------------------------- */

.bdpc-carousel__card {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	border: 2px solid transparent;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.08 );
	transition:
		border-color 0.2s ease,
		box-shadow   0.2s ease;
}

.bdpc-carousel__card:hover {
	box-shadow: 0 4px 12px rgba( 0, 0, 0, 0.12 );
}

/* --- Active state (T3.13) -------------------------------------------------- */
/*
 * .bdpc-product--active is added to .bdpc-carousel__card by bdpc-carousel.js
 * when the user clicks "Select". Removed from all siblings on each selection.
 */

.bdpc-product--active {
	border-color: #2271b1;
	box-shadow: 0 0 0 3px rgba( 34, 113, 177, 0.2 );
}

/* Button state change on active card (T3.13) */
.bdpc-product--active .bdpc-carousel__btn {
	background-color: #135e96;
	cursor: default;
}

/* Checkmark appended to the button label on active card (T3.13) */
.bdpc-product--active .bdpc-carousel__btn::after {
	content: ' \2713'; /* ✓ */
}

/* --- Image (T3.12) --------------------------------------------------------- */

.bdpc-carousel__image {
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	flex-shrink: 0;
	background: #f5f5f5;
}

.bdpc-carousel__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.bdpc-carousel__card:hover .bdpc-carousel__img {
	transform: scale( 1.04 );
}

/* --- Body ------------------------------------------------------------------- */

.bdpc-carousel__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 14px 14px 16px;
	gap: 8px;
}

/* --- Name (T3.12) ---------------------------------------------------------- */

.bdpc-carousel__name {
	margin: 0;
	font-size: 0.9375em;
	font-weight: 600;
	line-height: 1.4;
	color: #1e1e1e;

	/* Clamp to 2 lines to keep cards uniform height */
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
}

/* --- Price (T3.12) --------------------------------------------------------- */

.bdpc-carousel__price {
	font-size: 0.9375em;
	font-weight: 700;
	color: #d63638;
	margin: 0;
}

.bdpc-carousel__price del {
	font-weight: 400;
	color: #999;
	margin-right: 4px;
}

.bdpc-carousel__price ins {
	text-decoration: none;
}

/* --- Footer — quantity + button -------------------------------------------- */

.bdpc-carousel__footer {
	display: flex;
	flex-wrap: nowrap;   /* button must never drop to a second line */
	align-items: center;
	gap: 8px;
	margin-top: auto;    /* push to bottom of card */
}

/* --- Quantity input (T3.12) ------------------------------------------------ */

/*
 * Scoped with the parent class for higher specificity than generic theme rules
 * such as  .woocommerce input[type="number"] { width:100% }  or even rules
 * carrying !important.  max-width !important is the final backstop.
 */
.bdpc-carousel__footer .bdpc-carousel__qty {
	flex: 0 0 60px;
	width: 60px !important;
	max-width: 60px !important;
	min-width: 0 !important;
	padding: 8px 4px;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	font-size: 0.875em;
	text-align: center;
	color: #1e1e1e;
	background: #fff;
	box-sizing: border-box;
	-moz-appearance: textfield; /* hide spinner in Firefox */
}

.bdpc-carousel__footer .bdpc-carousel__qty::-webkit-inner-spin-button,
.bdpc-carousel__footer .bdpc-carousel__qty::-webkit-outer-spin-button {
	opacity: 1; /* keep spinner visible on Webkit */
}

.bdpc-carousel__footer .bdpc-carousel__qty:focus {
	outline: none;
	border-color: #2271b1;
	box-shadow: 0 0 0 2px rgba( 34, 113, 177, 0.2 );
}

/* --- Select button (T3.12) ------------------------------------------------- */

.bdpc-carousel__footer .bdpc-carousel__btn {
	flex: 1 1 auto;  /* take all remaining space in the row */
	min-width: 0;    /* allow shrinking below content width if card is very narrow */
	padding: 9px 10px;
	background: #2271b1;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 0.875em;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: background-color 0.18s ease;
	-webkit-appearance: none;
}

.bdpc-carousel__footer .bdpc-carousel__btn:hover {
	background: #135e96;
}

.bdpc-carousel__footer .bdpc-carousel__btn:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* --- Swiper navigation — base ----------------------------------------------- */

.bdpc-carousel__swiper .swiper-button-next,
.bdpc-carousel__swiper .swiper-button-prev {
	color: #2271b1;
	/* Flex centering so custom icons and background colour align correctly. */
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Custom nav icon wrapper */
.bdpc-carousel__swiper .bdpc-nav-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	pointer-events: none;
}

/*
 * When a custom icon is rendered (.bdpc-carousel--custom-nav), suppress
 * Swiper's built-in ::after pseudo-element that draws the default arrow
 * using the 'swiper-icons' font.
 */
.bdpc-carousel--custom-nav .swiper-button-next::after,
.bdpc-carousel--custom-nav .swiper-button-prev::after {
	display: none;
}

/* --- Navigation: outside position ------------------------------------------ */

/*
 * Adds horizontal padding equal to half the Swiper navigation button width so
 * the absolutely-positioned buttons sit in the padding zone rather than
 * overlapping the slides.  left:0 / right:0 keeps them flush with the edge.
 */
.bdpc-carousel--nav-outside .bdpc-carousel__swiper {
	padding-left: 50px;
	padding-right: 50px;
}

.bdpc-carousel--nav-outside .swiper-button-prev {
	left: 0;
}

.bdpc-carousel--nav-outside .swiper-button-next {
	right: 0;
}

/* --- Swiper pagination colour ----------------------------------------------- */

.bdpc-carousel__swiper .swiper-pagination-bullet-active {
	background: #2271b1;
}

/* --- Variable product: full-width select button (no qty beside it on card) - */

.bdpc-carousel__btn--variable {
	width: 100%; /* takes full footer width since there is no qty input beside it */
}

/* --- Variation selection modal --------------------------------------------- */

/*
 * The modal is a fixed overlay that centres its box on desktop and slides it
 * up as a bottom-sheet on mobile (≤ 600 px).
 *
 * It is hidden by default (display:none) and toggled by adding
 * .bdpc-variation-modal--open via JS.
 */

.bdpc-variation-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999999;
	align-items: center;
	justify-content: center;
}

.bdpc-variation-modal--open {
	display: flex;
}

/* Semi-transparent backdrop — click closes the modal */
.bdpc-variation-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.55 );
	cursor: pointer;
}

/* Modal box */
.bdpc-variation-modal__box {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 12px;
	padding: 24px 20px 20px;
	width: 100%;
	max-width: 440px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.22 );
	box-sizing: border-box;
}

/* Close button (top-right ×) */
.bdpc-variation-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	background: none;
	border: none;
	font-size: 1.6em;
	line-height: 1;
	color: #888;
	cursor: pointer;
	padding: 4px 6px;
	border-radius: 4px;
	transition: color 0.15s ease;
}

.bdpc-variation-modal__close:hover {
	color: #1e1e1e;
}

/* Product title */
.bdpc-variation-modal__title {
	margin: 0 28px 10px 0;
	font-size: 1em;
	font-weight: 700;
	line-height: 1.4;
	color: #1e1e1e;
}

/* Price row */
.bdpc-variation-modal__price-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 18px;
	font-size: 0.9375em;
}

.bdpc-variation-modal__price-label {
	color: #666;
}

.bdpc-variation-modal__price {
	font-weight: 700;
	font-size: 1.1em;
	color: #d63638;
}

/* Attributes area */
.bdpc-variation-modal__attributes {
	margin-bottom: 20px;
}

.bdpc-variation-modal__attr-row {
	margin-bottom: 14px;
}

.bdpc-variation-modal__attr-row:last-child {
	margin-bottom: 0;
}

.bdpc-variation-modal__attr-label {
	display: block;
	font-size: 0.85em;
	font-weight: 600;
	color: #444;
	margin-bottom: 8px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* Swatch pill buttons */
.bdpc-variation-modal__swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/*
 * Scope all swatch rules under the modal container to beat any theme button
 * resets that would otherwise override background / color / border on <button>.
 */
.bdpc-variation-modal .bdpc-variation-modal__swatch {
	padding: 6px 16px;
	border: 1.5px solid #d0d0d0 !important;
	border-radius: 24px !important;
	background: #fff !important;
	color: #333 !important;
	font-size: 0.875em;
	cursor: pointer;
	line-height: 1.4;
	box-shadow: none !important;
	outline: none;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.bdpc-variation-modal .bdpc-variation-modal__swatch:hover:not( .bdpc-variation-modal__swatch--unavailable ) {
	border-color: #2271b1 !important;
	color: #2271b1 !important;
	background: #eef3fb !important;
}

/* Selected state — highest priority; must visually dominate any theme override */
.bdpc-variation-modal .bdpc-variation-modal__swatch--selected,
.bdpc-variation-modal .bdpc-variation-modal__swatch--selected:hover {
	border-color: #2271b1 !important;
	background: #2271b1 !important;
	background-color: #2271b1 !important;
	color: #fff !important;
	box-shadow: 0 0 0 2px rgba( 34, 113, 177, 0.3 ) !important;
	font-weight: 600;
}

.bdpc-variation-modal .bdpc-variation-modal__swatch--unavailable {
	opacity: 0.38 !important;
	cursor: not-allowed !important;
	text-decoration: line-through;
	pointer-events: none;
}

/* Footer: qty control + confirm button */
.bdpc-variation-modal__footer {
	display: flex;
	align-items: center;
	gap: 12px;
}

/* Qty stepper (−  n  +) */
.bdpc-variation-modal__qty-wrap {
	display: flex;
	align-items: stretch;
	border: 1.5px solid #d0d0d0;
	border-radius: 6px;
	overflow: hidden;
	flex-shrink: 0;
}

.bdpc-variation-modal__qty-btn {
	width: 36px;
	background: #f5f5f5;
	border: none;
	font-size: 1.1em;
	font-weight: 700;
	color: #444;
	cursor: pointer;
	line-height: 1;
	padding: 0;
	transition: background 0.15s ease;
}

.bdpc-variation-modal__qty-btn:hover {
	background: #e5e5e5;
}

.bdpc-variation-modal__qty-input {
	width: 46px;
	border: none;
	border-left: 1.5px solid #d0d0d0;
	border-right: 1.5px solid #d0d0d0;
	text-align: center;
	font-size: 0.9375em;
	color: #1e1e1e;
	padding: 8px 4px;
	-moz-appearance: textfield;
	box-sizing: border-box;
}

.bdpc-variation-modal__qty-input::-webkit-inner-spin-button,
.bdpc-variation-modal__qty-input::-webkit-outer-spin-button {
	display: none;
}

/* Confirm button */
.bdpc-variation-modal__confirm {
	flex: 1;
	padding: 11px 16px;
	background: #2271b1;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 0.9375em;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.18s ease;
	white-space: nowrap;
}

.bdpc-variation-modal__confirm:hover:not( :disabled ) {
	background: #135e96;
}

.bdpc-variation-modal__confirm:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* Prevent page scroll while modal is open */
body.bdpc-modal-open {
	overflow: hidden;
}

/* --- Mobile 2-column: compact footer --------------------------------------- */

/*
 * At narrow viewport widths the two-column card is ~180 px wide.  The default
 * 60 px quantity input leaves only ~83 px for the Select button, which can be
 * tight once border/padding is included.  Shrinking the qty input and reducing
 * button padding keeps both controls comfortably on one line.
 */
@media ( max-width: 480px ) {
	.bdpc-carousel__footer .bdpc-carousel__qty {
		flex: 0 0 46px;
		width: 46px !important;
		max-width: 46px !important;
		padding: 7px 2px;
	}

	.bdpc-carousel__footer .bdpc-carousel__btn {
		padding: 9px 7px;
		font-size: 0.8125em;
	}
}

/* --- Variation modal: bottom-sheet on mobile ------------------------------- */

@media ( max-width: 600px ) {
	.bdpc-variation-modal--open {
		align-items: flex-end; /* box anchors to the bottom edge */
	}

	.bdpc-variation-modal__box {
		border-radius: 16px 16px 0 0;
		max-width: 100%;
		max-height: 85vh;
		padding: 20px 16px 24px; /* extra bottom padding for home-bar safe area */
	}
}
