/**
 * Bundle Deals Page Styles
 *
 * Styles for the Bundle Deals page including product grid,
 * selection UI, calculator sidebar, and tier progress indicators.
 */

/* ==========================================================================
   Page Header
   ========================================================================== */

.bundle-deals-header {
	padding: 2rem 0;
}

.bundle-deals-header h1 {
	font-weight: 700;
	color: #2c3e50;
	margin-bottom: 1rem;
}

.bundle-deals-header .lead {
	font-size: 1.25rem;
	max-width: 700px;
	margin: 0 auto;
}

/* ==========================================================================
   Products Grid
   ========================================================================== */

.bundle-deals-products-section {
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.section-header h3 {
	font-size: 1.5rem;
	font-weight: 700;
	color: #2c3e50;
}

.section-header .products-count {
	font-size: 1rem;
	padding: 0.5rem 1rem;
}

.bundle-products-grid {
	display: grid;
	gap: 1.5rem;
	margin-top: 1.5rem;
}

.bundle-products-grid.grid-cols-2 {
	grid-template-columns: repeat(2, 1fr);
}

.bundle-products-grid.grid-cols-3 {
	grid-template-columns: repeat(3, 1fr);
}

.bundle-products-grid.grid-cols-4 {
	grid-template-columns: repeat(4, 1fr);
}

/* Product Card */
.bundle-product-card {
	position: relative;
	border-radius: 12px;
	overflow: hidden;
	background: #fff;
	border: 2px solid #e9ecef;
	transition: all 0.3s ease;
	cursor: pointer;
}

.bundle-product-card:hover {
	border-color: #27ae60;
	box-shadow: 0 5px 20px rgba(39, 174, 96, 0.15);
	transform: translateY(-5px);
}

.bundle-product-card.selected {
	border-color: #27ae60;
	background: linear-gradient(135deg, #f8fff8 0%, #e8f8e8 100%);
	box-shadow: 0 5px 20px rgba(39, 174, 96, 0.2);
}

.product-card-inner {
	padding: 1rem;
}

/* Product Image */
.product-image {
	position: relative;
	width: 100%;
	padding-top: 100%;
	overflow: hidden;
	border-radius: 8px;
	background: #f8f9fa;
	margin-bottom: 1rem;
}

.product-image img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.bundle-product-card:hover .product-image img {
	transform: scale(1.05);
}

.sale-badge {
	position: absolute;
	 top: 10px; 
	right: 10px;
	background: #e74c3c;
	color: #fff;
	padding: 0.25rem 0.75rem;
	border-radius: 20px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	z-index: 2;
}

.selection-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(39, 174, 96, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.bundle-product-card.selected .selection-overlay {
	opacity: 1;
}

.selection-overlay i {
	font-size: 3rem;
	color: #fff;
	animation: checkPulse 0.6s ease;
}

@keyframes checkPulse {
	0% {
		transform: scale(0);
		opacity: 0;
	}
	50% {
		transform: scale(1.2);
	}
	100% {
		transform: scale(1);
		opacity: 1;
	}
}

/* Product Info */
.product-info {
	text-align: center;
}

.product-title {
	font-size: 1rem;
	font-weight: 600;
	color: #2c3e50;
	margin-bottom: 0.75rem;
	min-height: 2.5rem;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.product-price {
	margin-bottom: 1rem;
}

.product-price .price,
.product-price .sale-price {
	font-size: 1.25rem;
	font-weight: 700;
	color: #27ae60;
}

.product-price .regular-price {
	font-size: 1rem;
	color: #95a5a6;
	text-decoration: line-through;
	margin-right: 0.5rem;
}

/* Quantity Selector */
.quantity-selector {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.qty-btn {
	width: 35px;
	height: 35px;
	border: 2px solid #27ae60;
	background: #fff;
	color: #27ae60;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	font-size: 1.25rem;
	padding: 0;
}

.qty-btn:hover {
	background: #27ae60;
	color: #fff;
	transform: scale(1.1);
}

.qty-btn:active {
	transform: scale(0.95);
}

.qty-input {
	width: 60px;
	height: 35px;
	text-align: center;
	border: 2px solid #e9ecef;
	border-radius: 8px;
	font-size: 1rem;
	font-weight: 600;
	color: #2c3e50;
}

.bundle-product-card.selected .qty-input {
	border-color: #27ae60;
	background: #fff;
}

/* Product Select Checkbox */
.product-select {
	margin-top: 1rem;
}

.product-select input[type="checkbox"] {
	display: none;
}

.product-select label {
	display: block;
	padding: 0.5rem 1rem;
	background: #e9ecef;
	color: #6c757d;
	border-radius: 8px;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.product-select input[type="checkbox"]:checked + label {
	background: #27ae60;
	color: #fff;
}

/* ==========================================================================
   Bundle Calculator Sidebar
   ========================================================================== */

.bundle-calculator {
	top: 100px;
}

.calculator-inner {
	background: #fff;
	border-radius: 16px;
	padding: 2rem;
	box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
}

.calculator-title {
	font-size: 1.5rem;
	font-weight: 700;
	color: #2c3e50;
	margin-bottom: 1.5rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.calculator-title i {
	color: #27ae60;
}

/* Selected Products Summary */
.selected-products-summary .summary-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem 0;
	font-size: 1rem;
}

.selected-products-summary .summary-row span {
	color: #6c757d;
}

.selected-products-summary .summary-row strong {
	color: #2c3e50;
	font-size: 1.125rem;
}

/* Available Deals */
.available-deals {
	margin-top: 1.5rem;
}

.deals-title {
	font-size: 1.125rem;
	font-weight: 700;
	color: #2c3e50;
	margin-bottom: 1rem;
}

.deals-list {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	max-height: 300px;
	overflow-y: auto;
	padding-right: 0.5rem;
}

.deals-list::-webkit-scrollbar {
	width: 6px;
}

.deals-list::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 10px;
}

.deals-list::-webkit-scrollbar-thumb {
	background: #27ae60;
	border-radius: 10px;
}

.deals-list::-webkit-scrollbar-thumb:hover {
	background: #229954;
}

.deal-item {
	background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
	border-radius: 12px;
	padding: 1rem;
	border: 2px solid #dee2e6;
	transition: all 0.3s ease;
}

.deal-header {
	margin-bottom: 0.75rem;
}

.deal-badge {
	display: inline-block;
	padding: 0.25rem 0.75rem;
	border-radius: 20px;
	font-size: 0.75rem;
	font-weight: 600;
	color: #fff;
	text-transform: uppercase;
	margin-bottom: 0.5rem;
}

.deal-name {
	font-size: 1.125rem;
	font-weight: 700;
	color: #2c3e50;
	margin: 0;
}

/* Tier Items */
.deal-tiers {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.tier-item {
	background: #fff;
	border-radius: 10px;
	padding: 0.75rem;
	border: 2px solid #e9ecef;
	transition: all 0.3s ease;
}

.tier-item.unlocked {
	border-color: #27ae60;
	background: linear-gradient(135deg, #f8fff8 0%, #e8f8e8 100%);
}

.tier-item.active {
	box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.3);
}

.tier-item.animate-unlock {
	animation: tierUnlock 0.6s ease;
}

@keyframes tierUnlock {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.05);
	}
}

.tier-info {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.75rem;
	font-weight: 700;
}

.tier-threshold {
	color: #2c3e50;
	font-size: 1rem;
}

.tier-arrow {
	color: #95a5a6;
	font-size: 1.25rem;
}

.tier-discount {
	color: #27ae60;
	font-size: 1.125rem;
}

.tier-progress {
	margin-bottom: 0.75rem;
}

.tier-progress .progress {
	height: 8px;
	background: #e9ecef;
	border-radius: 10px;
	overflow: hidden;
}

.tier-progress .progress-bar {
	background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
	transition: width 0.5s ease;
}

.tier-status {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.875rem;
}

.tier-status i {
	font-size: 1rem;
}

/* Discount Summary */
.discount-summary {
	margin-top: 1.5rem;
}

.discount-summary .summary-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem 0;
	font-size: 1.125rem;
}

.discount-summary .discount-row {
	color: #27ae60;
}

.discount-summary .total-row {
	padding-top: 1rem;
}

.discount-summary .total-label {
	font-weight: 700;
	color: #2c3e50;
	font-size: 1.25rem;
}

.discount-summary .bundle-total {
	font-size: 1.75rem;
	font-weight: 700;
	color: #27ae60;
}

/* Add to Cart Button */
.btn-add-bundle {
	font-weight: 700;
	font-size: 1.125rem;
	padding: 1rem;
	border-radius: 12px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	transition: all 0.3s ease;
}

.btn-add-bundle:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: 0 5px 20px rgba(39, 174, 96, 0.3);
}

.btn-add-bundle:active:not(:disabled) {
	transform: translateY(0);
}

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

/* Empty Bundle Message */
.empty-bundle-message {
	text-align: center;
	padding: 1rem;
	background: #fff3cd;
	border-radius: 8px;
}

.empty-bundle-message small {
	color: #856404;
}

/* ==========================================================================
   Notifications
   ========================================================================== */

.bundle-deals-notification {
	position: relative;
	margin-bottom: 2rem;
	border-radius: 12px;
	animation: slideDown 0.3s ease;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.cart-redirect-message p {
	margin-bottom: 1rem;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 991px) {
	/* Add padding to bottom of page to prevent content from being hidden */
	.bundle-deals-page .container {
		padding-bottom: 90px;
	}

	.bundle-calculator {
		position: fixed !important;
		bottom: 0;
		left: 0;
		right: 0;
		z-index: 1000;
		/* max-height: 80vh; */
		transition: transform 0.3s ease;
		margin: 0;
	}

	.bundle-calculator.collapsed {
		transform: translateY(calc(100% - 70px));
	}

	.calculator-inner {
		border-radius: 20px 20px 0 0;
		padding: 0.75rem;
		max-height: 88vh;
		overflow-y: auto;
		box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.2);
	}

	/* Toggle Button */
	.calculator-toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0.875rem 1rem;
		background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
		color: #fff;
		border-radius: 20px 20px 0 0;
		cursor: pointer;
		margin: -0.75rem -0.75rem 1rem -0.75rem;
		user-select: none;
	}

	.calculator-toggle-content {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
	}

	.calculator-toggle-left {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		flex: 1;
		min-width: 0;
	}

	.calculator-toggle-left > i {
		font-size: 1.75rem;
		flex-shrink: 0;
	}

	.calculator-toggle-info {
		display: flex;
		align-items: baseline;
		gap: 0.5rem;
		flex-wrap: wrap;
	}

	.calculator-toggle-title {
		font-size: 0.9rem;
		font-weight: 600;
		margin: 0;
		white-space: nowrap;
	}

	.calculator-toggle-summary {
		font-size: 0.8rem;
		opacity: 0.85;
		white-space: nowrap;
	}

	.calculator-toggle-right {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		flex-shrink: 0;
	}

	.calculator-toggle-price {
		font-size: 1.5rem;
		font-weight: 700;
		margin: 0;
		white-space: nowrap;
	}

	.calculator-toggle-icon {
		font-size: 1.5rem;
		transition: transform 0.3s ease;
	}

	.bundle-calculator.collapsed .calculator-toggle-icon {
		transform: rotate(180deg);
	}

	.calculator-content {
		transition: opacity 0.3s ease;
	}

	.bundle-calculator.collapsed .calculator-content {
		opacity: 0;
		pointer-events: none;
	}

	/* Hide title on mobile since we have toggle */
	.bundle-calculator .calculator-title {
		display: none;
	}

	/* Adjust spacing */
	.selected-products-summary {
		margin-top: 0;
	}

	/* Add overlay when expanded */
	body.bundle-calculator-open::before {
		content: '';
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.5);
		z-index: 999;
		animation: fadeIn 0.3s ease;
	}

	@keyframes fadeIn {
		from {
			opacity: 0;
		}
		to {
			opacity: 1;
		}
	}
}

@media (max-width: 768px) {
	.bundle-products-grid.grid-cols-3,
	.bundle-products-grid.grid-cols-4 {
		grid-template-columns: repeat(2, 1fr);
	}

	.bundle-deals-header h1 {
		font-size: 2rem;
	}

	.calculator-inner {
		padding: 1.5rem;
	}

	.section-header {
		flex-direction: column;
		align-items: flex-start !important;
		gap: 1rem;
	}
}

@media (max-width: 480px) {
	.bundle-products-grid {
		grid-template-columns: 1fr;
	}

	.bundle-deals-header h1 {
		font-size: 1.75rem;
	}

	.bundle-deals-header .lead {
		font-size: 1rem;
	}

	.calculator-inner {
		padding: 1rem;
	}

	.product-title {
		font-size: 0.875rem;
		min-height: auto;
	}
}

/* ==========================================================================
   RTL Support
   ========================================================================== */

[dir="rtl"] .tier-arrow {
	transform: scaleX(-1);
}

[dir="rtl"] .calculator-title,
[dir="rtl"] .tier-status {
	flex-direction: row-reverse;
}

[dir="rtl"] .tier-info {
	flex-direction: row-reverse;
}

[dir="rtl"] .calculator-toggle-content {
	flex-direction: row-reverse;
}

[dir="rtl"] .calculator-toggle-left {
	flex-direction: row-reverse;
}

[dir="rtl"] .calculator-toggle-right {
	flex-direction: row-reverse;
}
