/**
 * Madara Advanced Ad Inserter — frontend styles.
 */

.maai-ad {
	position: relative;
	margin: 12px 0;
	text-align: center;
	overflow: hidden;
}

.maai-ad__inner {
	display: inline-block;
	max-width: 100%;
}

.maai-ad__iframe {
	max-width: 100%;
	border: 0;
}

/* Banner */
.maai-ad--banner .maai-ad__inner {
	width: 100%;
}

/* Sticky */
.maai-ad--sticky {
	position: sticky;
	top: 80px;
	z-index: 90;
}

.maai-ad--sticky.maai-ad--placement-manga_reading {
	top: 60px;
}

/* Video */
.maai-ad--video .maai-ad__inner {
	width: 100%;
}

.maai-ad--video video,
.maai-ad--video iframe {
	width: 100%;
	max-width: 100%;
	height: auto;
	min-height: 180px;
}

/* Popup overlay */
.maai-popup-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.65);
	z-index: 99998;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.maai-popup-overlay[hidden] {
	display: none;
}

.maai-popup-box {
	position: relative;
	background: #fff;
	border-radius: 6px;
	padding: 16px;
	max-width: 90vw;
	max-height: 90vh;
	overflow: auto;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.maai-popup-close {
	position: absolute;
	top: 6px;
	right: 10px;
	background: transparent;
	border: 0;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: #333;
	padding: 4px 8px;
	z-index: 2;
}

.maai-popup-close:hover {
	color: #000;
}

/* Widget wrapper in Madara sidebars */
.widget.maai-widget .maai-ad {
	margin: 0;
}

/* Wall-style sticky (Madara footer wall ads compatibility) */
.maai-ad--sticky.maai-ad--placement-homepage {
	position: fixed;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	top: auto;
	z-index: 9990;
}

/* Responsive */
@media (max-width: 768px) {
	.maai-ad--sticky {
		position: relative;
		top: auto;
	}

	.maai-popup-box {
		max-width: 95vw;
		padding: 12px;
	}
}
