/**
 * Robo Gym Lead Popup — Stylesheet
 *
 * Dark premium design matching robo-gym.co.za branding.
 * Red accent (#E40914), dark surface (#1A242E), white text.
 *
 * @package Robogym_Lead_Popup
 * @version 1.0.0
 */

/* ─────────────────────────────────────────────────────────────────────────────
   Typography — Import Montserrat from Google Fonts
   ───────────────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&display=swap');

/* ─────────────────────────────────────────────────────────────────────────────
   CSS Custom Properties (Design Tokens)
   ───────────────────────────────────────────────────────────────────────────── */
:root {
	--rg-brand:          #E40914;
	--rg-brand-dark:     #C5070F;
	--rg-brand-light:    rgba(228, 9, 20, 0.15);
	--rg-surface:        #1A242E;
	--rg-surface-light:  #222F3B;
	--rg-text-primary:   #FFFFFF;
	--rg-text-secondary: #B0B8C1;
	--rg-text-muted:     #6B7A87;
	--rg-overlay-bg:     rgba(0, 0, 0, 0.75);
	--rg-radius:         18px;
	--rg-shadow:
		0 4px 6px -1px rgba(0, 0, 0, 0.25),
		0 20px 60px -10px rgba(0, 0, 0, 0.55),
		0 0 0 1px rgba(255, 255, 255, 0.05);
	--rg-font:           'Montserrat', 'Segoe UI', Tahoma, Arial, sans-serif;
	--rg-transition:     0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Body Lock — prevent scroll when popup is open
   ───────────────────────────────────────────────────────────────────────────── */
body.robogym-lp-body-lock {
	overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Keyframe Animations
   ───────────────────────────────────────────────────────────────────────────── */

@keyframes rg-overlay-in {
	from {
		opacity: 0;
		backdrop-filter: blur(0px);
	}
	to {
		opacity: 1;
		backdrop-filter: blur(6px);
	}
}

@keyframes rg-modal-in {
	from {
		opacity: 0;
		transform: scale(0.90) translateY(20px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

@keyframes rg-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.05); }
}

@keyframes rg-shake {
	0%, 100% { transform: translateX(0); }
	20% { transform: translateX(-6px); }
	40% { transform: translateX(6px); }
	60% { transform: translateX(-4px); }
	80% { transform: translateX(4px); }
}

@keyframes rg-spin {
	to { transform: rotate(360deg); }
}

@keyframes rg-success-in {
	from {
		opacity: 0;
		transform: scale(0.8);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* ─────────────────────────────────────────────────────────────────────────────
   Overlay — Dark Semi-transparent Backdrop
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-overlay {
	display: flex;
	align-items: center;
	justify-content: center;
	position: fixed;
	inset: 0;
	z-index: 999999;
	padding: 20px;
	background-color: var(--rg-overlay-bg);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);

	/* Hidden state */
	opacity: 0;
	pointer-events: none;
	visibility: hidden;

	transition:
		opacity var(--rg-transition),
		visibility var(--rg-transition);
}

.robogym-lp-overlay.is-visible {
	opacity: 1;
	pointer-events: auto;
	visibility: visible;
	animation: rg-overlay-in 0.35s ease forwards;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Modal Card
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-modal {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	width: 100%;
	max-width: 520px;
	background: var(--rg-surface);
	border-radius: var(--rg-radius);
	box-shadow: var(--rg-shadow);
	padding: 48px 40px 36px;

	/* Top accent border */
	border-top: 4px solid var(--rg-brand);

	/* Hidden when overlay is hidden */
	opacity: 0;
	transform: scale(0.90) translateY(20px);
	transition:
		opacity var(--rg-transition),
		transform var(--rg-transition);
}

/* Width variants */
.robogym-lp-modal[data-width="small"] {
	max-width: 400px;
}
.robogym-lp-modal[data-width="large"] {
	max-width: 640px;
}

/* Animate modal card when overlay becomes visible */
.robogym-lp-overlay.is-visible .robogym-lp-modal {
	animation: rg-modal-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Close Button (X)
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-close {
	position: absolute;
	top: 14px;
	right: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: var(--rg-text-muted);
	cursor: pointer;
	padding: 0;
	line-height: 1;
	transition:
		background-color 0.2s ease,
		color 0.2s ease,
		transform 0.2s ease;
}

.robogym-lp-close:hover {
	background-color: rgba(255, 255, 255, 0.15);
	color: var(--rg-text-primary);
	transform: rotate(90deg);
}

.robogym-lp-close:focus-visible {
	outline: 2px solid var(--rg-brand);
	outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Popup Image
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-image-wrap {
	width: calc( 100% + 80px );
	margin: -48px -40px 24px;
	overflow: hidden;
	border-radius: calc( var(--rg-radius) - 4px ) calc( var(--rg-radius) - 4px ) 0 0;
	max-height: 200px;
	flex-shrink: 0;
}

.robogym-lp-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Icon Accent (fallback)
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 68px;
	height: 68px;
	border-radius: 16px;
	background: var(--rg-brand-light);
	color: var(--rg-brand);
	margin-bottom: 20px;
	flex-shrink: 0;
	animation: rg-pulse 2.5s ease-in-out infinite;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Badge / Label (LIMITED TIME OFFER)
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-badge {
	display: inline-block;
	font-family: var(--rg-font) !important;
	font-size: 0.75rem !important;
	font-weight: 800 !important;
	letter-spacing: 0.12em !important;
	text-transform: uppercase;
	color: var(--rg-brand) !important;
	background: var(--rg-brand-light);
	padding: 6px 18px !important;
	border-radius: 100px;
	margin-bottom: 16px !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Headline
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-headline {
	font-family: var(--rg-font) !important;
	font-size: 1.55rem !important;
	font-weight: 800 !important;
	line-height: 1.2 !important;
	color: var(--rg-text-primary) !important;
	margin: 0 0 12px !important;
	padding: 0 !important;
	letter-spacing: -0.02em !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Body Text
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-body {
	font-family: var(--rg-font) !important;
	font-size: 0.9rem !important;
	font-weight: 400 !important;
	line-height: 1.7 !important;
	color: var(--rg-text-secondary) !important;
	margin: 0 0 24px !important;
	padding: 0 !important;
	max-width: 420px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Lead Capture Form
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-form {
	width: 100%;
	max-width: 380px;
}

.robogym-lp-input-group {
	margin-bottom: 14px;
}

.robogym-lp-input-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.robogym-lp-input-icon {
	position: absolute;
	left: 16px;
	color: var(--rg-text-muted);
	pointer-events: none;
	flex-shrink: 0;
}

.robogym-lp-input {
	width: 100% !important;
	padding: 14px 16px 14px 46px !important;
	border: 2px solid rgba(255, 255, 255, 0.1) !important;
	border-radius: 12px !important;
	background: var(--rg-surface-light) !important;
	color: var(--rg-text-primary) !important;
	font-family: var(--rg-font) !important;
	font-size: 0.95rem !important;
	font-weight: 500 !important;
	outline: none !important;
	transition:
		border-color 0.2s ease,
		box-shadow 0.2s ease !important;
	box-sizing: border-box !important;
}

.robogym-lp-input::placeholder {
	color: var(--rg-text-muted) !important;
	font-weight: 400 !important;
}

.robogym-lp-input:focus {
	border-color: var(--rg-brand) !important;
	box-shadow: 0 0 0 3px var(--rg-brand-light) !important;
}

.robogym-lp-input.has-error {
	border-color: var(--rg-brand) !important;
	animation: rg-shake 0.4s ease;
}

/* Error message */
.robogym-lp-error {
	font-family: var(--rg-font) !important;
	font-size: 0.8rem !important;
	font-weight: 500 !important;
	color: var(--rg-brand) !important;
	margin: 8px 0 0 !important;
	padding: 0 !important;
	min-height: 0;
	text-align: left;
}

.robogym-lp-error:empty {
	display: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CTA Button
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-cta {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 8px !important;
	width: 100% !important;
	padding: 15px 28px !important;
	border-radius: 12px !important;
	background: var(--rg-brand) !important;
	color: #ffffff !important;
	font-family: var(--rg-font) !important;
	font-size: 1rem !important;
	font-weight: 700 !important;
	letter-spacing: -0.01em !important;
	text-transform: uppercase;
	text-decoration: none !important;
	border: none !important;
	cursor: pointer;
	box-shadow:
		0 1px 3px rgba(228, 9, 20, 0.3),
		0 8px 24px rgba(228, 9, 20, 0.35) !important;
	transition:
		background-color 0.2s ease,
		box-shadow 0.2s ease,
		transform 0.15s ease !important;
	margin-bottom: 16px !important;
	position: relative;
}

.robogym-lp-cta:hover {
	background: var(--rg-brand-dark) !important;
	box-shadow:
		0 1px 3px rgba(228, 9, 20, 0.3),
		0 12px 32px rgba(228, 9, 20, 0.45) !important;
	transform: translateY(-2px) !important;
	text-decoration: none !important;
	color: #ffffff !important;
}

.robogym-lp-cta:active {
	transform: translateY(0) !important;
}

.robogym-lp-cta:focus-visible {
	outline: 2px solid var(--rg-brand) !important;
	outline-offset: 3px !important;
}

/* Loading state */
.robogym-lp-cta.is-loading {
	pointer-events: none;
	opacity: 0.85 !important;
}

.robogym-lp-cta.is-loading .robogym-lp-cta-text {
	opacity: 0;
}

.robogym-lp-cta-spinner {
	display: none;
	position: absolute;
	width: 22px;
	height: 22px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: rg-spin 0.6s linear infinite;
}

.robogym-lp-cta.is-loading .robogym-lp-cta-spinner {
	display: block;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Success State
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-success {
	display: none;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 10px 0 16px;
	animation: rg-success-in 0.4s ease both;
}

.robogym-lp-success.is-visible {
	display: flex;
}

.robogym-lp-success svg {
	color: #22c55e;
	margin-bottom: 16px;
}

.robogym-lp-success-text {
	font-family: var(--rg-font) !important;
	font-size: 1rem !important;
	font-weight: 600 !important;
	color: var(--rg-text-primary) !important;
	margin: 0 !important;
	line-height: 1.5 !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Dismiss / "No thanks" Link
   ───────────────────────────────────────────────────────────────────────────── */
.robogym-lp-dismiss {
	background: none;
	border: none;
	padding: 4px 0;
	font-family: var(--rg-font);
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--rg-text-muted);
	cursor: pointer;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-underline-offset: 3px;
	transition:
		color 0.2s ease,
		text-decoration-color 0.2s ease;
}

.robogym-lp-dismiss:hover {
	color: var(--rg-text-secondary);
	text-decoration-color: var(--rg-text-secondary);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive — Mobile
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
	.robogym-lp-overlay {
		padding: 16px;
		align-items: flex-end;
	}

	.robogym-lp-modal {
		padding: 36px 20px 28px;
		border-radius: 20px 20px 16px 16px;
		max-width: 100%;
	}

	.robogym-lp-headline {
		font-size: 1.3rem !important;
	}

	.robogym-lp-body {
		font-size: 0.85rem !important;
	}

	.robogym-lp-image-wrap {
		width: calc( 100% + 40px );
		margin: -36px -20px 20px;
	}
}

/* ─────────────────────────────────────────────────────────────────────────────
   Respect user's reduced-motion preference
   ───────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.robogym-lp-overlay,
	.robogym-lp-overlay.is-visible,
	.robogym-lp-overlay.is-visible .robogym-lp-modal {
		animation: none !important;
		transition: none !important;
	}

	.robogym-lp-overlay.is-visible {
		opacity: 1;
	}

	.robogym-lp-overlay.is-visible .robogym-lp-modal {
		opacity: 1;
		transform: none;
	}

	.robogym-lp-close:hover {
		transform: none;
	}

	.robogym-lp-cta:hover {
		transform: none !important;
	}

	.robogym-lp-icon {
		animation: none;
	}

	.robogym-lp-input.has-error {
		animation: none;
	}
}
