/*
 * TEMP/TEST — "Pilot – Test Visual Estor" visual prototype
 * (inc/test-visual-estor.php, assets/js/test-visual-estor.js).
 * Loaded ONLY on the test product; `.ed-tv-colors` is added by the script to
 * the expanded fabric's colors block only while a wired fabric is selected.
 */

.ed-tv-estor {
	margin: 0 0 var(--ed-space-md);
}

.ed-tv-estor[hidden],
.ed-tv-aside[hidden] {
	display: none;
}

.ed-tv-estor__stage {
	position: relative;
	width: 100%;
	max-width: 360px;
	margin-inline: auto;
	aspect-ratio: 600 / 720;
	border-radius: var(--ed-radius-md);
	overflow: hidden;
	/* Neutral, premium backdrop: no beige, no blue — it must not tint the fabric. */
	background-color: #f2f2f0;
}

.ed-tv-estor__svg {
	display: block;
	width: 100%;
	height: 100%;
}

.ed-tv-estor__badge {
	position: absolute;
	top: 8px;
	left: 8px;
	padding: 2px 8px;
	border-radius: var(--ed-radius-full);
	background-color: rgba(255, 255, 255, 0.85);
	font-family: var(--ed-font-body);
	font-size: var(--ed-font-size-xs);
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--ed-color-text);
}

/* Close-up of the same photo at (near) native resolution — texture check. */
.ed-tv-estor__loupe {
	position: absolute;
	right: 10px;
	bottom: 10px;
	width: 26%;
	aspect-ratio: 1;
	border-radius: 50%;
	overflow: hidden;
	border: 3px solid #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
	background-color: #ddd;
}

.ed-tv-estor__loupe img {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 800%;
	max-width: none;
	height: auto;
	transform: translate(-50%, -50%);
}

.ed-tv-estor__caption {
	margin-top: var(--ed-space-2xs, 0.5rem);
	font-family: var(--ed-font-body);
	font-size: var(--ed-font-size-sm);
	text-align: center;
	color: var(--ed-color-text);
}

.ed-tv-estor.is-awaiting-color .ed-tv-estor__caption {
	color: var(--ed-color-muted);
}

/* No loupe until a real colour texture is on the panel (neutral state, loading). */
.ed-tv-estor:not(.has-texture) .ed-tv-estor__loupe {
	display: none;
}

/*
 * Colour note, always next to the preview: the on-screen colour is indicative —
 * a calm recommendation (not a warning), with "muestra gratis" as the action.
 */
.ed-tv-note {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 var(--ed-space-md);
	padding: 12px 14px;
	background-color: var(--ed-color-background, #fff);
	border: 1px solid var(--ed-color-border);
	border-radius: var(--ed-radius-md);
	font-family: var(--ed-font-body);
	font-size: var(--ed-font-size-xs);
	line-height: 1.5;
	color: var(--ed-color-text);
}

.ed-tv-note__icon {
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	margin-top: 1px;
	color: var(--ed-color-muted);
}

.ed-tv-note__body {
	min-width: 0;
}

.ed-tv-note__title {
	margin: 0 0 2px;
	font-size: var(--ed-font-size-sm);
	font-weight: 600;
}

.ed-tv-note__text {
	margin: 0;
	color: var(--ed-color-muted);
}

.ed-tv-note__sample {
	display: inline;
	padding: 0;
	background: none;
	border: 0;
	font: inherit;
	font-weight: 600;
	color: var(--ed-color-link);
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

/* No colour yet: still explains itself on click, but reads as not-yet-available. */
.ed-tv-note__sample[aria-disabled='true'] {
	color: var(--ed-color-muted);
	text-decoration-style: dotted;
}

.ed-tv-note__sample:focus-visible {
	outline: var(--ed-focus-outline);
	outline-offset: 2px;
}

.ed-tv-note__status {
	margin: 6px 0 0;
	font-weight: 600;
	color: var(--ed-color-text);
}

.ed-tv-note__status:empty {
	display: none;
}

/*
 * STEP 1 — MEDIDAS, Mobile / Tablet only (≤991px). The "fabric ≈ 5 cm narrower" note
 * and the existing diagram come BEFORE "Precio según medidas" and Continuar, so they
 * can't be skipped on the way to the button:
 *   Ancho · Alto (with their hints) → note → diagram → price → Continuar.
 * Pure CSS order over the DOM staggs-medidas-bridge.js builds: the fields column is
 * `display: contents` here, so its children and the diagram become one column of flex
 * items. Desktop (≥992px) keeps its two columns exactly as before; the note is hidden.
 */
.ed-medidas-width-note {
	display: none;
}

@media (max-width: 991px) {
	.ed-medidas-layout {
		display: flex;
		flex-direction: column;
		/* Full-width rows, as in the single fields column before. */
		align-items: stretch;
		gap: 0;
	}

	.ed-medidas-layout > .ed-medidas-fields {
		display: contents;
	}

	.ed-medidas-layout .ed-medidas-helper {
		order: 0;
	}

	.ed-medidas-layout .option-group {
		order: 1;
	}

	.ed-medidas-width-note {
		display: flex;
		order: 2;
		align-items: flex-start;
		gap: 10px;
		margin: var(--ed-space-xs) 0 var(--ed-space-sm);
		padding: 12px 14px;
		background-color: var(--ed-color-surface-alt);
		border: 1px solid var(--ed-color-border);
		border-radius: var(--ed-radius-md);
		font-family: var(--ed-font-body);
		font-size: var(--ed-font-size-sm);
		line-height: 1.5;
		color: var(--ed-color-text);
	}

	.ed-medidas-width-note__icon {
		flex: 0 0 18px;
		width: 18px;
		height: 18px;
		margin-top: 2px;
		color: var(--ed-color-link);
	}

	.ed-medidas-layout > .ed-medidas-visual {
		order: 3;
		margin-bottom: var(--ed-space-xs);
	}

	/* Readable but compact: the square diagram never fills the whole screen. */
	.ed-medidas-layout .ed-medidas-visual__img {
		max-width: 280px;
		margin-inline: auto;
	}

	.ed-medidas-layout .ed-medidas-price-mirror {
		order: 4;
	}

	.ed-medidas-layout .ed-medidas-continuar {
		order: 5;
	}

	.ed-medidas-layout .ed-medidas-reconfirm {
		order: 6;
	}
}

/* Mobile: the live caption under the diagram grows to 3 lines once Ancho is typed —
 * keep that room from the start, so the price and Continuar below never move. */
@media (max-width: 767px) {
	.ed-medidas-layout .ed-medidas-visual__caption {
		min-height: 4.5em;
	}
}

@media (min-width: 768px) and (max-width: 991px) {
	.ed-medidas-layout .ed-medidas-visual__img {
		max-width: 340px;
	}
}

/*
 * All breakpoints: the selected fabric's detail opens in ONE permanent host after the
 * whole fabric grid (staggs-tejido-bridge.js, opt-in set by test-visual-estor.js), so
 * the grid always stays whole. The selected card is then just a selected card again —
 * the shared recipe (turquoise border all round, check mark, normal corners), not
 * the open "tab" that joined it to an inline panel below it.
 */
.ed-tejido-detail-host {
	margin-top: var(--ed-space-md);
}

.ed-tejido-detail--inline[data-placement='after-grid'] {
	margin-top: 0;
	border-radius: 12px;
}

#option-group-2817[data-ed-detail-after-grid] .option-group-options.cards label:has(input:checked) .option {
	border-bottom-width: 1px;
	border-radius: 12px;
	box-shadow: inset 0 0 0 1px var(--ed-color-primary);
}

/*
 * TEST (Mobile, this product only) — header fix under evaluation on real phones.
 * The shared header is a sticky wrapper whose child slides away with a transform;
 * on Android Chrome, while the address bar shows/hides, that pair is drawn with a
 * stale offset (header partly left on screen when hidden, a gap of page above it
 * when it comes back). Here the header itself is position: fixed (which Chrome
 * keeps glued to the viewport top through toolbar changes); its wrapper stays in
 * the flow at the header's measured height (--ed-tv-header-height, set by the
 * script), so the page does not move. The hide/show logic is unchanged.
 */
@media (max-width: 767px) {
	body.postid-2992 .ed-header-shell,
	body.postid-2992.admin-bar .ed-header-shell {
		position: relative;
		top: auto;
		height: var(--ed-tv-header-height, auto);
	}

	body.postid-2992 .ed-site-header {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
	}

	body.postid-2992.admin-bar .ed-site-header {
		top: 46px;
	}
}

/*
 * Mobile / Tablet: the caption always keeps room for two lines, so switching
 * between the (longer) "elige un color" hint and "Material · Color" never
 * changes the height above the colour cards — the list does not move.
 */
@media (max-width: 991px) {
	.ed-tv-estor__caption {
		min-height: 3em;
		line-height: 1.5;
	}
}

/* Mobile: a smaller loupe (−23%), so the estor itself stays the main subject. */
@media (max-width: 767px) {
	.ed-tv-estor__loupe {
		width: 20%;
		right: 8px;
		bottom: 8px;
		border-width: 2px;
	}
}

/*
 * Mobile: the ONE large preview itself stays in view while the colour list
 * scrolls under it (position: sticky, bounded by the colour list, so it leaves
 * with the section). It is shown whole — the SVG scene scales as one piece, never
 * cropped — at a mobile size that leaves room for the cards. No clone, no
 * transform: the same element, same state, same bitmap.
 */
@media (max-width: 767px) {
	.ed-tv-aside {
		display: contents;
	}

	.ed-tv-colors .ed-tv-aside > .ed-tv-estor {
		position: sticky;
		/* Right under the smart-reveal header whenever it is shown (header-scroll.js). */
		top: var(--ed-header-stack-offset, 0px);
		z-index: 5;
		margin: 0;
		padding-block: var(--ed-space-2xs, 0.5rem) var(--ed-space-sm);
		background-color: var(--ed-color-surface-alt);
		/* Same timing as the header slide (header.css), so no strip of the list shows between them. */
		transition: top var(--ed-transition-base);
	}

	.ed-tv-colors .ed-tv-aside > .ed-tv-estor .ed-tv-estor__stage {
		max-width: 240px;
	}
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
	.ed-tv-colors .ed-tv-aside > .ed-tv-estor {
		transition: none;
	}
}

/*
 * Tablet: colour cards on the left (two per row), the large preview pinned on the
 * right at a readable size, sticky only within the colour list (its grid). STAGGS
 * keeps this product 600px wide on tablets, so the preview column is 236px.
 */
@media (min-width: 768px) and (max-width: 991px) {
	.ed-tv-colors {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 236px;
		grid-template-rows: auto auto 1fr;
		column-gap: 12px;
		align-items: start;
	}

	.ed-tv-colors > * {
		grid-column: 1;
	}

	.ed-tv-colors > .ed-tv-aside {
		grid-column: 2;
		grid-row: 1 / 4;
		position: sticky;
		/* Below the smart-reveal header whenever it is shown (header-scroll.js). */
		top: calc(var(--ed-space-sm) + var(--ed-header-stack-offset, 0px));
		transition: top 0.25s ease;
		margin: 0;
	}

	.ed-tv-colors > .ed-tv-aside .ed-tv-estor__stage {
		max-width: none;
	}

	.ed-tv-colors .ed-tejido-detail__colors-slot {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	/* The narrower cards keep "Muestra gratis" on one line. */
	.ed-tv-colors .ed-color-sample-btn {
		white-space: nowrap;
		padding-inline: 6px;
	}
}

@media (min-width: 768px) and (max-width: 991px) and (prefers-reduced-motion: reduce) {
	.ed-tv-colors > .ed-tv-aside {
		transition: none;
	}
}

/* Desktop: color cards on the left, the estor pinned on the right. */
@media (min-width: 992px) {
	.ed-tv-colors {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
		grid-template-rows: auto auto 1fr;
		column-gap: var(--ed-space-lg);
		align-items: start;
	}

	.ed-tv-colors > * {
		grid-column: 1;
	}

	.ed-tv-colors > .ed-tv-aside {
		grid-column: 2;
		grid-row: 1 / 4;
		position: sticky;
		/* Below the smart-reveal header whenever it is shown (header-scroll.js). */
		top: calc(var(--ed-space-sm) + var(--ed-header-stack-offset, 0px));
		transition: top 0.25s ease;
		margin: 0;
	}

	.ed-tv-colors > .ed-tv-aside .ed-tv-estor__stage {
		max-width: none;
	}
}

@media (min-width: 992px) and (prefers-reduced-motion: reduce) {
	.ed-tv-colors > .ed-tv-aside {
		transition: none;
	}
}

/*
 * Pilot layout for the test copy: the live PILOT layout rules in
 * staggs-bridge.css / staggs-quantity.css are scoped to body.postid-2833,
 * so they are mirrored here 1:1 for body.postid-2992 (generated, comments
 * stripped). The shared files stay untouched.
 */

/* --- mirrored from staggs-bridge.css --- */

body.postid-2992 .staggs-product-view-image {
	display: none !important;
}

@media (max-width: 899px) {
	body.postid-2992 .gallery-spacer {
			display: none !important;
		}
}

body.postid-2992 .staggs-product-options {
	flex: 1 1 auto !important;
	width: auto !important;
	max-width: 100% !important;
}

@media (max-width: 899px) {
	body.postid-2992 .staggs-container {
			padding-inline: 16px;
		}
}

body.postid-2992 .option-group-options.cards {
	grid-template-columns: repeat(auto-fit, minmax(200px, 220px)) !important;
}

@media (max-width: 899px) {
	body.postid-2992 .option-group-options.cards {
			grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
			gap: 12px !important;
		}
}

@media (min-width: 768px) and (max-width: 991px) {
	body.postid-2992 .staggs-configurator-main .staggs-product-options .option-group-wrapper {
			width: 100%;
			margin-inline: 0;
			padding-right: 0;
		}
	
	body.postid-2992 .option-group-options.cards {
			grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
			gap: 12px !important;
		}
}

body.postid-2992 {
	--sgg-input-active-border: var(--ed-color-primary);
}

body.postid-2992 {
	--sgg-button-background: var(--ed-color-link);
	--sgg-button-color: #ffffff;
	--sgg-button-hover-background: var(--ed-color-link-hover);
	--sgg-button-hover-color: #ffffff;
	--sgg-option-active-background: rgb(0 183 183 / 0.09);
}

body.postid-2992 .staggs-product-options .option-group-summary {
	margin-top: var(--ed-space-xs);
	color: var(--ed-color-muted);
	font-size: var(--ed-font-size-sm);
	font-weight: 500;
}

body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button {
	position: relative; 
	display: inline-flex !important;
	flex: 0 1 auto !important;
	margin-left: auto !important;
	align-items: center;
	justify-content: center;
	gap: var(--ed-space-2xs);
	width: auto !important;
	max-width: 100%;
	min-height: 48px;
	padding: var(--ed-space-xs) var(--ed-space-lg) !important;
	background-color: var(--ed-color-primary) !important;
	color: var(--ed-color-heading) !important;
	border-radius: var(--ed-radius-full) !important;
	font-family: var(--ed-font-body) !important;
	font-size: var(--ed-font-size-sm) !important;
	font-weight: 600;
	letter-spacing: var(--ed-letter-spacing-button);
	box-shadow: var(--ed-shadow-sm);
	transition: background-color var(--ed-transition-fast), color var(--ed-transition-fast), transform var(--ed-transition-fast), box-shadow var(--ed-transition-fast);
}

body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button #totalprice {
	margin-left: var(--ed-space-3xs);
	font-weight: 700;
}

body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button:hover,
body.postid-2992 .option-group-wrapper .option-group.total .staggs-cart-form-button.staggs button.single_add_to_cart_button:hover,
body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button:focus,
body.postid-2992 .option-group-wrapper .staggs-cart-form-button.staggs button.single_add_to_cart_button:focus {
	background-color: var(--ed-color-primary-hover) !important;
	color: var(--ed-color-heading) !important;
	transform: translateY(-1px);
	box-shadow: var(--ed-shadow-md);
}

body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button:focus-visible {
	outline: var(--ed-focus-outline);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button:hover {
			transform: none;
		}
}

body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button.loading {
	cursor: default;
}

body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button.loading::before {
	content: none !important;
}

body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button.loading .ed-cart-btn-icon,
body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button.loading .ed-cart-btn-label,
body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button.loading #totalprice {
	visibility: hidden;
}

body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button.loading .ed-cart-btn-loading {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ed-space-2xs);
	position: absolute;
	inset: 0;
}

/* --- mirrored from staggs-quantity.css --- */

body.postid-2992 .option-group-wrapper .staggs-summary-widget {
	margin-bottom: var(--ed-space-md);
}

body.postid-2992 .option-group-wrapper .option-group.total {
	padding-top: 0;
	padding-bottom: 0;
}

body.postid-2992 .staggs-cart-form-button {
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: var(--ed-space-sm) var(--ed-space-md);
}

body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button .ed-cart-btn-total {
	margin-left: var(--ed-space-3xs);
	font-weight: 700;
}

body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button .ed-cart-btn-total del {
	margin-left: var(--ed-space-3xs);
	font-size: 0.85em;
	font-weight: 400;
	opacity: 0.72;
	text-decoration-thickness: 1px;
}

body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button.loading .ed-cart-btn-total {
	visibility: hidden;
}

@media (max-width: 1023px) {
	body.postid-2992 .staggs-cart-form-button {
			gap: var(--ed-space-xs);
		}
}

@media (min-width: 1024px) {
	body.postid-2992 .staggs-cart-form-button .ed-qty {
			margin-left: 0;
			margin-right: 0.5rem; 
		}
	
	body.postid-2992 .staggs-cart-form-button .single_add_to_cart_button {
			margin-left: 0 !important;
			margin-right: auto !important;
		}
}
