/* Single product page — additive polish on top of WooCommerce's own default
   markup (no template overrides exist; the base gallery/price/variation/
   stock restyling already lives in components/shop/component.css, see the
   "Single product page" comment there). This file covers the newer pieces:
   the sale badge, the accepted-payments line, the Buy Now button, the
   mobile sticky purchase bar, a tighter related-products grid, and review
   readability — nothing here duplicates what shop/component.css already
   does. */

/* Sale badge — only printed by qg_single_product_sale_badge() in
   inc/single-product.php when the product actually has a real, unambiguous
   discount; never a fixed/decorative element. */

.qg-sale-badge-row {
	margin: -0.75rem 0 var(--qg-space-3);
}

.qg-sale-badge {
	display: inline-flex;
	align-items: center;
	padding: 0.25rem 0.7rem;
	border-radius: 999px;
	background: var(--qg-gradient-cta);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.03em;
}

/* WooCommerce's own default "Sale!" flash (span.onsale, printed by
   woocommerce_show_product_sale_flash() over the gallery image) — restyled
   to match the shop grid's product-card stamp (.qg-product-card__badge in
   components/product-grid/component.css: same translucent ink-stamp look,
   same accent color, same pulsing double-ring) instead of WooCommerce's
   unstyled default circle, so the "on sale" treatment reads as one
   consistent stamp family across the grid and the single product page. */

.woocommerce div.product span.onsale {
	position: absolute;
	top: var(--qg-space-2);
	left: var(--qg-space-2);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 48px;
	min-height: 48px;
	width: auto;
	height: auto;
	margin: 0;
	padding: 0.3rem;
	border-radius: 50%;
	background: rgba(255, 74, 31, 0.14);
	opacity: 0.8;
	transform: rotate(-9deg);
	border: 1.5px solid rgba(255, 74, 31, 0.75);
	box-shadow: inset 0 0 0 3px rgba(255, 74, 31, 0.12);
	color: var(--qg-color-accent);
	font-family: var(--qg-font-body);
	font-size: 0.68rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	line-height: 1;
}

.woocommerce div.product span.onsale::before {
	content: '';
	position: absolute;
	inset: -5px;
	border-radius: 50%;
	border: 1px solid rgba(255, 74, 31, 0.4);
	animation: qg-badge-stamp-pulse 2.4s var(--qg-ease) infinite;
}

@media (prefers-reduced-motion: reduce) {
	.woocommerce div.product span.onsale::before {
		animation: none;
		opacity: 0.6;
	}
}

/* Buy Now — sits beside the real Add to Cart button inside the same flex
   row (form.cart already lays its children out with gap/wrap — see
   components/shop/component.css), matched to its exact pill height/shape
   so the two read as one deliberate pair rather than two different button
   systems. */

.qg-buy-now {
	height: 52px;
	padding: 0 var(--qg-space-5);
	border-radius: 999px;
	font-size: 0.95rem;
	text-transform: none;
	letter-spacing: normal;
}

.qg-buy-now.is-loading {
	opacity: 0.7;
	cursor: wait;
}

/* Accepted payment methods — plain, quiet line under the trust row (see
   qg_single_product_payment_methods()); never a decorative badge row of
   invented logos, just an honest sentence sourced from real enabled
   gateways. */

.qg-payment-methods {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	margin: var(--qg-space-3) 0 0;
	font-size: 0.85rem;
	color: var(--qg-color-ink-soft);
}

.qg-payment-methods .qg-icon {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	margin-top: 0.15rem;
	color: var(--qg-color-muted);
}

/* Share row (see qg_single_product_share_row()) — real icon buttons, not
   literal "Facebook" / "WhatsApp" / "Telegram" text links. */

.qg-product-share {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: var(--qg-space-4) 0 0;
	font-family: var(--qg-font-body);
}

.qg-product-share__label {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--qg-color-ink-soft);
	margin-right: 0.2rem;
}

.qg-product-share__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--qg-color-paper);
	color: var(--qg-color-ink-soft);
	border: 1px solid var(--qg-color-line);
	transition: background-color 0.2s var(--qg-ease), color 0.2s var(--qg-ease), transform 0.2s var(--qg-ease), border-color 0.2s var(--qg-ease);
}

.qg-product-share__btn .qg-icon {
	width: 15px;
	height: 15px;
}

.qg-product-share__btn:hover {
	transform: translateY(-2px);
	border-color: transparent;
	color: #fff;
}

.qg-product-share__btn--facebook:hover {
	background: #1877f2;
}

.qg-product-share__btn--whatsapp:hover {
	background: #25d366;
}

.qg-product-share__btn--telegram:hover {
	background: #0088cc;
}

.qg-product-share__btn:focus-visible {
	outline: 2px solid var(--qg-color-accent);
	outline-offset: 2px;
}

/* Related products: a firm 2-up / 4-up cap (see
   woocommerce_output_related_products_args filter in inc/single-product.php)
   instead of the shop archive's own wider up-to-5-column breakpoints —
   right for a full catalog grid, cramped-feeling for a short "you may also
   like" row. */

.related.products ul.products {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 1024px) {
	.related.products ul.products {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* Gallery whitespace: the default WooCommerce gallery wrapper already gets
   a paper background + rounded corners from shop/component.css; this adds
   the breathing room around the product itself so it doesn't touch the
   frame edges, without touching aspect ratio/cropping (object-fit: contain
   keeps the real image proportions; WooCommerce always serves the
   registered "woocommerce_single" image size here, never the full
   original). */

.woocommerce-product-gallery__image:first-child {
	padding: var(--qg-space-4);
	box-sizing: border-box;
}

.woocommerce-product-gallery__image:first-child img {
	aspect-ratio: 1 / 1;
	object-fit: contain;
	background: #fff;
}

/* Accessible focus for the variation swatches (woo-variation-swatches
   plugin) — the plugin ships zero :focus styling of its own, so keyboard
   users had no visible indicator of which option was focused. Additive
   only: doesn't touch the plugin's own selected/hover visuals. */

.woocommerce div.product .variable-item:focus-visible,
.woocommerce div.product .variable-item a:focus-visible {
	outline: 2px solid var(--qg-color-accent);
	outline-offset: 2px;
}

.woocommerce div.product .variations select:focus-visible {
	outline: 2px solid var(--qg-color-accent);
	outline-offset: 1px;
}

/* Reviews toggle (see qg_single_product_reviews_toggle() — replaces
   WooCommerce's default always-open "Reviews (N)" tab). Collapsed by
   default; expands via a CSS grid-rows animation driven by the
   data-qg-reviews-toggle click handler in component.js, which also toggles
   `inert` on the panel so its form fields aren't tab-reachable while
   closed. The inner content below (#reviews.woocommerce-Reviews etc.) is
   still wc_get_template()'s real output, just restyled. */

.qg-reviews {
	max-width: 760px;
	margin-top: var(--qg-space-6);
	border: 1px solid var(--qg-color-line);
	border-radius: var(--qg-radius-lg);
	background: var(--qg-color-surface);
	overflow: hidden;
}

.qg-reviews__toggle {
	display: flex;
	align-items: center;
	gap: var(--qg-space-3);
	width: 100%;
	padding: var(--qg-space-4) var(--qg-space-5);
	background: none;
	border: 0;
	cursor: pointer;
	text-align: left;
	font-family: var(--qg-font-body);
}

.qg-reviews__toggle-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border-radius: 50%;
	background: var(--qg-color-accent-soft);
	color: var(--qg-color-accent-dark);
	transition: background-color 0.2s var(--qg-ease), color 0.2s var(--qg-ease);
}

.qg-reviews__toggle-icon .qg-icon {
	width: 18px;
	height: 18px;
}

.qg-reviews__toggle:hover .qg-reviews__toggle-icon {
	background: var(--qg-color-accent);
	color: #fff;
}

.qg-reviews__toggle-text {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.qg-reviews__toggle-title {
	font-family: var(--qg-font-heading);
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--qg-color-ink);
}

.qg-reviews__toggle-meta {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.85rem;
	color: var(--qg-color-ink-soft);
}

.qg-reviews__toggle-meta .star-rating {
	color: var(--qg-color-yellow);
	font-size: 0.8rem;
	margin: 0;
}

.qg-reviews__chevron {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	color: var(--qg-color-muted);
	transition: transform 0.3s var(--qg-ease);
}

.qg-reviews__toggle[aria-expanded='true'] .qg-reviews__chevron {
	transform: rotate(90deg);
}

.qg-reviews__panel {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.35s var(--qg-ease);
}

.qg-reviews__panel.is-open {
	grid-template-rows: 1fr;
}

.qg-reviews__panel-inner {
	overflow: hidden;
	min-height: 0;
	padding: 0 var(--qg-space-5) var(--qg-space-5);
	border-top: 1px solid var(--qg-color-line);
	margin-top: 0;
}

.qg-reviews__panel:not(.is-open) .qg-reviews__panel-inner {
	border-top-color: transparent;
}

/* Reviews content — WooCommerce's default review markup (#reviews,
   .commentlist, .star-rating) ships with no theme styling at all currently,
   so it fell back to the plugin's bare default look. Restyled here only;
   the review system itself (WC_Comments, comment moderation, the form's
   nonce/fields) is untouched. */

#reviews.woocommerce-Reviews {
	max-width: none;
	padding-top: var(--qg-space-5);
}

#reviews .woocommerce-Reviews-title {
	font-family: var(--qg-font-heading);
	font-size: 1.3rem;
	font-weight: 700;
	margin: 0 0 var(--qg-space-4);
}

.woocommerce-Reviews ol.commentlist {
	list-style: none;
	margin: 0 0 var(--qg-space-5);
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--qg-space-4);
}

.woocommerce-Reviews .comment_container {
	display: flex;
	gap: var(--qg-space-3);
	padding-bottom: var(--qg-space-4);
	border-bottom: 1px solid var(--qg-color-line);
}

.woocommerce-Reviews .avatar {
	border-radius: 50%;
	flex-shrink: 0;
}

.woocommerce-Reviews .comment-text {
	flex: 1;
	min-width: 0;
}

.woocommerce-Reviews .star-rating {
	margin-bottom: 0.4rem;
	color: var(--qg-color-yellow);
}

/* The interactive "Your rating" star picker in the review form (WooCommerce
   core markup/JS — .stars/.star-1../star-5, backed by the hidden #rating
   select; already fully functional, just unstyled/hard to tap). Bigger hit
   targets for touch, an amber fill to match .star-rating above, and a
   hover preview so it reads as clickable before committing a value. */
.comment-form-rating {
	margin-bottom: var(--qg-space-4);
}

.comment-form-rating label {
	display: block;
	margin-bottom: 0.5rem;
	font-weight: 600;
	font-size: 0.88rem;
	color: var(--qg-color-ink);
}

.comment-form-rating .stars a {
	width: 1.6em;
	height: 1.6em;
	font-size: 22px;
	color: var(--qg-color-line);
	transition: color 0.15s var(--qg-ease), transform 0.15s var(--qg-ease);
}

.comment-form-rating .stars a:hover,
.comment-form-rating .stars:hover a::before,
.comment-form-rating .stars.selected a.active::before,
.comment-form-rating .stars.selected a.active ~ a::before {
	color: var(--qg-color-yellow);
}

.comment-form-rating .stars a:hover {
	transform: scale(1.15);
}

.comment-form-rating .stars a:focus-visible {
	outline: 2px solid var(--qg-color-accent);
	outline-offset: 3px;
	border-radius: 2px;
}

.woocommerce-Reviews .woocommerce-review__author {
	font-weight: 700;
	color: var(--qg-color-ink);
}

.woocommerce-Reviews .woocommerce-review__dash {
	display: none;
}

.woocommerce-Reviews .woocommerce-review__published-date {
	display: block;
	font-size: 0.78rem;
	color: var(--qg-color-muted);
	margin-bottom: 0.4rem;
}

.woocommerce-Reviews .description p {
	margin: 0;
	color: var(--qg-color-ink-soft);
	line-height: 1.7;
}

#review_form_wrapper #respond {
	max-width: 100%;
	margin: 0;
	padding: var(--qg-space-4);
	background: var(--qg-color-paper);
	border-radius: var(--qg-radius-lg);
}

#review_form_wrapper .comment-reply-title {
	font-family: var(--qg-font-heading);
	font-size: 1.15rem;
	font-weight: 700;
}

#review_form_wrapper .comment-form-rating select {
	display: none;
}

#review_form_wrapper input[type='text'],
#review_form_wrapper input[type='email'],
#review_form_wrapper textarea {
	width: 100%;
	padding: 0.75rem 1rem;
	border-radius: var(--qg-radius);
	border: 1px solid var(--qg-color-line);
	background: var(--qg-color-surface);
	font-family: var(--qg-font-body);
	font-size: 0.92rem;
	color: var(--qg-color-ink);
}

#review_form_wrapper input[type='text']:focus-visible,
#review_form_wrapper input[type='email']:focus-visible,
#review_form_wrapper textarea:focus-visible {
	outline: none;
	border-color: var(--qg-color-accent);
	box-shadow: 0 0 0 3px var(--qg-color-accent-soft);
}

#review_form_wrapper .comment-form-cookies-consent {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.8rem;
	color: var(--qg-color-ink-soft);
}

#review_form_wrapper .comment-form-cookies-consent label {
	margin: 0;
	font-weight: 400;
}

/* #respond is doubled into the selector (it genuinely wraps .form-submit in
   the real DOM) purely to out-specificity WooCommerce core's own
   `.woocommerce #respond input#submit` button skin (two IDs already) —
   without it this loses to woocommerce.css's default lavender button. */
#review_form_wrapper #respond .form-submit input[type='submit'] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.85rem 1.75rem;
	border: 0;
	border-radius: var(--qg-radius);
	background: var(--qg-color-ink);
	color: var(--qg-color-surface);
	font-family: var(--qg-font-body);
	font-size: 0.9rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.2s var(--qg-ease), transform 0.2s var(--qg-ease);
}

#review_form_wrapper #respond .form-submit input[type='submit']:hover {
	background: var(--qg-color-accent-dark);
}

#review_form_wrapper #respond .form-submit input[type='submit']:focus-visible {
	outline: 2px solid var(--qg-color-accent);
	outline-offset: 2px;
}

/* Mobile sticky purchase bar (see qg_single_product_sticky_bar() +
   single-product/component.js) — pinned above the existing bottom tab bar,
   reusing its exact reserved height (58px + safe-area, see .qg-tabbar in
   components/header/component.css) rather than guessing a new offset.
   Desktop deliberately has no sticky summary: already tried once (see the
   comment in components/shop/component.css) and dropped because Related
   Products shares the same grid container as the summary column. */

.qg-sticky-buy {
	position: fixed;
	left: 0;
	right: 0;
	bottom: calc(58px + env(safe-area-inset-bottom, 0px));
	z-index: 110;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--qg-space-3);
	padding: 0.7rem var(--qg-space-4);
	background: var(--qg-color-surface);
	border-top: 1px solid var(--qg-color-line);
	box-shadow: 0 -8px 24px rgba(15, 14, 14, 0.08);
	transform: translateY(100%);
	opacity: 0;
	transition: transform 0.3s var(--qg-ease), opacity 0.3s var(--qg-ease);
}

.qg-sticky-buy[data-open] {
	transform: translateY(0);
	opacity: 1;
	pointer-events: auto;
}

.qg-sticky-buy__info {
	min-width: 0;
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--qg-color-accent-dark);
}

.qg-sticky-buy__info .amount,
.qg-sticky-buy__info del {
	font-size: 0.95em;
}

.qg-sticky-buy__add {
	flex-shrink: 0;
	height: 44px;
	padding: 0 var(--qg-space-4);
	border-radius: 999px;
	font-size: 0.85rem;
}

.qg-sticky-buy__add.is-loading {
	opacity: 0.7;
	cursor: wait;
}

.qg-sticky-buy__add:disabled {
	background: var(--qg-color-line);
	color: var(--qg-color-muted);
	cursor: not-allowed;
}

@media (min-width: 768px) {
	.qg-sticky-buy {
		display: none;
	}
}

/* Extra bottom padding, added/removed by component.js exactly while the bar
   is visible, so the page never reserves dead empty space before the user
   has scrolled far enough to see it. */

body.qg-sticky-buy-visible:not(.woocommerce-checkout) {
	padding-bottom: calc(58px + 68px + env(safe-area-inset-bottom, 0px));
}

@media (prefers-reduced-motion: reduce) {
	.qg-sticky-buy {
		transition: none;
	}
}
