/**
 * RechargePlus Quantity Discounts Styles
 * Design inspired by Bundler Pro vertical layout
 */

/* === Quantity Input Styles === */
.rp-quantity-discounts {
	position: relative;
	width: 95px;
	margin-top: 15px;
	margin-bottom: 0px;
}

input[type="number"] {
	margin-bottom: 0px;
}

.rp-qty-button {
	display: inline-block;
	border-width: 0 !important;
	width: 35px !important;
	height: 35px !important;
	text-align: center;
	font-weight: 600;
	cursor: pointer;
	font-size: 1.4rem;
	background-repeat: no-repeat;
	background-size: 7px 7px;
	background-position: center 14px;
	line-height: 2.8;
	-webkit-transform: translateY(-4px);
	transform: translateY(-4px);
}

#rp-quantity-button {
	width: 100px;
	margin-bottom: 15px;
}

.cart > .rp-quantity-discounts > .rp-qty-button.down,
.cart > .rp-quantity-discounts > .rp-qty-button.up,
.single_variation_wrap > .rp-quantity-discounts > .rp-qty-button.down,
.single_variation_wrap > .rp-quantity-discounts > .rp-qty-button.up,
div.woocommerce-variation-add-to-cart.variations_button > div > div.rp-qty-button.down,
div.woocommerce-variation-add-to-cart.variations_button > div > div.rp-qty-button.up,
td.product-quantity > div > div.rp-qty-button.up,
td.product-quantity > div > div.rp-qty-button.down {
	display: none;
}

.entry-summary > .rp-quantity-discounts > .input-text.qty.text {
	text-align: center;
	padding-left: 25px;
	padding-right: 25px;
}

/* === Header Styles === */
.rp-quantity-discount-header {
	margin: 10px 0 30px 0;
	text-align: center;
}

.rp-quantity-discount-header h6 {
	font-weight: 600;
	margin: 8px 0;
	font-size: 1.3em;
	color: var(--color-gold, #111c33);
}

.rp-quantity-discount-header p {
	font-size: 16px;
	margin: 0;
	font-weight: 400;
	color: var(--color-gold, #111c33);
}

/* === Main Container - Vertical Grid Layout === */
.rp-product-quantity-discount {
	display: grid;
	column-gap: 10px;
	width: 100%;
	max-width: 100%;
	grid-template-columns: repeat(3, 1fr);
	margin-top: 20px;
	margin-bottom: 30px;
}

/* When 4 boxes (12 qty tier included) */
.rp-product-quantity-discount:has(.rp-offer-box:nth-child(4)) {
	grid-template-columns: repeat(4, 1fr);
}

/* === Individual Offer Box === */
.rp-offer-box {
	border: 2px solid var(--color-gold, #c9a969);
	border-radius: 8px;
	background: var(--color-white, #f5f5f5);
	font-weight: normal;
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	cursor: pointer;
	position: relative;
	padding: 15px 12px 20px;
	transition: all 0.25s ease;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	min-height: 200px;
	min-width: 44px;
	min-height: 44px;
}

/* Focus state for keyboard navigation */
.rp-offer-box:focus {
	outline: 3px solid var(--color-gold-hover, #b09358);
	outline-offset: 2px;
}

.rp-offer-box:hover {
	transform: translateY(-3px);
	box-shadow: 0 6px 16px rgba(201, 169, 105, 0.2);
}

.rp-offer-box.active {
	background: var(--color-beige, #F6E8CE);
	border: 2px solid var(--color-gold-hover, #b09358);
	box-shadow: 0 4px 12px rgba(201, 169, 105, 0.3);
}

/* === Badge at Top (Best Value, etc) === */
.rp-discount-best-offer {
	position: absolute;
	top: 0;
	left: 50%;
	transform: translate(-50%, -50%);
	background: var(--color-beige-dark, #D4B78F);
	color: var(--color-blue, #111c33);
	padding: 3px 14px;
	border-radius: 12px;
	white-space: nowrap;
	z-index: 10;
	font-weight: 700;
	font-size: 11px;
	text-transform: lowercase;
	letter-spacing: 0.3px;
	border: 1px solid var(--color-gold, #c9a969);
}

.rp-discount-best-offer > svg {
	display: none;
}

/* === Product Image === */
.rp-discount-image {
	width: 65%;
	max-width: 150px;
	margin: 0 auto 15px;
	text-align: center;
}

.rp-discount-image img {
	width: 100%;
	height: auto;
	object-fit: contain;
	display: block;
}

/* === Content Wrapper === */
.rp-discount-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	width: 100%;
	gap: 15px;
	flex: 1;
}

/* === Title (e.g., "1x", "3x Focus Trio") === */
.rp-discount-title {
	color: var(--color-blue);
	font-size: 14px;
	font-weight: 400;
	margin: 0;
	line-height: 1.3;
	text-align: center;
	pointer-events: none;
}

/* === Subtitle/Price Container === */
.rp-discount-subtitle {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	width: 100%;
	gap: 3px;
	pointer-events: none;
}

/* === Bundle Prices Container === */
.rp-discount-bundle-prices {
	display: flex;
	align-items: center;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
}

/* === Bundle Total (discounted total price) === */
.rp-discount-bundle-total {
	font-size: 17px;
	color: var(--color-gold-hover, #b09358);
	font-weight: 600;
	white-space: nowrap;
	font-family: 'Montserrat', 'Poppins', sans-serif;
}

/* === Regular Price (crossed out) === */
.rp-discount-regular-price {
	font-size: 15px;
	color: #afafaf;
	text-decoration: line-through;
	font-weight: 400;
	white-space: nowrap;
}

/* === Sale Price === */
.rp-discount-price {
	font-size: 15px;
	font-weight: 600;
	font-family: 'Montserrat', 'Poppins', sans-serif;
	color: var(--color-gold-hover, #b09358);
	white-space: nowrap;
}

/* === Label (per product / izdelek) === */
.rp-discount-label {
	font-size: 13px;
	color: #666;
	line-height: 1.2;
	font-weight: 400;
}

/* === Savings Badge at Bottom === */
.rp-discount-savings {
	position: absolute;
	left: 50%;
	bottom: -15px;
	transform: translateX(-50%);
	background: var(--color-beige-dark, #D4B78F);
	padding: 4px 14px;
	border-radius: 15px;
	white-space: nowrap;
	z-index: 1;
	font-family: 'Montserrat', 'Poppins', sans-serif;
	font-size: 12px;
	font-weight: 600;
	color: var(--color-blue, #111c33);
	letter-spacing: 0.05em;
	border: 1px solid var(--color-gold, #c9a969);
}

.rp-offer-box.active .rp-discount-savings {
	background: var(--color-gold, #c9a969);
	color: var(--color-white, #f5f5f5);
}


/* === Responsive Design === */
@media only screen and (max-width: 768px) {
	.rp-quantity-discounts > .input-text.qty.text {
		text-align: center;
		padding-left: 25px;
		padding-right: 25px;
	}

	.rp-product-quantity-discount {
		grid-template-columns: 1fr;
		gap: 35px;
	}

	.rp-offer-box {
		padding: 20px 15px 25px;
		min-height: 160px;
		/* Increase touch target size on mobile */
		min-height: 48px;
	}

	.rp-discount-image {
		max-width: 70%;
	}

	.rp-discount-best-offer {
		font-size: 12px;
		padding: 4px 16px;
	}

	.rp-discount-savings {
		font-size: 13px;
		bottom: -16px;
		padding: 5px 16px;
	}
	
	/* Better touch interaction on mobile */
	.rp-offer-box:active {
		transform: scale(0.98);
	}
}

@media only screen and (min-width: 769px) and (max-width: 1024px) {
	.rp-product-quantity-discount:has(.rp-offer-box:nth-child(4)) {
		grid-template-columns: repeat(2, 1fr);
		gap: 20px 12px;
	}

	.rp-discount-image {
		max-width: 55%;
	}
}
