/**
 * Add-to-cart success modal — Estor enrollable Screen pilot
 * (project-docs/10-estores-enrollables-screen-pilot.md). Presentation for
 * assets/js/staggs-cart-success-modal.js — see that file's own docblock.
 * Same visual language as assets/js/staggs-tejido-bridge.js's own
 * `.ed-tejido-modal` (fixed overlay, centered dialog, restrained shadow),
 * built as its own component since the two live in separate files.
 * UX reference only was cortinas.es's own success popup — this design is
 * EstoresDirecto's own: brand turquoise primary action, no orange, no
 * copied icon/copy.
 */

body.ed-cart-modal-open {
	overflow: hidden;
}

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

.ed-cart-modal[hidden] {
	display: none;
}

.ed-cart-modal__backdrop {
	position: absolute;
	inset: 0;
	background-color: rgba(16, 19, 20, 0.5);
	border: 0;
	padding: 0;
	cursor: default;
}

.ed-cart-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 480px;
	max-height: 85vh;
	overflow-y: auto;
	background-color: var(--ed-color-surface);
	border-radius: var(--ed-radius-lg);
	box-shadow: var(--ed-shadow-lg);
	padding: var(--ed-space-xl) var(--ed-space-lg) var(--ed-space-lg);
	text-align: center;
}

.ed-cart-modal__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-cart-modal__close:hover {
	color: var(--ed-color-text);
	background-color: var(--ed-color-surface-alt);
}

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

.ed-cart-modal__close svg {
	width: 16px;
	height: 16px;
}

/*
 * Success icon — turquoise circle + white check (item 13's first option):
 * fits the brand accent restraint rule better than a green success color
 * that has no other role in this palette.
 */
.ed-cart-modal__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin: 0 auto var(--ed-space-sm);
	border-radius: var(--ed-radius-full);
	background-color: var(--ed-color-primary);
	color: var(--ed-color-surface);
}

.ed-cart-modal__icon svg {
	width: 28px;
	height: 28px;
}

.ed-cart-modal__title {
	margin: 0 0 var(--ed-space-2xs);
	font-family: var(--ed-font-heading);
	font-size: var(--ed-font-size-xl);
	font-weight: 600;
	color: var(--ed-color-heading);
}

.ed-cart-modal__count {
	margin: 0 0 var(--ed-space-lg);
	font-family: var(--ed-font-body);
	font-size: var(--ed-font-size-base);
	color: var(--ed-color-muted);
}

.ed-cart-modal__count[hidden] {
	display: none;
}

.ed-cart-modal__actions {
	display: flex;
	flex-direction: column-reverse;
	gap: var(--ed-space-2xs);
}

@media (min-width: 480px) {
	.ed-cart-modal__actions {
		flex-direction: row;
	}
}

.ed-cart-modal__action {
	flex: 1 1 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: var(--ed-space-2xs) var(--ed-space-md);
	border-radius: var(--ed-radius-md);
	font-family: var(--ed-font-body);
	font-size: var(--ed-font-size-sm);
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color var(--ed-transition-fast), border-color var(--ed-transition-fast), color var(--ed-transition-fast);
}

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

/*
 * Secondary — white background, gray border, dark text (item 12: never
 * orange, never mimics the primary). Same height as the primary action.
 */
.ed-cart-modal__action--secondary {
	background-color: var(--ed-color-surface);
	border: 1px solid var(--ed-color-border);
	color: var(--ed-color-text);
}

.ed-cart-modal__action--secondary:hover {
	border-color: var(--ed-color-muted);
	background-color: var(--ed-color-surface-alt);
}

/*
 * Primary — brand turquoise, never the competitor's orange.
 */
.ed-cart-modal__action--primary {
	background-color: var(--ed-color-primary);
	border: 1px solid var(--ed-color-primary);
	color: var(--ed-color-surface);
}

.ed-cart-modal__action--primary:hover {
	background-color: var(--ed-color-primary-hover, var(--ed-color-primary));
	filter: brightness(0.94);
}

/* Second view ("¿Qué quieres añadir a continuación?") — same dialog, same actions. */
.ed-cart-modal__view[hidden] {
	display: none;
}

.ed-cart-modal__title--next {
	margin-bottom: var(--ed-space-lg);
}

.ed-cart-modal__action svg {
	flex: none;
	width: 18px;
	height: 18px;
	margin-right: var(--ed-space-2xs);
}

/* Second view: long labels next to an icon must stay on one line in the two-up row. */
.ed-cart-modal__view[data-ed-cart-view="next"] .ed-cart-modal__action {
	padding-inline: var(--ed-space-xs);
	white-space: nowrap;
}

.ed-cart-modal__view[data-ed-cart-view="next"] .ed-cart-modal__action svg {
	width: 16px;
	height: 16px;
	margin-right: 6px;
}
