:root {
	--mwpt-accent: #161616;
	--mwpt-border: #e5e7eb;
	--mwpt-muted: #6b7280;
	--mwpt-radius: 12px;
}

body.mwpt-modal-open {
	overflow: hidden;
}

.mwpt-size-guide-entry {
	margin: 10px 0 16px;
}

.mwpt-guide-open,
.mwpt-image-toggle,
.mwpt-filter-mobile-toggle {
	font: inherit;
	cursor: pointer;
}

.mwpt-guide-open {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	border: 0 !important;
	border-bottom: 1px solid currentColor;
	background: transparent;
	color: #0b3a53 !important;
	padding: 4px 0;
	background: #0b3a53 !important;
	color: #ffffff !important;
	border: 0;
	padding: 10px 18px;
	border-radius: 8px;
	transition: .2s ease;
}

.mwpt-guide-open:hover {
	background: #0f4c6b !important;
	color: #ffffff !important;
}

.mwpt-ruler-icon {
	width: 21px;
	height: 10px;
	border: 2px solid currentColor;
	border-radius: 2px;
	transform: rotate(-8deg);
	background: repeating-linear-gradient(90deg, transparent 0 4px, currentColor 4px 5px, transparent 5px 8px);
}

.mwpt-modal[hidden] {
	display: none !important;
}

.mwpt-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: grid;
	place-items: center;
	padding: 20px;
}

.mwpt-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.62);
	backdrop-filter: blur(2px);
}

.mwpt-modal-panel {
	position: relative;
	z-index: 1;
	width: min(920px, 100%);
	max-height: min(84vh, 760px);
	overflow: auto;
	background: #fff;
	color: #151515;
	border-radius: 18px;
	padding: clamp(20px, 4vw, 38px);
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

.mwpt-modal-panel h2 {
	margin: 0 0 22px;
	font-size: clamp(20px, 3vw, 30px);
}

.mwpt-modal-close {
	position: absolute;
	top: 12px;
	left: 14px;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 50%;
	background: #f3f4f6;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.mwpt-guide-content.has-image {
	display: grid;
	grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr);
	gap: 28px;
	align-items: start;
}

.mwpt-guide-image {
	margin: 0;
}

.mwpt-guide-image img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--mwpt-radius);
}

.mwpt-guide-table-wrap {
	overflow-x: auto;
}

.mwpt-guide-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	border: 1px solid var(--mwpt-border);
	border-radius: var(--mwpt-radius);
	overflow: hidden;
	font-size: 14px;
}

.mwpt-guide-table th,
.mwpt-guide-table td {
	padding: 12px 13px;
	text-align: center;
	border-bottom: 1px solid var(--mwpt-border);
	white-space: nowrap;
}

.mwpt-guide-table th {
	background: #f7f7f8;
	font-weight: 700;
}

.mwpt-guide-table tr:last-child td {
	border-bottom: 0;
}

.mwpt-guide-notes {
	margin: 20px 0 0;
	padding: 13px 15px;
	background: #f7f7f8;
	border-radius: 10px;
	color: #4b5563;
}

.mwpt-filters {
	clear: both;
	width: 100%;
	margin: 0 0 28px;
	padding: 18px 20px;
	border: 1px solid var(--mwpt-border);
	border-radius: var(--mwpt-radius);
	background: #fff;
}

.mwpt-filter-heading {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
}

.mwpt-filter-mobile-toggle {
	display: none !important;
	border: 0;
	background: transparent;
	font-weight: 700;
	padding: 0;
}

.mwpt-filter-clear {
	margin-inline-start: auto;
	color: #a32323;
	font-size: 13px;
	text-decoration: none;
}

.mwpt-filter-form {
	display: flex;
	align-items: flex-end;
	flex-wrap: wrap;
	gap: 18px 30px;
}

.mwpt-filter-group {
	border: 0;
	margin: 0;
	padding: 0;
}

.mwpt-filter-group legend {
	font-size: 13px;
	font-weight: 700;
	margin-bottom: 9px;
}

.mwpt-filter-options {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.mwpt-filter-options label {
	margin: 0;
	cursor: pointer;
}

.mwpt-filter-options input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.mwpt-filter-sizes label span,
.mwpt-filter-status label span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 34px;
	padding: 5px 11px;
	border: 1px solid var(--mwpt-border);
	border-radius: 8px;
	font-size: 13px;
	transition: 0.18s ease;
}

.mwpt-filter-sizes input:checked + span,
.mwpt-filter-status input:checked + span {
	border-color: var(--mwpt-accent);
	background: var(--mwpt-accent);
	color: #fff;
}

.mwpt-filter-options input:focus-visible + span {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
}

.mwpt-filter-color-dot,
.mwpt-color-swatch {
	display: inline-block;
	width: 24px;
	height: 24px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--mwpt-color);
	box-shadow: 0 0 0 1px #cfd2d6;
}

.mwpt-filter-colors input:checked + .mwpt-filter-color-dot {
	box-shadow: 0 0 0 2px var(--mwpt-accent);
}

.mwpt-products-fragment {
	position: relative;
	min-height: 80px;
	clear: both;
}

.mwpt-products-fragment.is-loading {
	min-height: 180px;
}

.mwpt-products-fragment.is-loading > * {
	opacity: 0.45;
	pointer-events: none;
}

.mwpt-products-fragment.is-loading::after {
	content: '';
	position: absolute;
	top: 110px;
	left: 50%;
	z-index: 20;
	width: 34px;
	height: 34px;
	margin-left: -17px;
	border: 3px solid #dedede;
	border-top-color: #111;
	border-radius: 50%;
	animation: mwpt-spin 0.75s linear infinite;
}

.mwpt-filters.is-loading {
	opacity: 0.65;
	pointer-events: none;
}

.mwpt-ajax-error {
	margin: 0 0 16px;
	padding: 12px 16px;
	border: 1px solid #efd39a;
	border-radius: 6px;
	background: #fff8e8;
	color: #7a5410;
	font-size: 13px;
	text-align: right;
}

@keyframes mwpt-spin {
	to { transform: rotate(360deg); }
}

.mwpt-loop-options {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 8px;
	min-height: 28px;
}

.mwpt-loop-colors,
.mwpt-loop-sizes {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
}

.mwpt-loop-colors .mwpt-color-swatch {
	width: 17px;
	height: 17px;
}

.mwpt-loop-sizes span {
	font-size: 11px;
	line-height: 1;
	padding: 5px 6px;
	border: 1px solid var(--mwpt-border);
	border-radius: 5px;
	color: #444;
}

.mwpt-image-view-switch {
	float: left;
	margin: 0 0 16px 10px;
}

.woocommerce .mwpt-image-toggle,
.mwpt-image-toggle {
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	border: 0 !important;
	border-radius: 8px;
	background: transparent !important;
	box-shadow: none !important;
	padding: 0;
	color: #111 !important;
	font-size: 0 !important;
	line-height: 1 !important;
	appearance: none;
	-webkit-appearance: none;
}

.woocommerce .mwpt-image-toggle::before,
.mwpt-image-toggle::before {
	content: '' !important;
	display: block;
	width: 29px !important;
	height: 29px !important;
	background-color: currentColor !important;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M8.15 3.5 4.1 5.28 1.9 10.5l3.2 1.4V21h13.8v-9.1l3.2-1.4-2.2-5.22-4.05-1.78C15.02 4.7 13.72 5.4 12 5.4S8.98 4.7 8.15 3.5Zm.62 2.08C9.7 6.42 10.76 6.8 12 6.8s2.3-.38 3.23-1.22l2.76 1.21 1.34 3.18-1.83.8V19.6h-11v-8.83l-1.83-.8 1.34-3.18 2.76-1.21Z'/%3E%3C/svg%3E") center / contain no-repeat !important;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M8.15 3.5 4.1 5.28 1.9 10.5l3.2 1.4V21h13.8v-9.1l3.2-1.4-2.2-5.22-4.05-1.78C15.02 4.7 13.72 5.4 12 5.4S8.98 4.7 8.15 3.5Zm.62 2.08C9.7 6.42 10.76 6.8 12 6.8s2.3-.38 3.23-1.22l2.76 1.21 1.34 3.18-1.83.8V19.6h-11v-8.83l-1.83-.8 1.34-3.18 2.76-1.21Z'/%3E%3C/svg%3E") center / contain no-repeat !important;
	transition: transform 0.2s ease;
}

.woocommerce .mwpt-image-toggle:hover,
.mwpt-image-toggle:hover,
.woocommerce .mwpt-image-toggle[aria-pressed="true"],
.mwpt-image-toggle[aria-pressed="true"] {
	background: #f1f1f1 !important;
	color: #111 !important;
}

.mwpt-image-toggle[aria-pressed="true"]::before {
	transform: rotateY(180deg);
}

/*
 * Product-loop compatibility. WooCommerce core commonly uses ul.products/li.product,
 * while WoodMart uses div.products/div.wd-product. The secondary image must always
 * be an overlay, never a normal-flow image, regardless of which loop wrapper is used.
 */
.woocommerce .products .product a.woocommerce-LoopProduct-link,
.woocommerce .products .product a.woocommerce-loop-product__link,
.woocommerce .products .product .product-image-link,
.products .product a.woocommerce-LoopProduct-link,
.products .product a.woocommerce-loop-product__link,
.products .product .product-image-link,
.product-grid-item .product-image-link {
	position: relative;
	display: block;
}

.mwpt-secondary-image,
.woocommerce .products .product .mwpt-secondary-image,
.products .product .mwpt-secondary-image,
.product-grid-item .mwpt-secondary-image {
	position: absolute !important;
	top: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	left: 0 !important;
	z-index: 2;
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	margin: 0 !important;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.22s ease;
	object-fit: cover;
}

html.mwpt-secondary-view .woocommerce .products .product .mwpt-secondary-image,
html.mwpt-secondary-view .products .product .mwpt-secondary-image,
html.mwpt-secondary-view .product-grid-item .mwpt-secondary-image {
	opacity: 1;
	visibility: visible;
}

/*
 * Miran's separate AJAX/card snippets already provide these controls. Hide only the
 * duplicate MWPT UI when the compatibility class is added by frontend.js; the data
 * image itself remains available to the external snippet as a fallback source.
 */
html.mwpt-external-image-tools .mwpt-image-view-switch {
	display: none !important;
}

html.mwpt-external-card-options .mwpt-loop-options.mwpt-duplicate-options {
	display: none !important;
}

@media (max-width: 767px) {
	.mwpt-modal {
		padding: 10px;
	}

	.mwpt-modal-panel {
		max-height: 92vh;
		border-radius: 14px;
		padding: 46px 16px 20px;
	}

	.mwpt-guide-content.has-image {
		display: block;
	}

	.mwpt-guide-image {
		margin-bottom: 20px;
	}

	.mwpt-filter-mobile-toggle {
		display: inline-flex !important;
		align-items: center;
		gap: 7px;
	}

	.mwpt-filter-form {
		display: none;
		padding-top: 18px;
	}

	.mwpt-filters.is-mobile-open .mwpt-filter-form {
		display: flex;
		flex-direction: column;
		align-items: stretch;
	}

	.mwpt-filter-group {
		padding-bottom: 14px;
		border-bottom: 1px solid var(--mwpt-border);
	}

	.mwpt-image-view-switch {
		float: none;
		display: flex;
		justify-content: flex-end;
		width: 100%;
		margin: 0 0 14px;
	}
}

/* Size guide button - Woodmart/MWPT final override */
html body.single-product .mwpt-size-guide-entry button.mwpt-guide-open,
html body .mwpt-size-guide-entry .mwpt-guide-open {
    background-color:#0b3a53 !important;
    color:#ffffff !important;
    border-color:#0b3a53 !important;
    border-radius:8px !important;
    padding:12px 20px !important;
    font-weight:600 !important;
    box-shadow:none !important;
}
html body.single-product .mwpt-size-guide-entry button.mwpt-guide-open:hover,
html body .mwpt-size-guide-entry .mwpt-guide-open:hover {
    background-color:#123f56 !important;
    color:#ffffff !important;
}
html body.single-product .mwpt-size-guide-entry .mwpt-ruler-icon:before {
    color:#ffffff !important;
}
