/**
 * Rejuven8 WP 2.1 — Frontend Upsell Styles
 *
 * Modern, conversion-focused product cards for cart & checkout pages.
 * Shopify-quality design: clean lines, clear CTAs, responsive grid.
 *
 * CSS Class Reference:
 *   .r8wp-upsell-wrap     — outer container
 *   .r8wp-upsell-heading  — section heading
 *   .r8wp-upsell-item     — individual product card
 *   .r8wp-upsell-img      — product thumbnail
 *   .r8wp-upsell-info     — name + price wrapper
 *   .r8wp-upsell-name     — product name
 *   .r8wp-upsell-price    — price display
 *   .r8wp-upsell-btn      — add to cart button
 *   .r8wp-upsell-discount — discount badge
 */

/* ── Container ─────────────────────────────────────────────────────────── */

.r8wp-upsell-wrap {
	margin: 32px 0 24px;
	padding: 24px;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ── Heading ───────────────────────────────────────────────────────────── */

.r8wp-upsell-heading {
	font-size: 18px;
	font-weight: 700;
	color: #1f2937;
	margin: 0 0 20px;
	padding-bottom: 12px;
	border-bottom: 2px solid #f3f4f6;
	display: flex;
	align-items: center;
	gap: 8px;
}

.r8wp-upsell-heading::before {
	content: "✨";
	font-size: 20px;
}

/* ── Product grid ──────────────────────────────────────────────────────── */

.r8wp-upsell-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
}

/* ── Product card ──────────────────────────────────────────────────────── */

.r8wp-upsell-item {
	display: flex;
	flex-direction: column;
	background: #fafafa;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 16px;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
	position: relative;
	overflow: hidden;
	min-width: 180px;
	flex: 1;
}

.r8wp-upsell-item:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	border-color: #d1d5db;
}

/* ── Product image ─────────────────────────────────────────────────────── */

.r8wp-upsell-img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 8px;
	margin-bottom: 12px;
	background: #f3f4f6;
}

/* ── Product info ──────────────────────────────────────────────────────── */

.r8wp-upsell-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 12px;
}

.r8wp-upsell-name {
	font-size: 14px;
	font-weight: 600;
	color: #1f2937;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
}

.r8wp-upsell-price {
	font-size: 16px;
	font-weight: 700;
	color: #111827;
	margin: 2px 0 0;
}

.r8wp-upsell-price del {
	color: #9ca3af;
	font-weight: 400;
	font-size: 13px;
	margin-right: 4px;
}

.r8wp-upsell-price ins {
	text-decoration: none;
	color: #dc2626;
}

/* ── Discount badge ────────────────────────────────────────────────────── */

.r8wp-upsell-discount {
	position: absolute;
	top: 12px;
	right: 12px;
	background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 20px;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
	z-index: 1;
}

/* ── Add to cart button — !important guards against theme overrides ─────── */

.r8wp-upsell-btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 100% !important;
	padding: 10px 16px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	color: #ffffff !important;
	background: linear-gradient(135deg, #1a44a1 0%, #2a5cc7 100%) !important;
	border: none !important;
	border-radius: 8px !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
	text-transform: none !important;
	letter-spacing: 0.2px !important;
	line-height: 1.4 !important;
	text-decoration: none !important;
	box-sizing: border-box !important;
}

.r8wp-upsell-btn:hover {
	background: linear-gradient(135deg, #2a5cc7 0%, #3b6fd8 100%) !important;
	box-shadow: 0 2px 8px rgba(26, 68, 161, 0.35) !important;
	transform: translateY(-1px) !important;
	color: #ffffff !important;
}

.r8wp-upsell-btn:active {
	transform: translateY(0) !important;
	box-shadow: 0 1px 3px rgba(26, 68, 161, 0.25) !important;
}

.r8wp-upsell-btn:focus {
	outline: none !important;
	box-shadow: 0 0 0 3px rgba(26, 68, 161, 0.25) !important;
}

.r8wp-upsell-btn.r8wp-adding {
	opacity: 0.7 !important;
	pointer-events: none !important;
}

.r8wp-upsell-btn.r8wp-added {
	background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
	pointer-events: none !important;
	color: #ffffff !important;
}

/* ── Bar layout ────────────────────────────────────────────────────────── */

.r8wp-upsell-wrap.r8wp-layout-bar .r8wp-upsell-grid {
	flex-direction: row;
	flex-wrap: nowrap;
}

.r8wp-upsell-wrap.r8wp-layout-bar .r8wp-upsell-item {
	flex-direction: row;
	width: 100%;
	min-width: unset;
	align-items: center;
	gap: 16px;
	padding: 12px 16px;
}

.r8wp-upsell-wrap.r8wp-layout-bar .r8wp-upsell-img {
	width: 60px;
	height: 60px;
	flex-shrink: 0;
	aspect-ratio: 1;
	border-radius: 8px;
	margin-bottom: 0;
}

.r8wp-upsell-wrap.r8wp-layout-bar .r8wp-upsell-info {
	flex: 1;
	padding: 0;
	margin-bottom: 0;
}

.r8wp-upsell-wrap.r8wp-layout-bar .r8wp-upsell-btn {
	width: auto !important;
	margin: 0 !important;
	white-space: nowrap !important;
	padding: 8px 20px !important;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
	.r8wp-upsell-wrap {
		padding: 16px;
		margin: 20px 0 16px;
	}

	.r8wp-upsell-grid {
		flex-wrap: wrap;
	}

	.r8wp-upsell-item {
		min-width: calc(50% - 8px);
	}

	.r8wp-upsell-heading {
		font-size: 16px;
	}

	.r8wp-upsell-item {
		padding: 12px;
	}

	.r8wp-upsell-name {
		font-size: 13px;
	}

	.r8wp-upsell-price {
		font-size: 14px;
	}

	.r8wp-upsell-btn {
		font-size: 12px !important;
		padding: 8px 12px !important;
	}

	/* Bar layout falls back to vertical on mobile */
	.r8wp-upsell-wrap.r8wp-layout-bar .r8wp-upsell-grid {
		flex-direction: column;
	}

	.r8wp-upsell-wrap.r8wp-layout-bar .r8wp-upsell-item {
		min-width: unset;
	}
}

@media (max-width: 380px) {
	.r8wp-upsell-item {
		min-width: 100%;
	}
}
