/**
 * Confirm modal — shared across admin, Gutenberg, and frontend editor.
 */

.bm-confirm-modal-root {
	--bm-confirm-primary: var(--bm-color-primary, #3525cd);
	--bm-confirm-primary-soft: var(--bm-color-primary-soft, #ebe8ff);
	--bm-confirm-danger: var(--bm-color-danger, #b32d2e);
	--bm-confirm-danger-soft: var(--bm-color-danger-soft, #fcebec);
	--bm-confirm-warning: var(--bm-color-warning, #9a6700);
	--bm-confirm-warning-soft: var(--bm-color-warning-soft, #fff3cd);
	--bm-confirm-surface: var(--bm-color-surface-lowest, #fff);
	--bm-confirm-surface-low: var(--bm-color-surface-low, #f6f7f9);
	--bm-confirm-on-surface: var(--bm-color-on-surface, #1e1e1e);
	--bm-confirm-muted: var(--bm-color-on-surface-variant, #646970);
	--bm-confirm-outline: var(--bm-color-outline-variant, #dcdcde);
	--bm-confirm-ease: var(--bm-ease, cubic-bezier(0.2, 0.8, 0.2, 1));

	position: fixed;
	inset: 0;
	z-index: 100100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	isolation: isolate;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans,
		Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	box-sizing: border-box;
}

.bm-confirm-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.48) !important;
	backdrop-filter: blur(4px);
}

.bm-confirm-modal {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 460px;
	overflow: hidden;
	border-radius: 12px;
	border: 1px solid color-mix(in srgb, var(--bm-confirm-outline) 70%, transparent);
	background: var(--bm-confirm-surface);
	box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
	animation: bm-confirm-in 0.28s var(--bm-confirm-ease) both;
}

.bm-confirm-modal__glow {
	pointer-events: none;
	position: absolute;
	inset: 0 0 auto;
	height: 140px;
	background: radial-gradient(
		120% 100% at 50% 0%,
		var(--bm-confirm-primary-soft),
		transparent 70%
	);
}

.bm-confirm-modal-root--danger .bm-confirm-modal__glow {
	background: radial-gradient(
		120% 100% at 50% 0%,
		var(--bm-confirm-danger-soft),
		transparent 70%
	);
}

.bm-confirm-modal-root--warning .bm-confirm-modal__glow {
	background: radial-gradient(
		120% 100% at 50% 0%,
		var(--bm-confirm-warning-soft),
		transparent 70%
	);
}

.bm-confirm-modal__body {
	position: relative;
	padding: 1.75rem 1.5rem 1.5rem;
	text-align: center;
}

.bm-confirm-modal__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3.25rem;
	height: 3.25rem;
	border-radius: 999px;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.bm-confirm-modal__icon .dashicons {
	width: 1.5rem;
	height: 1.5rem;
	font-size: 1.5rem;
	line-height: 1;
}

.bm-confirm-modal__icon.is-primary {
	background: var(--bm-confirm-primary-soft);
	color: var(--bm-confirm-primary);
}

.bm-confirm-modal__icon.is-danger {
	background: var(--bm-confirm-danger-soft);
	color: var(--bm-confirm-danger);
}

.bm-confirm-modal__icon.is-warning {
	background: var(--bm-confirm-warning-soft);
	color: var(--bm-confirm-warning);
}

.bm-confirm-modal__title {
	margin: 1rem 0 0;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--bm-confirm-on-surface);
}

.bm-confirm-modal__desc {
	margin: 0.5rem auto 0;
	max-width: 34ch;
	font-size: 0.9375rem;
	line-height: 1.45;
	color: var(--bm-confirm-muted);
}

.bm-confirm-modal__children {
	margin-top: 1.25rem;
	text-align: left;
}

.bm-confirm-modal__actions {
	display: flex;
	flex-direction: column-reverse;
	gap: 0.5rem;
	padding: 1rem 1.25rem;
	border-top: 1px solid color-mix(in srgb, var(--bm-confirm-outline) 55%, transparent);
	background: color-mix(in srgb, var(--bm-confirm-surface-low) 80%, transparent);
}

@media (min-width: 600px) {
	.bm-confirm-modal__actions {
		flex-direction: row;
		justify-content: flex-end;
	}

	.bm-confirm-modal__btn {
		min-width: 7rem;
	}
}

.bm-confirm-modal__btn.is-warning {
	background: var(--bm-confirm-warning) !important;
	border-color: var(--bm-confirm-warning) !important;
	color: #fff !important;
}

/* Meta / list helpers (admin bulk confirms) */
.bm-confirm-modal__meta {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: 0.875rem 1rem;
	border-radius: 8px;
	border: 1px solid var(--bm-confirm-outline);
	background: var(--bm-confirm-surface);
}

.bm-confirm-modal__meta-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.bm-confirm-modal__meta-label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--bm-confirm-muted);
}

.bm-confirm-modal__meta-value {
	font-size: 13px;
	font-weight: 600;
	color: var(--bm-confirm-on-surface);
	text-align: right;
	word-break: break-word;
}

.bm-confirm-modal__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
}

.bm-confirm-modal__chip {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.2rem 0.55rem;
	border-radius: 4px;
	background: var(--bm-confirm-surface-low);
	color: var(--bm-confirm-muted);
	font-size: 11px;
	font-weight: 600;
}

.bm-confirm-modal__items {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	padding: 0.85rem 0.9rem;
	border-radius: 8px;
	border: 1px solid var(--bm-confirm-outline);
	background: var(--bm-confirm-surface);
}

.bm-confirm-modal__items-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.bm-confirm-modal__items-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.5rem;
	height: 1.5rem;
	padding: 0 0.45rem;
	border-radius: 999px;
	background: var(--bm-confirm-primary-soft);
	color: var(--bm-confirm-primary);
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

.bm-confirm-modal-root--danger .bm-confirm-modal__items-count {
	background: var(--bm-confirm-danger-soft);
	color: var(--bm-confirm-danger);
}

.bm-confirm-modal-root--warning .bm-confirm-modal__items-count {
	background: var(--bm-confirm-warning-soft);
	color: var(--bm-confirm-warning);
}

.bm-confirm-modal__items-empty {
	margin: 0;
	font-size: 13px;
	color: var(--bm-confirm-muted);
}

.bm-confirm-modal__items-list {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	margin: 0;
	padding: 0;
	list-style: none;
	max-height: 13.5rem;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.bm-confirm-modal__item {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.15rem;
	padding: 0.55rem 0.7rem;
	border-radius: 6px;
	border: 1px solid color-mix(in srgb, var(--bm-confirm-outline) 55%, transparent);
	background: #fff;
}

.bm-confirm-modal__item-title {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--bm-confirm-on-surface);
	word-break: break-word;
}

.bm-confirm-modal__item-meta {
	font-size: 11px;
	font-weight: 500;
	line-height: 1.35;
	color: var(--bm-confirm-muted);
	word-break: break-word;
}

.bm-confirm-modal__item-meta code {
	font-size: 11px;
	font-weight: 600;
}

@keyframes bm-confirm-in {
	from {
		opacity: 0;
		transform: translateY(10px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.bm-confirm-modal {
		animation: none;
	}
}
