/* S Popup Frontend Styles - Namespaced to prevent conflicts */

/* Removed external icon imports to comply with wp.org guidelines */

/* Prevent conflicts with other plugins */
.sp-popup-container {
	/* Namespace container */
}

/* Overlay */
.sp-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	display: none;
	z-index: 9998;
}

.sp-overlay.is-open {
	display: block;
}

/* Modal */
.sp-modal {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-width: 90vw;
	max-height: 90vh;
	overflow: auto;
	background: #fff;
	color: #111;
	border-radius: 8px;
	padding: 24px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
	display: none;
	z-index: 9999;
}

/* Form-only modal tweaks */
.sp-modal.sp-modal--form-only { padding: 0; }
.sp-modal.sp-modal--form-only .sp-content { padding: 0; }

/* Modal adjustments for outside close buttons */
.sp-modal:has(.sp-close-button--circle-outside),
.sp-modal:has(.sp-close-button--square-outside) {
	margin-top: 20px;
	margin-right: 20px;
}

/* Modal with border */
.sp-modal--has-border {
	border: 1px solid #ddd;
}

/* Modal positions */
.sp-modal--left {
	left: 20px;
	transform: translateY(-50%);
}

.sp-modal--right {
	left: auto;
	right: 20px;
	transform: translateY(-50%);
}

.sp-modal.is-open {
	display: block;
}

/* Modal sizes */
.sp-modal--sm {
	width: 360px;
}

.sp-modal--md {
	width: 560px;
}

.sp-modal--lg {
	width: 760px;
}

/* Custom sizes - will be overridden by inline styles from JS */
.sp-modal[data-sp-use-custom-size="1"] {
	/* Custom sizes applied via JavaScript */
}

/* Modal border */
.sp-modal--border {
	border: 1px solid #e2e8f0;
}

/* Modal positions */
.sp-modal--left {
	left: 20px;
	transform: translateY(-50%);
}

.sp-modal--right {
	left: auto;
	right: 20px;
	transform: translateY(-50%);
}

/* Close button base */
.sp-close-button {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 32px;
	height: 32px;
	border: none;
	background: rgba(0, 0, 0, 0.1);
	color: #666;
	font-size: 18px;
	font-weight: bold;
	cursor: pointer;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	z-index: 10000;
}

/* Left-positioned close button */
.sp-close-button.sp-close-button--left {
	left: 8px;
	right: auto;
}

.sp-close-button:hover {
	background: rgba(0, 0, 0, 0.2);
	color: #333;
	transform: scale(1.1);
}

/* Default style */
.sp-close-button--default::before {
	content: '×';
	font-size: 20px;
	line-height: 1;
}

/* Circle style */
.sp-close-button--circle {
	background: #ff4757;
	color: white;
	box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
}

.sp-close-button--circle:hover {
	background: #ff3742;
	transform: scale(1.1);
	box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
}

/* use the built-in × character via .sp-close-icon */

/* Square style */
.sp-close-button--square {
	border-radius: 6px;
	background: #2f3542;
	color: white;
	box-shadow: 0 2px 8px rgba(47, 53, 66, 0.3);
}

.sp-close-button--square:hover {
	background: #1e2127;
	transform: scale(1.1);
	box-shadow: 0 4px 12px rgba(47, 53, 66, 0.4);
}

/* icon handled by .sp-close-icon */

/* Circle outside popup */
.sp-close-button--circle-outside {
	top: -16px;
	right: -16px;
	background: #ff4757;
	color: white;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	border: 3px solid white;
}

/* Left variant for outside circle */
.sp-close-button--circle-outside.sp-close-button--left {
	left: -16px;
	right: auto;
}

.sp-close-button--circle-outside:hover {
	background: #ff3742;
	transform: scale(1.1);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* icon handled by .sp-close-icon */

/* Square outside popup */
.sp-close-button--square-outside {
	top: -16px;
	right: -16px;
	border-radius: 6px;
	background: #2f3542;
	color: white;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	border: 3px solid white;
}

/* Left variant for outside square */
.sp-close-button--square-outside.sp-close-button--left {
	left: -16px;
	right: auto;
}

.sp-close-button--square-outside:hover {
	background: #1e2127;
	transform: scale(1.1);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* icon handled by .sp-close-icon */

/* Minimal style */
.sp-close-button--minimal {
	background: transparent;
	color: #999;
	font-size: 24px;
	width: 24px;
	height: 24px;
	top: 12px;
	right: 12px;
}

.sp-close-button--minimal:hover {
	background: rgba(0, 0, 0, 0.1);
	color: #333;
	transform: scale(1.2);
}

/* icon handled by .sp-close-icon */

/* Modern style */
.sp-close-button--modern {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: white;
	box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
	border-radius: 8px;
}

.sp-close-button--modern:hover {
	background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
	transform: scale(1.1);
	box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* icon handled by .sp-close-icon */

/* Elegant style */
.sp-close-button--elegant {
	background: rgba(255, 255, 255, 0.9);
	color: #333;
	border: 1px solid rgba(0, 0, 0, 0.1);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	backdrop-filter: blur(10px);
}

.sp-close-button--elegant:hover {
	background: rgba(255, 255, 255, 1);
	color: #000;
	transform: scale(1.1);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* icon handled by .sp-close-icon */

/* Responsive adjustments */
@media (max-width: 768px) {
	.sp-close-button--circle-outside,
	.sp-close-button--square-outside {
		top: -12px;
		right: -12px;
		width: 28px;
		height: 28px;
	}

	/* Adjust left variants on small screens */
	.sp-close-button--circle-outside.sp-close-button--left,
	.sp-close-button--square-outside.sp-close-button--left {
		left: -12px;
		right: auto;
	}
	
	.sp-close-button--circle-outside::before,
	.sp-close-button--square-outside::before {
		font-size: 14px;
	}
}

/* Always show the × mark inside the close button */
.sp-close-button .sp-close-icon { display: block; line-height: 1; font-size: 18px; }

/* Focus styles for accessibility */
.sp-close-button:focus {
	outline: 2px solid #007cba;
	outline-offset: 2px;
}

.sp-close-button:focus:not(:focus-visible) {
	outline: none;
}

/* Action button */
.sp-action-button {
	display: block;
	padding: 12px 20px;
	background-color: #007cba;
	color: white;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: 16px;
	font-weight: 600;
	margin: 10px 0;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

/* Action button alignments */
.sp-action-button--center {
	margin-left: auto;
	margin-right: auto;
	width: auto;
}

.sp-action-button--full-width {
	width: 100%;
}

.sp-action-button--left {
	margin-left: 0;
	margin-right: auto;
	width: auto;
}

.sp-action-button--right {
	margin-left: auto;
	margin-right: 0;
	width: auto;
}

.sp-action-button:hover {
	background-color: #005a87;
	transform: translateY(-1px);
}

.sp-action-button:active {
	transform: translateY(0);
}

/* Shortcode trigger button */
.sp-popup-trigger-wrapper {
	display: flex;
	margin: 16px 0;
}

.sp-popup-trigger-wrapper--left { justify-content: flex-start; }
.sp-popup-trigger-wrapper--center { justify-content: center; }
.sp-popup-trigger-wrapper--right { justify-content: flex-end; }
.sp-popup-trigger-wrapper--full {
	display: block;
}

.sp-popup-trigger-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35em;
	padding: 8px 32px !important;
	background-color: #007cba;
	color: #fff;
	border: 1px solid #007cba;
	border-radius: 999px;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
	box-shadow: 0 4px 12px rgba(0, 124, 186, 0.22);
	line-height: 1.2;
	min-height: auto;
	height: auto;
	box-sizing: border-box;
}

.sp-popup-trigger-button--full {
	width: 100%;
}

.sp-popup-trigger-wrapper--full .sp-popup-trigger-button {
	width: 100%;
}

.sp-popup-trigger-button:hover,
.sp-popup-trigger-button:focus {
	background-color: #005a87;
	border-color: #005a87;
	box-shadow: 0 6px 18px rgba(0, 90, 135, 0.35);
	transform: translateY(-1px);
	color: #fff;
}

.sp-popup-trigger-button:active {
	transform: translateY(0);
	box-shadow: 0 3px 10px rgba(0, 90, 135, 0.25);
}

.sp-popup-trigger-button:focus-visible {
	outline: 2px solid #111;
	outline-offset: 3px;
}

/* Content */
.sp-content {
	line-height: 1.6;
}

/* Form-only wrapper alignment */
.sp-form-only {
	display: flex;
	width: 100%;
	padding: 0;
	box-sizing: border-box;
}
.sp-form-only.sp-form-only--center { justify-content: center; }
.sp-form-only.sp-form-only--left { justify-content: flex-start; }
.sp-form-only.sp-form-only--right { justify-content: flex-end; }
.sp-form-only__inner { 
	width: 100%; 
	max-width: 640px; 
	margin: 0 !important; /* Reset margin, will be set by JavaScript */
}

/* Ensure margin can be applied by JavaScript */
.sp-modal .sp-form-only .sp-form-only__inner {
	margin: 0 !important;
}
.sp-form-only.sp-form-only--left .sp-form-only__inner { max-width: 520px; }
.sp-form-only.sp-form-only--right .sp-form-only__inner { max-width: 520px; }

/* Separate alignment for desktop/mobile */
.sp-form-only--desktop-center { justify-content: center; }
.sp-form-only--desktop-left { justify-content: flex-start; }
.sp-form-only--desktop-right { justify-content: flex-end; }
/* Width for left/right will be set by JavaScript based on data attribute */

@media (max-width: 768px) {
	.sp-form-only--mobile-center { justify-content: center !important; }
	.sp-form-only--mobile-left { justify-content: flex-start !important; }
	.sp-form-only--mobile-right { justify-content: flex-end !important; }
	.sp-form-only--mobile-left .sp-form-only__inner { max-width: 520px; }
	.sp-form-only--mobile-right .sp-form-only__inner { max-width: 520px; }
}

/* CF7 submit button (form-only popup) */
.sp-modal .wpcf7-submit,
.sp-form-only .wpcf7-submit,
.sp-modal input.wpcf7-submit.xc-form__submit {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-color: #e53935;
	border: 1px solid #c62828;
	color: #fff;
	border-radius: 6px;
	padding: 10px 16px 10px 42px;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
	background-repeat: no-repeat;
	background-position: 14px center;
	background-size: 18px 18px;
	/* Download icon (white) */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E");
}

.sp-modal .wpcf7-submit:hover,
.sp-form-only .wpcf7-submit:hover,
.sp-modal input.wpcf7-submit.xc-form__submit:hover {
	background-color: #d32f2f;
	box-shadow: 0 4px 12px rgba(229, 57, 53, 0.3);
}

.sp-modal .wpcf7-submit:active,
.sp-form-only .wpcf7-submit:active,
.sp-modal input.wpcf7-submit.xc-form__submit:active {
	transform: translateY(1px);
}

.sp-modal .wpcf7-submit:focus,
.sp-form-only .wpcf7-submit:focus,
.sp-modal input.wpcf7-submit.xc-form__submit:focus {
	outline: 2px solid rgba(229, 57, 53, 0.5);
	outline-offset: 2px;
}
/* Rows inside popup */
.sp-row {
	display: block;
	margin-top: 16px;
}

.sp-row--media-form {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	align-items: start;
	max-width: 100%;
}
.sp-row--media-form.sp-row--layout-vertical {
	display: flex;
	flex-direction: column;
	gap: 16px;
}
.sp-row--media-form.sp-row--layout-vertical .sp-col {
	width: 100%;
}
.sp-row--media-form.sp-row--layout-overlay {
	display: grid;
	gap: 0;
	position: relative;
	min-height: 320px;
}
.sp-row--media-form.sp-row--layout-overlay .sp-col {
	grid-area: 1 / 1 / 2 / 2;
	width: 100%;
}
.sp-row--media-form.sp-row--layout-overlay .sp-col--media {
	z-index: 1;
}
.sp-row--media-form.sp-row--layout-overlay .sp-col--form {
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding: 24px;
	background: rgba(255, 255, 255, 0.92);
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.sp-row--media-form.sp-row--layout-overlay .sp-col--media .sp-media-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (max-width: 768px) {
	.sp-row--media-form.sp-row--layout-overlay {
		min-height: 260px;
	}
	.sp-row--media-form.sp-row--layout-overlay .sp-col--form {
		padding: 16px;
	}
}

.sp-col img.sp-media-img,
.sp-col .sp-media-img img {
	max-width: 100%;
	height: auto;
	display: block;
	border-radius: 6px;
}

/* Image display modes */
.sp-media-img {
	width: 100%;
	height: auto;
	object-fit: contain;
	object-position: center center;
}

.sp-media-img.sp-media-img--fit-top { object-position: top center; }
.sp-media-img.sp-media-img--fit-bottom { object-position: bottom center; }

/* Cover mode: make the media column a cover container */
.sp-media-img.sp-media-img--cover {
	width: 100%;
	height: 100%;
	max-height: 420px;
	object-fit: cover;
	object-position: center center;
}

.sp-row--media-form .sp-col--left:has(.sp-media-img--cover),
.sp-row--media-form .sp-col--right:has(.sp-media-img--cover) {
	position: relative;
	min-height: 220px;
}

@media (max-width: 768px) {
	.sp-media-img.sp-media-img--cover { max-height: 260px; }
}

.sp-row--extra-text {
	margin-top: 12px;
}

/* Background cover column */
.sp-col.sp-col--bg-cover {
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center center;
	border-radius: 6px;
	width: 100%;
	max-width: 100%;
	max-height: calc(100vh - 140px);
}
.sp-col.sp-col--bg-cover.sp-bgpos-top { background-position: top center; }
.sp-col.sp-col--bg-cover.sp-bgpos-center { background-position: center center; }
.sp-col.sp-col--bg-cover.sp-bgpos-bottom { background-position: bottom center; }

/* Ensure some vertical height for background columns */
.sp-row--media-form .sp-col--bg-cover { min-height: 260px; }
@media (min-width: 769px) {
	.sp-row--media-form .sp-col--bg-cover { min-height: 360px; }
}

/* Separate images for desktop/mobile */
.sp-media-img--desktop {
	display: none;
}
.sp-media-img--mobile {
	display: block;
}
@media (min-width: 769px) {
	.sp-media-img--desktop {
		display: block;
	}
	.sp-media-img--mobile {
		display: none;
	}
}

/* Cover mode with separate images - handled by JavaScript */

@media (max-width: 768px) {
	.sp-row--media-form {
		grid-template-columns: 1fr;
	}
}

.sp-content p:last-child {
	margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
	.sp-modal {
		width: 90vw !important;
		max-width: 90vw !important;
		max-height: 90vh !important;
		padding: 20px;
	}
	
	.sp-modal--sm,
	.sp-modal--md,
	.sp-modal--lg {
		width: 90vw !important;
		max-width: 90vw !important;
		max-height: 90vh !important;
	}
	
	.sp-modal.sp-modal--form-only {
		width: 90vw !important;
		max-width: 90vw !important;
		max-height: 90vh !important;
	}
	
	.sp-modal--left,
	.sp-modal--right {
		left: 50%;
		right: auto;
		transform: translate(-50%, -50%);
	}
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
	.sp-close,
	.sp-action-button {
		transition: none;
	}
	
	.sp-close:hover {
		transform: none;
	}
	
	.sp-action-button:hover {
		transform: none;
	}
}

/* High contrast mode */
@media (prefers-contrast: high) {
	.sp-modal {
		border: 2px solid #000;
	}
	
	.sp-close {
		background: #000;
		color: #fff;
	}
	
	.sp-action-button {
		background: #000;
		border: 2px solid #000;
	}
}

/* Print styles */
@media print {
	.sp-overlay,
	.sp-modal {
		display: none !important;
	}
}