/**
 * EW Enhance - TikTok Shop style product cards.
 * Scoped to .ew-product-card so theme and Elementor widgets stay untouched.
 */

ul.products li.product.ew-product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border: 1px solid rgba(22, 24, 35, 0.06);
	border-radius: 10px;
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

ul.products li.product.ew-product-card:hover {
	box-shadow: 0 8px 24px rgba(22, 24, 35, 0.1);
	transform: translateY(-2px);
}

/* The default WooCommerce "Sale!" bubble is replaced by the Flash Sale chip. */
ul.products li.product.ew-product-card .onsale {
	display: none !important;
}

/* ---------- Image ---------- */

ul.products li.product.ew-product-card .woocommerce-loop-image-link {
	display: block;
	position: relative;
	overflow: hidden;
	background: #f6f6f8;
	aspect-ratio: 1 / 1;
}

ul.products li.product.ew-product-card .woocommerce-loop-image-link img {
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
	transition: transform 0.35s ease;
}

ul.products li.product.ew-product-card:hover .woocommerce-loop-image-link img {
	transform: scale(1.04);
}

/* Keep list view images natural instead of square. */
.products-list-view li.product.ew-product-card .woocommerce-loop-image-link {
	aspect-ratio: auto;
}

/* ---------- Content ---------- */

ul.products li.product.ew-product-card .product-details {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	padding: 10px 10px 12px;
	background: transparent;
}

ul.products li.product.ew-product-card .woocommerce-loop-product__title {
	margin: 0 0 2px;
	padding: 0;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	color: #161823;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

ul.products li.product.ew-product-card .woocommerce-loop-product__title a {
	color: inherit;
	text-decoration: none;
}

/* ---------- Badges ---------- */

.ew-product-meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0;
}

.ew-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

.ew-badge {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	padding: 3px 5px;
	border: 1px solid currentColor;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	letter-spacing: 0.1px;
}

.ew-badge .ew-icon {
	width: 10px;
	height: 10px;
	flex: 0 0 auto;
	display: block;
}

/* The Flash Sale bolt is intentionally larger, like the TikTok Shop badge. */
.ew-badge--flash {
	gap: 4px;
	padding: 2px 5px;
	color: #fe2c55;
	background: rgba(254, 44, 85, 0.07);
	border-color: rgba(254, 44, 85, 0.45);
}

.ew-badge--flash .ew-icon {
	width: 14px;
	height: 14px;
	margin: -1px 0;
}

.ew-badge--shipping {
	color: #0aa8a7;
	background: rgba(10, 168, 167, 0.07);
	border-color: rgba(10, 168, 167, 0.45);
}

/* ---------- Sold counter ---------- */

ul.products li.product.ew-product-card .ew-sold {
	font-size: 11px;
	line-height: 1.3;
	color: #8a8b91;
}

/* ---------- Price ---------- */

ul.products li.product.ew-product-card .price {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1px;
	margin: 3px 0 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.15;
	color: #161823;
}

ul.products li.product.ew-product-card .price ins {
	order: 1;
	text-decoration: none;
	color: #fe2c55 !important;
	font-weight: 700;
	background: none;
}

ul.products li.product.ew-product-card .price del {
	order: 2;
	color: #9a9ba2 !important;
	font-size: 12px;
	font-weight: 400;
	text-decoration: line-through;
	opacity: 1;
	background: none;
}

ul.products li.product.ew-product-card .price del .amount,
ul.products li.product.ew-product-card .price ins .amount {
	color: inherit;
	font-weight: inherit;
	font-size: inherit;
}

/* Price number is larger than the currency symbol. */
ul.products li.product.ew-product-card .price .woocommerce-Price-currencySymbol {
	font-size: 0.7em;
	font-weight: 600;
	line-height: 1;
	vertical-align: baseline;
	margin-right: 1px;
	letter-spacing: 0;
}

ul.products li.product.ew-product-card .price .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Actions ---------- */

/* Add to cart is hidden on shop and product archive listings. */
body.ew-hide-loop-cart ul.products li.product.ew-product-card .product-action-wrap,
body.ew-hide-loop-cart ul.products li.product.ew-product-card .button.add_to_cart_button,
body.ew-hide-loop-cart ul.products li.product.ew-product-card .added_to_cart,
body.ew-hide-loop-cart .woocommerce-loop-product__buttons,
body.ew-hide-loop-cart .wc-block-grid__product-add-to-cart,
body.ew-hide-loop-cart .elementor-wc-products li.product .product-action-wrap {
	display: none !important;
}

/* The action wrapper can be left behind empty once the button is removed. */
body.ew-hide-loop-cart ul.products li.product.ew-product-card .product-action-wrap:empty {
	display: none !important;
	margin: 0 !important;
}

ul.products li.product.ew-product-card .product-action-wrap {
	margin-top: 8px;
}

ul.products li.product.ew-product-card .product-action-wrap .button {
	font-size: 12px;
	padding: 0.5em 0.9em;
	width: 100%;
	text-align: center;
}

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
	ul.products li.product.ew-product-card .product-details {
		padding: 8px 8px 10px;
	}

	ul.products li.product.ew-product-card .woocommerce-loop-product__title {
		font-size: 12px;
	}

	.ew-badge {
		font-size: 9px;
		padding: 2px 4px;
	}

	ul.products li.product.ew-product-card .price {
		font-size: 15px;
	}
}
