/* ==========================================================================
   AN PHAT WINDOOR GUTENBERG - WOOCOMMERCE STYLES (Stage 1 & Global)
   Palette locked: #0e51d1, #0a3d91, #082f70, #1e73be, #ffffff, #ebf2f5, #0a0a0a, #4b5563, #e5e7eb
   ========================================================================== */

/* Price ("Liên hệ" & normal) */
.apw-price-contact,
.wc-block-components-product-price .apw-price-contact {
	color: #0e51d1;
	font-weight: 700;
	font-size: 0.9375rem;
}

/* Breadcrumbs */
.wc-block-breadcrumbs,
.woocommerce-breadcrumb {
	font-size: 0.875rem;
	color: #4b5563;
	margin-bottom: 0.75rem;
	line-height: 1.5;
	word-break: break-word;
}

.wc-block-breadcrumbs a,
.woocommerce-breadcrumb a {
	color: #1e73be;
}

/* Archive / Category Header & Toolbar */
.apw-archive-main .wp-block-query-title {
	margin-top: 0.25rem;
	margin-bottom: 0.5rem;
	color: #0a3d91;
}

.apw-archive-main .wp-block-term-description {
	color: #4b5563;
	margin-bottom: 1.25rem;
	max-width: 78ch;
}

.apw-archive-main .wp-block-term-description p {
	margin-top: 0;
}

.apw-archive-toolbar {
	gap: 0.75rem;
	margin-bottom: 1.25rem;
	align-items: center;
}

.apw-archive-toolbar .wc-block-product-results-count,
.apw-archive-toolbar .woocommerce-result-count {
	margin: 0;
	font-size: 0.9375rem;
	color: #4b5563;
}

.apw-archive-toolbar .woocommerce-ordering select {
	min-height: 48px;
	padding: 0.5rem 0.875rem;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	background-color: #ffffff;
	color: #0a0a0a;
	font-family: inherit;
	font-size: 0.9375rem;
	max-width: 100%;
}

/* Horizontal Scrollable Category Filter Pills */
.apw-cat-pills-wrap {
	margin-top: 0.5rem;
	margin-bottom: 1.25rem;
	max-width: 100%;
}

.apw-cat-pills-track {
	display: flex !important;
	flex-wrap: nowrap !important;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
	gap: 0.5rem !important;
	padding-bottom: 0.5rem;
	scrollbar-width: thin;
	scrollbar-color: #0e51d1 #ebf2f5;
}

@media (min-width: 960px) {
	.apw-cat-pills-track {
		flex-wrap: wrap !important;
		overflow-x: visible;
		padding-bottom: 0;
	}
}

.apw-cat-pill {
	flex: 0 0 auto;
	scroll-snap-align: start;
}

.apw-cat-pill .wp-block-button__link {
	min-height: 48px;
	padding: 0.625rem 1.125rem;
	border-radius: 99px !important;
	border: 1.5px solid #e5e7eb !important;
	background-color: #ffffff !important;
	color: #0a0a0a !important;
	font-size: 0.875rem;
	font-weight: 500;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.apw-cat-pill .wp-block-button__link:hover {
	border-color: #0e51d1 !important;
	background-color: #ebf2f5 !important;
	color: #0e51d1 !important;
}

.apw-cat-pill.is-active .wp-block-button__link {
	background-color: #0e51d1 !important;
	border-color: #0e51d1 !important;
	color: #ffffff !important;
	font-weight: 700;
}

/* Archive & Category Product Grid: 2-col Mobile / 3-col Tablet / 4-col Desktop */
.apw-archive-main .wp-block-woocommerce-product-collection ul.wc-block-product-template {
	display: grid !important;
	grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	gap: 0.75rem !important;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 600px) {
	.apw-archive-main .wp-block-woocommerce-product-collection ul.wc-block-product-template {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		gap: 1rem !important;
	}
}

@media (min-width: 960px) {
	.apw-archive-main .wp-block-woocommerce-product-collection ul.wc-block-product-template {
		grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
		gap: 1.25rem !important;
	}
}

/* Shared Product Card Styling (Archive + Related + Homepage) */
.wp-block-woocommerce-product-collection ul.wc-block-product-template > li.wc-block-product {
	min-width: 0;
	width: 100% !important;
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 0.75rem;
	transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

@media (min-width: 782px) {
	.wp-block-woocommerce-product-collection ul.wc-block-product-template > li.wc-block-product {
		padding: 0.875rem;
	}
}

.wp-block-woocommerce-product-collection ul.wc-block-product-template > li.wc-block-product:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 24px rgba(10, 61, 145, 0.1);
	border-color: #0e51d1;
}

/* Preserved Original Product Image Aspect Ratios (No cropping / No distortion) */
.wc-block-product .wc-block-components-product-image {
	margin-bottom: 0.75rem;
	background-color: #ebf2f5;
	border-radius: 8px;
	overflow: hidden;
}

.wc-block-product .wc-block-components-product-image a {
	display: block;
}

.wc-block-product .wc-block-components-product-image img {
	border-radius: 8px;
	width: 100% !important;
	height: auto !important;
	object-fit: contain;
	display: block;
}

.wc-block-product .wp-block-post-title {
	margin: 0 0 0.4rem;
}

.wc-block-product .wp-block-post-title a {
	color: #0a0a0a;
	font-weight: 700;
	font-size: 0.9375rem;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

@media (min-width: 782px) {
	.wc-block-product .wp-block-post-title a {
		font-size: 1rem;
	}
}

.wc-block-product .wp-block-post-title a:hover {
	color: #0e51d1;
}

.wc-block-product .wc-block-components-product-price {
	margin-top: auto;
	margin-bottom: 0.5rem;
}

.wc-block-product .wc-block-components-product-button {
	margin-top: 0.25rem;
}

.wc-block-product .wc-block-components-product-button .wp-block-button__link {
	width: 100%;
	min-height: 48px;
	padding: 0.625rem 0.75rem;
	border-radius: 6px;
	background-color: #0e51d1;
	color: #ffffff;
	font-size: 0.875rem;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.wc-block-product .wc-block-components-product-button .wp-block-button__link:hover {
	background-color: #0a3d91;
	color: #ffffff;
}

/* Pagination */
.apw-archive-main .wp-block-query-pagination {
	margin-top: 2rem;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.apw-archive-main .wp-block-query-pagination a,
.apw-archive-main .wp-block-query-pagination span.page-numbers {
	min-width: 48px;
	min-height: 48px;
	padding: 0 0.875rem;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	background: #ffffff;
	color: #0a0a0a;
	font-weight: 500;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.apw-archive-main .wp-block-query-pagination a:hover {
	border-color: #0e51d1;
	color: #0e51d1;
	background: #ebf2f5;
}

.apw-archive-main .wp-block-query-pagination span.page-numbers.current {
	background: #0e51d1;
	border-color: #0e51d1;
	color: #ffffff;
	font-weight: 700;
}

/* Homepage Product Scroll Strip */
.apw-home-products ul.wc-block-product-template {
	display: flex !important;
	flex-wrap: nowrap !important;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	gap: 1rem;
	padding-bottom: 0.5rem;
	scrollbar-width: thin;
	scrollbar-color: #0e51d1 #ebf2f5;
}

.apw-home-products ul.wc-block-product-template > li.wc-block-product {
	flex: 0 0 74% !important;
	width: auto !important;
	scroll-snap-align: start;
}

@media (min-width: 600px) {
	.apw-home-products ul.wc-block-product-template > li.wc-block-product {
		flex: 0 0 45% !important;
	}
}

@media (min-width: 960px) {
	.apw-home-products ul.wc-block-product-template {
		display: grid !important;
		grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
		overflow-x: visible;
	}
	.apw-home-products ul.wc-block-product-template > li.wc-block-product {
		flex: initial !important;
	}
}

/* ==========================================================================
   SINGLE PRODUCT PAGE
   ========================================================================== */
.apw-single-product-hero {
	margin-top: 0.75rem;
	align-items: flex-start;
}

.apw-product-gallery-col,
.apw-product-summary-col {
	min-width: 0;
}

.apw-product-summary-col .wp-block-post-title {
	margin-top: 0;
	margin-bottom: 0.5rem;
	color: #0a3d91;
}

/* Single Product Gallery: Original Aspect Ratio + Lightbox Click */
.apw-product-gallery-col .wp-block-woocommerce-product-image-gallery,
.apw-product-gallery-col .woocommerce-product-gallery {
	width: 100% !important;
	float: none !important;
	margin: 0 !important;
	position: relative;
}

.apw-product-gallery-col .woocommerce-product-gallery__wrapper {
	margin: 0;
}

.apw-product-gallery-col .woocommerce-product-gallery__image {
	background-color: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	overflow: hidden;
}

.apw-product-gallery-col .woocommerce-product-gallery__image a {
	display: block;
	cursor: zoom-in;
}

.apw-product-gallery-col .woocommerce-product-gallery__image img {
	width: 100% !important;
	height: auto !important;
	object-fit: contain;
	display: block;
}

.apw-product-gallery-col .flex-control-thumbs {
	display: flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	gap: 0.5rem;
	margin: 0.75rem 0 0;
	padding: 0 0 0.25rem;
	list-style: none;
	scrollbar-width: thin;
}

.apw-product-gallery-col .flex-control-thumbs li {
	flex: 0 0 72px;
	width: 72px !important;
	float: none !important;
	margin: 0 !important;
}

.apw-product-gallery-col .flex-control-thumbs li img {
	width: 100%;
	height: auto !important;
	border-radius: 6px;
	border: 2px solid #e5e7eb;
	opacity: 0.78;
	cursor: pointer;
	transition: border-color 0.2s ease, opacity 0.2s ease;
}

.apw-product-gallery-col .flex-control-thumbs li img.flex-active,
.apw-product-gallery-col .flex-control-thumbs li img:hover {
	opacity: 1;
	border-color: #0e51d1;
}

.apw-product-gallery-col .woocommerce-product-gallery__trigger {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 15;
	width: 48px !important;
	height: 48px !important;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.94);
	border: 1px solid #e5e7eb;
	box-shadow: 0 4px 12px rgba(10, 61, 145, 0.12);
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Single Product Price Badge ("Liên hệ") */
.apw-single-price-badge {
	margin: 0.75rem 0;
}

.apw-single-price-badge .apw-price-contact {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0.45rem 1.125rem;
	background-color: #ebf2f5;
	border: 1.5px solid #0e51d1;
	border-radius: 8px;
	color: #0e51d1;
	font-size: 1.125rem;
	font-weight: 700;
}

.apw-single-price-badge .apw-price-contact::before {
	content: "Giá: ";
	font-weight: 500;
	color: #0a3d91;
	margin-right: 0.35rem;
}

/* Single Product Direct CTA Buttons */
.apw-single-cta-wrap {
	margin: 1.25rem 0;
}

.apw-product-cta-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.apw-product-cta-buttons .apw-cta-btn {
	flex: 1 1 200px;
}

.apw-product-cta-buttons .apw-cta-btn .wp-block-button__link {
	width: 100%;
	min-height: 48px;
	padding: 0.75rem 1.125rem;
	font-size: 0.9375rem;
	font-weight: 700;
	border-radius: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.apw-product-cta-buttons .apw-cta-quote.is-style-outline .wp-block-button__link {
	border: 1.5px solid #0e51d1;
	color: #0e51d1;
	background-color: #ffffff;
}

.apw-product-cta-buttons .apw-cta-quote.is-style-outline .wp-block-button__link:hover {
	background-color: #ebf2f5;
	color: #0a3d91;
}

.apw-quick-quote-details {
	margin-top: 0.875rem;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	background: #ebf2f5;
}

.apw-quick-quote-details summary {
	min-height: 48px;
	color: #0a3d91;
	font-weight: 700;
}

.apw-quick-quote-details[open] .apw-form-wrapper {
	margin-top: 0.75rem;
	background: #ffffff;
}

/* Single Product Meta */
.wp-block-woocommerce-product-meta {
	margin-top: 1.25rem;
	padding-top: 1rem;
	border-top: 1px solid #e5e7eb;
	font-size: 0.9375rem;
	color: #4b5563;
}

.wp-block-woocommerce-product-meta .wp-block-group {
	gap: 0.75rem 1.5rem;
}

/* Single Product Details Tabs / Accordion */
.apw-product-details-wrap {
	margin-top: 2.5rem;
}

.apw-product-details-wrap .woocommerce-tabs {
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	background-color: #ffffff;
	overflow: hidden;
}

.apw-product-details-wrap ul.tabs.wc-tabs {
	display: flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	gap: 0.35rem;
	list-style: none;
	margin: 0;
	padding: 0.625rem 0.75rem 0;
	background-color: #ebf2f5;
	border-bottom: 1px solid #e5e7eb;
	scrollbar-width: none;
}

.apw-product-details-wrap ul.tabs.wc-tabs::-webkit-scrollbar {
	display: none;
}

.apw-product-details-wrap ul.tabs.wc-tabs li {
	margin: 0;
	flex: 0 0 auto;
}

.apw-product-details-wrap ul.tabs.wc-tabs li a {
	display: inline-flex;
	align-items: center;
	min-height: 48px;
	padding: 0.625rem 1.25rem;
	font-weight: 700;
	font-size: 0.9375rem;
	color: #4b5563;
	white-space: nowrap;
	border-radius: 8px 8px 0 0;
	border: 1px solid transparent;
	border-bottom: 0;
}

.apw-product-details-wrap ul.tabs.wc-tabs li a:hover {
	color: #0e51d1;
}

.apw-product-details-wrap ul.tabs.wc-tabs li.active a {
	background-color: #ffffff;
	color: #0e51d1;
	border-color: #e5e7eb;
	position: relative;
}

.apw-product-details-wrap .woocommerce-Tabs-panel {
	padding: 1.25rem;
	color: #0a0a0a;
}

@media (min-width: 782px) {
	.apw-product-details-wrap .woocommerce-Tabs-panel {
		padding: 1.75rem;
	}
}

.apw-product-details-wrap .woocommerce-Tabs-panel h2:first-child {
	margin-top: 0;
	color: #0a3d91;
}

.apw-product-details-wrap .woocommerce-Tabs-panel img {
	height: auto;
	border-radius: 8px;
}

.apw-table-scroll {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 1rem 0;
}

.apw-product-details-wrap .woocommerce-Tabs-panel table {
	width: 100%;
	border-collapse: collapse;
	min-width: 440px;
}

.apw-product-details-wrap .woocommerce-Tabs-panel th,
.apw-product-details-wrap .woocommerce-Tabs-panel td {
	padding: 0.75rem 0.875rem;
	border: 1px solid #e5e7eb;
	text-align: left;
}

.apw-product-details-wrap .woocommerce-Tabs-panel th {
	background-color: #ebf2f5;
	color: #0a3d91;
	font-weight: 700;
}

/* Collapsible long description to avoid endless mobile scrolling */
.apw-desc-collapsible.is-collapsed {
	max-height: 440px;
	overflow: hidden;
	position: relative;
}

.apw-desc-collapsible.is-collapsed::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 84px;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff);
	pointer-events: none;
}

.apw-desc-toggle-wrap {
	margin-top: 0.75rem;
	text-align: center;
}

.apw-desc-toggle-btn {
	min-height: 48px;
	padding: 0.625rem 1.5rem;
	border-radius: 99px;
	border: 1.5px solid #0e51d1;
	background: #ffffff;
	color: #0e51d1;
	font-weight: 700;
	font-size: 0.9375rem;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.apw-desc-toggle-btn:hover {
	background: #0e51d1;
	color: #ffffff;
}

/* Related Products Horizontal Carousel */
.apw-related-products {
	margin-top: 2.5rem;
}

.apw-related-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.apw-related-head h2 {
	margin: 0;
}

.apw-related-products .apw-carousel-controls {
	margin-top: 0;
	gap: 0.5rem;
}

.apw-related-products .apw-carousel-btn {
	width: auto;
	height: auto;
	border: 0;
	background: transparent;
}

.apw-related-products .apw-carousel-btn .wp-block-button__link {
	width: 48px;
	height: 48px;
	min-height: 48px;
	padding: 0;
	border-radius: 50%;
	border: 1.5px solid #0e51d1;
	background-color: #ffffff;
	color: #0e51d1;
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.apw-related-products .apw-carousel-btn .wp-block-button__link:hover {
	background-color: #0e51d1;
	color: #ffffff;
}

.apw-related-products ul.wc-block-product-template {
	display: flex !important;
	flex-wrap: nowrap !important;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	gap: 1rem;
	margin: 0;
	padding: 0 0 0.75rem;
	list-style: none;
	scrollbar-width: thin;
	scrollbar-color: #0e51d1 #ebf2f5;
}

.apw-related-products ul.wc-block-product-template > li.wc-block-product {
	flex: 0 0 74% !important;
	width: auto !important;
	scroll-snap-align: start;
}

@media (min-width: 600px) {
	.apw-related-products ul.wc-block-product-template > li.wc-block-product {
		flex: 0 0 46% !important;
	}
}

@media (min-width: 960px) {
	.apw-related-products ul.wc-block-product-template > li.wc-block-product {
		flex: 0 0 calc((100% - 3rem) / 4) !important;
	}
}
