/**
 * Huge Addons Site – Campaign Popups & Banners Styling
 */

:root {
	--ha-topbar-height: 60px;
}

/* ==========================================================================
   1. Topbar Sticky Banner
   ========================================================================== */
.ha-topbar-popup {
	position: sticky;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 99990;
	background: #7716b0;
	height: auto;
	display: block;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
	font-family: inherit;
	overflow: hidden;
	transition: margin-top 0.3s ease, opacity 0.3s ease, height 0.3s ease;
}

body.admin-bar .ha-topbar-popup {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .ha-topbar-popup {
		top: 46px;
	}
}

.ha-topbar-popup.ha-dismissed {
	height: 0 !important;
	opacity: 0 !important;
	pointer-events: none !important;
	box-shadow: none !important;
}

.ha-topbar-popup-inner {
	position: relative;
	width: 100%;
	height: auto;
	display: block;
	padding: 0;
	margin: 0;
	box-sizing: border-box;
}

.ha-topbar-popup-link {
	display: block;
	width: 100%;
	height: auto;
	line-height: 0;
	text-decoration: none;
	cursor: pointer;
}

.ha-topbar-picture {
	display: block;
	width: 100%;
	height: auto;
	line-height: 0;
	margin: 0;
	padding: 0;
}

.ha-topbar-img,
.ha-topbar-img-desktop {
	width: 100%;
	height: auto;
	display: block;
	border: 0;
}

.ha-topbar-img-mobile {
	display: none !important;
}

.ha-side-popup-mobile-close {
	display: none;
}

/* Close button placed at the very end of the viewport */
.ha-topbar-popup-close {
	position: absolute;
	right: 20px;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.18);
	border: 1px solid rgba(255, 255, 255, 0.35);
	color: #ffffff;
	font-size: 20px;
	font-weight: 300;
	line-height: 1;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.2s, transform 0.2s;
	z-index: 20;
}

.ha-topbar-popup-close:hover {
	background: rgba(255, 255, 255, 0.45);
	transform: translateY(-50%) scale(1.1);
}

/* Adjust sticky headers in Elementor or other builders to sit beneath the sticky topbar */
body.has-ha-topbar .elementor-sticky--active {
	top: var(--ha-topbar-height, 38px) !important;
}

body.admin-bar.has-ha-topbar .elementor-sticky--active {
	top: calc(var(--ha-topbar-height, 38px) + 32px) !important;
}

@media screen and (max-width: 782px) {
	body.admin-bar.has-ha-topbar .elementor-sticky--active {
		top: calc(var(--ha-topbar-height, 38px) + 46px) !important;
	}
}

/* ==========================================================================
   2. Center Modal Popup
   ========================================================================== */
.ha-center-popup-overlay {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(14, 5, 28, 0.75);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
	padding: 16px;
	box-sizing: border-box;
}

.ha-center-popup-overlay.ha-visible {
	opacity: 1;
	pointer-events: auto;
}

.ha-center-popup-dialog {
	position: relative;
	width: 100%;
	max-width: 600px;
	transform: scale(0.92);
	transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
	user-select: none;
}

.ha-center-popup-overlay.ha-visible .ha-center-popup-dialog {
	transform: scale(1);
}

.ha-center-popup-link {
	display: block;
	cursor: pointer;
	text-decoration: none;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.ha-center-popup-link img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 14px;
}

/* Invisible overlay close button sitting precisely over artwork's yellow square box */
.ha-center-popup-close {
	position: absolute;
	top: 4.2%;
	right: 3.2%;
	width: 5.6%;
	height: 7.4%;
	min-width: 38px;
	min-height: 38px;
	background: transparent;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	z-index: 20;
	padding: 0;
	transition: background 0.2s, transform 0.2s;
}

.ha-center-popup-close:hover {
	background: rgba(255, 255, 255, 0.25);
	transform: scale(1.08);
}

.ha-side-popup-tab {
	display: none;
}

.ha-side-popup {
	position: fixed;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	z-index: 99998;
	width: 190px;
	max-width: 25vw;
	transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
	user-select: none;
}

.ha-side-popup.ha-hidden {
	transform: translate(115%, -50%);
	opacity: 0;
	pointer-events: none;
}

.ha-side-popup-dialog {
	position: relative;
	width: 100%;
}

.ha-side-popup-link {
	display: block;
	cursor: pointer;
	text-decoration: none;
	border-radius: 10px 0 0 10px;
	overflow: hidden;
	box-shadow: -6px 8px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.ha-side-popup-link img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 10px 0 0 10px;
}

/* Overlay close button over artwork's yellow box on side card */
.ha-side-popup-close {
	position: absolute;
	top: 3%;
	right: 5%;
	width: 12%;
	height: 6%;
	min-width: 30px;
	min-height: 30px;
	background: transparent;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	z-index: 20;
	padding: 0;
	transition: background 0.2s, transform 0.2s;
}

.ha-side-popup-close:hover {
	background: rgba(255, 255, 255, 0.25);
	transform: scale(1.12);
}

/* ==========================================================================
   4. Mobile & Responsive Refinements
   ========================================================================== */
@media screen and (max-width: 768px) {
	.ha-topbar-popup {
		height: auto !important;
	}

	.ha-topbar-popup-inner {
		padding: 0 !important;
		height: auto !important;
		display: block !important;
	}

	.ha-topbar-popup-link {
		width: 100% !important;
		height: auto !important;
		display: block !important;
		line-height: 0 !important;
	}

	.ha-topbar-img,
	.ha-topbar-img-desktop {
		width: 100% !important;
		height: auto !important;
		display: block !important;
	}

	.ha-topbar-popup-close {
		right: 8px;
		width: 24px;
		height: 24px;
		font-size: 16px;
	}

	/* Side popup mobile: ALWAYS tucked off-screen by default, ONLY tab badge is visible */
	.ha-side-popup {
		width: 150px;
		max-width: 50vw;
		top: 62%;
		right: 0;
		transform: translateX(100%) translateY(-50%) !important;
		transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
	}

	.ha-side-popup.ha-hidden {
		transform: translateX(120%) translateY(-50%) !important;
		opacity: 0;
		pointer-events: none;
	}

	.ha-side-popup-tab {
		display: flex !important;
		align-items: center;
		gap: 5px;
		position: absolute;
		right: 100%;
		top: 50%;
		transform: translateY(-50%);
		background: linear-gradient(135deg, #7716b0 0%, #2f0170 100%);
		color: #ffffff;
		border: 1.5px solid rgba(255, 255, 255, 0.45);
		border-right: none;
		border-radius: 20px 0 0 20px;
		padding: 8px 12px 8px 10px;
		font-size: 11px;
		font-weight: 800;
		letter-spacing: 0.5px;
		cursor: pointer;
		box-shadow: -4px 6px 18px rgba(0, 0, 0, 0.35);
		white-space: nowrap;
		z-index: 10;
		transition: transform 0.2s, background 0.2s;
	}

	.ha-side-popup-tab .ha-tab-star {
		color: #ffe600;
		font-size: 12px;
	}

	.ha-side-popup-tab .ha-tab-text {
		color: #ffffff;
		text-transform: uppercase;
	}

	/* When expanded on mobile by clicking the tab badge */
	.ha-side-popup.ha-expanded {
		transform: translateX(0) translateY(-50%) !important;
		box-shadow: -14px 16px 45px rgba(0, 0, 0, 0.55);
	}

	.ha-side-popup.ha-expanded .ha-side-popup-tab {
		opacity: 0;
		pointer-events: none;
	}

	/* Mobile visible close button on the top-left corner of the expanded card */
	.ha-side-popup-mobile-close {
		display: flex !important;
		align-items: center;
		justify-content: center;
		position: absolute;
		top: -10px;
		left: -10px;
		width: 28px;
		height: 28px;
		background: #200247;
		color: #ffffff;
		border: 2px solid #ffffff;
		border-radius: 50%;
		font-size: 16px;
		font-weight: 700;
		line-height: 1;
		cursor: pointer;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
		z-index: 30;
	}

	.ha-side-popup-close {
		top: 2%;
		right: 4%;
		min-width: 32px;
		min-height: 32px;
	}

	/* Center modal on mobile */
	.ha-center-popup-overlay {
		padding: 16px;
	}

	.ha-center-popup-dialog {
		width: 92%;
		max-width: 380px;
		max-height: 85vh;
	}

	.ha-center-popup-link img {
		max-height: 75vh;
		object-fit: contain;
		border-radius: 12px;
	}

	.ha-center-popup-close {
		top: 3%;
		right: 3%;
		min-width: 44px;
		min-height: 44px;
	}
}

@media screen and (max-width: 480px) {
	.ha-topbar-popup {
		height: auto !important;
	}

	.ha-topbar-popup-inner {
		padding: 0 !important;
		height: auto !important;
		display: block !important;
	}

	.ha-topbar-popup-link {
		width: 100% !important;
		height: auto !important;
		display: block !important;
		line-height: 0 !important;
	}

	.ha-topbar-img,
	.ha-topbar-img-desktop {
		height: auto !important;
		width: 100% !important;
		display: block !important;
	}

	.ha-topbar-popup-close {
		right: 6px;
		width: 20px;
		height: 20px;
		font-size: 14px;
	}

	.ha-side-popup {
		width: 140px;
		max-width: 48vw;
		top: 62%;
	}
}
