/* ================================================================
 * Gem Product Detail Page – Custom Styles
 * Tailwind utilities come from zetu-commerce or CDN.
 * This file handles: button animations, WC overrides, modal, sections.
 * ================================================================ */

/* ── HIDE DUPLICATES ──
 * Hide default theme titles, banners, and headers to prevent repetition.
 * Our custom elements use .gem-pdp-title and .gem-pdp-actions-container.
 * ────────────────────────────────────────────────────────────────── */

/* Hide Astra elements that cause duplication */
.single-product .ast-single-post-banner,
.single-product .entry-header,
.single-product .ast-archive-description,
.single-product header.entry-header,
.single-product .ast-woo-single-product-header,
.single-product .ast-container header,
.single-product .entry-title:not(.gem-pdp-title),
.single-product .ast-product-title,
.single-product .woocommerce-products-header__title,
.single-product .ast-single-product-title,
.single-product .ast-single-post-banner-title,
.single-product .ast-banner-elements-wrap,
.single-product .ast-header-without-markup {
	display: none !important;
}

.gem-pdp-title {
	display: block !important;
	visibility: visible !important;
}

/* Ensure only one set of buttons/form appears in the summary area */
.single-product .summary .cart:not(:first-of-type) {
	display: none !important;
}

/* Ensure our action container only shows once */
.single-product .summary .gem-pdp-actions-container ~ .gem-pdp-actions-container {
	display: none !important;
}

/* ── BUTTONS ──────────────────────────────────────────────────────
 * Matches zetu-commerce .zc-swipe-button design language:
 * Sharp corners, uppercase, Manrope, letter-spacing, swipe hover.
 * ────────────────────────────────────────────────────────────────── */

.gem-pdp-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	overflow: hidden;
	z-index: 1;
	padding: 14px 28px;
	font-family: 'Manrope', sans-serif;
	font-weight: 700;
	font-size: 0.8125rem;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	text-decoration: none;
	cursor: pointer;
	border: none;
	border-radius: 0;
	line-height: 1.2;
	transition: color 0.4s ease, border-color 0.4s ease;
	white-space: nowrap;
}

.gem-pdp-btn__text,
.gem-pdp-btn__icon {
	position: relative;
	z-index: 2;
	display: inline-flex;
	align-items: center;
}

.gem-pdp-btn__icon svg {
	transition: transform 0.3s ease;
}

.gem-pdp-btn:hover .gem-pdp-btn__icon svg {
	transform: translateX(4px);
}

/* ── Primary: filled dark with gold swipe ── */
.gem-pdp-btn--primary {
	background-color: #003229;
	color: #ffffff;
}

.gem-pdp-btn--primary::before {
	content: '';
	position: absolute;
	inset: 0;
	background-color: #f8be5c;
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	z-index: -1;
}

.gem-pdp-btn--primary:hover::before {
	transform: scaleX(1);
}

.gem-pdp-btn--primary:hover {
	color: #000000;
}

.gem-pdp-btn--primary:active {
	transform: scale(0.97);
}

/* ── Outline: transparent with border ── */
.gem-pdp-btn--outline {
	background-color: transparent;
	color: #003229;
	border: 2px solid #003229;
}

.gem-pdp-btn--outline::before {
	content: '';
	position: absolute;
	inset: 0;
	background-color: #003229;
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	z-index: -1;
}

.gem-pdp-btn--outline:hover::before {
	transform: scaleX(1);
}

.gem-pdp-btn--outline:hover {
	color: #ffffff;
	border-color: #003229;
}

.gem-pdp-btn--outline:active {
	transform: scale(0.97);
}

/* ── Ghost: light border for tertiary actions ── */
.gem-pdp-btn--ghost {
	background-color: transparent;
	color: #404945;
	border: 1px solid #d1d5db;
}

.gem-pdp-btn--ghost::before {
	content: '';
	position: absolute;
	inset: 0;
	background-color: #f3f4f6;
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	z-index: -1;
}

.gem-pdp-btn--ghost:hover::before {
	transform: scaleX(1);
}

.gem-pdp-btn--ghost:hover {
	color: #003229;
	border-color: #003229;
}

/* ── Override WooCommerce's "Add to cart" button → outline style ── */
.single_add_to_cart_button.button.alt {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	overflow: hidden;
	z-index: 1;
	padding: 14px 28px !important;
	font-family: 'Manrope', sans-serif !important;
	font-weight: 700 !important;
	font-size: 0.8125rem !important;
	text-transform: uppercase !important;
	letter-spacing: 0.15em !important;
	border-radius: 0 !important;
	line-height: 1.2 !important;
	background-color: transparent !important;
	color: #003229 !important;
	border: 2px solid #003229 !important;
	cursor: pointer;
	transition: color 0.4s ease !important;
	white-space: nowrap;
}

.single_add_to_cart_button.button.alt::before {
	content: '';
	position: absolute;
	inset: 0;
	background-color: #003229;
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	z-index: -1;
}

.single_add_to_cart_button.button.alt:hover::before {
	transform: scaleX(1);
}

.single_add_to_cart_button.button.alt:hover {
	color: #ffffff !important;
}

.single_add_to_cart_button.button.alt:active {
	transform: scale(0.97);
}

/* ── WC form layout: flex wrap for buttons ── */
.woocommerce div.product form.cart {
	display: flex !important;
	flex-wrap: wrap !important;
	align-items: center !important;
	gap: 16px !important; /* Spacing between standard Add to Cart and others */
	margin-bottom: 2rem !important;
}

/* Force standard Add to Cart to not grow or have huge margins */
.woocommerce div.product form.cart .single_add_to_cart_button {
	margin: 0 !important;
	flex: 0 0 auto !important;
}

.gem-pdp-actions-container {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important; /* Keep Buy Now and Inquire together */
	gap: 16px !important; /* Spacing between Buy Now and Inquire */
	width: auto !important;
	margin: 0 !important;
	flex: 0 0 auto !important;
}

.woocommerce div.product form.cart .quantity {
	margin-right: 0;
}

.woocommerce div.product form.cart .quantity input.qty {
	width: 80px;
	text-align: center;
	font-family: 'Manrope', sans-serif;
	font-size: 0.95rem;
	padding: 12px 10px;
	border: 1px solid #d1d5db;
	border-radius: 0;
}

/* ── Contact pills ── */
.gem-pdp-contact-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border: 1px solid #d1d5db;
	text-decoration: none;
	color: #404945;
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	transition: all 0.3s ease;
	border-radius: 0;
}

.gem-pdp-contact-pill:hover {
	background-color: #003229;
	color: #ffffff;
	border-color: #003229;
}

/* ── Section blocks (below image) ── */
.gem-pdp-section {
	margin-bottom: 2rem;
	padding: 2rem 0;
	border-bottom: 1px solid #f3f4f6;
}

.gem-pdp-section:last-of-type {
	border-bottom: none;
}

.gem-pdp-section__title {
	font-family: 'Space Grotesk', sans-serif;
	font-size: 1.5rem;
	font-weight: 700;
	color: #003229;
	letter-spacing: -0.02em;
	margin: 0 0 1rem;
}

.gem-pdp-section__body {
	font-family: 'Manrope', sans-serif;
	font-size: 0.9375rem;
	line-height: 1.7;
	color: #404945;
}

.gem-pdp-section__body p {
	margin: 0 0 0.75rem;
}

.gem-pdp-section__body p:last-child {
	margin-bottom: 0;
}

/* ================================================================
 * INQUIRY MODAL
 * ================================================================ */
.gem-pdp-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999999;
}

.gem-pdp-modal[aria-hidden="false"],
.gem-pdp-modal.is-open {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 40px 16px;
	overflow-y: auto;
}

.gem-pdp-modal__overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 50, 41, 0.5);
	backdrop-filter: blur(4px);
	z-index: 1;
}

.gem-pdp-modal__dialog {
	position: relative;
	z-index: 2;
	background: #ffffff;
	max-width: 520px;
	width: 100%;
	padding: 32px 28px;
	box-shadow: 0 20px 60px rgba(0, 50, 41, 0.15);
	border-radius: 0;
}

.gem-pdp-modal__close {
	position: absolute;
	top: 16px;
	right: 16px;
	background: transparent;
	border: 0;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #707975;
	transition: color 0.2s;
}

.gem-pdp-modal__close:hover {
	color: #003229;
}

.gem-pdp-modal__field {
	margin-bottom: 14px;
}

.gem-pdp-modal__field label {
	display: block;
	font-family: 'Manrope', sans-serif;
	font-weight: 600;
	font-size: 0.8125rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #404945;
	margin-bottom: 4px;
}

.gem-pdp-modal__field input[type="text"],
.gem-pdp-modal__field input[type="email"],
.gem-pdp-modal__field input[type="number"],
.gem-pdp-modal__field textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #d1d5db;
	border-radius: 0;
	font-family: 'Manrope', sans-serif;
	font-size: 0.9375rem;
	color: #1a1a1a;
	box-sizing: border-box;
	transition: border-color 0.2s;
}

.gem-pdp-modal__field input:focus,
.gem-pdp-modal__field textarea:focus {
	outline: none;
	border-color: #003229;
}

.gem-pdp-modal__field--cb {
	margin-bottom: 10px;
}

.gem-pdp-modal__field--cb label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: 'Manrope', sans-serif;
	font-weight: 500;
	font-size: 0.875rem;
	color: #404945;
	cursor: pointer;
	text-transform: none;
	letter-spacing: normal;
}

/* ── Inquiry result message ── */
#gem-inquiry-result.success { color: #1a7e3c; }
#gem-inquiry-result.error   { color: #c0392b; }

/* ── Astra Sticky Add to Cart Fixes ── */
.ast-sticky-add-to-cart {
	z-index: 9999 !important;
	background: #ffffff !important;
	box-shadow: 0 -10px 30px rgba(0, 50, 41, 0.1) !important;
	padding: 0 !important;
	height: 54px !important;
	display: flex !important;
	align-items: center !important;
}

.ast-sticky-add-to-cart .ast-container {
	max-width: 1200px !important;
	padding: 0 15px !important;
	height: 100% !important;
}

/* Force horizontal layout for Astra's sticky content */
.ast-sticky-add-to-cart-content {
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	justify-content: flex-end !important; /* Push everything to the right */
	gap: 12px !important;
	height: 100% !important;
	width: 100% !important;
}

/* Keep thumbnail + price visible in sticky bar (requested), hide only the title text */
.ast-sticky-add-to-cart-title {
	display: none !important;
}

.ast-sticky-add-to-cart-title-wrap img,
.ast-sticky-add-to-cart-action-price {
	display: inline-block !important;
}

.ast-sticky-add-to-cart-title-wrap img {
	width: 34px !important;
	height: 34px !important;
	object-fit: cover !important;
}

.ast-sticky-add-to-cart-action-price {
	white-space: nowrap !important;
}

/* Sticky Action Wrap (Form only) */
.ast-sticky-add-to-cart-action-wrap {
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	gap: 12px !important;
	flex: 1 !important;
	justify-content: flex-end !important;
}

/* Force horizontal layout for the form in sticky bar */
.ast-sticky-add-to-cart form.cart {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	align-items: center !important;
	gap: 12px !important; /* Space between standard button and our container */
	margin: 0 !important;
	padding: 0 !important;
	width: auto !important;
}

/* Hide quantity in sticky bar completely */
.ast-sticky-add-to-cart .quantity,
.ast-sticky-add-to-cart label[for^="quantity"] {
	display: none !important;
}

.ast-sticky-add-to-cart .gem-pdp-actions-container {
	width: auto !important;
	margin: 0 !important;
	display: inline-flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	gap: 12px !important; /* Space between Buy Now and Inquire buttons */
}

/* Ultra Tiny buttons for the sticky bar */
.ast-sticky-add-to-cart .gem-pdp-btn,
.ast-sticky-add-to-cart .single_add_to_cart_button.button.alt,
.ast-sticky-add-to-cart .single_link_to_cart_button {
	padding: 0 14px !important;
	font-size: 0.65rem !important;
	height: 34px !important;
	min-height: 34px !important;
	line-height: 34px !important;
	letter-spacing: 0.05em !important;
	width: auto !important;
	flex: 0 0 auto !important;
	border-radius: 0 !important;
	white-space: nowrap !important;
	margin: 0 !important;
	border: 2px solid #003229 !important;
	background-color: transparent !important;
	color: #003229 !important;
}

/* Sticky: make Add to Cart hover state readable (no swipe overlay in sticky) */
.ast-sticky-add-to-cart .single_add_to_cart_button.button.alt::before {
	display: none !important;
}

.ast-sticky-add-to-cart .single_add_to_cart_button.button.alt:hover {
	background-color: #003229 !important;
	color: #ffffff !important;
}

/* Specific styling for primary button in sticky bar to keep it filled */
.ast-sticky-add-to-cart .gem-pdp-btn--primary {
	background-color: #003229 !important;
	color: #ffffff !important;
	border: none !important;
}

.ast-sticky-add-to-cart .gem-pdp-btn__icon {
	display: none !important; /* Hide icons in sticky bar to save width */
}

/* ── Responsive ── */
@media (max-width: 768px) {
	.ast-sticky-add-to-cart-content {
		flex-direction: column !important;
		gap: 10px !important;
		text-align: center !important;
	}
	
	.ast-sticky-add-to-cart-title-wrap {
		display: none !important; /* Hide title on mobile sticky to save space */
	}

	.ast-sticky-add-to-cart .gem-pdp-actions-container {
		flex-direction: row !important;
		width: auto !important;
	}
}

@media (max-width: 640px) {
	.woocommerce div.product form.cart {
		flex-direction: column;
		align-items: stretch;
	}

	.gem-pdp-actions-container {
		flex-direction: column;
	}

	.woocommerce div.product form.cart .quantity {
		width: 100%;
	}

	.woocommerce div.product form.cart .quantity input.qty {
		width: 100%;
	}

	.gem-pdp-btn {
		width: 100%;
		justify-content: center;
	}

	.single_add_to_cart_button.button.alt {
		width: 100%;
		justify-content: center;
	}

	.gem-pdp-modal__dialog {
		padding: 24px 16px;
		margin-top: 20px;
	}

	/* Keep sticky buttons horizontal and smaller on mobile if needed, or stack them */
	.ast-sticky-add-to-cart .gem-pdp-actions-container {
		flex-direction: row;
		width: auto;
	}
}
