/**
 * Popup front-end: modal (giữa màn hình), slide (góc dưới phải), bar (thanh
 * dính đáy). z-index cao hơn header theme (100) để luôn nổi trên cùng.
 * Dùng biến CSS --th-bg/--th-text/--th-border của theme để tương thích dark mode.
 */
#th-popup-root {
	position: relative;
}

.th-popup-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 17, 21, 0.6);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.th-popup-modal {
	position: relative;
	background: var(--th-bg, #fff);
	color: var(--th-text, #111827);
	border-radius: 12px;
	max-width: 90vw;
	max-height: 90vh;
	overflow: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.th-popup-modal--sm {
	width: 360px;
}

.th-popup-modal--md {
	width: 560px;
}

.th-popup-modal--lg {
	width: 860px;
}

.th-popup-slide {
	position: fixed;
	right: 16px;
	bottom: 16px;
	width: 320px;
	max-width: calc(100vw - 32px);
	background: var(--th-bg, #fff);
	color: var(--th-text, #111827);
	border-radius: 12px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
	z-index: 99999;
	overflow: hidden;
}

.th-popup-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--th-bg, #fff);
	color: var(--th-text, #111827);
	border-top: 1px solid var(--th-border, #e5e7eb);
	z-index: 99999;
	padding: 12px 48px 12px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.th-popup-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.th-popup-image {
	display: block;
	width: 100%;
	height: auto;
}

.th-popup-html {
	padding: 20px;
}

.th-popup-bar .th-popup-html,
.th-popup-slide .th-popup-html {
	padding: 0;
}

.th-popup-close {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(17, 24, 39, 0.7);
	color: #fff;
	border: none;
	border-radius: 999px;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	z-index: 1;
}

.th-popup-close:focus-visible {
	outline: 2px solid var(--th-accent, #2563eb);
	outline-offset: 2px;
}

.th-popup-bar .th-popup-close,
.th-popup-slide .th-popup-close {
	position: absolute;
	top: 6px;
	right: 6px;
	background: transparent;
	color: inherit;
	font-size: 22px;
}

@media (max-width: 600px) {
	.th-popup-slide {
		left: 16px;
		right: 16px;
		width: auto;
		bottom: 12px;
	}
}

html[data-theme="dark"] .th-popup-modal,
html[data-theme="dark"] .th-popup-slide,
html[data-theme="dark"] .th-popup-bar {
	background: var(--th-bg-subtle, #171a21);
	color: var(--th-text, #f3f4f6);
	border-color: var(--th-border, #262b35);
}

html[data-theme="dark"] .th-popup-bar .th-popup-close,
html[data-theme="dark"] .th-popup-slide .th-popup-close {
	color: var(--th-text, #f3f4f6);
}
