/**
 * RB_ProductCard - Frontend Stylesheet
 * Responsive Product & Affiliate Cards
 */

:root {
	--rb-card-radius: 16px;
	--rb-card-bg: #ffffff;
	--rb-card-border: #e2e8f0;
	--rb-card-title-color: #111827;
	--rb-card-text-color: #4b5563;
	--rb-btn-bg: #b02a37;
	--rb-btn-bg-hover: #92202c;
	--rb-btn-color: #ffffff;
	--rb-disclaimer-color: #64748b;
}

/* ─── Grid Container for Multiple Cards (Rettangolini) ─────────────── */

.rb-product-cards-grid {
	display: grid;
	gap: 24px;
	width: 100%;
	margin: 28px 0;
	box-sizing: border-box;
}

.rb-product-cards-grid.rb-grid-cols-1 {
	grid-template-columns: 1fr;
}

.rb-product-cards-grid.rb-grid-cols-2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rb-product-cards-grid.rb-grid-cols-3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rb-product-cards-grid.rb-grid-cols-4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rb-product-cards-grid.rb-grid-cols-auto {
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (max-width: 768px) {
	.rb-product-cards-grid.rb-grid-cols-2,
	.rb-product-cards-grid.rb-grid-cols-3,
	.rb-product-cards-grid.rb-grid-cols-4 {
		grid-template-columns: 1fr;
		gap: 18px;
	}
}

/* ─── Product Card Box Base ────────────────────────────────────────── */

.rb-product-card {
	position: relative;
	background: var(--rb-card-bg, #ffffff);
	border: 1px solid var(--rb-card-border, #e2e8f0);
	border-radius: var(--rb-card-radius, 16px);
	padding: 24px 28px;
	box-sizing: border-box;
	transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
	margin: 24px 0;
	width: 100%;
	font-family: inherit;
}

.rb-product-cards-grid .rb-product-card {
	margin: 0;
	display: flex;
	flex-direction: column;
	height: 100%;
}

.rb-product-card:hover {
	border-color: #cbd5e1;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
}

/* ─── Badge ────────────────────────────────────────────────────────── */

.rb-product-badge {
	position: absolute;
	top: -12px;
	left: 24px;
	background: #1e293b;
	color: #ffffff;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	padding: 4px 12px;
	border-radius: 9999px;
	box-shadow: 0 2px 6px rgba(0,0,0,0.12);
	z-index: 2;
}

/* ─── Content Wrapper ──────────────────────────────────────────────── */

.rb-card-content-wrapper {
	display: flex;
	gap: 20px;
	width: 100%;
	height: 100%;
}

.rb-card-body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
}

/* Optional Image */
.rb-card-image {
	flex-shrink: 0;
	width: 120px;
	height: 120px;
	border-radius: 10px;
	overflow: hidden;
	background: #f8fafc;
	border: 1px solid #f1f5f9;
}

.rb-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ─── Title ────────────────────────────────────────────────────────── */

.rb-card-title {
	margin: 0 0 10px 0;
	padding: 0;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.35;
	color: var(--rb-card-title-color, #111827);
	letter-spacing: -0.2px;
}

/* ─── Description ──────────────────────────────────────────────────── */

.rb-card-description {
	margin: 0 0 20px 0;
	font-size: 0.98rem;
	line-height: 1.6;
	color: var(--rb-card-text-color, #4b5563);
}

.rb-card-description p {
	margin: 0 0 8px 0;
}

.rb-card-description p:last-child {
	margin-bottom: 0;
}

/* ─── Footer & Action Row ──────────────────────────────────────────── */

.rb-card-footer {
	margin-top: auto;
}

.rb-card-actions {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 14px 18px;
}

/* ─── Action Button ────────────────────────────────────────────────── */

.rb-card-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background-color: var(--rb-btn-bg, #b02a37);
	color: var(--rb-btn-color, #ffffff) !important;
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1;
	padding: 11px 20px;
	border-radius: 8px;
	text-decoration: none !important;
	border: none;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(0,0,0,0.06);
	transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	outline: none;
}

.rb-card-btn:hover {
	background-color: var(--rb-btn-bg-hover, #92202c);
	color: var(--rb-btn-color, #ffffff) !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(176, 42, 55, 0.22);
}

.rb-card-btn:active {
	transform: translateY(0);
}

.rb-card-btn:focus-visible {
	box-shadow: 0 0 0 3px rgba(176, 42, 55, 0.35);
}

.rb-btn-icon {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	transition: transform 0.2s ease;
}

.rb-card-btn:hover .rb-btn-icon {
	transform: translate(2px, -2px);
}

/* ─── Price & Disclaimer ───────────────────────────────────────────── */

.rb-card-price {
	font-size: 1.15rem;
	font-weight: 700;
	color: #111827;
}

.rb-card-disclaimer {
	font-size: 0.88rem;
	color: var(--rb-disclaimer-color, #64748b);
	font-weight: 400;
	line-height: 1.4;
	user-select: none;
}

/* ─── Single Card Click Stats Badge ────────────────────────────────── */

.rb-card-stats-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 0.82rem;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 9999px;
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fee2e2;
	line-height: 1.2;
}

.rb-card-stats-badge.rb-admin-stats-indicator {
	background: #eff6ff;
	color: #1e40af;
	border: 1px solid #dbeafe;
	font-size: 0.78rem;
	cursor: help;
}

/* ─── Layout Specific Styles ───────────────────────────────────────── */

/* Full Width Layout */
.rb-layout-full {
	width: 100%;
}

/* Box / Card Layout (Rettangolino) */
.rb-layout-box,
.rb-layout-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: 22px 24px;
}

.rb-layout-box .rb-card-content-wrapper,
.rb-layout-card .rb-card-content-wrapper {
	flex-direction: column;
	gap: 12px;
}

.rb-layout-box .rb-card-actions,
.rb-layout-card .rb-card-actions {
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
}

.rb-layout-box .rb-card-btn,
.rb-layout-card .rb-card-btn {
	width: auto;
}

/* Compact Layout */
.rb-layout-compact {
	padding: 16px 20px;
}

.rb-layout-compact .rb-card-title {
	font-size: 1.1rem;
	margin-bottom: 6px;
}

.rb-layout-compact .rb-card-description {
	font-size: 0.9rem;
	margin-bottom: 12px;
}

.rb-layout-compact .rb-card-btn {
	padding: 8px 14px;
	font-size: 0.88rem;
}

/* ─── Responsive Media Queries ─────────────────────────────────────── */

@media (max-width: 600px) {
	.rb-product-card {
		padding: 18px 20px;
		border-radius: 14px;
	}

	.rb-card-content-wrapper {
		flex-direction: column;
	}

	.rb-card-image {
		width: 100%;
		height: 180px;
	}

	.rb-card-title {
		font-size: 1.15rem;
	}

	.rb-card-description {
		font-size: 0.92rem;
	}

	.rb-card-actions {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
	}

	.rb-card-btn {
		width: 100%;
		justify-content: center;
	}
}
