/**
 * Marflow Fashion Sizes & Measurements — storefront CSS.
 * Designed to play nicely with WooCommerce, the Astra theme, and any
 * WC-compatible theme by scoping every rule to the `.mfs-` prefix.
 */

.mfs-wrapper {
	margin: 1.5em 0 2em;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--ast-global-color-2, #1a1a1a);
}

/* Delivery note ---------------------------------------------------------- */

.mfs-delivery-note {
	display: flex;
	align-items: flex-start;
	gap: 0.5em;
	background: #f7f7f7;
	border-left: 3px solid #d4a574;
	padding: 0.75em 1em;
	margin: 0 0 1.25em;
	font-size: 0.9rem;
	border-radius: 2px;
}

.mfs-delivery-note-icon {
	font-size: 1.1em;
	line-height: 1.2;
	color: #d4a574;
}

.mfs-delivery-note-text {
	flex: 1 1 auto;
}

/* Unit toggle ----------------------------------------------------------- */

.mfs-unit-toggle {
	display: flex;
	align-items: center;
	gap: 0.6em;
	margin: 0 0 1em;
	padding: 0.5em 0.75em;
	background: #fafafa;
	border: 1px solid #ececec;
	border-radius: 4px;
	font-size: 0.85rem;
	flex-wrap: wrap;
}

.mfs-unit-toggle-label {
	font-weight: 600;
	margin-right: 0.25em;
}

.mfs-unit-option {
	display: inline-flex;
	align-items: center;
	gap: 0.25em;
	cursor: pointer;
	padding: 0.15em 0.4em;
	border-radius: 3px;
	transition: background 0.15s ease;
}

.mfs-unit-option:hover {
	background: #f0f0f0;
}

.mfs-unit-option input[type="radio"] {
	margin: 0;
}

/* Size selector --------------------------------------------------------- */

.mfs-size-section {
	margin: 0 0 1.25em;
}

.mfs-size-heading {
	display: flex;
	align-items: baseline;
	gap: 0.75em;
	flex-wrap: wrap;
	margin-bottom: 0.5em;
}

.mfs-size-title {
	font-size: 1rem;
	font-weight: 600;
}

.mfs-size-hint {
	font-size: 0.85em;
	color: #777;
}

.mfs-size-options {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
}

.mfs-size-option {
	margin: 0;
	padding: 0;
}

.mfs-size-option label {
	display: inline-block;
	cursor: pointer;
}

.mfs-size-option input[type="radio"] {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect( 1px, 1px, 1px, 1px );
	white-space: nowrap;
}

.mfs-size-pill {
	display: inline-block;
	min-width: 2.5em;
	padding: 0.45em 0.85em;
	border: 1px solid #d8d8d8;
	border-radius: 3px;
	font-size: 0.9rem;
	text-align: center;
	background: #fff;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
	user-select: none;
}

.mfs-size-option input[type="radio"]:checked + .mfs-size-pill {
	border-color: #d4a574;
	background: #d4a574;
	color: #fff;
}

.mfs-size-option input[type="radio"]:focus + .mfs-size-pill {
	box-shadow: 0 0 0 2px rgba( 212, 165, 116, 0.3 );
}

.mfs-size-option label:hover .mfs-size-pill {
	border-color: #b0b0b0;
}

.mfs-size-option input[type="radio"]:checked + .mfs-size-pill:hover {
	border-color: #d4a574;
}

.mfs-size-option-custom .mfs-size-pill {
	background: #faf5f0;
	border-style: dashed;
	color: #6b5340;
}

.mfs-size-option-custom input[type="radio"]:checked + .mfs-size-pill {
	background: #d4a574;
	border-style: solid;
	color: #fff;
}

.mfs-size-select {
	min-width: 180px;
	padding: 0.45em 0.65em;
	border: 1px solid #d8d8d8;
	border-radius: 3px;
	background: #fff;
	font-size: 0.95rem;
}

/* Measurement table ----------------------------------------------------- */

.mfs-measurement-table-wrapper {
	margin: 0 0 1.5em;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.mfs-measurement-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
	background: #fff;
	border: 1px solid #ececec;
}

.mfs-measurement-table th,
.mfs-measurement-table td {
	padding: 0.65em 0.85em;
	border-bottom: 1px solid #f0f0f0;
	text-align: left;
	white-space: nowrap;
}

.mfs-measurement-table thead th {
	background: #fafafa;
	font-weight: 600;
	color: #444;
	border-bottom: 1px solid #e0e0e0;
}

.mfs-measurement-table .mfs-col-size {
	font-weight: 600;
	background: #fbf7f2;
}

.mfs-measurement-table tbody tr:hover td {
	background: #fcfaf7;
}

.mfs-measurement-table tbody tr:hover .mfs-col-size {
	background: #f7efe4;
}

/* Custom measurement form ---------------------------------------------- */

.mfs-custom-form-wrapper {
	margin: 0 0 1.5em;
	padding: 1.25em;
	background: #fafafa;
	border: 1px solid #ececec;
	border-radius: 4px;
}

.mfs-custom-title {
	margin: 0 0 0.4em;
	font-size: 1.05rem;
	font-weight: 600;
}

.mfs-custom-hint {
	margin: 0 0 1em;
	font-size: 0.85rem;
	color: #777;
}

.mfs-custom-rows {
	display: grid;
	gap: 1em;
}

.mfs-custom-row {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 3px;
	padding: 0.85em 1em;
}

.mfs-custom-row-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.65em;
	font-weight: 600;
	font-size: 0.9rem;
	color: #555;
}

.mfs-remove-row {
	background: none;
	border: none;
	color: #c00;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	padding: 0 0.25em;
	border-radius: 2px;
}

.mfs-remove-row:hover {
	background: #fee;
}

.mfs-custom-fields {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 140px, 1fr ) );
	gap: 0.75em 1em;
	margin-bottom: 0.65em;
}

.mfs-field {
	display: flex;
	flex-direction: column;
	gap: 0.25em;
}

.mfs-field-label {
	font-size: 0.8rem;
	color: #555;
}

.mfs-required {
	color: #c00;
}

.mfs-field-input,
.mfs-set-name-input {
	width: 100%;
	padding: 0.4em 0.55em;
	border: 1px solid #d0d0d0;
	border-radius: 3px;
	font-size: 0.95rem;
	background: #fff;
	box-sizing: border-box;
}

.mfs-field-input:focus,
.mfs-set-name-input:focus {
	border-color: #d4a574;
	outline: none;
	box-shadow: 0 0 0 1px rgba( 212, 165, 116, 0.4 );
}

.mfs-field-name {
	grid-column: 1 / -1;
}

.mfs-add-row {
	margin-top: 0.5em;
}

/* Demo image thumbnail next to each custom-measurement field ------------ */

.mfs-field-input-row {
	display: flex;
	align-items: stretch;
	gap: 0.4em;
}

.mfs-field-input-row .mfs-field-input {
	flex: 1 1 auto;
}

.mfs-field-demo-btn {
	flex: 0 0 auto;
	padding: 0;
	border: 1px solid #d0d0d0;
	border-radius: 3px;
	background: #fff;
	cursor: pointer;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.mfs-field-demo-btn:hover,
.mfs-field-demo-btn:focus {
	border-color: #d4a574;
	transform: scale( 1.04 );
	outline: none;
	box-shadow: 0 0 0 2px rgba( 212, 165, 116, 0.3 );
}

.mfs-field-demo-img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	display: block;
	object-fit: cover;
}

/* Demo image modal ------------------------------------------------------ */

.mfs-demo-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba( 0, 0, 0, 0.78 );
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5em;
}

.mfs-demo-modal {
	background: #fff;
	border-radius: 4px;
	padding: 1em;
	max-width: 90vw;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75em;
	position: relative;
	box-shadow: 0 8px 30px rgba( 0, 0, 0, 0.4 );
}

.mfs-demo-modal-img {
	max-width: 100%;
	max-height: 75vh;
	width: auto;
	height: auto;
	display: block;
	object-fit: contain;
}

.mfs-demo-modal-caption {
	margin: 0;
	font-size: 0.95rem;
	color: #333;
	text-align: center;
}

.mfs-demo-modal-close {
	position: absolute;
	top: -14px;
	right: -14px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none;
	background: #fff;
	color: #333;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba( 0, 0, 0, 0.3 );
	display: flex;
	align-items: center;
	justify-content: center;
}

.mfs-demo-modal-close:hover,
.mfs-demo-modal-close:focus {
	background: #d4a574;
	color: #fff;
	outline: none;
}

@media ( max-width: 640px ) {
	.mfs-field-input-row {
		flex-direction: row;
	}
	.mfs-field-demo-btn {
		width: 34px;
		height: 34px;
	}
}

/* Social icons ---------------------------------------------------------- */

.mfs-social {
	display: flex;
	align-items: center;
	gap: 0.65em;
	flex-wrap: wrap;
	margin: 1.25em 0;
	font-size: 0.9rem;
}

.mfs-social-label {
	font-weight: 600;
	color: #555;
}

.mfs-social-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: 0.5em;
	flex-wrap: wrap;
}

.mfs-social-item a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #f0f0f0;
	color: #555;
	transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.mfs-social-item a:hover,
.mfs-social-item a:focus {
	background: #d4a574;
	color: #fff;
	transform: translateY( -2px );
}

.mfs-social-instagram a:hover { background: #e1306c; }
.mfs-social-facebook a:hover { background: #1877f2; }
.mfs-social-twitter a:hover { background: #000; }
.mfs-social-tiktok a:hover { background: #000; }
.mfs-social-pinterest a:hover { background: #e60023; }
.mfs-social-youtube a:hover { background: #ff0000; }

.screen-reader-text {
	border: 0;
	clip: rect( 1px, 1px, 1px, 1px );
	clip-path: inset( 50% );
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

/* Tabs ------------------------------------------------------------------ */

.mfs-howto-tab,
.mfs-policy-tab {
	font-size: 0.95rem;
	line-height: 1.6;
}

.mfs-howto-images {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 220px, 1fr ) );
	gap: 1em;
	margin-top: 1em;
}

.mfs-howto-image {
	max-width: 100%;
	height: auto;
	border: 1px solid #ececec;
	border-radius: 3px;
}

/* How to Measure: measurement-areas sidebar --------------------------- */
.mfs-howto-areas {
	display: grid;
	grid-template-columns: 200px 1fr;
	gap: 1.5em;
	margin: 1em 0;
	border: 1px solid #ececec;
	border-radius: 4px;
	background: #fff;
	overflow: hidden;
}
.mfs-howto-areas-menu {
	list-style: none;
	padding: 0;
	margin: 0;
	border-right: 1px solid #ececec;
	background: #faf9f6;
}
.mfs-howto-areas-item {
	border-bottom: 1px solid #f0ece6;
}
.mfs-howto-areas-item:last-child {
	border-bottom: none;
}
.mfs-howto-areas-btn {
	width: 100%;
	text-align: left;
	background: transparent;
	border: none;
	padding: 0.85em 1em;
	cursor: pointer;
	font-size: 0.92rem;
	color: #555;
	font-family: inherit;
}
.mfs-howto-areas-btn:hover {
	background: #f0ebe3;
}
.mfs-howto-areas-item.is-active .mfs-howto-areas-btn {
	background: #6b4a2a;
	color: #fff;
	font-weight: 600;
}
.mfs-howto-areas-main {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 280px;
	padding: 1em;
	background: #fff;
}
.mfs-howto-areas-img {
	max-width: 100%;
	max-height: 420px;
	width: auto;
	height: auto;
	display: block;
	border-radius: 3px;
}
.mfs-howto-areas-empty {
	color: #aaa;
	font-style: italic;
	text-align: center;
	margin: 0;
}

/* How to Measure: contact section ------------------------------------- */
.mfs-howto-contact {
	margin: 2em 0;
	padding: 1.5em;
	border: 1px solid #ececec;
	border-radius: 4px;
	background: #faf9f6;
	text-align: center;
}
.mfs-howto-contact h3 {
	margin: 0 0 0.4em;
	font-size: 1.2rem;
	color: #333;
}
.mfs-howto-contact p {
	margin: 0 0 1em;
	color: #555;
	max-width: 640px;
	margin-left: auto;
	margin-right: auto;
}
.mfs-howto-contact-btn {
	display: inline-block;
	background: #6b4a2a;
	color: #fff !important;
	padding: 0.7em 1.8em;
	border-radius: 3px;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.95rem;
	border: none;
	transition: background 0.15s ease;
}
.mfs-howto-contact-btn:hover,
.mfs-howto-contact-btn:focus {
	background: #5a3d23;
	color: #fff;
}

/* How to Measure: full measurement lists ------------------------------ */
.mfs-howto-tables {
	margin: 2em 0 1em;
}
.mfs-howto-tables-title {
	font-size: 1.1rem;
	margin: 0 0 0.75em;
	color: #333;
}
.mfs-howto-table-block {
	margin-bottom: 1.5em;
}
.mfs-howto-table-title {
	font-size: 1rem;
	margin: 0 0 0.5em;
	color: #444;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.mfs-table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.mfs-howto-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}
.mfs-howto-table th,
.mfs-howto-table td {
	border: 1px solid #ececec;
	padding: 0.55em 0.8em;
	text-align: center;
	white-space: nowrap;
}
.mfs-howto-table thead th {
	background: #faf9f6;
	font-weight: 600;
	color: #444;
}
.mfs-howto-table .mfs-howto-size-cell {
	font-weight: 600;
	background: #faf9f6;
	text-align: left;
}
.mfs-howto-table-empty {
	color: #aaa;
	font-style: italic;
}

/* Responsive ----------------------------------------------------------- */

@media ( max-width: 640px ) {
	.mfs-size-options {
		gap: 0.4em;
	}
	.mfs-size-pill {
		min-width: 2.25em;
		padding: 0.4em 0.65em;
		font-size: 0.85rem;
	}
	.mfs-custom-fields {
		grid-template-columns: 1fr 1fr;
		gap: 0.5em;
	}
	.mfs-measurement-table th,
	.mfs-measurement-table td {
		padding: 0.5em 0.65em;
		font-size: 0.82rem;
	}
	.mfs-social-item a {
		width: 32px;
		height: 32px;
	}
	.mfs-howto-areas {
		grid-template-columns: 1fr;
	}
	.mfs-howto-areas-menu {
		display: flex;
		flex-wrap: wrap;
		border-right: none;
		border-bottom: 1px solid #ececec;
	}
	.mfs-howto-areas-item {
		border-bottom: none;
		border-right: 1px solid #f0ece6;
		flex: 1 1 auto;
	}
	.mfs-howto-areas-btn {
		padding: 0.6em 0.75em;
		font-size: 0.85rem;
	}
	.mfs-howto-areas-main {
		min-height: 200px;
	}
	.mfs-howto-contact {
		padding: 1.2em;
	}
	.mfs-howto-table th,
	.mfs-howto-table td {
		padding: 0.45em 0.6em;
		font-size: 0.82rem;
	}
}

/* Astra theme tweaks ---------------------------------------------------- */

.ast-theme .mfs-wrapper {
	margin-top: 1em;
}

.ast-theme .mfs-delivery-note {
	margin-bottom: 1em;
}

.ast-theme .product .mfs-size-section + .cart,
.ast-theme .product .mfs-wrapper + form.cart {
	margin-top: 0;
}

/* WC block-theme fallbacks --------------------------------------------- */

.wp-block-woocommerce-single-product .mfs-wrapper {
	margin: 1.25em 0;
}
