/**
 * Intrinsic Blue — Product Card
 * Used on: Shop archive, category pages, and related/upsell product
 * grids on the single product page.
 */

.ib-product-card {
	list-style: none;
	background: var(--ib-bg-surface);
	border-radius: var(--ib-radius-md);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: var(--ib-shadow-card);
	border: 1px solid var(--ib-border-subtle);
	margin: 0 !important; /* override Astra/WC default loop margins — grid gap handles spacing */
	transition: transform var(--ib-transition-base);
}

.ib-product-card:hover {
	transform: translateY(-4px);
}

.ib-product-card .ib-product-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

/* ---------- Media / Image ---------- */
.ib-product-card__media {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--ib-bg-surface-alt);
}

.ib-product-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform var(--ib-transition-base);
}

.ib-product-card:hover .ib-product-card__media img {
	transform: scale(1.04);
}

/* Suppress WooCommerce's default "Sale!" ribbon — Figma communicates
   sale state via strikethrough price only, and our own NEW badge. */
.ib-product-card__media .onsale {
	display: none;
}

.ib-badge {
	position: absolute;
	top: var(--ib-space-3);
	left: var(--ib-space-3);
	z-index: 2;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 5px 12px;
	border-radius: var(--ib-radius-pill);
	color: var(--ib-text-on-accent);
}

.ib-badge--new {
	background: var(--ib-badge-new-bg);
}

/* ---------- Body ---------- */
.ib-product-card__body {
	padding: var(--ib-space-4) var(--ib-space-4) 0;
}

.ib-product-card__category {
	display: block;
	font-size: 12px;
	color: var(--ib-text-muted);
	margin-bottom: var(--ib-space-1);
}

.ib-product-card .ib-product-card__title {
	font-family: var(--ib-font-body);
	font-size: 16px;
	font-weight: 600;
	color: var(--ib-text-primary);
	margin: 0 0 var(--ib-space-2);
	line-height: 1.35;
}

.ib-product-card__rating {
	margin-bottom: var(--ib-space-2);
	display: flex;
	align-items: center;
	gap: var(--ib-space-1);
}

.ib-product-card__rating .star-rating {
	font-size: 14px;
	color: var(--ib-star-filled);
}

.ib-product-card__rating .star-rating span:before {
	color: var(--ib-star-filled);
}

.ib-product-card__review-count {
	font-size: 13px;
	color: var(--ib-text-muted);
}

/* ---------- Footer: price + Add button, same row ---------- */
.ib-product-card__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ib-space-3);
	padding: var(--ib-space-3) var(--ib-space-4) var(--ib-space-4);
}

.ib-product-card__price .price {
	font-size: 18px;
	font-weight: 700;
	color: var(--ib-price-color);
}

.ib-product-card__price .price del {
	font-size: 14px;
	font-weight: 400;
	color: var(--ib-text-strike);
	opacity: 1;
	margin-right: var(--ib-space-2);
}

.ib-product-card__price .price ins {
	text-decoration: none;
}

.ib-product-card__add .added_to_cart {
	display: block;
	font-size: 12px;
	color: var(--ib-success);
	margin-top: var(--ib-space-1);
	text-align: center;
}

/* Loading state WooCommerce applies during AJAX add-to-cart */
.ib-product-card__add .add_to_cart_button.loading {
	opacity: 0.6;
	pointer-events: none;
}


/* v2.8 — Keep WooCommerce rating row identical to the approved card:
   stars first, review count second, never wrapped/reversed by Astra/WC. */
.ib-product-card .ib-product-card__rating {
	display: inline-flex !important;
	flex-direction: row !important;
	align-items: center !important;
	justify-content: flex-start !important;
	gap: 5px !important;
	width: auto !important;
	max-width: 100% !important;
	white-space: nowrap !important;
	direction: ltr !important;
}

.ib-product-card .ib-product-card__rating .star-rating {
	order: 1 !important;
	float: none !important;
	display: inline-block !important;
	flex: 0 0 auto !important;
	margin: 0 !important;
	vertical-align: middle !important;
	position: relative !important;
}

/* WooCommerce paints the empty/base stars on ::before and fills the
   percentage on span::before. Keep empty stars grey and filled stars gold. */
.ib-product-card .ib-product-card__rating .star-rating::before {
	color: var(--ib-star-empty) !important;
}

.ib-product-card .ib-product-card__rating .star-rating span::before {
	color: var(--ib-star-filled) !important;
}

.ib-product-card .ib-product-card__review-count {
	order: 2 !important;
	display: inline-block !important;
	flex: 0 0 auto !important;
	margin: 0 !important;
	line-height: 1 !important;
	white-space: nowrap !important;
	direction: ltr !important;
}
