.cb-popup[hidden],
.cb-popup__overlay[hidden],
.cb-popup__container[hidden] {
	display: none !important;
}

.cb-popup {
	position: fixed;
	inset: 0;
	display: flex;
	box-sizing: border-box;
}

.cb-popup__overlay {
	position: absolute;
	inset: 0;
	background: var(--cb-popup-overlay, #0000007d);
}

.cb-popup__stage {
	position: relative;
	display: flex;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	justify-content: var(--cb-popup-position-x, center);
	align-items: var(--cb-popup-position-y, center);
	pointer-events: none;
}

.cb-popup__container {
	position: relative;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	width: 100%;
	max-width: var(--cb-popup-width, 800px);
	max-height: 100vh;
	height: var(--cb-popup-height, auto);
	margin: var(--cb-popup-margin-y, 0) var(--cb-popup-margin-x, 0);
	padding: var(--cb-popup-padding-y, 20px) var(--cb-popup-padding-x, 20px);
	border: var(--cb-popup-border-width, 0) var(--cb-popup-border-style, none) var(--cb-popup-border-color, #000);
	border-radius: var(--cb-popup-radius, 0);
	background: var(--cb-popup-background, #fff);
	box-shadow: var(--cb-popup-shadow, none);
	overflow: auto;
	pointer-events: auto;
}

.cb-popup[data-cb-popup-state="loading"] .cb-popup__container {
	opacity: 0;
	pointer-events: none;
}

.cb-popup__container--with-close {
	padding-top: max(var(--cb-popup-padding-y, 20px), calc(var(--cb-popup-close-size, 32px) + 12px));
}

.cb-popup__content {
	display: flex;
	flex: 1;
	flex-direction: column;
	justify-content: var(--cb-popup-content-y, flex-start);
}

.cb-popup__load-error {
	padding: 12px;
	text-align: center;
}

.cb-popup__loading {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.cb-popup__loading .cb-popup__spinner {
	width: 48px;
	height: 48px;
	padding: 12px;
	border: 0;
	background: rgb(17 24 39 / 75%);
	color: #fff;
}

.cb-popup__loading .cb-popup__spinner::after {
	content: '';
	display: block;
	width: 24px;
	height: 24px;
	box-sizing: border-box;
	border: 2px solid currentColor;
	border-inline-end-color: transparent;
	border-radius: 50%;
	animation: cb-popup-spinner 0.8s linear infinite;
}

.cb-popup__spinner {
	box-sizing: border-box;
	border-radius: 50%;
}

.cb-popup__loading-label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@keyframes cb-popup-spinner {
	to { transform: rotate(360deg); }
}

.cb-popup__close {
	position: absolute;
	top: 8px;
	right: 8px;
	box-sizing: border-box;
	display: block;
	appearance: none;
	padding: 0;
	margin: 0;
	min-width: 0;
	min-height: 0;
	width: var(--cb-popup-close-size, 32px);
	height: var(--cb-popup-close-size, 32px);
	border: var(--cb-popup-close-border-width, 0) var(--cb-popup-close-border-style, none) var(--cb-popup-close-border-color, #000);
	border-radius: var(--cb-popup-close-radius, 0);
	background: var(--cb-popup-close-background, transparent);
	color: var(--cb-popup-close-icon, #000);
	font-size: 0;
	line-height: 0;
	box-shadow: none;
	transform: translate(var(--cb-popup-close-x, 0), var(--cb-popup-close-y, 0));
	cursor: pointer;
}

.cb-popup__close:is(:hover, :focus, :active) {
	border: var(--cb-popup-close-border-width, 0) var(--cb-popup-close-border-style, none) var(--cb-popup-close-border-color, #000);
	background: var(--cb-popup-close-background, transparent);
	color: var(--cb-popup-close-icon, #000);
	box-shadow: none;
}

.cb-popup__close::before,
.cb-popup__close::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: min(var(--cb-popup-close-icon-size, 24px), calc(100% - 8px));
	height: 2px;
	border-radius: 1px;
	background: currentColor;
}

.cb-popup__close::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.cb-popup__close::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.cb-popup__close:focus {
	outline: none;
	box-shadow: none;
}

.cb-popup[data-cb-popup-animation="fade"], .cb-popup-preview-scene[data-cb-popup-animation="fade"] { --cb-popup-animation-name: cb-popup-fade; }
.cb-popup[data-cb-popup-animation="zoom-in"], .cb-popup-preview-scene[data-cb-popup-animation="zoom-in"] { --cb-popup-animation-name: cb-popup-zoom-in; }
.cb-popup[data-cb-popup-animation="zoom-out"], .cb-popup-preview-scene[data-cb-popup-animation="zoom-out"] { --cb-popup-animation-name: cb-popup-zoom-out; }
.cb-popup[data-cb-popup-animation="rotate"], .cb-popup-preview-scene[data-cb-popup-animation="rotate"] { --cb-popup-animation-name: cb-popup-rotate; }
.cb-popup[data-cb-popup-animation="move-up"], .cb-popup-preview-scene[data-cb-popup-animation="move-up"] { --cb-popup-animation-name: cb-popup-move-up; }
.cb-popup[data-cb-popup-animation="flip-x"], .cb-popup-preview-scene[data-cb-popup-animation="flip-x"] { --cb-popup-animation-name: cb-popup-flip-x; }
.cb-popup[data-cb-popup-animation="flip-y"], .cb-popup-preview-scene[data-cb-popup-animation="flip-y"] { --cb-popup-animation-name: cb-popup-flip-y; }
.cb-popup[data-cb-popup-animation="bounce-in"], .cb-popup-preview-scene[data-cb-popup-animation="bounce-in"] { --cb-popup-animation-name: cb-popup-bounce-in; }
.cb-popup[data-cb-popup-animation="bounce-out"], .cb-popup-preview-scene[data-cb-popup-animation="bounce-out"] { --cb-popup-animation-name: cb-popup-bounce-out; }
.cb-popup[data-cb-popup-animation="slide-in-up"], .cb-popup-preview-scene[data-cb-popup-animation="slide-in-up"] { --cb-popup-animation-name: cb-popup-slide-up; }
.cb-popup[data-cb-popup-animation="slide-in-right"], .cb-popup-preview-scene[data-cb-popup-animation="slide-in-right"] { --cb-popup-animation-name: cb-popup-slide-right; }
.cb-popup[data-cb-popup-animation="slide-in-down"], .cb-popup-preview-scene[data-cb-popup-animation="slide-in-down"] { --cb-popup-animation-name: cb-popup-slide-down; }
.cb-popup[data-cb-popup-animation="slide-in-left"], .cb-popup-preview-scene[data-cb-popup-animation="slide-in-left"] { --cb-popup-animation-name: cb-popup-slide-left; }

.cb-popup[data-cb-popup-state="opening"] .cb-popup__container,
.cb-popup[data-cb-popup-state="closing"] .cb-popup__container {
	animation-name: var(--cb-popup-animation-name);
	animation-fill-mode: both;
	animation-timing-function: ease-out;
	backface-visibility: hidden;
}

.cb-popup[data-cb-popup-state="opening"] .cb-popup__container {
	animation-duration: var(--cb-popup-animation-in-duration, 400ms);
}

.cb-popup[data-cb-popup-state="closing"] .cb-popup__container {
	animation-duration: var(--cb-popup-animation-out-duration, 125ms);
	animation-direction: reverse;
	animation-timing-function: ease-in;
}

.cb-popup[data-cb-popup-state="opening"]:not([data-cb-popup-skip-overlay-entry]) .cb-popup__overlay,
.cb-popup[data-cb-popup-state="closing"] .cb-popup__overlay {
	animation: cb-popup-fade var(--cb-popup-animation-in-duration, 400ms) ease-out both;
}

.cb-popup[data-cb-popup-state="closing"] .cb-popup__overlay {
	animation-duration: var(--cb-popup-animation-out-duration, 125ms);
	animation-direction: reverse;
}

.cb-popup-preview-scene[data-cb-popup-state="opening"] .cb-popup-preview-container {
	animation: var(--cb-popup-animation-name) var(--cb-popup-animation-in-duration, 400ms) ease-out both;
	backface-visibility: hidden;
}

.cb-popup-preview-scene[data-cb-popup-state="opening"] .cb-popup-preview-overlay {
	animation: cb-popup-fade var(--cb-popup-animation-in-duration, 400ms) ease-out both;
}

@keyframes cb-popup-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cb-popup-zoom-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
@keyframes cb-popup-zoom-out { from { opacity: 0; transform: scale(1.35); } to { opacity: 1; transform: scale(1); } }
@keyframes cb-popup-rotate { from { opacity: 0; transform: rotate(-12deg) scale(.7); } to { opacity: 1; transform: rotate(0) scale(1); } }
@keyframes cb-popup-move-up { from { opacity: 0; transform: translateY(48px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cb-popup-flip-x { from { opacity: 0; transform: perspective(800px) rotateX(-80deg); } to { opacity: 1; transform: perspective(800px) rotateX(0); } }
@keyframes cb-popup-flip-y { from { opacity: 0; transform: perspective(800px) rotateY(-80deg); } to { opacity: 1; transform: perspective(800px) rotateY(0); } }
@keyframes cb-popup-bounce-in { 0% { opacity: 0; transform: scale(.3); } 60% { opacity: 1; transform: scale(1.08); } 80% { transform: scale(.95); } 100% { transform: scale(1); } }
@keyframes cb-popup-bounce-out { 0% { opacity: 0; transform: scale(1.4); } 60% { opacity: 1; transform: scale(.9); } 80% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes cb-popup-slide-up { from { opacity: 0; transform: translateY(100vh); } to { opacity: 1; transform: translateY(0); } }
@keyframes cb-popup-slide-right { from { opacity: 0; transform: translateX(-100vw); } to { opacity: 1; transform: translateX(0); } }
@keyframes cb-popup-slide-down { from { opacity: 0; transform: translateY(-100vh); } to { opacity: 1; transform: translateY(0); } }
@keyframes cb-popup-slide-left { from { opacity: 0; transform: translateX(100vw); } to { opacity: 1; transform: translateX(0); } }

@media (prefers-reduced-motion: reduce) {
	.cb-popup__spinner::after { animation: none; }
	.cb-popup[data-cb-popup-state] .cb-popup__container,
	.cb-popup[data-cb-popup-state] .cb-popup__overlay,
	.cb-popup-preview-scene[data-cb-popup-state] .cb-popup-preview-container,
	.cb-popup-preview-scene[data-cb-popup-state] .cb-popup-preview-overlay { animation: none; }
}
