/**
 * Public Styles for Mero Ad Manager.
 *
 * Strict Anti-Blocker Compliance: Contains ZERO instances of restricted keywords in class names.
 * Ensures zero Cumulative Layout Shift (CLS) and smooth modal experiences.
 */

/* Responsive Promotional Slot Container (CLS Shield) */
.mam-slot-wrapper {
	display: block;
	position: relative;
	margin: 1.5rem auto;
	text-align: center;
	clear: both;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
}

.mam-slot-inner {
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0 auto;
	vertical-align: middle;
	box-sizing: border-box;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* Ensure embed code (iframes, ins, scripts, dynamic ad containers) expand correctly */
.mam-slot-inner > div,
.mam-slot-inner iframe {
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
	overflow: visible;
}

/* Image Creative Link & Element */
.mam-slot-link {
	display: inline-block;
	max-width: 100%;
	text-decoration: none;
	border: none;
	outline: none;
	transition: opacity 0.2s ease;
}

.mam-slot-link:hover {
	opacity: 0.95;
}

.mam-slot-img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 0 auto;
	border: 0;
	border-radius: 4px;
}

/* Device-Responsive Targeting Helpers */
@media (max-width: 768px) {
	.mam-device-desktop {
		display: none !important;
	}
}

@media (min-width: 769px) {
	.mam-device-mobile {
		display: none !important;
	}
}

/* Ad Groups & Bulk Placements */
.mam-group-wrapper {
	display: block;
	position: relative;
	margin: 1.75rem auto;
	max-width: 100%;
	box-sizing: border-box;
	clear: both;
}

.mam-group-stacked {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.mam-group-stacked .mam-slot-wrapper {
	margin: 0 auto;
}

.mam-group-grid {
	display: grid;
	gap: 16px;
	align-items: start;
	justify-content: center;
}

.mam-group-grid-2 {
	grid-template-columns: repeat(2, 1fr);
}

.mam-group-grid-3 {
	grid-template-columns: repeat(3, 1fr);
}

.mam-group-grid .mam-slot-wrapper {
	margin: 0 auto;
	width: 100%;
}

@media (max-width: 820px) {
	.mam-group-grid-3 {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 680px) {
	.mam-group-grid-2,
	.mam-group-grid-3 {
		grid-template-columns: 1fr !important;
		gap: 14px !important;
	}
}

.mam-group-item {
	display: block;
	box-sizing: border-box;
	max-width: 100%;
}

/* Modal Popup Window */
.mam-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	box-sizing: border-box;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mam-modal-overlay.is-visible {
	opacity: 1;
	visibility: visible;
}

/* Backdrop */
.mam-modal-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(15, 23, 42, 0.65);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	cursor: pointer;
}

/* Modal Dialog Box */
.mam-modal-dialog {
	position: relative;
	z-index: 2;
	background: #ffffff;
	border-radius: 8px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
	max-width: 92vw;
	max-height: 92vh;
	overflow: visible;
	transform: scale(0.92) translateY(8px);
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	box-sizing: border-box;
}

.mam-modal-overlay.is-visible .mam-modal-dialog {
	transform: scale(1) translateY(0);
}

/* Modal Close Button */
.mam-modal-close {
	position: absolute;
	top: -14px;
	right: -14px;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 2px solid #ffffff;
	border-radius: 50%;
	background: #0f172a;
	color: #ffffff;
	font-size: 20px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease, transform 0.2s ease;
	z-index: 10;
}

.mam-modal-close:hover,
.mam-modal-close:focus {
	background: #ef4444;
	transform: scale(1.08);
	outline: none;
}

/* Modal Creative Content */
.mam-modal-content {
	position: relative;
	padding: 12px;
	max-width: 100%;
	max-height: calc(92vh - 24px);
	overflow: auto;
	display: flex;
	justify-content: center;
	align-items: center;
}

.mam-modal-content .mam-slot-wrapper {
	margin: 0;
	min-height: auto !important;
}

.mam-modal-content .mam-slot-img {
	max-width: 100%;
	max-height: calc(85vh - 36px);
	width: auto;
	height: auto;
	object-fit: contain;
}

/* Mobile & Touch Viewport Modal Optimization */
@media (max-width: 600px) {
	.mam-modal-dialog {
		max-width: 95vw !important;
		max-height: 88vh !important;
		border-radius: 12px !important;
		margin: auto !important;
	}

	.mam-modal-close {
		top: 8px !important;
		right: 8px !important;
		width: 40px !important;
		height: 40px !important;
		min-width: 40px !important;
		min-height: 40px !important;
		font-size: 22px !important;
		background: rgba(15, 23, 42, 0.9) !important;
		border: 2px solid #ffffff !important;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
		touch-action: manipulation !important;
	}

	.mam-modal-content {
		padding: 8px !important;
		max-height: calc(88vh - 16px) !important;
	}

	.mam-modal-content .mam-slot-img {
		max-height: calc(82vh - 24px) !important;
	}
}

