/**
 * Analytics Locked Page
 *
 * Forumax analytics presentation for free users.
 *
 * @package Forumax
 * @since   2.3.0
 */

/* ─── Variables ──────────────────────────────────── */
$frmx-purple-900: #581c87;
$frmx-purple-700: #7c3aed;
$frmx-purple-600: #8b5cf6;
$frmx-purple-500: #a78bfa;
$frmx-purple-200: #ddd6fe;
$frmx-purple-100: #ede9fe;
$frmx-purple-50:  #f5f3ff;
$frmx-purple-25:  #faf5ff;

$frmx-indigo:  #6366f1;
$frmx-teal:    #14b8a6;
$frmx-amber:   #f59e0b;
$frmx-green:   #10b981;
$frmx-blue:    #3b82f6;

$frmx-slate-900: #0f172a;
$frmx-slate-800: #1e293b;
$frmx-slate-700: #334155;
$frmx-slate-500: #64748b;
$frmx-slate-400: #94a3b8;
$frmx-slate-300: #cbd5e1;
$frmx-slate-200: #e2e8f0;
$frmx-slate-100: #f1f5f9;
$frmx-slate-50:  #f8fafc;

/* ─── Reset & base ──────────────────────────────── */
.frmx-analytics-page {
	margin: 20px 20px 20px 0;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
		Oxygen, Ubuntu, sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;

	*,
	*::before,
	*::after {
		box-sizing: border-box;
	}
}

/* ─── Shell ───────────────────────────────────────── */
.frmx-analytics-shell {
	width: 100%;
	background: $frmx-slate-50;
	border: 1px solid $frmx-slate-200;
	border-radius: 20px;
	overflow: hidden;
	box-shadow:
		0 1px 3px rgba($frmx-slate-900, 0.04),
		0 12px 40px rgba($frmx-slate-900, 0.06);
}

/* ─── Shared badge / kicker ──────────────────────── */
.frmx-analytics-kicker {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border-radius: 999px;
	background: rgba(#fff, 0.14);
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;

	&--dark {
		background: rgba($frmx-purple-700, 0.1);
		color: $frmx-purple-700;
	}
}

/* ─── Buttons ────────────────────────────────────── */
.frmx-analytics-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 22px;
	border-radius: 12px;
	border: 1px solid transparent;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

	svg {
		flex-shrink: 0;
	}

	&--accent {
		background: linear-gradient(135deg, #f7b14f 0%, $frmx-amber 100%);
		border-color: rgba($frmx-amber, 0.3);
		color: #1c1917;
		box-shadow:
			0 1px 2px rgba($frmx-amber, 0.3),
			0 4px 12px rgba($frmx-amber, 0.15);

		&:hover {
			background: linear-gradient(135deg, #f5a83d 0%, darken($frmx-amber, 8%) 100%);
			color: #1c1917;
			box-shadow:
				0 1px 2px rgba($frmx-amber, 0.4),
				0 8px 20px rgba($frmx-amber, 0.25);
			transform: translateY(-1px);
		}
	}

	&--secondary {
		background: #fff;
		border-color: $frmx-slate-200;
		color: $frmx-slate-800;
		box-shadow: 0 1px 3px rgba($frmx-slate-900, 0.06);

		&:hover {
			border-color: $frmx-slate-300;
			background: $frmx-slate-50;
			color: $frmx-slate-900;
			box-shadow: 0 2px 8px rgba($frmx-slate-900, 0.08);
			transform: translateY(-1px);
		}
	}

	&--primary {
		background: linear-gradient(135deg, $frmx-purple-700 0%, darken($frmx-purple-700, 6%) 100%);
		color: #fff;
		border-color: rgba($frmx-purple-700, 0.3);
		box-shadow:
			0 1px 2px rgba($frmx-purple-700, 0.3),
			0 4px 12px rgba($frmx-purple-700, 0.2);

		&:hover {
			background: linear-gradient(135deg, darken($frmx-purple-700, 6%) 0%, darken($frmx-purple-700, 12%) 100%);
			color: #fff;
			box-shadow:
				0 1px 2px rgba($frmx-purple-700, 0.4),
				0 8px 20px rgba($frmx-purple-700, 0.3);
			transform: translateY(-1px);
		}
	}
}

/* ─── Top bar ────────────────────────────────────── */
.frmx-analytics-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding: 24px 36px 28px;
	background: linear-gradient(135deg, $frmx-purple-900 0%, $frmx-purple-700 50%, $frmx-purple-600 100%);
	position: relative;
	overflow: hidden;

	&::before {
		content: '';
		position: absolute;
		top: -60%;
		right: -10%;
		width: 400px;
		height: 400px;
		border-radius: 50%;
		background: radial-gradient(circle, rgba(#fff, 0.08) 0%, transparent 70%);
		pointer-events: none;
	}

	&::after {
		content: '';
		position: absolute;
		bottom: -40%;
		left: 15%;
		width: 300px;
		height: 300px;
		border-radius: 50%;
		background: radial-gradient(circle, rgba(#fff, 0.05) 0%, transparent 70%);
		pointer-events: none;
	}

	&__main {
		display: flex;
		align-items: center;
		gap: 18px;
		min-width: 0;
		position: relative;
		z-index: 1;
	}

	&__logo {
		width: 56px;
		height: 56px;
		border-radius: 16px;
		display: flex;
		align-items: center;
		justify-content: center;
		background: rgba(#fff, 0.12);
		border: 1px solid rgba(#fff, 0.18);
		box-shadow:
			inset 0 1px 0 rgba(#fff, 0.1),
			0 4px 12px rgba(#000, 0.1);
		backdrop-filter: blur(8px);

		img {
			height: 26px;
			width: auto;
			display: block;
		}
	}

	&__copy {
		h1 {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			gap: 10px;
			margin: 8px 0 6px;
			font-size: 28px;
			line-height: 1.1;
			letter-spacing: -0.03em;
			color: #fff;
		}

		p {
			margin: 0;
			max-width: 42ch;
			font-size: 13.5px;
			line-height: 1.65;
			color: rgba(#fff, 0.82);
		}
	}

	&__actions {
		position: relative;
		z-index: 1;
	}
}

.frmx-analytics-plan {
	display: inline-flex;
	padding: 5px 10px;
	border-radius: 999px;
	background: rgba(#fff, 0.16);
	color: #fff;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	backdrop-filter: blur(4px);
}

/* ─── Hero section ──────────────────────────────── */
.frmx-analytics-hero {
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
	gap: 40px;
	padding: 40px 36px;
	background: linear-gradient(180deg, $frmx-slate-100 0%, #fff 100%);
	border-bottom: 1px solid $frmx-slate-200;

	&__eyebrow {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		padding: 6px 12px;
		border-radius: 999px;
		background: linear-gradient(135deg, rgba($frmx-purple-700, 0.08) 0%, rgba($frmx-purple-600, 0.12) 100%);
		color: $frmx-purple-700;
		font-size: 11px;
		font-weight: 800;
		letter-spacing: 0.08em;
		text-transform: uppercase;

		svg {
			flex-shrink: 0;
		}
	}

	&__copy {
		h2 {
			margin: 18px 0 14px;
			max-width: 16ch;
			font-size: 38px;
			line-height: 1.08;
			letter-spacing: -0.04em;
			color: $frmx-slate-900;
		}

		p {
			max-width: 48ch;
			margin: 0;
			font-size: 15px;
			line-height: 1.75;
			color: $frmx-slate-500;
		}
	}

	&__actions {
		display: flex;
		flex-wrap: wrap;
		gap: 12px;
		margin-top: 24px;
	}
}

/* ─── Summary items ─────────────────────────────── */
.frmx-analytics-summary {
	display: grid;
	gap: 10px;
	margin-top: 28px;

	&__item {
		display: grid;
		grid-template-columns: 42px minmax(0, 1fr);
		gap: 14px;
		padding: 14px 16px;
		background: #fff;
		border: 1px solid $frmx-slate-200;
		border-radius: 14px;
		box-shadow: 0 1px 4px rgba($frmx-slate-900, 0.03);
		transition: all 0.2s ease;

		&:hover {
			border-color: #c7d2fe;
			box-shadow: 0 4px 16px rgba($frmx-purple-700, 0.06);
		}

		strong {
			display: block;
			margin-bottom: 2px;
			font-size: 14px;
			color: $frmx-slate-900;
		}

		p {
			margin: 0;
			font-size: 12.5px;
			line-height: 1.55;
			color: $frmx-slate-500;
		}
	}

	&__icon {
		width: 42px;
		height: 42px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 12px;

		&--blue {
			background: linear-gradient(135deg, rgba($frmx-blue, 0.1) 0%, rgba($frmx-blue, 0.16) 100%);
			color: $frmx-blue;
		}

		&--purple {
			background: linear-gradient(135deg, rgba($frmx-purple-700, 0.1) 0%, rgba($frmx-purple-700, 0.16) 100%);
			color: $frmx-purple-700;
		}

		&--green {
			background: linear-gradient(135deg, rgba($frmx-green, 0.1) 0%, rgba($frmx-green, 0.16) 100%);
			color: $frmx-green;
		}
	}
}

/* ─── Preview widget ────────────────────────────── */
.frmx-analytics-preview {
	&__window {
		padding: 16px;
		background: #fff;
		border: 1px solid $frmx-slate-200;
		border-radius: 24px;
		box-shadow:
			0 1px 3px rgba($frmx-slate-900, 0.04),
			0 12px 36px rgba($frmx-slate-900, 0.07);
	}

	&__top {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		margin-bottom: 16px;
		padding: 4px 4px 0;
	}

	&__dots {
		display: flex;
		gap: 6px;

		span {
			width: 8px;
			height: 8px;
			border-radius: 50%;
			background: $frmx-slate-200;

			&:first-child {
				background: $frmx-purple-500;
			}

			&:nth-child(2) {
				background: $frmx-purple-200;
			}
		}
	}

	&__label {
		font-size: 12px;
		font-weight: 700;
		color: $frmx-purple-700;
		letter-spacing: 0.02em;
	}

	/* Preview stats */
	&__stats {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 12px;
	}

	&__stat {
		padding: 16px 14px 14px;
		background: #fafbff;
		border: 1px solid #eef2ff;
		border-radius: 16px;
		transition: all 0.2s ease;

		&:hover {
			border-color: #c7d2fe;
			background: $frmx-purple-50;
		}

		label {
			display: block;
			margin-bottom: 4px;
			font-size: 11px;
			font-weight: 700;
			color: $frmx-slate-400;
			text-transform: uppercase;
			letter-spacing: 0.04em;
		}

		strong {
			display: block;
			font-size: 26px;
			line-height: 1;
			letter-spacing: -0.03em;
			color: $frmx-slate-900;
		}
	}

	/* Sparklines */
	&__sparkline {
		margin-top: 8px;
		height: 24px;
		opacity: 0.6;

		svg {
			width: 100%;
			height: 100%;
		}
	}

	/* Preview chart */
	&__chart {
		position: relative;
		margin-top: 14px;
		border-radius: 18px;
		overflow: hidden;
		background: linear-gradient(180deg, $frmx-purple-50 0%, $frmx-purple-100 100%);
	}

	&__chart-bars {
		display: flex;
		align-items: flex-end;
		gap: 10px;
		height: 220px;
		padding: 20px 18px 24px;
	}

	/* Lock overlay */
	&__lock {
		position: absolute;
		inset: 0;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 10px;
		background: rgba(#fff, 0.5);
		backdrop-filter: blur(4px);
		-webkit-backdrop-filter: blur(4px);

		span {
			font-size: 13px;
			font-weight: 800;
			color: #1e1b4b;
			letter-spacing: 0.02em;
		}
	}

	&__lock-icon {
		width: 44px;
		height: 44px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 50%;
		background: rgba($frmx-purple-700, 0.08);
		color: $frmx-purple-700;
	}
}

/* ─── Badges ──────────────────────────────────── */
.frmx-analytics-badge {
	display: inline-flex;
	margin-top: 8px;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;

	&--green {
		background: rgba($frmx-green, 0.1);
		color: darken($frmx-green, 8%);
	}

	&--purple {
		background: rgba($frmx-purple-600, 0.1);
		color: $frmx-purple-700;
	}

	&--amber {
		background: rgba($frmx-amber, 0.1);
		color: darken($frmx-amber, 8%);
	}
}

/* ─── Chart bars with animation ─────────────────── */
.frmx-bar {
	flex: 1;
	min-width: 0;
	border-radius: 8px 8px 4px 4px;
	background: linear-gradient(
		180deg,
		rgba($frmx-purple-600, 0.4) 0%,
		rgba($frmx-purple-700, 0.65) 100%
	);
	animation: frmx-bar-grow 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;

	&-1 { height: 22%; animation-delay: 0s; }
	&-2 { height: 38%; animation-delay: 0.06s; }
	&-3 { height: 28%; animation-delay: 0.12s; }
	&-4 { height: 55%; animation-delay: 0.18s; }
	&-5 { height: 40%; animation-delay: 0.24s; }
	&-6 { height: 65%; animation-delay: 0.3s; }
	&-7 { height: 48%; animation-delay: 0.36s; }
}

@keyframes frmx-bar-grow {
	from {
		height: 0;
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* ─── Section ────────────────────────────────────── */
.frmx-analytics-section {
	padding: 44px 36px;
	border-bottom: 1px solid $frmx-slate-200;

	&--soft {
		background: linear-gradient(180deg, $frmx-purple-25 0%, $frmx-slate-50 100%);
	}

	&__header {
		max-width: 640px;
		margin: 0 auto;
		text-align: center;

		h2 {
			margin: 16px 0 10px;
			font-size: 30px;
			line-height: 1.15;
			letter-spacing: -0.035em;
			color: $frmx-slate-900;
		}

		p {
			margin: 0;
			font-size: 14.5px;
			line-height: 1.75;
			color: $frmx-slate-500;
		}
	}
}

/* Section icons */
.frmx-analytics-icon {
	width: 48px;
	height: 48px;
	margin: 0 auto;
	border-radius: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, rgba($frmx-purple-700, 0.08) 0%, rgba($frmx-purple-700, 0.14) 100%);
	color: $frmx-purple-700;

	&--blue {
		background: linear-gradient(135deg, rgba($frmx-blue, 0.08) 0%, rgba($frmx-blue, 0.14) 100%);
		color: $frmx-blue;
	}
}

/* ─── Stats grid (What you can measure) ──────── */
.frmx-analytics-stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	margin-top: 30px;
}

.frmx-analytics-stat {
	padding: 22px 20px;
	background: #fff;
	border: 1px solid $frmx-slate-200;
	border-radius: 16px;
	transition: all 0.25s ease;
	position: relative;
	overflow: hidden;

	&::before {
		content: '';
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		height: 3px;
		background: transparent;
		border-radius: 16px 16px 0 0;
		transition: background 0.25s ease;
	}

	&:hover {
		border-color: #c7d2fe;
		box-shadow:
			0 4px 16px rgba($frmx-purple-700, 0.06),
			0 1px 3px rgba($frmx-slate-900, 0.04);
		transform: translateY(-2px);
	}

	&:nth-child(1):hover::before { background: linear-gradient(90deg, $frmx-indigo, lighten($frmx-indigo, 12%)); }
	&:nth-child(2):hover::before { background: linear-gradient(90deg, $frmx-purple-600, $frmx-purple-500); }
	&:nth-child(3):hover::before { background: linear-gradient(90deg, $frmx-teal, lighten($frmx-teal, 12%)); }
	&:nth-child(4):hover::before { background: linear-gradient(90deg, $frmx-amber, lighten($frmx-amber, 12%)); }

	/* Stat icons */
	&__icon {
		width: 44px;
		height: 44px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 12px;
		margin-bottom: 16px;

		&--indigo {
			background: linear-gradient(135deg, rgba($frmx-indigo, 0.1) 0%, rgba($frmx-indigo, 0.18) 100%);
			color: $frmx-indigo;
		}

		&--violet {
			background: linear-gradient(135deg, rgba($frmx-purple-600, 0.1) 0%, rgba($frmx-purple-600, 0.18) 100%);
			color: $frmx-purple-600;
		}

		&--teal {
			background: linear-gradient(135deg, rgba($frmx-teal, 0.1) 0%, rgba($frmx-teal, 0.18) 100%);
			color: $frmx-teal;
		}

		&--amber {
			background: linear-gradient(135deg, rgba($frmx-amber, 0.1) 0%, rgba($frmx-amber, 0.18) 100%);
			color: $frmx-amber;
		}
	}

	strong {
		display: block;
		margin-bottom: 8px;
		font-size: 18px;
		letter-spacing: -0.02em;
		color: $frmx-slate-900;
	}

	span {
		display: block;
		font-size: 13px;
		line-height: 1.7;
		color: $frmx-slate-500;
	}
}

/* ─── Report cards grid ─────────────────────────── */
.frmx-analytics-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	margin-top: 30px;
}

.frmx-analytics-card {
	padding: 24px 22px;
	background: #fff;
	border: 1px solid $frmx-slate-200;
	border-radius: 16px;
	transition: all 0.25s ease;

	&:hover {
		border-color: #c7d2fe;
		box-shadow:
			0 4px 16px rgba($frmx-purple-700, 0.06),
			0 1px 3px rgba($frmx-slate-900, 0.04);
		transform: translateY(-2px);
	}

	/* Card icons */
	&__icon {
		width: 40px;
		height: 40px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 10px;
		margin-bottom: 14px;

		&--indigo {
			background: linear-gradient(135deg, rgba($frmx-indigo, 0.08) 0%, rgba($frmx-indigo, 0.16) 100%);
			color: $frmx-indigo;
		}

		&--violet {
			background: linear-gradient(135deg, rgba($frmx-purple-600, 0.08) 0%, rgba($frmx-purple-600, 0.16) 100%);
			color: $frmx-purple-600;
		}

		&--teal {
			background: linear-gradient(135deg, rgba($frmx-teal, 0.08) 0%, rgba($frmx-teal, 0.16) 100%);
			color: $frmx-teal;
		}

		&--amber {
			background: linear-gradient(135deg, rgba($frmx-amber, 0.08) 0%, rgba($frmx-amber, 0.16) 100%);
			color: $frmx-amber;
		}
	}

	h3 {
		margin: 0 0 8px;
		font-size: 17px;
		line-height: 1.3;
		letter-spacing: -0.01em;
		color: $frmx-slate-900;
	}

	p {
		margin: 0;
		font-size: 13.5px;
		line-height: 1.75;
		color: $frmx-slate-500;
	}
}

/* ─── Footer CTA ─────────────────────────────────── */
.frmx-analytics-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 32px;
	padding: 36px;
	background: linear-gradient(135deg, $frmx-purple-25 0%, #f0f9ff 50%, #fff 100%);
	position: relative;
	overflow: hidden;

	&__glow {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		width: 500px;
		height: 200px;
		background: radial-gradient(ellipse, rgba($frmx-purple-700, 0.06) 0%, transparent 70%);
		pointer-events: none;
	}

	&__content {
		max-width: 560px;
		position: relative;
		z-index: 1;

		h2 {
			margin: 14px 0 8px;
			font-size: 28px;
			line-height: 1.15;
			letter-spacing: -0.035em;
			color: $frmx-slate-900;
		}

		p {
			margin: 0;
			font-size: 14px;
			line-height: 1.75;
			color: $frmx-slate-500;
		}
	}

	> .frmx-analytics-btn {
		position: relative;
		z-index: 1;
		flex-shrink: 0;
	}
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 1080px) {
	.frmx-analytics-hero {
		grid-template-columns: 1fr;
		gap: 32px;

		&__copy h2 {
			max-width: none;
		}
	}
}

@media (max-width: 980px) {
	.frmx-analytics-topbar,
	.frmx-analytics-footer {
		flex-direction: column;
		align-items: flex-start;
	}

	.frmx-analytics-stats {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 782px) {
	.frmx-analytics-page {
		margin-right: 10px;
	}

	.frmx-analytics-topbar,
	.frmx-analytics-hero,
	.frmx-analytics-section,
	.frmx-analytics-footer {
		padding-left: 20px;
		padding-right: 20px;
	}

	.frmx-analytics-topbar__copy h1,
	.frmx-analytics-hero__copy h2,
	.frmx-analytics-section__header h2,
	.frmx-analytics-footer__content h2 {
		font-size: 24px;
		max-width: none;
	}

	.frmx-analytics-topbar__main {
		align-items: flex-start;
	}

	.frmx-analytics-topbar__logo {
		width: 48px;
		height: 48px;
	}

	.frmx-analytics-preview__stats,
	.frmx-analytics-stats,
	.frmx-analytics-grid {
		grid-template-columns: 1fr;
	}
}
