/**
 * Shokofa Product Options — product cards / listings (1.5.2, turquoise accent)
 * Scope: body.sh-po-listing (added by the plugin). Theme markup: .ss-products > .ss-product-card
 * Disable: add_filter( 'shokofa_po_listing_style', '__return_false' );
 */

.sh-po-listing,
.sh-po-accent-pdp {
	--sh-gold-1: #0c8080;          /* accent top: white text 4.76:1 */
	--sh-gold-2: #096a6b;          /* accent bottom: white text 6.39:1 */
	--sh-gold-3: #096a6b;
	--sh-ink: #ffffff;            /* text on accent */
	--sh-accent-rgb: 9, 106, 107;   /* button shadow tint */
	--sh-accent-hi: .18;             /* inset highlight alpha */
	--sh-soft-bg: #e8f6f6;           /* «به‌زودی» pill */
	--sh-soft-border: #b9e2e2;
	--sh-soft-ink: #0a5f60;         /* 6.72:1 on soft-bg */
	--sh-card-shadow: 0 1px 2px rgba(11, 61, 120, .05), 0 10px 24px -14px rgba(11, 61, 120, .30);
}

/* ---------- Every width: product without price, sale badge ---------- */
.sh-po-listing .ss-product-card .ss-product-price:empty::before {
	content: var(--sh-noprice, "به‌زودی");
	display: inline-flex;
	align-items: center;
	padding: 3px 11px;
	border-radius: 999px;
	background: var(--sh-soft-bg);
	border: 1px solid var(--sh-soft-border);
	color: var(--sh-soft-ink);
	font-size: 11.5px;
	font-weight: 700;
	line-height: 1.8;
}
.sh-po-listing .ss-product-card .sh-badge-sale {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	padding: 2px 9px;
	border-radius: 999px;
	background: #c0392b;         /* white text 5.4:1 */
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	line-height: 1.9;
	box-shadow: 0 4px 10px -4px rgba(192, 57, 43, .6);
	pointer-events: none;
}

/* Product page: main add-to-cart in the same turquoise "buy" accent (every width). */
.sh-po-accent-pdp.single-product form.cart .single_add_to_cart_button.button.alt,
.sh-po-accent-pdp.single-product form.cart .single_add_to_cart_button {
	background: linear-gradient(180deg, var(--sh-gold-1) 0%, var(--sh-gold-2) 100%);
	color: var(--sh-ink);
	font-weight: 800;
	border: 0;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, var(--sh-accent-hi)), 0 8px 18px -8px rgba(var(--sh-accent-rgb), .7);
	transition: transform .12s ease, filter .15s ease, box-shadow .15s ease;
}
.sh-po-accent-pdp.single-product form.cart .single_add_to_cart_button:hover {
	background: linear-gradient(180deg, var(--sh-gold-1) 0%, var(--sh-gold-2) 100%);
	color: var(--sh-ink);
	filter: brightness(1.04);
}
.sh-po-accent-pdp.single-product form.cart .single_add_to_cart_button:active {
	transform: translateY(1px) scale(.985);
	filter: brightness(.95);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, var(--sh-accent-hi)), 0 3px 8px -4px rgba(var(--sh-accent-rgb), .7);
}
.sh-po-accent-pdp.single-product form.cart .single_add_to_cart_button:focus-visible {
	outline: 3px solid rgba(14, 90, 167, .35);
	outline-offset: 2px;
}

/* ---------- Cards, every width (1.5.1: desktop too) ---------- */
.sh-po-listing .ss-products:not(.is-list) .ss-product-card {
	display: flex;
	flex-direction: column;
}
.sh-po-listing .ss-products .ss-product-card {
	min-width: 0;
	padding: 8px;
	border-radius: 16px;
	border: 1px solid rgba(14, 90, 167, .08);
	background: #fff;
	box-shadow: var(--sh-card-shadow);
	-webkit-tap-highlight-color: transparent;
	transition: transform .18s ease, box-shadow .2s ease;
}
.sh-po-listing .ss-products .ss-product-card:active {
	transform: scale(.985);
	box-shadow: 0 1px 2px rgba(11, 61, 120, .06), 0 4px 12px -8px rgba(11, 61, 120, .3);
}
.sh-po-listing .ss-products .ss-product-card > a:not(.ss-card-cart):not(.sh-card-view) {
	display: block;
	color: inherit;
	text-decoration: none;
}
.sh-po-listing .ss-products .ss-product-img {
	position: relative;
	aspect-ratio: 1 / 1;
	margin: 0 0 9px;
	border-radius: 12px;
	background: #fff;
	overflow: hidden;
}
.sh-po-listing .ss-products .ss-product-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.sh-po-listing .ss-products .ss-product-card:active .ss-product-img img,
.sh-po-listing .ss-products .ss-product-card:hover .ss-product-img img {
	transform: scale(1.05);
}
.sh-po-listing .ss-products .ss-product-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 3.5em;
	margin: 0 2px 6px;
	font-size: 12.5px;
	line-height: 1.75;
	font-weight: 600;
	color: var(--c-text, #1c2b3a);
}
.sh-po-listing .ss-products .ss-product-price {
	margin: auto 2px 0;
	font-size: 14px;
	font-weight: 800;
	line-height: 1.8;
	color: var(--c-blue-dark, #0b3d78);
}
.sh-po-listing .ss-products .ss-product-price .woocommerce-Price-currencySymbol {
	font-size: 11px;
	font-weight: 600;
	color: var(--c-text-light, #6c7a89);
}
.sh-po-listing .ss-products .ss-product-price del {
	display: block;
	font-size: 11px;
	font-weight: 400;
	color: var(--c-text-light, #6c7a89);
	margin: 0;
}
.sh-po-listing .ss-products .ss-product-price ins { text-decoration: none; }

/* wishlist heart: small white bubble */
.sh-po-listing .ss-products .ss-product-wish {
	top: 12px;
	left: 12px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92);
	box-shadow: 0 2px 8px rgba(11, 61, 120, .14);
	color: #98aec4;
}
.sh-po-listing .ss-products .ss-product-wish.is-active { color: #e0245e; }
.sh-po-listing .ss-products .ss-product-wish svg { width: 17px; height: 17px; }
.sh-po-listing .ss-products .ss-product-wish::after { /* keep a 44px tap area */
	content: "";
	position: absolute;
	inset: -4px;
}

/* the buy button: turquoise accent, full width, clear */
.sh-po-listing .ss-products .ss-card-cart,
.sh-po-listing .ss-products .sh-card-view {
	display: flex !important;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	min-height: 40px;
	margin: 8px 0 0;
	padding: 8px 8px;
	border-radius: 11px;
	border: 0;
	font-size: 12.5px;
	font-weight: 800;
	line-height: 1.4;
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
	transition: transform .12s ease, filter .15s ease, box-shadow .15s ease;
}
.sh-po-listing .ss-products .ss-card-cart {
	background: linear-gradient(180deg, var(--sh-gold-1) 0%, var(--sh-gold-2) 100%);
	color: var(--sh-ink);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, var(--sh-accent-hi)), 0 6px 14px -7px rgba(var(--sh-accent-rgb), .75);
}
.sh-po-listing .ss-products .ss-card-cart:hover {
	background: linear-gradient(180deg, var(--sh-gold-1) 0%, var(--sh-gold-2) 100%);
	color: var(--sh-ink);
	filter: brightness(1.04);
}
.sh-po-listing .ss-products .ss-card-cart:active,
.sh-po-listing .ss-products .sh-card-view:active {
	transform: translateY(1px) scale(.97);
	filter: brightness(.94);
	box-shadow: none;
}
.sh-po-listing .ss-products .ss-card-cart svg,
.sh-po-listing .ss-products .sh-card-view svg {
	width: 16px;
	height: 16px;
	flex: 0 0 16px;
}
.sh-po-listing .ss-products .ss-card-cart .ss-card-cart-label { display: inline; }
.sh-po-listing .ss-products .ss-card-cart.loading { opacity: .7; }
.sh-po-listing .ss-products .sh-card-view {
	background: var(--c-blue-lighter, #f4f9fd);
	color: var(--c-blue, #0e5aa7);
	box-shadow: inset 0 0 0 1px var(--c-border, #e3ebf3);
}

/* section headings: short accent underline */
.sh-po-listing .ss-section-head-row h2 {
	position: relative;
	padding-bottom: 9px;
}
.sh-po-listing .ss-section-head-row h2::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	width: 34px;
	height: 3px;
	border-radius: 3px;
	background: linear-gradient(90deg, var(--sh-gold-2), var(--sh-gold-1));
}
.sh-po-listing .ss-section-head .ss-divider {
	width: 44px;
	height: 3px;
	border-radius: 3px;
	background: linear-gradient(90deg, var(--sh-gold-2), var(--sh-gold-1));
}
.sh-po-listing .ss-viewall {
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--c-blue-lighter, #f4f9fd);
	font-weight: 700;
}

/* ---------- Phones (≤767px): always 2 products per row ---------- */
@media (max-width: 767px) {
	.sh-po-listing .ss-products,
	.sh-po-listing .ss-carousel-wrap .ss-products,
	.sh-po-listing .ss-products.ss-products-related,
	.sh-po-listing .ss-products.ss-products-shop,
	.sh-po-listing .ss-products.ss-products-shop.is-list {
		display: grid !important;
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		grid-auto-flow: row !important;
		grid-auto-columns: auto !important;
		gap: 14px 10px !important;
		overflow: visible !important; /* theme JS sets inline overflow-x:auto on sliders */
		scroll-snap-type: none !important;
		padding: 2px 0 6px;
	}
	.sh-po-listing .ss-carousel-wrap .ss-arrow { display: none !important; }
	/* list view would stretch cards to full width: phones always use the grid */
	.sh-po-listing .ss-view-toggle { display: none !important; }
	.sh-po-listing .ss-carousel-wrap .ss-card-cart,
	.sh-po-listing .ss-products-related .ss-card-cart { display: flex !important; }
	.sh-po-listing .ss-products .sh-card-view { display: flex !important; }
	.sh-po-listing .ss-products .ss-rating { display: none; }

	.sh-po-listing .ss-section-head-row { margin-bottom: 14px; gap: 10px; align-items: flex-end; }
	.sh-po-listing .ss-section-head-row h2 { flex: 1 1 auto; min-width: 0; font-size: 16px; line-height: 1.7; }
	.sh-po-listing .ss-section-head-row .ss-viewall { flex: 0 0 auto; white-space: nowrap; font-size: 12px; padding: 6px 11px; margin-bottom: 4px; }
}

/* ---------- Tablet (768–1024px) ---------- */
@media (min-width: 768px) and (max-width: 1024px) {
	.sh-po-listing .ss-carousel-wrap .ss-card-cart,
	.sh-po-listing .ss-products-related .ss-card-cart { display: flex !important; }
	.sh-po-listing .ss-products { gap: 16px 14px; }
	.sh-po-listing .ss-products.ss-products-related {
		grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
		grid-auto-flow: row !important;
		overflow: visible !important;
	}
	.sh-po-listing .ss-related .ss-arrow { display: none !important; }
}

/* ---------- Desktop (≥1025px) ---------- */
@media (min-width: 1025px) {
	.sh-po-listing .ss-products { gap: 22px 20px; }
	.sh-po-listing .ss-products .ss-product-card {
		padding: 12px;
		border-radius: 18px;
	}
	.sh-po-listing .ss-products .ss-product-card:hover {
		transform: translateY(-4px);
		border-color: rgba(14, 90, 167, .16);
		box-shadow: 0 2px 4px rgba(11, 61, 120, .05), 0 20px 36px -18px rgba(11, 61, 120, .38);
	}
	.sh-po-listing .ss-products .ss-product-card:hover .ss-product-title { color: var(--c-blue, #0e5aa7); }
	.sh-po-listing .ss-products .ss-product-img { margin-bottom: 12px; border-radius: 14px; }
	.sh-po-listing .ss-products .ss-product-title { font-size: 14px; margin-bottom: 8px; }
	.sh-po-listing .ss-products .ss-product-price { font-size: 15.5px; }
	.sh-po-listing .ss-products .ss-product-wish { top: 20px; left: 20px; width: 38px; height: 38px; }
	.sh-po-listing .ss-products .ss-card-cart,
	.sh-po-listing .ss-products .sh-card-view {
		min-height: 44px;
		margin-top: 12px;
		font-size: 13.5px;
		border-radius: 12px;
	}
	.sh-po-listing .ss-products .sh-card-view:hover {
		background: var(--c-blue-light, #eaf3fb);
		box-shadow: inset 0 0 0 1px #cfe0f2;
	}

	/* home sliders: 4 cards in view, arrows/swipe for the rest */
	.sh-po-listing .ss-carousel-wrap .ss-products:not(.ss-products-related) {
		grid-template-columns: none;
		grid-auto-flow: column;
		grid-auto-columns: calc((100% - 3 * 20px) / 4);
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		padding: 8px 6px 18px;
		margin: -8px -6px -18px;
	}
	.sh-po-listing .ss-carousel-wrap .ss-products::-webkit-scrollbar { display: none; }
	.sh-po-listing .ss-carousel-wrap .ss-product-card { scroll-snap-align: start; }

	/* related products: 4 in a row, no slider arrows needed */
	.sh-po-listing .ss-products.ss-products-related {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		grid-auto-flow: row;
		overflow: visible !important;
		padding: 6px 0 10px;
	}
	.sh-po-listing .ss-related .ss-arrow { display: none; }

	/* shop / category / search next to the sidebar: 3 roomy cards per row */
	.sh-po-listing .ss-products.ss-products-shop:not(.is-list) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.sh-po-listing .ss-products-shop.is-list .ss-card-cart,
	.sh-po-listing .ss-products-shop.is-list .sh-card-view { width: auto; min-width: 160px; margin: 0; padding: 0 18px; }

	/* slider arrows: soft white bubbles, accent on hover; hidden when nothing to scroll */
	.sh-po-listing .ss-carousel-wrap .ss-arrow {
		width: 42px;
		height: 42px;
		top: calc(50% - 21px);
		background: #fff;
		border: 1px solid var(--c-border, #e3ebf3);
		box-shadow: 0 6px 16px -6px rgba(11, 61, 120, .3);
		transition: background .15s ease, color .15s ease, transform .15s ease;
	}
	.sh-po-listing .ss-carousel-wrap .ss-arrow:hover {
		background: linear-gradient(180deg, var(--sh-gold-1), var(--sh-gold-2));
		color: var(--sh-ink);
		border-color: transparent;
	}
	.sh-po-listing .ss-carousel-wrap .ss-arrow:active { transform: scale(.94); }
	.sh-po-listing .ss-carousel-wrap.sh-noscroll .ss-arrow { display: none; }
	.sh-po-listing .ss-carousel-wrap .ss-arrow.prev { right: -21px; }
	.sh-po-listing .ss-carousel-wrap .ss-arrow.next { left: -21px; }

	.sh-po-listing .ss-section-head-row { margin-bottom: 26px; }
	.sh-po-listing .ss-section-head-row h2 { padding-bottom: 12px; }
	.sh-po-listing .ss-section-head-row h2::after { width: 46px; }
	.sh-po-listing .ss-viewall:hover { background: var(--c-blue-light, #eaf3fb); }
}

/* ---------- Entrance animation (class set by listing.js) ---------- */
.sh-po-anim .ss-product-card.sh-pre {
	opacity: 0;
	transform: translateY(18px);
}
.sh-po-anim .ss-product-card.sh-in {
	opacity: 1;
	transform: none;
	transition: opacity .55s ease, transform .55s cubic-bezier(.2, .7, .2, 1), box-shadow .2s ease;
	transition-delay: var(--sh-d, 0ms);
}

@media (prefers-reduced-motion: reduce) {
	.sh-po-listing .ss-product-card,
	.sh-po-listing .ss-product-card .ss-product-img img,
	.sh-po-listing .ss-card-cart,
	.sh-po-anim .ss-product-card.sh-in { transition: none !important; }
	.sh-po-anim .ss-product-card.sh-pre { opacity: 1; transform: none; }
	.sh-po-listing .ss-products .ss-product-card:active .ss-product-img img { transform: none; }
}

/* ---------- Infinite scroll (1.6.0) ---------- */
/* Hide pagination only after JS adds .sh-inf-hide (no-JS / crawlers still see it). */
.sh-po-infinite nav.ss-pagination.sh-inf-hide,
.sh-po-infinite nav.woocommerce-pagination.sh-inf-hide,
.sh-po-infinite .woocommerce-pagination.sh-inf-hide {
	display: none !important;
}
.sh-inf-sentinel {
	width: 100%;
	height: 1px;
	margin: 0;
	padding: 0;
	pointer-events: none;
}
.sh-inf-status {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 0;
	margin: 18px 0 8px;
	padding: 0 12px;
	text-align: center;
	color: var(--c-text-light, #6c7a89);
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.7;
}
.sh-inf-status.sh-inf-loading,
.sh-inf-status.sh-inf-end,
.sh-inf-status.sh-inf-error {
	min-height: 48px;
}
.sh-inf-status.sh-inf-end .sh-inf-text {
	display: inline-block;
	padding: 6px 14px;
	border-radius: 999px;
	background: var(--sh-soft-bg, #e8f6f6);
	border: 1px solid var(--sh-soft-border, #b9e2e2);
	color: var(--sh-soft-ink, #0a5f60);
	font-size: 12.5px;
}
.sh-inf-spin {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 2.5px solid rgba(12, 128, 128, .22);
	border-top-color: #0c8080;
	animation: sh-inf-spin .7s linear infinite;
	flex: 0 0 22px;
}
@keyframes sh-inf-spin {
	to { transform: rotate(360deg); }
}
.sh-inf-retry {
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
	min-height: 42px;
	padding: 8px 18px;
	border: 0;
	border-radius: 11px;
	background: linear-gradient(180deg, #0c8080 0%, #096a6b 100%);
	color: #fff;
	font: inherit;
	font-size: 13.5px;
	font-weight: 800;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 6px 14px -7px rgba(9, 106, 107, .75);
	-webkit-tap-highlight-color: transparent;
}
.sh-inf-retry:active {
	transform: translateY(1px) scale(.97);
	filter: brightness(.94);
}
@media (prefers-reduced-motion: reduce) {
	.sh-inf-spin { animation: none; border-top-color: #0c8080; opacity: .85; }
}
