/* ------------------------------------------------------------------ *
 * Samples popup (confirmation + max-reached) — opened by staggs-samples-popup.js
 * from the PILOT configurator and from /muestras-gratis/ (shared component). Same overlay/dialog/focus-trap
 * shape as .ed-lightbox and the header samples panel, EstoresDirecto
 * styling (turquoise accent, Cormorant Garamond title, Montserrat body).
 * ------------------------------------------------------------------ */

body.ed-samples-popup-open {
	overflow: hidden;
}

.ed-samples-popup {
	position: fixed;
	inset: 0;
	z-index: 110;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--ed-space-lg) var(--ed-space-sm);
}

.ed-samples-popup[hidden] {
	display: none;
}

.ed-samples-popup__overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(16, 19, 20, 0.5);
	border: 0;
	padding: 0;
	cursor: default;
	opacity: 0;
	transition: opacity var(--ed-transition-base);
}

.ed-samples-popup.is-open .ed-samples-popup__overlay {
	opacity: 1;
}

.ed-samples-popup__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 420px;
	max-height: 85vh;
	max-height: 85dvh;
	overflow-y: auto;
	overscroll-behavior: contain;
	background-color: var(--ed-color-surface);
	border-radius: var(--ed-radius-lg);
	box-shadow: var(--ed-shadow-lg);
	padding: var(--ed-space-lg) var(--ed-space-md) var(--ed-space-md);
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	transition: opacity var(--ed-transition-base), transform var(--ed-transition-base);
}

.ed-samples-popup.is-open .ed-samples-popup__dialog {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.ed-samples-popup__overlay,
	.ed-samples-popup__dialog {
		transition: none;
	}
}

.ed-samples-popup__close {
	position: absolute;
	top: var(--ed-space-sm);
	right: var(--ed-space-sm);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: none;
	color: var(--ed-color-muted);
	border: 0;
	border-radius: var(--ed-radius-full);
	cursor: pointer;
}

.ed-samples-popup__close:hover {
	color: var(--ed-color-text);
	background-color: var(--ed-color-surface-alt);
}

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

.ed-samples-popup__close svg {
	width: 16px;
	height: 16px;
}

.ed-samples-popup__check {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: 0 0 var(--ed-space-sm);
	background-color: var(--ed-color-primary);
	color: #ffffff;
	border-radius: var(--ed-radius-full);
}

.ed-samples-popup__check svg {
	width: 24px;
	height: 24px;
}

/*
 * Max-reached is a service limit, not something the visitor got wrong —
 * swap the icon circle to the existing warning token (amber) instead of
 * an error/red one, and never touch the shape/size, only the color.
 */
.ed-samples-popup.is-max .ed-samples-popup__check {
	background-color: var(--ed-color-warning);
}

.ed-samples-popup__title {
	margin: 0 0 var(--ed-space-3xs);
	font-family: var(--ed-font-heading);
	font-size: var(--ed-font-size-lg);
	font-weight: 600;
	color: var(--ed-color-heading);
}

.ed-samples-popup__subtitle {
	margin: 0 0 var(--ed-space-sm);
	color: var(--ed-color-muted);
	font-size: var(--ed-font-size-sm);
}

/*
 * When the max-reached explanation line is present, it — not the
 * subtitle above it — should carry the space before the sample list, so
 * tighten the subtitle's own bottom margin only in that case rather than
 * fighting the resulting double gap with a negative margin.
 */
.ed-samples-popup__subtitle:has( + .ed-samples-popup__extra:not( [hidden] ) ) {
	margin-bottom: var(--ed-space-3xs);
}

.ed-samples-popup__extra {
	margin: 0 0 var(--ed-space-sm);
	color: var(--ed-color-muted);
	font-size: var(--ed-font-size-xs);
}

.ed-samples-popup__list {
	list-style: none;
	margin: 0 0 var(--ed-space-md);
	padding: 0;
	border-top: 1px solid var(--ed-color-border);
}

.ed-samples-popup__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ed-space-sm);
	padding: var(--ed-space-xs) 0;
	border-bottom: 1px solid var(--ed-color-border);
}

.ed-samples-popup__item-text {
	font-size: var(--ed-font-size-sm);
	color: var(--ed-color-text);
}

.ed-samples-popup__item-remove {
	display: inline-flex;
	align-items: center;
	gap: var(--ed-space-3xs);
	background: none;
	border: 0;
	color: var(--ed-color-muted);
	font-family: var(--ed-font-body);
	font-size: var(--ed-font-size-xs);
	cursor: pointer;
	flex-shrink: 0;
}

.ed-samples-popup__item-remove:hover {
	color: var(--ed-color-error);
}

.ed-samples-popup__item-remove:focus-visible {
	outline: var(--ed-focus-outline);
	outline-offset: 2px;
}

.ed-samples-popup__item-remove svg {
	width: 12px;
	height: 12px;
}

.ed-samples-popup__actions {
	display: flex;
	flex-direction: column;
	gap: var(--ed-space-2xs);
}

/*
 * Both actions must be pixel-identical in size (width, height, radius,
 * padding) — only fill/border/text color differ between "Seguir
 * eligiendo muestras" (.ed-button--outline) and "Solicitar N muestras
 * gratis" (.ed-button--primary). buttons.css's shared `.ed-button
 * .wp-block-button__link` base already gives both the same min-height
 * and padding, so this only needs to add the parts that base doesn't
 * already unify (both are just `display: inline-flex` there, sized to
 * their own text unless stretched) — an explicit height, box-sizing and
 * width on both the <button> and its inner .wp-block-button__link keep
 * a 1px border (outline variant only) from making one button's box even
 * fractionally taller than the other's.
 */
.ed-samples-popup__actions .ed-button,
.ed-samples-popup__actions .ed-button .wp-block-button__link {
	box-sizing: border-box;
	width: 100%;
	height: 48px;
}

.ed-samples-popup__actions .ed-button {
	display: flex;
}

.ed-samples-popup__actions .ed-button .wp-block-button__link {
	padding: 0 var(--ed-space-md);
	text-align: center;
	justify-content: center;
}

.ed-samples-popup__actions .ed-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}
