/* WooCommerce Sticky Recommended Product Slide-In Styles */

:root {
	--wc-rps-bg: rgba(255, 255, 255, 0.88);
	--wc-rps-border: rgba(0, 0, 0, 0.08);
	--wc-rps-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
	--wc-rps-radius-card: 14px;
	--wc-rps-radius-btn: 8px;
	
	/* Typography & Colors */
	--wc-rps-text-primary: #1e293b;
	--wc-rps-text-secondary: #64748b;
	--wc-rps-badge-bg: #e0e7ff;
	--wc-rps-badge-text: #4338ca;
	
	/* Call to Action */
	--wc-rps-btn-bg: #0f172a;
	--wc-rps-btn-text: #ffffff;
	--wc-rps-btn-bg-hover: #1e293b;
	
	/* Widths */
	--wc-rps-card-width: 390px;
}

/* Card Wrapper */
.wc-rps-card-wrapper {
	position: fixed;
	bottom: 24px;
	left: 24px;
	width: var(--wc-rps-card-width);
	background: var(--wc-rps-bg);
	border: 1px solid var(--wc-rps-border);
	border-radius: var(--wc-rps-radius-card);
	box-shadow: var(--wc-rps-shadow);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	z-index: 99999;
	padding: 14px;
	box-sizing: border-box;
	
	/* Animation: Hidden off-screen initially */
	opacity: 0;
	transform: translateY(150%) scale(0.96);
	pointer-events: none;
	transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Activated State via JS */
.wc-rps-card-wrapper.wc-rps-active {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* Content Container */
.wc-rps-card-content {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
}

/* Thumbnail Container */
.wc-rps-thumbnail {
	flex-shrink: 0;
	width: 70px;
	height: 70px;
	border-radius: 8px;
	overflow: hidden;
	background: #f8fafc;
	border: 1px solid rgba(0, 0, 0, 0.04);
}

.wc-rps-thumbnail img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.wc-rps-thumbnail a:hover img {
	transform: scale(1.05);
}

/* Info Section (Middle) */
.wc-rps-info {
	flex-grow: 1;
	min-width: 0; /* Ensures truncation works correctly */
	display: flex;
	flex-direction: column;
	gap: 4px;
}

/* Custom Pill Badge */
.wc-rps-badge {
	align-self: flex-start;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--wc-rps-badge-text);
	background: var(--wc-rps-badge-bg);
	padding: 3px 8px;
	border-radius: 99px;
	line-height: 1.2;
}

/* Product Title */
.wc-rps-title {
	margin: 0;
	padding: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
}

.wc-rps-title a {
	color: var(--wc-rps-text-primary);
	text-decoration: none !important;
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color 0.2s ease;
	box-shadow: none !important;
}

.wc-rps-title a:hover {
	color: var(--wc-rps-badge-text);
}

/* Price */
.wc-rps-price {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 14px;
	font-weight: 700;
	color: var(--wc-rps-text-primary);
}

.wc-rps-price del {
	font-size: 11px;
	color: var(--wc-rps-text-secondary);
	margin-right: 4px;
	font-weight: 400;
}

.wc-rps-price ins {
	text-decoration: none;
	background: transparent;
	color: inherit;
}

/* Actions Section */
.wc-rps-action {
	flex-shrink: 0;
}

.wc-rps-btn {
	display: inline-block;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	text-decoration: none !important;
	color: var(--wc-rps-btn-text) !important;
	background: var(--wc-rps-btn-bg) !important;
	border: none !important;
	border-radius: var(--wc-rps-radius-btn);
	padding: 8px 14px;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

.wc-rps-btn:hover {
	background: var(--wc-rps-btn-bg-hover) !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.wc-rps-btn:active {
	transform: translateY(0);
}

/* Handle WooCommerce adding loading spinner classes */
.wc-rps-btn.loading {
	padding-right: 32px;
	position: relative;
	opacity: 0.8;
}

.wc-rps-btn.loading::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 12px;
	width: 12px;
	height: 12px;
	margin-top: -6px;
	border: 2px solid transparent;
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: wc-rps-spin 0.6s linear infinite;
}

/* Close/Dismiss Button */
.wc-rps-close-btn {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #ffffff;
	border: 1px solid var(--wc-rps-border);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--wc-rps-text-secondary);
	cursor: pointer;
	padding: 0;
	transition: background-color 0.2s ease, color 0.2s ease;
	z-index: 10;
}

.wc-rps-close-btn:hover {
	background: #f8fafc;
	color: var(--wc-rps-text-primary);
}

.wc-rps-close-btn svg {
	width: 12px;
	height: 12px;
	display: block;
}

/* Keyframes */
@keyframes wc-rps-spin {
	to { transform: rotate(360deg); }
}

/* Responsive Styles for Mobile (max-width: 767px) */
@media screen and (max-width: 767px) {
	.wc-rps-card-wrapper {
		width: calc(100% - 32px);
		bottom: 16px;
		left: 16px;
		right: 16px;
		padding: 10px 12px;
		border-radius: 12px;
		/* Slide from absolute bottom on mobile */
		transform: translateY(160%);
	}
	
	.wc-rps-card-content {
		gap: 10px;
	}
	
	.wc-rps-thumbnail {
		width: 55px;
		height: 55px;
		border-radius: 6px;
	}
	
	.wc-rps-badge {
		font-size: 8px;
		padding: 2px 6px;
	}
	
	.wc-rps-title {
		font-size: 13px;
	}
	
	.wc-rps-price {
		font-size: 13px;
	}
	
	.wc-rps-btn {
		font-size: 12px;
		padding: 7px 10px;
	}
	
	.wc-rps-close-btn {
		top: 6px;
		right: 6px;
		background: transparent;
		border: none;
		box-shadow: none;
		width: 20px;
		height: 20px;
	}

	.wc-rps-close-btn:hover {
		background: rgba(0, 0, 0, 0.05);
	}
	
	/* Add space for single product mobile sticky buttons (if any) */
	.woocommerce-page .wc-rps-card-wrapper {
		margin-bottom: constant(safe-area-inset-bottom);
		margin-bottom: env(safe-area-inset-bottom);
	}
}
