/* ================================================
   WC Product Showcase — Frontend Styles
   ================================================ */

:root {
	--wcps-primary:      #0c8a8a;
	--wcps-primary-dark: #097373;
	--wcps-secondary:    #f58220;
	--wcps-secondary-dark: #d9700f;
	--wcps-badge:        #f58220;
	--wcps-radius:       12px;
	--wcps-shadow:       0 2px 12px rgba(0,0,0,.08);
	--wcps-shadow-hover: 0 8px 32px rgba(0,0,0,.16);
	--wcps-text:         #1a1a2e;
	--wcps-sub:          #6c757d;
	--wcps-border:       #e8ecef;
	--wcps-bg:           #ffffff;
	--wcps-savings-bg:   rgba(0,0,0,.72);
	--wcps-transition:   .28s cubic-bezier(.4,0,.2,1);
}

/* ── Wrapper ─────────────────────────────────── */
.wcps-wrapper {
	width: 100%;
	position: relative;
}

.wcps-no-products {
	text-align: center;
	color: var(--wcps-sub);
	padding: 32px;
}

/* ── Grid ────────────────────────────────────── */
.wcps-grid {
	display: grid;
	grid-template-columns: repeat(var(--wcps-cols, 4), 1fr);
	gap: 20px;
	/* CSS grid makes every cell in a row the same height */
	align-items: stretch;
}

@media (max-width: 1024px) {
	.wcps-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
	.wcps-grid { grid-template-columns: 1fr; }
}

/* Grid cell wrapper — flex column so the card inside fills it */
.wcps-grid-item {
	display: flex;
	flex-direction: column;
}

/* ── Product Card ────────────────────────────── */
.wcps-product-card {
	background: var(--wcps-bg);
	border: 1px solid var(--wcps-border);
	border-radius: var(--wcps-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	/* Fills grid cell AND slider slide completely */
	width: 100%;
	flex: 1 1 auto;
	transition: transform var(--wcps-transition),
	            box-shadow var(--wcps-transition),
	            border-color var(--wcps-transition);
	box-shadow: var(--wcps-shadow);
	position: relative;
}

/* ── Slider equal height ─────────────────────────────────────────
   Key: swiper-wrapper must use align-items:stretch so all slides
   in the visible group grow to the height of the tallest one.
   Each slide is a flex column so the card inside fills it.
─────────────────────────────────────────────────────────────────── */
.wcps-swiper .swiper-wrapper {
	align-items: stretch;
}

.wcps-swiper .swiper-slide {
	display: flex;
	flex-direction: column;
	height: auto !important;
}

.wcps-product-card.wcps-hover:hover {
	transform: translateY(-4px) scale(1.02);
	box-shadow: var(--wcps-shadow-hover);
	border-color: var(--wcps-primary);
	z-index: 2;
}

/* ── Card Top (badge + brand) ────────────────── */
.wcps-card-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px 0;
	min-height: 28px;
}

.wcps-badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 4px;
	line-height: 1;
	letter-spacing: .3px;
}

.wcps-badge-discount {
	background: var(--wcps-badge);
	color: #fff;
}

.wcps-brand {
	font-size: 11px;
	font-weight: 600;
	color: var(--wcps-sub);
	letter-spacing: .6px;
	text-transform: uppercase;
	margin-left: auto;
}

/* ── Image ───────────────────────────────────── */
.wcps-image-wrap {
	display: block;
	position: relative;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	background: #f8f9fa;
	margin: 10px 14px;
	border-radius: 8px;
	/* prevent image area from shrinking */
	flex-shrink: 0;
}

.wcps-image-wrap .wcps-img,
.wcps-image-wrap img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform var(--wcps-transition);
	display: block;
}

.wcps-product-card.wcps-hover:hover .wcps-image-wrap img {
	transform: scale(1.06);
}

/* ── Savings Overlay ─────────────────────────── */
.wcps-savings-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: var(--wcps-savings-bg);
	color: #fff;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 10px;
	transform: translateY(100%);
	transition: transform var(--wcps-transition);
	backdrop-filter: blur(4px);
	border-radius: 0 0 8px 8px;
}

.wcps-product-card.wcps-hover:hover .wcps-savings-overlay {
	transform: translateY(0);
}

/* Touch fallback */
.wcps-savings-overlay.touch-visible {
	transform: translateY(0);
}

.wcps-savings-label {
	font-size: 11px;
	opacity: .85;
	letter-spacing: .4px;
}

.wcps-savings-amount {
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
}

.wcps-savings-amount .woocommerce-Price-currencySymbol,
.wcps-savings-amount bdi {
	color: #fff;
}

/* ── Card Body ───────────────────────────────── */
.wcps-card-body {
	padding: 0 14px 14px;
	display: flex;
	flex-direction: column;
	/* Fills remaining card height and locks sections to fixed positions */
	flex: 1;
	justify-content: space-between;
}

.wcps-product-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--wcps-text);
	text-decoration: none;
	line-height: 1.4;
	/* FIXED 2-line height — single-line titles get same space as two-line ones */
	height: calc(1.4em * 2);
	min-height: calc(1.4em * 2);
	max-height: calc(1.4em * 2);
	margin-bottom: 10px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	flex-shrink: 0;
}

.wcps-product-title:hover {
	color: var(--wcps-primary);
}

/* ── Pricing ─────────────────────────────────── */
.wcps-pricing {
	/* Fixed height: always reserves space for both regular + sale price */
	height: 52px;
	min-height: 52px;
	max-height: 52px;
	margin-bottom: 12px;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 2px;
	flex-shrink: 0;
}

.wcps-regular-price {
	font-size: 12px;
	color: var(--wcps-sub);
	text-decoration: line-through;
	min-height: 16px; /* reserves space even when no sale price */
}

.wcps-sale-price {
	font-size: 22px;
	font-weight: 800;
	color: var(--wcps-primary);
	line-height: 1;
	display: flex;
	align-items: baseline;
	gap: 3px;
}

.wcps-currency-code {
	font-size: 13px;
	font-weight: 600;
	color: var(--wcps-primary);
}

/* ── Actions ─────────────────────────────────── */
.wcps-card-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	/* space-between on .wcps-card-body keeps this locked to bottom */
	flex-shrink: 0;
}

/* Add to cart button */
.wcps-btn-cart {
	flex: 1;
	padding: 10px 14px;
	border: none;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .5px;
	cursor: pointer;
	transition: background var(--wcps-transition),
	            transform var(--wcps-transition);
}

.wcps-btn-primary {
	background: var(--wcps-primary);
	color: #fff;
}

.wcps-btn-primary:hover {
	background: var(--wcps-primary-dark);
	transform: translateY(-1px);
}

.wcps-btn-primary.wcps-loading {
	opacity: .7;
	pointer-events: none;
}

.wcps-btn-primary.wcps-added {
	background: #27ae60;
}

.wcps-btn-outofstock {
	background: transparent;
	border: 2px solid var(--wcps-border);
	color: var(--wcps-sub);
	cursor: not-allowed;
}

/* ── Icon buttons (wishlist / compare) ──────── */
.wcps-btn-icon {
	/* fixed box */
	width: 38px;
	height: 38px;
	min-width: 38px;
	min-height: 38px;
	padding: 0;

	border: 1.5px solid var(--wcps-border);
	border-radius: 8px;
	background: #fff;

	/* centre the SVG */
	display: inline-flex;
	align-items: center;
	justify-content: center;

	cursor: pointer;
	transition: border-color var(--wcps-transition),
	            background var(--wcps-transition),
	            color var(--wcps-transition);

	/* SVG inherits this colour via stroke="currentColor" */
	color: var(--wcps-sub);
	flex-shrink: 0;

	/* override any theme reset that hides button content */
	line-height: 1;
	overflow: visible;
}

/* Make sure SVG inside is visible */
.wcps-btn-icon svg {
	display: block;
	width: 18px;
	height: 18px;
	pointer-events: none;
	overflow: visible;
	stroke: currentColor;
	fill: none;
}

.wcps-btn-icon:hover {
	border-color: var(--wcps-primary);
	color: var(--wcps-primary);
	background: rgba(12,138,138,.06);
}

.wcps-btn-wishlist.is-active {
	background: #fee2e2;
	border-color: #ef4444;
	color: #ef4444;
}

.wcps-btn-wishlist.is-active svg {
	fill: #ef4444;
	stroke: #ef4444;
}

/* ── View More ───────────────────────────────── */
.wcps-viewmore-wrap {
	text-align: center;
	margin-top: 32px;
}

.wcps-viewmore-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--wcps-primary);
	color: #fff;
	text-decoration: none;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .5px;
	padding: 12px 32px;
	border-radius: 8px;
	transition: background var(--wcps-transition),
	            transform var(--wcps-transition),
	            box-shadow var(--wcps-transition);
}

.wcps-viewmore-btn:hover {
	background: var(--wcps-primary-dark);
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(12,138,138,.35);
}

.wcps-viewmore-btn svg {
	display: block;
	flex-shrink: 0;
}

/* ── Slider ──────────────────────────────────── */
.wcps-swiper {
	overflow: hidden;
	padding: 8px 4px 44px;
}

/* Pagination */
.wcps-pagination .swiper-pagination-bullet {
	background: var(--wcps-primary);
	opacity: .35;
	width: 8px;
	height: 8px;
	transition: opacity .2s, transform .2s;
}

.wcps-pagination .swiper-pagination-bullet-active {
	opacity: 1;
	transform: scale(1.3);
}

/* Arrows */
.wcps-prev, .wcps-next {
	color: var(--wcps-primary) !important;
	background: #fff;
	width: 40px !important;
	height: 40px !important;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(0,0,0,.15);
	transition: box-shadow var(--wcps-transition);
}

.wcps-prev::after, .wcps-next::after {
	font-size: 14px !important;
	font-weight: 900;
}

.wcps-prev:hover, .wcps-next:hover {
	box-shadow: 0 4px 16px rgba(0,0,0,.22);
}

/* ── Skeleton Loading ────────────────────────── */
.wcps-skeleton {
	background: #f0f0f0;
	border-radius: var(--wcps-radius);
	overflow: hidden;
	position: relative;
}

.wcps-skeleton::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
	animation: wcps-shimmer 1.4s infinite;
}

@keyframes wcps-shimmer {
	0%   { transform: translateX(-100%); }
	100% { transform: translateX(100%); }
}

/* ── Out-of-stock dimming ─────────────────────── */
.wcps-product-card.is-out-of-stock .wcps-image-wrap {
	opacity: .65;
}

/* ── Responsive card font tweaks ─────────────── */
@media (max-width: 480px) {
	.wcps-sale-price { font-size: 18px; }
	.wcps-btn-cart   { font-size: 12px; padding: 9px 10px; }
}
