/**
 * Single product page: gallery, summary, swatches, stepper, delivery estimate,
 * trust badges, accordion, reviews, frequently bought together, sticky bar.
 * Components follow design/Phonehub Design System.dc.html.
 */

/* ---------- Layout ---------- */

.single-product div.product {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--sp-7);
	align-items: start;
}

.single-product div.product > .woocommerce-product-gallery,
.single-product div.product > .summary {
	min-width: 0;
}

.single-product div.product > :not(.woocommerce-product-gallery):not(.summary):not(.onsale) {
	grid-column: 1 / -1;
}

@media (min-width: 900px) {
	.single-product div.product {
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
		gap: var(--sp-9) var(--sp-9);
	}

	.single-product div.product > .summary {
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 60px + var(--sp-6));
	}
}

.single-product div.product {
	position: relative;
}

.single-product div.product > .onsale {
	position: absolute;
	top: var(--sp-4);
	left: var(--sp-4);
	z-index: 3;
}

/* ---------- Gallery (WooCommerce FlexSlider / zoom / PhotoSwipe) ---------- */

.woocommerce-product-gallery {
	position: relative;
	opacity: 1 !important;
}

.woocommerce-product-gallery__wrapper {
	margin: 0;
}

.woocommerce-product-gallery .flex-viewport,
.woocommerce-product-gallery > .woocommerce-product-gallery__wrapper {
	overflow: hidden;
	border-radius: var(--r-lg);
	background: repeating-linear-gradient(135deg, var(--c-ph-1) 0 12px, var(--c-ph-2) 12px 24px);
}

.woocommerce-product-gallery__image img {
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

.woocommerce-product-gallery__image--placeholder img {
	opacity: 0;
}

.woocommerce-product-gallery__trigger {
	position: absolute;
	top: var(--sp-4);
	right: var(--sp-4);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--c-wish-bg);
	box-shadow: var(--sh-1);
	font-size: 0;
	text-decoration: none;
}

.woocommerce-product-gallery__trigger::before {
	content: "";
	width: 18px;
	height: 18px;
	background: currentColor;
	color: var(--c-text);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5M11 8v6M8 11h6'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5M11 8v6M8 11h6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.woocommerce-product-gallery__trigger img {
	display: none;
}

.woocommerce-product-gallery .flex-control-thumbs {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: var(--sp-2);
	margin: var(--sp-3) 0 0;
	padding: 0;
	list-style: none;
}

.woocommerce-product-gallery .flex-control-thumbs img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border: 2px solid transparent;
	border-radius: var(--r-sm);
	opacity: .7;
	cursor: pointer;
	transition: opacity var(--dur-fast), border-color var(--dur-fast);
}

.woocommerce-product-gallery .flex-control-thumbs img:hover,
.woocommerce-product-gallery .flex-control-thumbs img.flex-active {
	border-color: var(--c-text);
	opacity: 1;
}

.woocommerce-product-gallery .flex-direction-nav {
	display: none;
}

/* ---------- Summary ---------- */

.summary {
	display: flex;
	flex-direction: column;
	gap: var(--sp-4);
}

.summary > * {
	margin: 0;
}

.product-summary__brand {
	margin-bottom: calc(var(--sp-3) * -1);
	color: var(--c-muted);
	font-size: var(--fs-caption);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.summary .product_title {
	font-size: clamp(28px, 3vw, 40px);
	line-height: 1.1;
	letter-spacing: -0.03em;
}

.woocommerce-product-rating {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	color: var(--c-muted);
	font-size: var(--fs-small);
}

.woocommerce-review-link {
	color: var(--c-muted);
}

.summary .price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 10px;
	font-size: 26px;
	line-height: 1.2;
}

.summary .price del {
	order: 2;
	color: var(--c-muted);
	font-family: var(--fb);
	font-size: var(--fs-body);
	font-weight: 500;
}

.summary .price ins {
	text-decoration: none;
}

.woocommerce-product-details__short-description {
	color: var(--c-muted);
}

.woocommerce-product-details__short-description > :last-child {
	margin-bottom: 0;
}

/* Stock: in-stock / low / out as design badges */

.summary .stock,
.woocommerce-variation-availability .stock {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 24px;
	margin: 0;
	padding: 0 9px;
	border-radius: var(--r-pill);
	font-size: var(--fs-caption);
	font-weight: 700;
}

.stock.in-stock {
	background: var(--c-success-soft);
	color: var(--c-success);
}

.stock.out-of-stock,
.stock.available-on-backorder {
	border: 1px solid var(--c-line);
	color: var(--c-danger-ink);
}

/* ---------- Add to cart form ---------- */

form.cart {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
}

form.cart .single_add_to_cart_button {
	display: inline-flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	gap: var(--sp-2);
	min-width: 180px;
	height: var(--btn-h-lg);
	padding: 0 28px;
	border: 0;
	border-radius: var(--r-pill);
	background: var(--c-primary);
	color: var(--c-on-primary);
	font-size: var(--fs-body);
	font-weight: 700;
	transition: transform var(--dur-btn) var(--ease), box-shadow var(--dur-btn), background var(--dur-fast);
}

form.cart .single_add_to_cart_button:hover {
	background: var(--c-primary-hover);
	box-shadow: var(--sh-btn-primary);
	transform: translateY(-2px);
}

form.cart .single_add_to_cart_button:active {
	background: var(--c-primary-press);
	box-shadow: none;
	transform: translateY(1px);
}

form.cart .single_add_to_cart_button:focus-visible {
	outline: 2px solid var(--c-text);
	outline-offset: 3px;
}

form.cart .single_add_to_cart_button.disabled {
	opacity: .5;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

form.cart .single_add_to_cart_button.is-loading {
	pointer-events: none;
}

form.cart .single_add_to_cart_button.is-loading::before,
.sticky-atc__button.is-loading::before,
.fbt__add.is-loading::before {
	content: "";
	width: 16px;
	height: 16px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: phonehub-spin .7s linear infinite;
}

/* Quantity stepper (JS wraps .quantity) */

form.cart .quantity {
	flex: none;
}

form.cart .quantity.stepper input.qty {
	width: 44px;
	height: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	text-align: center;
	-moz-appearance: textfield;
}

form.cart .quantity input.qty::-webkit-inner-spin-button,
form.cart .quantity input.qty::-webkit-outer-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

form.cart .quantity:not(.stepper) input.qty {
	width: 88px;
	height: var(--btn-h-lg);
	border-radius: var(--r-pill);
	text-align: center;
}

/* Variations: label row + swatches */

form.variations_form {
	flex-direction: column;
	align-items: stretch;
}

table.variations {
	width: 100%;
	border-collapse: collapse;
}

table.variations tr {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
	margin-bottom: var(--sp-4);
}

table.variations th,
table.variations td {
	display: block;
	padding: 0;
	text-align: left;
}

table.variations th label {
	font-size: var(--fs-small);
	font-weight: 600;
}

.swatches__value {
	margin-left: 6px;
	color: var(--c-muted);
	font-weight: 500;
}

.swatches__value:not(:empty)::before {
	content: ": ";
	margin-left: -6px;
}

table.variations select {
	max-width: 320px;
}

.swatches__select {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	opacity: 0;
}

.swatches {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2);
}

.swatch {
	position: relative;
	border: 0;
	background: var(--c-surface);
	transition: transform var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}

.swatch--colour {
	width: 44px;
	height: 44px;
	padding: 3px;
	border: 2px solid var(--c-line);
	border-radius: 50%;
}

.swatch--colour:hover {
	transform: scale(1.08);
}

.swatch__fill {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}

.swatch--chip {
	height: 44px;
	padding: 0 var(--sp-4);
	border: 1.5px solid var(--c-line);
	border-radius: var(--r-sm);
	color: var(--c-text);
	font-size: var(--fs-small);
	font-weight: 700;
}

.swatch--chip:hover {
	border-color: var(--c-text);
}

.swatch[aria-checked="true"] {
	border-color: var(--c-text);
}

.swatch--chip[aria-checked="true"] {
	background: var(--c-text);
	color: var(--c-on-ink);
}

.swatch.is-unavailable {
	color: var(--c-disabled);
	cursor: not-allowed;
	transform: none;
}

.swatch--chip.is-unavailable {
	text-decoration: line-through;
}

.swatch--colour.is-unavailable::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 4px;
	right: 4px;
	height: 2px;
	background: var(--c-muted);
	transform: rotate(-45deg);
}

.reset_variations {
	display: inline-block;
	margin-top: var(--sp-2);
	color: var(--c-muted);
	font-size: 13px;
}

.single_variation_wrap {
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
}

.woocommerce-variation {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-3);
}

.woocommerce-variation-price .price {
	font-size: 22px;
}

.woocommerce-variation-add-to-cart {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* ---------- Delivery estimate + trust badges ---------- */

.delivery-estimate {
	display: flex;
	gap: var(--sp-3);
	padding: var(--sp-4);
	border-radius: var(--r-md);
	background: var(--c-surface-2);
}

.delivery-estimate__icon {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: var(--r-sm);
	background: var(--c-primary-soft);
	color: var(--c-text);
}

.delivery-estimate__body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: var(--fs-small);
}

.delivery-estimate__title {
	font-weight: 700;
}

.delivery-estimate__line {
	color: var(--c-muted);
}

.delivery-estimate__line strong {
	color: var(--c-text);
	font-weight: 600;
}

.delivery-estimate__cutoff {
	margin-top: 2px;
	color: var(--c-success);
	font-size: var(--fs-caption);
	font-weight: 600;
}

.trust-badges {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--sp-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.trust-badges__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: var(--sp-3) var(--sp-2);
	border: 1px solid var(--c-line);
	border-radius: var(--r-sm);
	font-size: var(--fs-caption);
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
}

.trust-badges__icon {
	color: var(--c-text);
}

/* ---------- Accordion (product details) ---------- */

.product-accordion {
	border-top: 1px solid var(--c-line);
}

.product-accordion__item {
	border-bottom: 1px solid var(--c-line);
}

.product-accordion__title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 52px;
	font-size: 15px;
	font-weight: 700;
	list-style: none;
	cursor: pointer;
}

.product-accordion__title::-webkit-details-marker {
	display: none;
}

.product-accordion__icon {
	font-size: 20px;
	font-weight: 400;
	transition: transform var(--dur-lift);
}

.product-accordion__item[open] .product-accordion__icon {
	transform: rotate(45deg);
}

.product-accordion__panel {
	padding-bottom: var(--sp-4);
	color: var(--c-muted);
	font-size: var(--fs-small);
}

.product-accordion__panel > :first-child {
	margin-top: 0;
}

.product-accordion__panel p {
	margin: 0 0 var(--sp-3);
}

.woocommerce-product-attributes {
	width: 100%;
	border-collapse: collapse;
}

.woocommerce-product-attributes th,
.woocommerce-product-attributes td {
	padding: var(--sp-2) 0;
	border-bottom: 1px solid var(--c-line);
	text-align: left;
	vertical-align: top;
}

.woocommerce-product-attributes th {
	width: 40%;
	color: var(--c-text);
	font-weight: 600;
}

.woocommerce-product-attributes td p {
	margin: 0;
}

/* ---------- Ratings (replaces WooCommerce's star font) ---------- */

.star-rating {
	position: relative;
	display: inline-block;
	width: 5.6em;
	height: 1.2em;
	overflow: hidden;
	font-size: var(--fs-small);
	line-height: 1.2;
	letter-spacing: 1px;
}

.star-rating::before {
	content: "★★★★★";
	position: absolute;
	inset: 0;
	color: var(--c-star-off);
}

.star-rating span {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	padding-top: 1.5em;
	overflow: hidden;
}

.star-rating span::before {
	content: "★★★★★";
	position: absolute;
	top: 0;
	left: 0;
	color: var(--c-star);
}

p.stars {
	display: flex;
	gap: 2px;
	margin: 0;
}

p.stars span {
	display: inline-flex;
	gap: 2px;
}

p.stars a {
	position: relative;
	display: inline-block;
	width: 1.4em;
	height: 1.4em;
	overflow: hidden;
	font-size: 22px;
	color: transparent;
	text-indent: 999px;
	text-decoration: none;
	white-space: nowrap;
}

p.stars a::before {
	content: "★";
	position: absolute;
	inset: 0;
	color: var(--c-star-off);
	text-indent: 0;
	line-height: 1.4;
	text-align: center;
}

/* Light up to the hovered star, or (when not hovering) up to the selected one. */
p.stars a:hover::before,
p.stars a:has(~ a:hover)::before,
p.stars.selected:not(:hover) a.active::before,
p.stars.selected:not(:hover) a:has(~ a.active)::before {
	color: var(--c-star);
}

/* Reviews list + form */

#reviews .woocommerce-Reviews-title {
	margin-bottom: var(--sp-3);
	color: var(--c-text);
	font-size: var(--fs-body);
}

#reviews .commentlist {
	margin: 0 0 var(--sp-5);
	padding: 0;
	list-style: none;
}

#reviews .commentlist li {
	padding: var(--sp-3) 0;
	border-bottom: 1px solid var(--c-line);
}

#reviews .commentlist .avatar {
	display: none;
}

#reviews .meta {
	margin: 4px 0;
	font-size: 13px;
}

#reviews .woocommerce-review__author {
	color: var(--c-text);
}

#reviews .woocommerce-review__verified {
	color: var(--c-success);
	font-style: normal;
}

#reviews .description p {
	margin: 0;
	color: var(--c-text);
}

#review_form .comment-reply-title {
	display: block;
	margin-bottom: var(--sp-3);
	color: var(--c-text);
	font-family: var(--fd);
	font-weight: 700;
}

#review_form .comment-form {
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
}

#review_form .comment-form p {
	margin: 0;
}

#review_form label {
	display: block;
	margin-bottom: 6px;
	color: var(--c-text);
	font-weight: 600;
}

#review_form .submit {
	height: var(--btn-h-md);
	padding: 0 var(--sp-6);
	border: 0;
	border-radius: var(--r-pill);
	background: var(--c-text);
	color: var(--c-on-ink);
	font-weight: 700;
	cursor: pointer;
}

.product_meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: var(--c-muted);
	font-size: 13px;
}

.product_meta a {
	color: var(--c-muted);
}

/* ---------- Sections below the product ---------- */

.product-section__title,
.up-sells > h2,
.related > h2 {
	margin-bottom: var(--sp-6);
	font-size: var(--fs-h3);
	letter-spacing: -0.02em;
}

.fbt,
.up-sells,
.related,
.recently-viewed {
	padding-top: var(--sp-9);
}

.recently-viewed[hidden] {
	display: none;
}

/* Frequently bought together */

.fbt__card {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--sp-5);
	padding: var(--sp-5);
	border: 1px solid var(--c-line);
	border-radius: var(--r-lg);
}

.fbt__images {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
}

.fbt__thumb {
	flex: none;
	width: 88px;
	height: 88px;
	overflow: hidden;
	border-radius: var(--r-sm);
	background: repeating-linear-gradient(135deg, var(--c-ph-1) 0 10px, var(--c-ph-2) 10px 20px);
}

.fbt__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fbt__plus {
	color: var(--c-muted);
	font-size: 20px;
	font-weight: 700;
}

.fbt__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.fbt__item {
	font-size: var(--fs-small);
}

.fbt__price {
	font-family: var(--fd);
	font-weight: 700;
	white-space: nowrap;
}

.fbt__buy {
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
}

.fbt__total strong {
	font-family: var(--fd);
	font-size: 22px;
}

@media (min-width: 900px) {
	.fbt__card {
		grid-template-columns: auto minmax(0, 1fr) 240px;
		align-items: center;
		gap: var(--sp-7);
	}

	.fbt__images {
		flex-wrap: wrap;
		max-width: 320px;
	}
}

/* ---------- Mobile sticky add-to-cart ---------- */

.sticky-atc {
	display: none;
}

@media (max-width: 899px) {
	.sticky-atc {
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: calc(var(--z-fab) - 1);
		display: flex;
		align-items: center;
		gap: var(--sp-3);
		padding: 10px var(--sp-4) calc(10px + env(safe-area-inset-bottom));
		border-top: 1px solid var(--c-line);
		background: var(--c-surface);
		box-shadow: 0 -12px 24px -16px rgba(14, 14, 14, .25);
		transform: translateY(110%);
		transition: transform var(--dur-lift) var(--ease);
	}

	.sticky-atc.is-visible {
		transform: none;
	}

	.has-sticky-atc .whatsapp-fab {
		visibility: hidden;
		opacity: 0;
	}

	.has-sticky-atc .toast {
		bottom: 96px;
	}
}

.sticky-atc__thumb {
	flex: none;
	width: 44px;
	height: 44px;
	overflow: hidden;
	border-radius: 10px;
	background: var(--c-surface-2);
}

.sticky-atc__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sticky-atc__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.sticky-atc__name {
	overflow: hidden;
	font-size: 13px;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sticky-atc__price {
	font-family: var(--fd);
	font-size: 15px;
	font-weight: 700;
}

.sticky-atc__price del {
	color: var(--c-muted);
	font-size: 12px;
	font-weight: 500;
}

.sticky-atc__price ins {
	text-decoration: none;
}

/* ---------- Tablet (700–899px): two columns so the gallery isn't a full-width square ---------- */

@media (min-width: 700px) and (max-width: 899px) {
	.single-product div.product {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: var(--sp-7);
	}
}
