/**
 * Breatheazy Product Page Enhanced Styles
 *
 * Additional product page styles for issue #8:
 *   - Gallery enhancements
 *   - Mobile-first layout (Image > Price > CTA > Details)
 *   - Touch-friendly buttons (44px minimum)
 *   - Sticky mobile Add to Cart bar
 *   - Social proof / testimonials section
 *   - Section headings
 *
 * Works alongside product-page.css (issue #7) without overriding it.
 * Uses CSS custom properties (--breatheazy-*) with hardcoded fallback values.
 * The :root definitions for these properties should be added in the child
 * theme's style.css (tracked in issue #5 / PR #31). Until then, the fallback
 * values ensure correct rendering.
 *
 * @package Breatheazy_Child
 * @since   1.0.0
 */

/* =============================================================================
   Section Headings
   ============================================================================= */

.breatheazy-section-heading {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--breatheazy-text, #1E293B);
	text-align: center;
	margin-bottom: 32px;
	position: relative;
	padding-bottom: 12px;
}

.breatheazy-section-heading::after {
	content: "";
	display: block;
	width: 60px;
	height: 3px;
	background-color: var(--breatheazy-primary, #0D9488);
	margin: 12px auto 0;
	border-radius: 2px;
}

/* =============================================================================
   Gallery Enhancements
   ============================================================================= */

.breatheazy-product-page .woocommerce-product-gallery {
	margin-bottom: 24px;
}

.breatheazy-product-page .woocommerce-product-gallery__image img {
	border-radius: 8px;
}

.breatheazy-product-page .flex-control-thumbs {
	display: flex;
	gap: 8px;
	margin-top: 12px;
	padding: 0;
	list-style: none;
}

.breatheazy-product-page .flex-control-thumbs li {
	flex: 0 0 auto;
}

.breatheazy-product-page .flex-control-thumbs li img {
	border-radius: 6px;
	border: 2px solid transparent;
	transition: border-color 0.2s ease;
	cursor: pointer;
}

.breatheazy-product-page .flex-control-thumbs li img:hover,
.breatheazy-product-page .flex-control-thumbs li img.flex-active {
	border-color: var(--breatheazy-primary, #0D9488);
}

/* =============================================================================
   Touch-Friendly Buttons — 48px Tap Target (exceeds 44px WCAG minimum)
   ============================================================================= */

.breatheazy-product-page .single_add_to_cart_button,
.breatheazy-product-page .breatheazy-buy-now-btn {
	min-height: 48px;
	min-width: 48px;
	padding: 12px 24px;
	font-size: 1rem;
	font-weight: 600;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.1s ease;
	-webkit-tap-highlight-color: transparent;
}

.breatheazy-product-page .single_add_to_cart_button:active,
.breatheazy-product-page .breatheazy-buy-now-btn:active {
	transform: scale(0.98);
}

.breatheazy-product-page .single_add_to_cart_button:not(.breatheazy-buy-now-btn) {
	background-color: var(--breatheazy-primary, #0D9488);
	color: #fff;
}

.breatheazy-product-page .single_add_to_cart_button:not(.breatheazy-buy-now-btn):hover {
	background-color: var(--breatheazy-primary-dark, #0B7C72);
}

/* Quantity input */
.breatheazy-product-page .quantity .qty {
	min-height: 48px;
	min-width: 48px;
	text-align: center;
	font-size: 1rem;
	border-radius: 8px;
	border: 1px solid var(--breatheazy-border, #E2E8F0);
}

/* =============================================================================
   Product Summary — Enhanced Layout
   ============================================================================= */

.breatheazy-product-page .product .summary {
	display: flex;
	flex-direction: column;
}

.breatheazy-product-page .product .summary .price {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--breatheazy-text, #1E293B);
	margin-bottom: 8px;
}

.breatheazy-product-page .product .summary .woocommerce-product-details__short-description {
	margin-bottom: 16px;
	line-height: 1.6;
	color: var(--breatheazy-text-muted, #64748B);
}

/* SKU display */
.breatheazy-product-page .product_meta {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--breatheazy-border, #E2E8F0);
	font-size: 0.85rem;
	color: var(--breatheazy-text-muted, #64748B);
}

/* =============================================================================
   Product Tabs — Enhanced Styling
   ============================================================================= */

.breatheazy-product-page .woocommerce-tabs {
	margin-top: 40px;
}

.breatheazy-product-page .woocommerce-tabs ul.tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	padding: 0;
	margin: 0 0 24px;
	list-style: none;
	border-bottom: 2px solid var(--breatheazy-border, #E2E8F0);
}

.breatheazy-product-page .woocommerce-tabs ul.tabs li {
	margin: 0;
	padding: 0;
}

.breatheazy-product-page .woocommerce-tabs ul.tabs li a {
	display: block;
	padding: 12px 20px;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--breatheazy-text-muted, #64748B);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	transition: color 0.2s ease, border-color 0.2s ease;
	min-height: 44px;
}

.breatheazy-product-page .woocommerce-tabs ul.tabs li a:hover {
	color: var(--breatheazy-primary, #0D9488);
}

.breatheazy-product-page .woocommerce-tabs ul.tabs li.active a {
	color: var(--breatheazy-primary, #0D9488);
	border-bottom-color: var(--breatheazy-primary, #0D9488);
}

/* =============================================================================
   Social Proof / Testimonials Section
   ============================================================================= */

.breatheazy-social-proof {
	max-width: 1200px;
	margin: 48px auto;
	padding: 48px 20px;
	background-color: var(--breatheazy-surface, #F8FAFC);
	border-radius: 12px;
}

.breatheazy-social-proof-placeholder {
	text-align: center;
	font-size: 1rem;
	color: var(--breatheazy-text-muted, #64748B);
	padding: 32px 16px;
	border: 2px dashed var(--breatheazy-border, #E2E8F0);
	border-radius: 8px;
	max-width: 500px;
	margin: 0 auto;
}

.breatheazy-testimonials-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}

.breatheazy-testimonial {
	background: #fff;
	padding: 24px;
	border-radius: 12px;
	border: 1px solid var(--breatheazy-border, #E2E8F0);
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.breatheazy-testimonial-stars {
	display: flex;
	gap: 2px;
}

.breatheazy-star {
	font-size: 1.1rem;
	color: var(--breatheazy-border, #E2E8F0);
}

.breatheazy-star--filled {
	color: #F59E0B;
}

.breatheazy-testimonial-text {
	font-size: 0.95rem;
	line-height: 1.6;
	color: var(--breatheazy-text, #1E293B);
	margin: 0;
	flex-grow: 1;
}

.breatheazy-testimonial-author {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.breatheazy-testimonial-author cite {
	font-style: normal;
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--breatheazy-text, #1E293B);
}

.breatheazy-testimonial-location {
	font-size: 0.8rem;
	color: var(--breatheazy-text-muted, #64748B);
}

/* =============================================================================
   Sticky Mobile Add to Cart Bar
   ============================================================================= */

.breatheazy-sticky-cart-bar {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 999;
	background: #fff;
	border-top: 1px solid var(--breatheazy-border, #E2E8F0);
	box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
	transform: translateY(100%);
	transition: transform 0.3s ease;
	display: none;
}

.breatheazy-sticky-cart-bar.is-visible {
	transform: translateY(0);
}

.breatheazy-sticky-cart-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 16px;
	max-width: 1200px;
	margin: 0 auto;
	gap: 12px;
}

.breatheazy-sticky-cart-price {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--breatheazy-text, #1E293B);
	white-space: nowrap;
	flex-shrink: 0;
}

.breatheazy-sticky-cart-price del {
	font-size: 0.8rem;
	color: var(--breatheazy-text-muted, #64748B);
	font-weight: 400;
}

.breatheazy-sticky-cart-actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}

.breatheazy-sticky-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 16px;
	font-size: 0.85rem;
	font-weight: 600;
	border-radius: 8px;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.breatheazy-sticky-btn--cart {
	background-color: var(--breatheazy-primary, #0D9488);
	color: #fff;
}

.breatheazy-sticky-btn--cart:hover {
	background-color: var(--breatheazy-primary-dark, #0B7C72);
	color: #fff;
}

.breatheazy-sticky-btn--buy {
	background-color: var(--breatheazy-accent, #F97316);
	color: #fff;
}

.breatheazy-sticky-btn--buy:hover {
	background-color: var(--breatheazy-accent-dark, #EA580C);
	color: #fff;
}

/* =============================================================================
   Image Lazy Loading — WordPress native support enhancement
   ============================================================================= */

.breatheazy-product-page img[loading="lazy"] {
	opacity: 0;
	transition: opacity 0.3s ease;
}

.breatheazy-product-page img[loading="lazy"].loaded {
	opacity: 1;
}

/* Ensure gallery images don't get lazy load fade (they're above the fold) */
.breatheazy-product-page .woocommerce-product-gallery img {
	opacity: 1;
}

/* =============================================================================
   Responsive — Mobile First
   ============================================================================= */

/* Show sticky bar on mobile/tablet only */
@media (max-width: 768px) {
	.breatheazy-sticky-cart-bar {
		display: block;
	}

	/* Ensure body has padding for sticky bar */
	.breatheazy-product-page {
		padding-bottom: 72px;
	}

	/* Testimonials stack on mobile */
	.breatheazy-testimonials-grid {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.breatheazy-testimonial {
		padding: 20px;
	}

	/* Tabs scroll horizontally on mobile */
	.breatheazy-product-page .woocommerce-tabs ul.tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.breatheazy-product-page .woocommerce-tabs ul.tabs::-webkit-scrollbar {
		display: none;
	}

	.breatheazy-product-page .woocommerce-tabs ul.tabs li a {
		padding: 10px 14px;
		font-size: 0.8rem;
		white-space: nowrap;
	}

	/* Full-width buttons on mobile */
	.breatheazy-product-page .cart {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
	}

	.breatheazy-product-page .single_add_to_cart_button,
	.breatheazy-product-page .breatheazy-buy-now-btn {
		flex: 1 1 100%;
		text-align: center;
		justify-content: center;
	}

	/* Gallery takes full width on mobile — !important overrides Storefront's inline widths */
	.breatheazy-product-page .woocommerce-product-gallery {
		width: 100% !important;
		float: none !important;
	}

	/* Summary takes full width on mobile — !important overrides Storefront's inline widths */
	.breatheazy-product-page .product .summary {
		width: 100% !important;
		float: none !important;
	}

	/* Social proof section mobile spacing */
	.breatheazy-social-proof {
		margin: 32px 0;
		padding: 32px 16px;
		border-radius: 0;
	}

	.breatheazy-section-heading {
		font-size: 1.25rem;
	}
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
	.breatheazy-testimonials-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* Desktop — force-hide sticky bar so JS cannot accidentally show it */
@media (min-width: 769px) {
	.breatheazy-sticky-cart-bar {
		display: none !important;
	}
}

/* Safe area inset for devices with notch/home bar */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
	.breatheazy-sticky-cart-bar {
		padding-bottom: env(safe-area-inset-bottom);
	}

	@media (max-width: 768px) {
		.breatheazy-product-page {
			padding-bottom: calc(72px + env(safe-area-inset-bottom));
		}
	}
}
