.hpb-widget-wrapper {
	position: relative;
}

.hpb-heading {
	margin: 0 0 15px;
}

.hpb-button-wrap {
	text-align: left;
}

.hpb-popup-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	text-decoration: none;
	border: 1px solid transparent;
	background-color: #6c5ce7;
	color: #fff;
	padding: 14px 30px;
	font-size: 16px;
	line-height: 1;
	border-radius: 4px;
	transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.15s ease;
}

.hpb-popup-trigger:active {
	transform: scale(0.97);
}

.hpb-btn-icon svg {
	width: 1em;
	height: 1em;
}

/* ============ Popup ============ */

.hpb-popup {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.hpb-popup.hpb-popup-visible {
	display: flex;
}

.hpb-popup-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	background-color: rgba(0, 0, 0, 0.6);
}

.hpb-popup-container {
	position: relative;
	z-index: 2;
	box-sizing: border-box;
	background-color: #fff;
	max-width: 900px;
	width: 60%;
	max-height: 90vh;
	border-radius: 8px;
	opacity: 0;
	transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Более специфичный селектор + !important: на некоторых сайтах тема или
   другой плагин глобально сбрасывает overflow (например, для caroussels/
   AOS-анимаций) с высоким приоритетом — это правило должно его перебить. */
.hpb-popup.hpb-popup-visible .hpb-popup-container,
.hpb-popup .hpb-popup-container {
	overflow-y: auto !important;
	overflow-x: hidden !important;
	-webkit-overflow-scrolling: touch !important;
}

/* Автоматический размер: попап подстраивается под фактический размер
   вставленного контента/шаблона, вместо ручных width/height. */
.hpb-popup-container.hpb-popup-auto {
	width: auto !important;
	max-width: 95vw !important;
	height: auto !important;
	max-height: 95vh !important;
}

/* fade-zoom (по умолчанию) */
.hpb-popup-container {
	transform: scale(0.92);
}
.hpb-popup-visible .hpb-popup-container {
	opacity: 1;
	transform: scale(1);
}

/* fade */
.hpb-popup[data-animation='fade'] .hpb-popup-container {
	transform: none;
}

/* slide-down */
.hpb-popup[data-animation='slide-down'] .hpb-popup-container {
	transform: translateY(-60px);
}
.hpb-popup[data-animation='slide-down'].hpb-popup-visible .hpb-popup-container {
	transform: translateY(0);
}

/* slide-up */
.hpb-popup[data-animation='slide-up'] .hpb-popup-container {
	transform: translateY(60px);
}
.hpb-popup[data-animation='slide-up'].hpb-popup-visible .hpb-popup-container {
	transform: translateY(0);
}

.hpb-popup-close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 3;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	background-color: #fff;
	color: #333;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	padding: 0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.hpb-popup-close svg {
	width: 45%;
	height: 45%;
}

/* .hpb-popup-body — обычный блок с отступами (padding), НЕ участвует
   в скролле сам по себе: скроллится .hpb-popup-container целиком.
   Именно так устроено в рабочем эталоне (dermtech-elementor-slider),
   это исключает баги flex (min-height:auto) и конфликты overflow. */
.hpb-popup-body {
	width: 100%;
	padding: 40px;
	box-sizing: border-box;
}

/* Шаблон Elementor внутри попапа не должен наследовать лишние отступы контейнера страницы */
.hpb-popup-template-content .elementor {
	margin: 0;
}

body.hpb-popup-open {
	overflow: hidden;
}
