/**
 * Frontend CSS for Kansan Ads
 */

:root {
	/* Universal Adaptive Colors */
	--ka-bg: transparent;
	--ka-border: rgba(128, 128, 128, 0.2);
	--ka-label: inherit;
	--ka-popup-bg: var(--wp--preset--color--base, #ffffff);
	--ka-popup-text: var(--wp--preset--color--contrast, #000000);
	--ka-shadow: rgba(0, 0, 0, 0.1);
	--ka-shadow-strong: rgba(0,0,0,0.25);
}

/* If the theme explicitly adds a dark class, we can override the fallback popup bg to a dark color */
html.dark, html.dark-mode, html[data-theme="dark"], html[data-bs-theme="dark"],
body.dark, body.dark-mode, body.is-dark-theme, body[data-theme="dark"] {
	--ka-popup-bg: var(--wp--preset--color--base, #1f2937);
	--ka-popup-text: var(--wp--preset--color--contrast, #ffffff);
	--ka-shadow: rgba(0, 0, 0, 0.5);
	--ka-shadow-strong: rgba(0, 0, 0, 0.7);
}

.kansan-ad-container {
	width: 96%;
	max-width: 100%;
	margin: 30px auto;
	display: block;
	position: relative;
	text-align: center;
	box-sizing: border-box;
	clear: both;
	
	/* Themed Colors */
	border: 1px solid var(--ka-border);
	padding: 0;
	background: var(--ka-bg);
	border-radius: 8px;
}

.kansan-ad-label {
	font-size: 10px;
	color: var(--ka-label);
	opacity: 0.6;
	text-align: right;
	margin: 0;
	padding: 8px 10px;
	text-transform: uppercase;
	letter-spacing: 1.2px;
	display: block;
	font-weight: 600;
	font-family: inherit;
}

.kansan-ad-swiper {
	padding-bottom: 25px; /* Space for pagination dots */
}

.kansan-ad-content {
	display: flex;
	justify-content: center;
	align-items: center;
	overflow: hidden;
	border-radius: 0 0 8px 8px;
	height: 100%;
}

.kansan-ad-swiper .swiper-slide {
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}

.kansan-ad-content img {
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 350px;
	object-fit: contain;
	border-radius: 0;
	display: block;
	margin: 0 auto;
}

/* Swiper pagination tweaks */
.kansan-ad-container .swiper-pagination-bullet {
	background: currentColor;
	opacity: 0.3;
}
.kansan-ad-container .swiper-pagination-bullet-active {
	background: #4F46E5;
	opacity: 1;
}

/* --- Close Button --- */
.kansan-ad-close {
	position: absolute;
	top: -12px;
	right: -12px;
	width: 28px;
	height: 28px;
	background: #ef4444;
	color: #fff;
	border: 2px solid #fff;
	border-radius: 50%;
	font-size: 16px;
	line-height: 24px;
	text-align: center;
	cursor: pointer;
	padding: 0;
	box-shadow: 0 2px 5px var(--ka-shadow);
	z-index: 9999999;
}
.kansan-ad-close:hover {
	background: #dc2626;
}

/* --- Special Slot Placements --- */

/* Floating Banner */
.kansan-slot-floating-banner {
	position: fixed !important;
	bottom: 20px;
	left: 20px;
	width: 200px !important;
	z-index: 99999;
	margin: 0 !important;
	box-shadow: 0 10px 25px -5px var(--ka-shadow-strong) !important;
	background: var(--ka-popup-bg);
	color: var(--ka-popup-text);
}

/* Mobile Sticky */
.kansan-slot-mobile-sticky {
	position: fixed !important;
	bottom: 0;
	left: 0;
	width: 100% !important;
	z-index: 99998;
	margin: 0 !important;
	border-radius: 0 !important;
	border-bottom: none !important;
	border-left: none !important;
	border-right: none !important;
	padding-bottom: 15px !important;
	box-shadow: 0 -4px 10px var(--ka-shadow) !important;
	background: var(--ka-popup-bg);
	color: var(--ka-popup-text);
}
.kansan-slot-mobile-sticky .kansan-ad-close {
	top: -15px;
	right: 15px; /* keep it inside the screen */
}
@media (min-width: 768px) {
	.kansan-slot-mobile-sticky {
		display: none !important;
	}
}

/* Popup Banner */
.kansan-slot-popup-banner {
	position: fixed !important;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 999999;
	width: 90% !important;
	max-width: 500px !important;
	box-shadow: 0 25px 50px -12px var(--ka-shadow-strong) !important;
	margin: 0 !important;
	background: var(--ka-popup-bg);
	color: var(--ka-popup-text);
}
