/**
 * WooCommerce Upsell Popup Styles
 */

/* Overlay */
.upsell-popup-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.7);
	z-index: 999998;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.upsell-popup-overlay.active {
	display: block;
}

/* Modal Container */
.upsell-popup-modal {
	display: none;
	position: relative;
	background: #fff;
	margin: 50px auto;
	max-width: 700px;
	width: 90%;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	z-index: 999999;
	overflow: hidden;
	animation: upsellPopupSlideIn 0.3s ease-out;
}

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

/* Close Button */
.upsell-popup-close {
	position: absolute;
	top: 15px;
	right: 15px;
	background: transparent;
	border: none;
	font-size: 32px;
	line-height: 1;
	color: #666;
	cursor: pointer;
	z-index: 10;
	padding: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.3s ease;
}

.upsell-popup-close:hover {
	color: #000;
}

.upsell-popup-close:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* Header */
.upsell-popup-header {
	padding: 30px 30px 20px;
	text-align: center;
	border-bottom: 1px solid #e5e5e5;
}

.upsell-popup-header h2 {
	margin: 0 0 10px;
	font-size: 28px;
	font-weight: 600;
	color: #333;
}

.upsell-popup-header p {
	margin: 0;
	font-size: 16px;
	color: #666;
}

/* Content */
.upsell-popup-content {
	padding: 30px;
	max-height: 60vh;
	overflow-y: auto;
}

/* Loading State */
.upsell-popup-loading {
	text-align: center;
	padding: 60px 20px;
}

.upsell-popup-spinner {
	border: 4px solid #f3f3f3;
	border-top: 4px solid #0073aa;
	border-radius: 50%;
	width: 50px;
	height: 50px;
	animation: upsellPopupSpin 1s linear infinite;
	margin: 0 auto 20px;
}

@keyframes upsellPopupSpin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.upsell-popup-loading p {
	margin: 0;
	color: #666;
	font-size: 16px;
}

/* Error State */
.upsell-popup-error {
	text-align: center;
	padding: 60px 20px;
	color: #d63638;
}

.upsell-popup-error p {
	margin: 0;
	font-size: 16px;
}

/* No Products */
.upsell-popup-no-products {
	text-align: center;
	padding: 60px 20px;
	color: #666;
	font-size: 16px;
}

/* Products Grid */
.upsell-popup-products {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* Product Item */
.upsell-popup-product {
	overflow: hidden;
    display: grid;
    grid-template-columns: 100px 1fr 150px;
    align-items: center;
    gap: clamp(10px, 1.5625vw + .1px, 30px);
}

/* Product Image */
.upsell-popup-product-image {
	width: 100%;
	height: auto;
	aspect-ratio: 1/1;
	overflow: hidden;
	background: #f5f5f5;
	display: flex;
	align-items: center;
	justify-content: center;
}

.upsell-popup-product-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.upsell-popup-product-image .no-image {
	color: #999;
	font-size: 14px;
}

/* Product Info */
.upsell-popup-product-info {
	padding: 15px;
}

.upsell-popup-product-title {
	margin: 0 0 10px;
	font-size: 16px;
	font-weight: 600;
	color: #333;
	line-height: 1.4;
}

.upsell-popup-product-price {
	margin: 0 0 15px;
	font-size: 18px;
	font-weight: 600;
	color: #0073aa;
}

.upsell-popup-product-price del {
	color: #999;
	font-size: 14px;
	font-weight: normal;
	margin-right: 5px;
}

/* Add to Cart Button */
.upsell-popup-add-to-cart {
	width: 100%;
	padding: 12px 20px;
	background: transparent !important;
	border: solid 1px #F68E2D;
	color: #F68E2D !important;
	border-radius: 6px !important;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.3s ease;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.upsell-popup-add-to-cart:hover:not(:disabled) {
	border-color: #005a87;
	color: #005a87 !important;
}

.upsell-popup-add-to-cart:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.upsell-popup-add-to-cart.added {
	border-color: #46b450;
	color: #46b450 !important;
}

/* Footer */
.upsell-popup-footer {
	padding: 20px 30px 30px;
	text-align: center;
	border-top: 1px solid #e5e5e5;
	background: #f9f9f9;
}

.upsell-popup-continue-checkout {
	padding: 15px 40px;
	background: #0073aa;
	color: #fff;
	border: none;
	border-radius: 6px !important;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.3s ease;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.upsell-popup-continue-checkout:hover {
	background: #005a87;
}

/* Responsive Design */
@media (max-width: 768px) {
	.upsell-popup-modal {
		width: 95%;
		margin: 20px auto;
	}

	.upsell-popup-header {
		padding: 20px 15px 15px;
	}

	.upsell-popup-header h2 {
		font-size: 22px;
	}

	.upsell-popup-content {
		padding: 20px 15px;
		max-height: 50vh;
	}

	.upsell-popup-products {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 15px;
	}

	.upsell-popup-product-image {
		height: 150px;
	}

	.upsell-popup-product-title {
		font-size: 14px;
		min-height: 40px;
	}

	.upsell-popup-product-price {
		font-size: 16px;
	}

	.upsell-popup-footer {
		padding: 15px;
	}

	.upsell-popup-continue-checkout {
		width: 100%;
		padding: 12px 20px;
		font-size: 14px;
	}
}

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

	.upsell-popup-product-image {
		height: 200px;
	}
}

/* Accessibility */
.upsell-popup-overlay:focus,
.upsell-popup-modal:focus {
	outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.upsell-popup-modal {
		border: 2px solid #000;
	}

	.upsell-popup-product {
		border: 2px solid #000;
	}
}
