/**
 * Smart Banner Popup – Frontend Styles
 * Popup + Product page banner.
 * All selectors are prefixed with .sbpp- to prevent theme conflicts.
 */

/* =========================================================================
   Keyframes
   ========================================================================= */
@keyframes sbppFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes sbppScaleIn {
	from { opacity: 0; transform: translate(-50%, -50%) scale(.88); }
	to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* =========================================================================
   Overlay
   ========================================================================= */
.sbpp-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	z-index: 99998;
	animation: sbppFadeIn .25s ease forwards;
}

.sbpp-overlay.is-visible {
	display: block;
}

/* =========================================================================
   Popup
   ========================================================================= */
.sbpp-popup {
	display: none;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(.88);
	z-index: 99999;
	width: 92%;
	/* max-width set inline from PHP settings */
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .25), 0 4px 12px rgba(0, 0, 0, .12);
	overflow: hidden;
	outline: none;
}

.sbpp-popup.is-visible {
	display: block;
	animation: sbppScaleIn .3s cubic-bezier(.34, 1.56, .64, 1) forwards;
}

/* Close button */
.sbpp-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: rgba(0, 0, 0, .45);
	color: #fff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	line-height: 1;
	transition: background .2s, transform .2s;
}

.sbpp-popup__close:hover {
	background: rgba(0, 0, 0, .7);
	transform: rotate(90deg);
}

.sbpp-popup__close svg {
	pointer-events: none;
	display: block;
}

/* Image */
.sbpp-popup__image {
	width: 100%;
	line-height: 0;
}

.sbpp-popup__image img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 420px;
	object-fit: cover;
}

/* Footer / CTA */
.sbpp-popup__footer {
	padding: 18px 20px;
	text-align: center;
	background: #fff;
}

.sbpp-popup__btn {
	display: inline-block;
	padding: 13px 32px;
	background: #2271b1;
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	border-radius: 50px;
	letter-spacing: .3px;
	transition: background .2s, transform .15s, box-shadow .2s;
	box-shadow: 0 4px 14px rgba(34, 113, 177, .35);
}

.sbpp-popup__btn:hover {
	background: #135e96;
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(34, 113, 177, .45);
	text-decoration: none;
}

.sbpp-popup__btn:active {
	transform: translateY(0);
}

/* =========================================================================
   Product banner
   ========================================================================= */
.sbpp-product-banner {
	display: block;
	width: 100%;
	box-sizing: border-box;
	overflow: hidden;
	/* Colours, border-radius and padding come from inline styles set by PHP */
}

/* image-only mode */
.sbpp-product-banner--image .sbpp-product-banner__image {
	width: 100%;
	line-height: 0;
}

.sbpp-product-banner--image .sbpp-product-banner__image img {
	display: block;
	width: 100%;
	height: auto;          /* preserve natural aspect ratio – no cropping */
	border-radius: inherit;
}

/* image + text (both) mode */
.sbpp-product-banner--both {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.sbpp-product-banner--both .sbpp-product-banner__image {
	width: 100%;
	line-height: 0;
}

.sbpp-product-banner--both .sbpp-product-banner__image img {
	display: block;
	width: 100%;
	height: auto;          /* preserve natural aspect ratio – no cropping */
}

/* Content area */
.sbpp-product-banner__content {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Alignment helpers (inline style handles text-align; these fix flex alignment) */
.sbpp-product-banner--left   .sbpp-product-banner__content { align-items: flex-start; }
.sbpp-product-banner--center .sbpp-product-banner__content { align-items: center; }
.sbpp-product-banner--right  .sbpp-product-banner__content { align-items: flex-end; }

.sbpp-product-banner__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
}

.sbpp-product-banner__desc {
	margin: 0;
	font-size: 14px;
	line-height: 1.6;
	opacity: .85;
}

/* Banner CTA button */
.sbpp-product-banner__btn {
	display: inline-block;
	margin-top: 4px;
	padding: 10px 24px;
	background: #2271b1;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	border-radius: 50px;
	transition: background .2s, transform .15s;
	box-shadow: 0 3px 10px rgba(34, 113, 177, .3);
}

.sbpp-product-banner__btn:hover {
	background: #135e96;
	color: #fff;
	transform: translateY(-1px);
	text-decoration: none;
}

/* Banner sits inside the WooCommerce .summary column – give it top breathing room */
.sbpp-product-banner {
	margin-top: 20px;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 600px) {
	.sbpp-popup {
		width: 96%;
	}

	.sbpp-popup__btn {
		padding: 12px 22px;
		font-size: 14px;
	}

	.sbpp-product-banner__title {
		font-size: 15px;
	}
}
