/* ==========================================================================
   Dynamic Product Cards — frontend
   Only structure and behaviour live here. Every colour, size and spacing
   value is left to the Elementor selectors so the admin owns the look.
   ========================================================================== */

.tps { position: relative; }

.tps-track { --tps-gap: 24px; overflow: hidden; }

.tps--grid .tps-slides {
	display: grid;
	gap: var(--tps-gap);
	grid-template-columns: repeat(var(--tps-cols, 4), minmax(0, 1fr));
}

.tps--slider .tps-slides { display: flex; }

/* Equal height toggle */
.tps--slider .swiper-slide { height: auto; }
.tps-slide > .tps-card { height: 100%; }

/* --------------------------------------------------------------- card */

.tps-card {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: transform .3s ease, box-shadow .3s ease, background-color .3s ease;
}

.tps-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1 1 auto;
}

.tps-card__footer {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: auto;
	padding-top: 10px;
	flex-wrap: wrap;
}

/* --------------------------------------------------------------- media */

.tps-media { position: relative; overflow: hidden; }
.tps-media__link { display: block; position: relative; }
.tps-media img { display: block; width: 100%; height: auto; }

.tps-media__main img,
.tps-media__hover img { transition: transform var(--tps-anim-duration, 300ms) ease, opacity var(--tps-anim-duration, 300ms) ease; }

.tps-media__hover {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity var(--tps-anim-duration, 300ms) ease;
}
.tps-card:hover .tps-media__hover { opacity: 1; }

.tps-media__gallery { position: absolute; inset: 0; }
.tps-media__gallery .tps-media__slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	object-fit: cover;
	width: 100%;
	height: 100%;
	transition: opacity .2s ease;
}
.tps-media__gallery .tps-media__slide.is-active { opacity: 1; }
.tps-media__dot {
	position: absolute;
	bottom: 8px;
	width: 18px;
	height: 3px;
	background: rgba(255, 255, 255, .5);
	z-index: 3;
}
.tps-media__dot.is-active { background: #fff; }

/* --------------------------------------------------------------- badges */

.tps-badges {
	position: absolute;
	z-index: 4;
	display: flex;
	flex-direction: column;
	gap: 6px;
	pointer-events: none;
}
.tps-badges--top-left     { top: 10px; left: 10px; align-items: flex-start; }
.tps-badges--top-right    { top: 10px; right: 10px; align-items: flex-end; }
.tps-badges--bottom-left  { bottom: 10px; left: 10px; align-items: flex-start; }
.tps-badges--bottom-right { bottom: 10px; right: 10px; align-items: flex-end; }

.tps-badge {
	display: inline-block;
	padding: 3px 9px;
	font-size: 11px;
	line-height: 1.6;
	letter-spacing: .02em;
	background: #111;
	color: #fff;
	border-radius: 2px;
}

/* --------------------------------------------------------------- actions */

.tps-actions { position: absolute; z-index: 5; display: flex; gap: 6px; }

.tps-actions--stack-right {
	top: 10px; right: 10px;
	flex-direction: column;
	transform: translateX(120%);
	opacity: 0;
	transition: transform .3s ease, opacity .3s ease;
}
.tps-actions--stack-left {
	top: 10px; left: 10px;
	flex-direction: column;
	transform: translateX(-120%);
	opacity: 0;
	transition: transform .3s ease, opacity .3s ease;
}
.tps-actions--bar-bottom {
	left: 0; right: 0; bottom: 0;
	justify-content: center;
	padding: 8px;
	transform: translateY(100%);
	transition: transform .3s ease;
}
.tps-actions--inline { position: static; margin-top: 8px; }

.tps-card:hover .tps-actions--stack-right,
.tps-card:hover .tps-actions--stack-left { transform: translateX(0); opacity: 1; }
.tps-card:hover .tps-actions--bar-bottom { transform: translateY(0); }

.tps-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: calc(var(--tps-icon-size, 18px) + 18px);
	height: calc(var(--tps-icon-size, 18px) + 18px);
	border: 0;
	cursor: pointer;
	background: #fff;
	position: relative;
}
.tps-action__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tps-action--quickview .tps-action__label { position: static; width: auto; height: auto; clip: auto; }

.tps-action[data-tooltip]::after {
	content: attr(data-tooltip);
	position: absolute;
	right: calc(100% + 8px);
	top: 50%;
	transform: translateY(-50%);
	white-space: nowrap;
	background: #111;
	color: #fff;
	font-size: 11px;
	padding: 3px 7px;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s ease;
}
.tps-action[data-tooltip]:hover::after { opacity: 1; }
.tps-action.is-active { color: #d33; }

/* --------------------------------------------------------------- text */

.tps-category a,
.tps-tags a { text-decoration: none; }
.tps-category a + a::before,
.tps-tags a + a::before { content: ", "; }

.tps-title { margin: 0; }
.tps-title a { text-decoration: none; color: inherit; }
.tps-title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.tps-title[style*="line-clamp:0"] { display: block; overflow: visible; }

.tps-excerpt { line-height: 1.55; }

/* rating */
.tps-rating { display: flex; align-items: center; gap: 6px; }
.tps-rating__stars {
	--tps-icon-size: 14px;
	position: relative;
	display: inline-block;
	width: calc(var(--tps-icon-size) * 5.4);
	height: var(--tps-icon-size);
	background: currentColor;
	opacity: .25;
	-webkit-mask: repeat-x left center / var(--tps-icon-size) var(--tps-icon-size)
		url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2l3 6.5 7 .9-5 4.8 1.2 7L12 17.8 5.8 21.2 7 14.2 2 9.4l7-.9z"/></svg>');
	        mask: repeat-x left center / var(--tps-icon-size) var(--tps-icon-size)
		url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2l3 6.5 7 .9-5 4.8 1.2 7L12 17.8 5.8 21.2 7 14.2 2 9.4l7-.9z"/></svg>');
}
.tps-rating__stars::before {
	content: "";
	position: absolute;
	inset: 0;
	width: var(--tps-rating, 0%);
	background: currentColor;
	opacity: 1;
	-webkit-mask: inherit;
	        mask: inherit;
}

/* price */
.tps-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tps-price del { text-decoration: line-through; opacity: .55; }
.tps-price ins { text-decoration: none; }

/* variations */
.tps-variations { display: flex; gap: 6px; flex-wrap: wrap; }
.tps-variations--swatch .tps-variation {
	width: 16px; height: 16px; border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, .15);
	background: var(--tps-swatch, #ccc);
	cursor: pointer;
}
.tps-variations--label .tps-variation { padding: 2px 8px; border: 1px solid currentColor; cursor: pointer; }

/* attributes */
.tps-attributes { list-style: none; margin: 0; padding: 0; }
.tps-attributes li { display: flex; justify-content: space-between; gap: 10px; }

/* quantity */
.tps-qty { display: inline-flex; align-items: center; border: 1px solid rgba(0, 0, 0, .15); }
.tps-qty__btn { width: 28px; height: 34px; border: 0; background: none; cursor: pointer; }
.tps-qty__input { width: 38px; height: 34px; border: 0; text-align: center; -moz-appearance: textfield; }
.tps-qty__input::-webkit-outer-spin-button,
.tps-qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* buttons */
.tps-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border: 0;
	cursor: pointer;
	text-decoration: none;
	padding: 10px 16px;
	background: #111;
	color: #fff;
	transition: background-color .25s ease, color .25s ease, transform .25s ease;
}
.tps-btn.is-loading { opacity: .6; pointer-events: none; }
.tps-btn.is-added { opacity: .9; }
.tps-btn--disabled { opacity: .5; pointer-events: none; }

/* Native WooCommerce price markup sits inside .tps-price__html */
.tps-price__html { display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tps-price .woocommerce-Price-amount,
.tps-price bdi { color: inherit; }
.tps-price .woocommerce-Price-currencySymbol { color: inherit; }
.tps-btn svg, .tps-action svg { width: var(--tps-icon-size, 18px); height: var(--tps-icon-size, 18px); }

/* full-width switches (prefix_class from btn_full_width) */
.tps-btn_cart-fw-yes .tps-btn--cart,
.tps-btn_buy_now-fw-yes .tps-btn--buy,
.tps-btn_details-fw-yes .tps-btn--details { flex: 1 1 100%; }

/* countdown */
.tps-countdown { display: flex; gap: 6px; }
.tps-countdown span { position: relative; padding-right: 10px; }
.tps-countdown span + span::before { content: ":"; position: absolute; left: -8px; }

/* stock */
.tps-stock--out { opacity: .7; }

/* --------------------------------------------------------------- slider ui */

.tps-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
}
.tps-arrow--prev { left: 6px; }
.tps-arrow--next { right: 6px; }
.tps-arrow.swiper-button-disabled { opacity: .35; cursor: default; }

.tps-notice {
	padding: 16px;
	border: 1px dashed rgba(0, 0, 0, .25);
	text-align: center;
	font-size: 13px;
}

/* --------------------------------------------------------------- animations
   Driven by prefix_class on each element's Hover Animation control,
   e.g. `tps-anim-title-zoom` lands on the widget wrapper.
   ------------------------------------------------------------------------ */

[class*="tps-anim-"] .tps-card > *,
[class*="tps-anim-"] .tps-card * { --tps-anim-duration: 300ms; }

.tps-anim-image-zoom   .tps-card:hover .tps-media__main img { transform: scale(1.08); }
.tps-anim-image-shrink .tps-card:hover .tps-media__main img { transform: scale(.94); }
.tps-anim-image-rotate .tps-card:hover .tps-media__main img { transform: rotate(3deg) scale(1.05); }
.tps-anim-image-fade   .tps-card:hover .tps-media__main img { opacity: .75; }
.tps-anim-image-slide  .tps-card:hover .tps-media__main img { transform: translateY(-8px); }

.tps-anim-hover_image-fade  .tps-media__hover { transition-timing-function: ease-in-out; }
.tps-anim-hover_image-slide .tps-media__hover { transform: translateX(12px); }
.tps-anim-hover_image-slide .tps-card:hover .tps-media__hover { transform: translateX(0); }
.tps-anim-hover_image-zoom  .tps-card:hover .tps-media__hover img { transform: scale(1.06); }

.tps-anim-title-slide .tps-card:hover .tps-title { transform: translateY(-2px); }
.tps-anim-title-fade  .tps-card:hover .tps-title { opacity: .75; }

.tps-anim-btn_cart-rise   .tps-btn--cart:hover,
.tps-anim-btn_buy_now-rise .tps-btn--buy:hover,
.tps-anim-btn_details-rise .tps-btn--details:hover { transform: translateY(-3px); }

.tps-anim-btn_cart-sink   .tps-btn--cart:hover,
.tps-anim-btn_buy_now-sink .tps-btn--buy:hover,
.tps-anim-btn_details-sink .tps-btn--details:hover { transform: translateY(3px); }

.tps-anim-btn_cart-zoom .tps-btn--cart:hover { transform: scale(1.04); }
.tps-anim-btn_cart-pulse .tps-btn--cart:hover { animation: tps-pulse .7s ease infinite; }

.tps-anim-btn_wishlist-pulse .tps-action--wishlist:hover,
.tps-anim-btn_compare-pulse  .tps-action--compare:hover,
.tps-anim-btn_quickview-pulse .tps-action--quickview:hover { animation: tps-pulse .7s ease infinite; }

.tps-anim-btn_wishlist-rotate .tps-action--wishlist:hover svg,
.tps-anim-btn_compare-rotate  .tps-action--compare:hover svg { transform: rotate(90deg); transition: transform .3s ease; }

@keyframes tps-pulse {
	0%, 100% { transform: scale(1); }
	50%      { transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
	.tps *, .tps *::before, .tps *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}
