/* ==========================================================================
   11 — Single product
   ========================================================================== */

.pd { padding-top: 16px; }
.pd__top { display: grid; gap: 24px; align-items: start; }
@media (min-width: 900px) { .pd__top { grid-template-columns: 1.05fr 1fr; gap: 48px; } }

/* ---------- Gallery (اسکریپت‌های استاندارد ووکامرس) ---------- */
.pd__gallery { position: relative; }
@media (min-width: 900px) { .pd__gallery { position: sticky; top: calc(var(--header-h) + 16px); } }
.pd__gallery > .badge { position: absolute; top: 16px; right: 16px; z-index: 3; }
.woocommerce-product-gallery { position: relative; opacity: 1 !important; }
.woocommerce-product-gallery__wrapper { margin: 0; }
.woocommerce-product-gallery .flex-viewport, .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child { border-radius: var(--r-xl); overflow: hidden; background: linear-gradient(160deg, #FBF7EE, var(--cream-2)); border: 1px solid var(--line); }
.woocommerce-product-gallery__image img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.woocommerce-product-gallery .flex-control-thumbs { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; }
.woocommerce-product-gallery .flex-control-thumbs li { flex: 0 0 76px; }
.woocommerce-product-gallery .flex-control-thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: var(--r); border: 2px solid transparent; opacity: .65; cursor: pointer; transition: opacity var(--t), border-color var(--t); }
.woocommerce-product-gallery .flex-control-thumbs img.flex-active, .woocommerce-product-gallery .flex-control-thumbs img:hover { opacity: 1; border-color: var(--gold); }
.woocommerce-product-gallery__trigger { position: absolute; top: 14px; left: 14px; z-index: 3; width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.9); display: grid; place-items: center; font-size: 0; box-shadow: var(--sh-1); }
.woocommerce-product-gallery__trigger::before { content: ""; width: 16px; height: 16px; border: 2px solid var(--green); border-radius: 50%; }
.woocommerce-product-gallery__trigger::after { content: ""; position: absolute; width: 7px; height: 2px; background: var(--green); transform: translate(8px, 8px) rotate(45deg); }

/* ---------- Summary ---------- */
.pd__summary { display: flex; flex-direction: column; gap: 14px; }
.pd__cat { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 12px; border-radius: var(--r-pill); background: var(--green-soft); color: var(--green); font-size: var(--fs-xs); font-weight: 800; }
.pd__cat .ico { width: 16px; height: 16px; }
.pd__title { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.3rem); font-weight: 900; line-height: 1.45; }
.pd__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: var(--fs-sm); color: var(--muted); }
.pd__rating { display: inline-flex; align-items: center; gap: 4px; }
.pd__rating .ico { width: 18px; height: 18px; color: var(--gold); fill: var(--gold); }
.pd__rating b { color: var(--ink); }
.pd__stock { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.pd__stock i { width: 8px; height: 8px; border-radius: 50%; }
.pd__stock.is-in { color: var(--ok); } .pd__stock.is-in i { background: var(--ok); box-shadow: 0 0 0 4px rgba(47,125,58,.15); }
.pd__stock.is-out { color: var(--err); } .pd__stock.is-out i { background: var(--err); }
.pd__stock small { font-weight: 500; color: var(--brown); }
.pd__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); font-weight: 900; color: var(--brown); }
.pd__price del { font-size: 1rem; color: var(--muted); font-weight: 500; }
.pd__price ins { text-decoration: none; }
.pd__price .woocommerce-Price-currencySymbol { font-size: .6em; margin-inline-start: 4px; }
.pd__short { font-size: var(--fs-md); color: var(--ink-2); }
.pd__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.pd__facts li { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--r); background: var(--white); border: 1px solid var(--line); font-weight: 700; font-size: var(--fs-sm); }
.pd__facts .ico { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--gold-soft); color: var(--brown); }
.pd__facts small { display: block; color: var(--muted); font-weight: 500; font-size: .7rem; }

/* ---------- Buy box ---------- */
.pd__buy { padding: 18px; border-radius: var(--r-lg); background: var(--white); border: 1px solid var(--line); }
.pd__buy form.cart { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0; }
.pd__buy form.cart .quantity { flex-shrink: 0; }
.pd__buy .single_add_to_cart_button { flex: 1; --h: 52px; min-width: 180px; }
.pd__buy .variations_form { flex-direction: column; align-items: stretch !important; }
.pd__buy table.variations { width: 100%; border: 0; margin: 0; }
.pd__buy table.variations tr { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.pd__buy table.variations th, .pd__buy table.variations td { padding: 0; text-align: right; border: 0; }
.pd__buy table.variations label { font-weight: 800; font-size: var(--fs-sm); color: var(--green-deep); }
.pd__buy .reset_variations { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; display: inline-block; }
.vpills { display: flex; flex-wrap: wrap; gap: 8px; }
.vpill--lg { height: 44px; padding: 0 18px; font-size: var(--fs-sm); background: #fff; }
.pd__buy .single_variation_wrap { display: flex; flex-direction: column; gap: 12px; }
.pd__buy .woocommerce-variation-add-to-cart { display: flex; flex-wrap: wrap; gap: 12px; }
.pd__buy .woocommerce-variation-price .price { font-weight: 900; color: var(--brown); font-size: 1.2rem; }
.pd__buy .stock { margin: 0; font-size: var(--fs-sm); font-weight: 700; color: var(--ok); }
.pd__buy .stock.out-of-stock { color: var(--err); }

.pd__trust { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: var(--fs-sm); color: var(--ink-2); }
.pd__trust li { display: inline-flex; align-items: center; gap: 6px; }
.pd__trust .ico { width: 18px; height: 18px; color: var(--gold); }

/* ---------- Tabs ---------- */
.pd__tabs { margin-top: clamp(36px, 6vw, 64px); }
.woocommerce-tabs .tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin: 0 0 24px; padding: 0; }
.woocommerce-tabs .tabs::-webkit-scrollbar { display: none; }
.woocommerce-tabs .tabs li { flex-shrink: 0; }
.woocommerce-tabs .tabs a { display: block; padding: 12px 18px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; transition: color var(--t), border-color var(--t); }
.woocommerce-tabs .tabs li.active a { color: var(--green); border-color: var(--gold); }
.woocommerce-Tabs-panel { padding: clamp(18px, 4vw, 40px); border-radius: var(--r-xl); background: var(--white); border: 1px solid var(--line); }
.woocommerce-Tabs-panel--description { font-size: 1.02rem; line-height: 2.05; }
.woocommerce-product-attributes { width: 100%; }
.woocommerce-product-attributes tr:nth-child(odd) { background: var(--cream); }
.woocommerce-product-attributes th, .woocommerce-product-attributes td { padding: 12px 16px; text-align: right; font-size: var(--fs-sm); }
.woocommerce-product-attributes th { width: 34%; color: var(--green-deep); }
.woocommerce-product-attributes td p { margin: 0; }

/* دیدگاه‌ها */
#reviews .commentlist { display: flex; flex-direction: column; gap: 12px; margin: 0 0 24px; padding: 0; list-style: none; }
#reviews .comment_container { display: flex; gap: 12px; padding: 16px; border-radius: var(--r); background: var(--cream); }
#reviews .comment_container img.avatar { width: 44px; height: 44px; border-radius: 50%; }
#reviews .comment-text { flex: 1; font-size: var(--fs-sm); }
#reviews .meta { color: var(--muted); font-size: var(--fs-xs); margin: 0 0 6px; }
#reviews .woocommerce-review__author { color: var(--green-deep); font-weight: 800; font-size: var(--fs-sm); }
.star-rating { position: relative; width: 5.4em; height: 1.1em; font-size: .9rem; overflow: hidden; line-height: 1; }
.star-rating::before { content: "★★★★★"; position: absolute; inset: 0; color: var(--line-2); letter-spacing: .1em; }
.star-rating span { position: absolute; top: 0; right: 0; height: 100%; overflow: hidden; font-size: 0; }
.star-rating span::before { content: "★★★★★"; position: absolute; top: 0; right: 0; font-size: .9rem; color: var(--gold); letter-spacing: .1em; }
.comment-form-rating .stars a { color: var(--gold); font-size: 1.4rem; }
#review_form .comment-reply-title { font-weight: 800; color: var(--green-deep); display: block; margin-bottom: 10px; }
#review_form textarea, #review_form input[type="text"], #review_form input[type="email"] { width: 100%; min-height: 50px; padding: 12px 16px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: #fff; }
#review_form .form-submit input { min-height: 48px; padding: 0 26px; border-radius: var(--r-pill); border: 0; background: var(--green); color: #fff; font-weight: 700; cursor: pointer; }

/* ---------- Related / upsells ---------- */
.related.products, .upsells.products, .cross-sells { margin-top: clamp(48px, 7vw, 88px); }
.related.products > h2, .upsells.products > h2, .cross-sells > h2 { font-size: var(--fs-xl); font-weight: 900; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.related.products > h2::before, .upsells.products > h2::before, .cross-sells > h2::before { content: ""; width: 10px; height: 16px; border-radius: 50%; background: var(--date); transform: rotate(25deg); }

/* ---------- Sticky buy bar (موبایل) ---------- */
.pd-sticky {
	position: fixed; z-index: var(--z-header); right: 0; left: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
	display: flex; align-items: center; gap: 12px; padding: 10px var(--gutter);
	background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); box-shadow: 0 -10px 24px -18px rgba(6,61,33,.4);
	transform: translateY(120%); transition: transform .4s var(--ease);
}
.pd-sticky.is-on { transform: none; }
.pd-sticky__info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.pd-sticky__info img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.pd-sticky__info b { display: block; font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-sticky__info .price { font-size: var(--fs-sm); font-weight: 900; color: var(--brown); }
.pd-sticky__info .price del { display: none; }
.pd-sticky .btn { --h: 44px; padding: 0 16px; font-size: var(--fs-sm); }
@media (min-width: 1024px) { .pd-sticky { display: none; } }
