/**
 * Feature Gamification Section
 *
 * "Stay Motivated, Track Your Progress" section with teal/cyan blob background.
 * Uses a dashboard-style layout with stats cards and achievement badges.
 *
 * @package AgenticWP
 */

/* Animated blob background container - extends both directions */
/* Top extends -160px to smoothly blend into the lightweight Bulk section above */
.gamification-background {
	top: -160px;
	bottom: -120px;
	filter: url('#gamification-plasma');
}

/* Blob color customization for gamification section */
.gamification-background .gamification-blob {
	background: radial-gradient(
		circle,
		var(--feature-gamification-bg, #ccfbf1) 0%,
		rgba(204, 251, 241, 0.1) 100%
	);
}

/* Blob animations with unique timings */
#gamification-blob-1 {
	animation: blob-float-1 24s ease-in-out infinite;
}

#gamification-blob-2 {
	animation: blob-float-2 28s ease-in-out infinite 4s;
}

#gamification-blob-3 {
	animation: blob-float-3 26s ease-in-out infinite 8s;
}

#gamification-blob-4 {
	animation: blob-float-4 29s ease-in-out infinite 2s;
}

#gamification-blob-5 {
	animation: blob-float-5 31s ease-in-out infinite 6s;
}

/* Content wrapper */
.gamification-content-wrapper {
	position: relative;
	z-index: 1;
	max-width: 1000px;
	margin: 0 auto;
	text-align: center;
}

/* Gradient accent for heading - teal theme */
.feature-gamification h2 .accent {
	background: var(--gradient-teal, linear-gradient(135deg, #14B8A6, #0D9488));
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	color: #0D9488;
}

/* Lead text */
.feature-gamification .lead {
	font-size: 1.25rem;
	color: var(--muted);
	max-width: 600px;
	margin: 0 auto 3rem;
}

/* ============================================
   Dashboard-style Achievement Showcase
   ============================================ */

.gamification-dashboard {
	background: linear-gradient(135deg, rgba(204, 251, 241, 0.35), rgba(153, 246, 228, 0.35));
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-radius: 20px;
	border: 1px solid var(--line);
	padding: 2rem;
	box-shadow: 0 8px 32px rgba(20, 184, 166, 0.1);
	margin: 3rem 0;
}

/* Stats Row */
.stats-row {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem;
	margin-bottom: 2rem;
	padding-bottom: 2rem;
	border-bottom: 1px solid var(--line);
}

.stat-card {
	text-align: center;
	padding: 1rem;
}

.stat-icon {
	width: 48px;
	height: 48px;
	margin: 0 auto 0.75rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #ccfbf1, #99f6e4);
	border-radius: 12px;
	color: #0D9488;
}

.stat-icon.streak-icon {
	background: linear-gradient(135deg, #fef3c7, #fde68a);
	color: #B45309;
}

.stat-value {
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--ink);
	margin-bottom: 0.25rem;
}

.stat-label {
	font-size: 0.875rem;
	color: var(--muted);
	font-weight: 500;
}

/* Progress bar */
.progress-bar {
	height: 8px;
	background: var(--line);
	border-radius: 4px;
	margin: 0.75rem 0 0.5rem;
	overflow: hidden;
}

.progress-fill {
	height: 100%;
	width: var(--progress, 0%);
	background: linear-gradient(90deg, #14B8A6, #0D9488);
	border-radius: 4px;
	transition: width 1s ease-out;
}

.gamification-dashboard.in-view .progress-fill {
	animation: progress-grow 1.5s ease-out 0.5s forwards;
}

@keyframes progress-grow {
	from { width: 0%; }
	to { width: var(--progress, 0%); }
}

.progress-text {
	font-size: 0.75rem;
	color: var(--muted);
}

/* Achievements Section */
.achievements-section {
	text-align: left;
}

.achievements-header {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 1rem;
}

.achievements-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1rem;
}

/* Achievement Badge Base Styles */
.achievement-badge {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	padding: 1.25rem 1rem;
	background: rgba(255, 255, 255, 0.8);
	border-radius: 12px;
	border: 1px solid var(--line);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.achievement-badge:hover {
	transform: translateY(-2px);
}

.badge-icon {
	width: 56px;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: transform 0.3s ease;
}

.badge-name {
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--ink);
	text-align: center;
}

/* Unlocked Badge */
.achievement-badge.unlocked .badge-icon {
	background: linear-gradient(135deg, #ccfbf1, #99f6e4);
	color: #0D9488;
}

.achievement-badge.unlocked:hover {
	box-shadow: 0 4px 16px rgba(20, 184, 166, 0.15);
}

/* Locked Badge */
.achievement-badge.locked {
	opacity: 0.6;
}

.achievement-badge.locked .badge-icon {
	background: var(--line);
	color: var(--muted);
}

.achievement-badge.locked .badge-name {
	color: var(--muted);
}

/* ============================================
   Unlocking Badge Animation
   ============================================ */

/* Initial locked state for the unlocking badge */
.achievement-badge.unlocking .badge-icon {
	background: var(--line);
	color: var(--muted);
	transform: scale(0);
	opacity: 0;
}

.achievement-badge.unlocking .badge-name {
	opacity: 0;
}

.achievement-badge.unlocking .badge-glow {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 80px;
	height: 80px;
	transform: translate(-50%, -60%);
	border-radius: 50%;
	background: transparent;
	pointer-events: none;
}

/* Confetti container */
.confetti-container {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -60%);
	width: 80px;
	height: 80px;
	pointer-events: none;
}

.confetti {
	position: absolute;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	opacity: 0;
}

.confetti-1 { background: #14B8A6; top: 50%; left: 50%; }
.confetti-2 { background: #F59E0B; top: 50%; left: 50%; }
.confetti-3 { background: #8B5CF6; top: 50%; left: 50%; }
.confetti-4 { background: #EC4899; top: 50%; left: 50%; }
.confetti-5 { background: #3B82F6; top: 50%; left: 50%; }
.confetti-6 { background: #10B981; top: 50%; left: 50%; }

/* Trigger animations when dashboard is in view */
.gamification-dashboard.in-view .achievement-badge.unlocking .badge-icon {
	animation: badge-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1.5s forwards;
}

.gamification-dashboard.in-view .achievement-badge.unlocking .badge-name {
	animation: fade-in 0.4s ease-out 2s forwards;
}

.gamification-dashboard.in-view .achievement-badge.unlocking .badge-glow {
	animation: glow-pulse 0.8s ease-out 1.5s forwards;
}

.gamification-dashboard.in-view .confetti-1 {
	animation: confetti-burst-1 0.8s ease-out 1.6s forwards;
}

.gamification-dashboard.in-view .confetti-2 {
	animation: confetti-burst-2 0.8s ease-out 1.65s forwards;
}

.gamification-dashboard.in-view .confetti-3 {
	animation: confetti-burst-3 0.8s ease-out 1.7s forwards;
}

.gamification-dashboard.in-view .confetti-4 {
	animation: confetti-burst-4 0.8s ease-out 1.75s forwards;
}

.gamification-dashboard.in-view .confetti-5 {
	animation: confetti-burst-5 0.8s ease-out 1.8s forwards;
}

.gamification-dashboard.in-view .confetti-6 {
	animation: confetti-burst-6 0.8s ease-out 1.85s forwards;
}

/* Badge pop animation */
@keyframes badge-pop {
	0% {
		transform: scale(0);
		opacity: 0;
		background: var(--line);
		color: var(--muted);
	}
	50% {
		transform: scale(1.2);
		opacity: 1;
	}
	100% {
		transform: scale(1);
		opacity: 1;
		background: linear-gradient(135deg, #ccfbf1, #99f6e4);
		color: #0D9488;
	}
}

/* Glow pulse animation */
@keyframes glow-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.6);
	}
	50% {
		box-shadow: 0 0 30px 15px rgba(20, 184, 166, 0.3);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(20, 184, 166, 0);
	}
}

/* Fade in for badge name */
@keyframes fade-in {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Confetti burst animations - each particle goes a different direction */
@keyframes confetti-burst-1 {
	0% { opacity: 1; transform: translate(0, 0) scale(1); }
	100% { opacity: 0; transform: translate(-30px, -40px) scale(0.5); }
}

@keyframes confetti-burst-2 {
	0% { opacity: 1; transform: translate(0, 0) scale(1); }
	100% { opacity: 0; transform: translate(30px, -35px) scale(0.5); }
}

@keyframes confetti-burst-3 {
	0% { opacity: 1; transform: translate(0, 0) scale(1); }
	100% { opacity: 0; transform: translate(-40px, -10px) scale(0.5); }
}

@keyframes confetti-burst-4 {
	0% { opacity: 1; transform: translate(0, 0) scale(1); }
	100% { opacity: 0; transform: translate(40px, -15px) scale(0.5); }
}

@keyframes confetti-burst-5 {
	0% { opacity: 1; transform: translate(0, 0) scale(1); }
	100% { opacity: 0; transform: translate(-20px, -50px) scale(0.5); }
}

@keyframes confetti-burst-6 {
	0% { opacity: 1; transform: translate(0, 0) scale(1); }
	100% { opacity: 0; transform: translate(25px, -45px) scale(0.5); }
}

/* ============================================
   Feature Highlight Cards Grid
   ============================================ */

.gamification-features-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1.5rem;
	margin-top: 3rem;
	text-align: left;
}

.gamification-feature-card {
	background: linear-gradient(135deg, rgba(204, 251, 241, 0.35), rgba(153, 246, 228, 0.35));
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	padding: 1.5rem;
	border-radius: 16px;
	border: 1px solid var(--line);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gamification-feature-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 30px rgba(20, 184, 166, 0.15);
}

.gamification-feature-card .feature-icon {
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #ccfbf1, #99f6e4);
	border-radius: 12px;
	color: #0D9488;
	margin-bottom: 1rem;
}

.gamification-feature-card h3 {
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--ink);
	margin-bottom: 0.5rem;
	text-align: left;
}

.gamification-feature-card p {
	font-size: 0.9375rem;
	color: var(--muted);
	line-height: 1.6;
	margin: 0;
	text-align: left;
}

/* ============================================
   Responsive Styles
   ============================================ */

@media (max-width: 900px) {
	.stats-row {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	.stat-card {
		padding: 0.75rem;
	}

	.achievements-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.gamification-features-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 768px) {
	.feature-gamification .lead {
		font-size: 1.125rem;
	}

	.gamification-dashboard {
		padding: 1.5rem;
	}

	.stat-value {
		font-size: 1.5rem;
	}

	.achievements-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.75rem;
	}

	.achievement-badge {
		padding: 1rem 0.75rem;
	}

	.badge-icon {
		width: 48px;
		height: 48px;
	}

	.badge-name {
		font-size: 0.75rem;
	}

	.gamification-features-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	.gamification-feature-card {
		padding: 1.25rem;
	}
}

@media (max-width: 480px) {
	.achievements-grid {
		grid-template-columns: 1fr 1fr;
	}
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
	.gamification-dashboard.in-view .progress-fill {
		animation: none;
		width: var(--progress, 0%);
	}

	.gamification-dashboard.in-view .achievement-badge.unlocking .badge-icon {
		animation: none;
		transform: scale(1);
		opacity: 1;
		background: linear-gradient(135deg, #ccfbf1, #99f6e4);
		color: #0D9488;
	}

	.gamification-dashboard.in-view .achievement-badge.unlocking .badge-name {
		animation: none;
		opacity: 1;
	}

	.gamification-dashboard.in-view .achievement-badge.unlocking .badge-glow,
	.gamification-dashboard.in-view .confetti-1,
	.gamification-dashboard.in-view .confetti-2,
	.gamification-dashboard.in-view .confetti-3,
	.gamification-dashboard.in-view .confetti-4,
	.gamification-dashboard.in-view .confetti-5,
	.gamification-dashboard.in-view .confetti-6 {
		animation: none;
		display: none;
	}

	#gamification-blob-1,
	#gamification-blob-2,
	#gamification-blob-3,
	#gamification-blob-4,
	#gamification-blob-5 {
		animation: none;
	}
}
