/*
 * پنجرهٔ شناور محصول.
 *
 * The panel is deliberately a plain white card with the product page's own
 * padding: everything inside it is the single-product template, unchanged, so
 * it should look like that page lifted onto the listing rather than a second
 * design to keep in sync.
 */

.gs-pm[hidden] {
	display: none;
}

.gs-pm {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 40px 20px;
	overflow-y: auto;
	overscroll-behavior: contain;
	direction: rtl;
}

.gs-pm__backdrop {
	position: fixed;
	inset: 0;
	background: rgba( 8, 24, 16, .62 );
	-webkit-backdrop-filter: blur( 4px );
	backdrop-filter: blur( 4px );
}

.gs-pm__dialog {
	position: relative;
	width: 100%;
	max-width: 1100px;
	margin: auto;
	padding: 34px 34px 28px;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 30px 70px rgba( 0, 0, 0, .35 );
	animation: gs-pm-in .22s ease-out;
}

@keyframes gs-pm-in {
	from { opacity: 0; transform: translateY( 12px ); }
	to { opacity: 1; transform: none; }
}

@media ( prefers-reduced-motion: reduce ) {
	.gs-pm__dialog { animation: none; }
}

/* Anchored to the panel's top-left; the card's own content is right-aligned. */
.gs-pm__close {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 3;
	width: 38px;
	height: 38px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 26px;
	line-height: 1;
	color: #4a4238;
	background: #f4efe6;
	border: 1px solid #e6ddcd;
	border-radius: 50%;
	cursor: pointer;
	transition: background .2s ease, color .2s ease;
}

.gs-pm__close:hover,
.gs-pm__close:focus {
	background: #1a3b24;
	border-color: #1a3b24;
	color: #fff;
}

.gs-pm__loading {
	padding: 70px 0;
	text-align: center;
	font-size: 15px;
	color: #8a8378;
}

/* Hold the page still behind the modal. */
html.gs-pm-open,
html.gs-pm-open body {
	overflow: hidden;
}

/* ---------- the product content itself ---------- */

/* The single-product template centres itself inside the page's content column;
   inside the panel it is already in one. */
.gs-pm__body div.product {
	margin: 0;
	padding: 0;
}

.gs-pm__body div.product::after {
	content: "";
	display: table;
	clear: both;
}

/* The theme hides the product title on the page because the page header shows
   it; there is no page header in here. */
.gs-pm__body .product_title {
	display: block;
}

/*
 * WooCommerce ships the gallery at opacity 0 and lets its own script fade it
 * in once flexslider is ready. That script is only enqueued on single-product
 * pages, so in a modal opened from a listing nothing ever turned it back on
 * and the image half of the panel was blank. There is one image per product
 * on this site, so there is nothing to initialise — just show it.
 */
.gs-pm__body .woocommerce-product-gallery {
	opacity: 1 !important;
}

/* Image right, details left — matching the product page. The theme's RTL
   rules already land here; stating it explicitly keeps it from depending on
   which stylesheet happens to win. */
.gs-pm__body .woocommerce-product-gallery {
	float: right;
	width: 52%;
	margin-bottom: 0;
}

.gs-pm__body .summary,
.gs-pm__body .entry-summary {
	float: left;
	width: 44%;
	margin-bottom: 0;
}

.gs-pm__body .woocommerce-product-gallery img {
	display: block;
	width: 100%;
	height: auto;
}

/* One image per product here, so the list is a plain block rather than a
   carousel; without flexslider the items would otherwise stack. */
.gs-pm__body .woocommerce-product-gallery__wrapper {
	margin: 0;
}

.gs-pm__body .flex-control-thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 10px 0 0;
	padding: 0;
	list-style: none;
}

.gs-pm__body .flex-control-thumbs li {
	width: 74px;
	margin: 0;
}

@media ( max-width: 900px ) {
	.gs-pm {
		padding: 0;
	}

	.gs-pm__dialog {
		max-width: none;
		min-height: 100%;
		margin: 0;
		padding: 60px 18px 26px;
		border-radius: 0;
	}

	.gs-pm__body .woocommerce-product-gallery,
	.gs-pm__body .summary,
	.gs-pm__body .entry-summary {
		float: none;
		width: 100%;
	}

	.gs-pm__body .summary,
	.gs-pm__body .entry-summary {
		margin-top: 22px;
	}
}

/* ==========================================================================
   Cart row — the quantity box on the left, both buttons on one edge
   --------------------------------------------------------------------------
   Stock layout put the quantity box hard right and left the add-to-cart button
   floating between it and nothing, while the wishlist button below sat on a
   third edge again. Measured at 1600px: quantity 672–723, add to cart 415–668,
   wishlist 476–723 — three different left edges in a column of two controls.

   The quantity box now sits at the left end and the add-to-cart button fills
   the rest of the row; the wishlist button below is inset by the same amount,
   so the two buttons share both edges.
   ========================================================================== */

.gs-pm form.cart {
	display: flex !important;
	align-items: stretch;
	gap: 10px;
	/* 20px of right padding was holding the button short of the edge the
	   wishlist button below reaches. */
	padding: 0 !important;
}

/* In a right-to-left row the lowest order renders right-most, so the button
   takes the right and the quantity box lands on the left. */
.gs-pm form.cart .quantity {
	order: 2;
	flex: 0 0 64px;
	margin: 0 !important;
}

.gs-pm form.cart .quantity input.qty {
	width: 100%;
	box-sizing: border-box;
	height: 100%;
	text-align: center;
}

.gs-pm form.cart button.single_add_to_cart_button {
	order: 1;
	flex: 1 1 auto;
	margin: 0 !important;
}

/* Same inset as the quantity box plus the gap, so this button's left edge
   lines up with the add-to-cart button above it. */
/* Inset to match the add-to-cart button exactly: the quantity box plus the gap
   on the left, and on the right the 20px the button itself leaves. */
.gs-pm .yith-wcwl-add-to-wishlist {
	padding-left: 74px;
	padding-right: 20px;
	margin-top: 10px;
}

.gs-pm .yith-wcwl-add-to-wishlist .yith-wcwl-add-button,
.gs-pm .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistaddedbrowse,
.gs-pm .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistexistsbrowse {
	display: block;
	width: 100%;
}

.gs-pm .yith-wcwl-add-to-wishlist a {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	box-sizing: border-box;
	text-align: center;
}
