/**
 * Smart CTA — Popup Styles
 *
 * Architecture:
 * - Fixed overlay with backdrop-blur
 * - Centered modal dialog
 * - Inherits --sc-* variables from the theme class applied to the container
 */

/* --------------------------------------------------------------------------
   1. Overlay & Container
   -------------------------------------------------------------------------- */
.smartcta-pop {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	
	/* -- Transitions -- */
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	
	/* -- Backdrop -- */
	background-color: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);

	/* -- Defaults -- */
	--sc-radius: 12px;
}

/* Open State */
.smartcta-pop[aria-hidden="false"] {
	visibility: visible;
	opacity: 1;
}

/* --------------------------------------------------------------------------
   2. Modal Dialog
   -------------------------------------------------------------------------- */
.smartcta-pop__dialog {
	position: relative;
	width: 100%;
	max-width: 600px;
	max-height: 90vh;
	overflow-y: auto;
	
	/* Background: Inherit from Theme Variable */
	background-color: var(--sc-bg, #ffffff);
	
	/* Text Color: Inherit from Theme Variable */
	color: var(--sc-text, #1e293b);
	
	border-radius: 12px;
	box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
	padding: 40px;
	text-align: center;
	
	/* Entry Animation */
	transform: scale(0.95) translateY(10px);
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.smartcta-pop[aria-hidden="false"] .smartcta-pop__dialog {
	transform: scale(1) translateY(0);
}

/* --------------------------------------------------------------------------
   3. CRITICAL: Theme-Based Text Colors (High Specificity)
   -------------------------------------------------------------------------- */

/* Dark Themes (Navy, Black, Slate, Glass) -> FORCE WHITE TEXT */
.smartcta-pop.smartcta--theme-navy .smartcta-pop__dialog,
.smartcta-pop.smartcta--theme-black .smartcta-pop__dialog,
.smartcta-pop.smartcta--theme-slate .smartcta-pop__dialog,
.smartcta-pop.smartcta--theme-glass .smartcta-pop__dialog {
    color: #ffffff !important;
    --sc-text: #ffffff;
}

/* Force Headlines to be White on Dark Themes (Overrides WP Theme Styles) */
.smartcta-pop.smartcta--theme-navy .smartcta-pop__title,
.smartcta-pop.smartcta--theme-black .smartcta-pop__title,
.smartcta-pop.smartcta--theme-slate .smartcta-pop__title,
.smartcta-pop.smartcta--theme-glass .smartcta-pop__title {
    color: #ffffff !important;
}

/* Ensure close button is visible on dark themes */
.smartcta-pop.smartcta--theme-navy .smartcta-pop__close,
.smartcta-pop.smartcta--theme-black .smartcta-pop__close,
.smartcta-pop.smartcta--theme-slate .smartcta-pop__close,
.smartcta-pop.smartcta--theme-glass .smartcta-pop__close {
    color: #ffffff !important;
    opacity: 0.8;
}
.smartcta-pop.smartcta--theme-navy .smartcta-pop__close:hover,
.smartcta-pop.smartcta--theme-black .smartcta-pop__close:hover,
.smartcta-pop.smartcta--theme-slate .smartcta-pop__close:hover,
.smartcta-pop.smartcta--theme-glass .smartcta-pop__close:hover {
    background-color: rgba(255,255,255,0.15);
}

/* Light Themes (White) -> FORCE DARK TEXT */
.smartcta-pop.smartcta--theme-white .smartcta-pop__dialog {
    color: #1e293b !important;
    --sc-text: #1e293b;
}
.smartcta-pop.smartcta--theme-white .smartcta-pop__title {
    color: #1e293b !important;
}
.smartcta-pop.smartcta--theme-white .smartcta-pop__close {
    color: #1e293b !important;
}

/* --------------------------------------------------------------------------
   4. Content Elements
   -------------------------------------------------------------------------- */
.smartcta-pop__close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	color: var(--sc-text);
	opacity: 0.6;
	cursor: pointer;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	line-height: 1;
	transition: all 0.2s;
}

.smartcta-pop__close:hover {
	background-color: rgba(0,0,0,0.05);
	opacity: 1;
}

.smartcta-pop__title {
	margin: 0 0 16px 0;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.2;
    /* Default inherit, overridden above by specific theme rules */
    color: inherit; 
}

.smartcta-pop__body {
	margin: 0 0 24px 0;
	font-size: 1rem;
	line-height: 1.6;
	opacity: 0.9;
    color: inherit;
}

/* --------------------------------------------------------------------------
   5. Media (Image/Video)
   -------------------------------------------------------------------------- */
.smartcta-pop__media {
	margin-bottom: 24px;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.smartcta-pop__media img {
	display: block;
	width: 100%;
	height: auto;
}

/* Video Wrapper (Aspect Ratio Lock) */
.smartcta-pop__video-wrap {
	position: relative;
	width: 100%;
	padding-top: 56.25%; /* 16:9 Aspect Ratio */
	background: #000;
}

.smartcta-pop__video-wrap iframe,
.smartcta-pop__video-wrap video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* --------------------------------------------------------------------------
   6. Modal Button (Inherits from Theme)
   -------------------------------------------------------------------------- */
.smartcta-pop__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 32px;
	font-size: 1rem;
	font-weight: 600;
	text-decoration: none;
	border-radius: 8px;
	cursor: pointer;
	
	/* Inherit variables from parent theme/frontend.css */
	background-color: var(--sc-btn-bg, #3b82f6);
	color: var(--sc-btn-text, #ffffff) !important;
	border: 1px solid transparent;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
	transition: all 0.2s;
}

.smartcta-pop__btn:hover {
	transform: translateY(-2px);
	background-color: var(--sc-btn-hover, #2563eb);
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Outline Style Override for Popup */
.smartcta--style-outline .smartcta-pop__btn {
	background-color: transparent;
	border: 2px solid var(--sc-btn-bg);
	color: var(--sc-btn-bg) !important;
	box-shadow: none;
}
.smartcta--style-outline .smartcta-pop__btn:hover {
	background-color: var(--sc-btn-bg);
	color: #ffffff !important;
}

/* Soft Style Override for Popup */
.smartcta--style-soft .smartcta-pop__btn {
	background-color: var(--sc-btn-soft-bg, rgba(59, 130, 246, 0.2));
	color: var(--sc-btn-bg) !important;
	border: 1px solid var(--sc-btn-soft-border, rgba(59, 130, 246, 0.3));
	box-shadow: none;
}
.smartcta--style-soft .smartcta-pop__btn:hover {
	background-color: var(--sc-btn-bg);
	color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   7. Animation Styles
   -------------------------------------------------------------------------- */
.smartcta--anim-fade .smartcta-pop__dialog {
	transform: none;
	opacity: 0;
	transition: opacity 0.3s ease;
}
.smartcta-pop[aria-hidden="false"].smartcta--anim-fade .smartcta-pop__dialog {
	opacity: 1;
}

.smartcta--anim-scale .smartcta-pop__dialog {
	transform: scale(0.8);
	opacity: 0;
}
.smartcta-pop[aria-hidden="false"].smartcta--anim-scale .smartcta-pop__dialog {
	transform: scale(1);
	opacity: 1;
}

/* --------------------------------------------------------------------------
   8. Dark Mode & Accessibility
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
	/* Only apply default dark mode if NO specific theme class is set */
	.smartcta-pop:not([class*="smartcta--theme-"]) .smartcta-pop__dialog {
		background-color: #1e293b;
		color: #ffffff;
	}
}

@media (prefers-reduced-motion: reduce) {
	.smartcta-pop,
	.smartcta-pop__dialog {
		transition: none !important;
		animation: none !important;
	}
}