/* ========================================
   USER STATS BAR
   ======================================== */

.user-stats-bar {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem 1.25rem;
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	border-radius: var(--radius-lg);
	margin-bottom: 1.5rem;
	flex-wrap: wrap;
	box-shadow: 0 6px 18px rgba(111, 66, 193, 0.06);
}

.stat-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	background: var(--bg-tertiary);
	border-radius: 8px;
	font-size: 0.9rem;
	color: var(--text-secondary);
}

.stat-item i {
	color: var(--accent-secondary);
	font-size: 1.1rem;
}

.stat-item .stat-value {
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--text-primary);
}

.stat-item .stat-label {
	font-size: 0.85rem;
	color: var(--text-secondary);
}

.stat-item.stat-summary {
	background: rgba(0, 255, 136, 0.1);
	border: 1px solid rgba(0, 255, 136, 0.2);
}

.stat-item.stat-summary i {
	color: var(--accent-primary);
}

/* When blocks are not fully filled - red */
.stat-item.stat-summary-incomplete {
	background: rgba(239, 68, 68, 0.1);
	border: 1px solid rgba(239, 68, 68, 0.2);
}

.stat-item.stat-summary-incomplete i {
	color: #ef4444;
}

.stat-item.stat-summary-incomplete .stat-value {
	color: #ef4444;
}

.stat-item.stat-open {
	background: rgba(251, 191, 36, 0.1);
	border: 1px solid rgba(251, 191, 36, 0.2);
}

.stat-item.stat-open i {
	color: #fbbf24;
}

/* Admin main stat - bigger */
.stat-item.stat-admin-main {
	padding: 0.75rem 1.5rem;
}

.stat-item.stat-admin-main .stat-value {
	font-size: 1.5rem;
	font-weight: 700;
}

.stat-item.stat-admin-main .stat-label {
	font-size: 1rem;
}

.stat-item.stat-admin-main i {
	font-size: 1.5rem;
}

/* User assigned blocks stat */
.stat-item.stat-user-assigned {
	background: rgba(124, 58, 237, 0.1);
	border: 1px solid rgba(124, 58, 237, 0.2);
	margin-left: auto;
}

.stat-item.stat-user-assigned i {
	color: var(--accent-info);
}

.stat-item.stat-user-assigned .stat-value {
	color: var(--accent-info);
}

/* ========================================
   STAT BUTTON
   ======================================== */

.stat-btn {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	border-radius: 8px;
	font-size: 0.9rem;
	border: none;
	cursor: pointer;
	transition: all 0.2s ease;
}

.stat-available-btn {
	background: rgba(0, 255, 136, 0.15);
	border: 1px solid rgba(0, 255, 136, 0.4);
	color: var(--accent-primary);
	position: relative;
	overflow: visible;
}

.stat-available-btn i {
	color: var(--accent-primary);
	font-size: 1.1rem;
}

.stat-available-btn .stat-value {
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--accent-primary);
}

.stat-available-btn .stat-label {
	font-size: 0.85rem;
	color: var(--accent-primary);
	opacity: 0.8;
}

.stat-available-btn:hover {
	background: rgba(0, 255, 136, 0.25);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

/* ========================================
   ENHANCED PULSATING ANIMATION
   ======================================== */

.stat-available-btn.pulse {
	animation: none;
	background: linear-gradient(
		135deg,
		rgba(0, 255, 136, 0.3),
		rgba(0, 212, 255, 0.2)
	);
	border: 2px solid rgba(0, 255, 136, 1);
	box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

.stat-available-btn.pulse::before,
.stat-available-btn.pulse::after {
	content: "";
	position: absolute;
	border-radius: 50%;
	background: rgba(0, 255, 136, 1);
	animation: particle-float 1.8s linear infinite;
	pointer-events: none;
	box-shadow: 0 0 4px rgba(0, 255, 136, 0.55);
}

.stat-available-btn.pulse::before {
	width: 8px;
	height: 8px;
	top: -4px;
	left: 15%;
	animation-delay: 0s;
}

.stat-available-btn.pulse::after {
	width: 6px;
	height: 6px;
	top: -3px;
	right: 20%;
	animation-delay: 0.7s;
}

@keyframes pulse-green {
	0% {
		box-shadow:
			0 0 0 0 rgba(0, 255, 136, 0.8),
			0 0 20px rgba(0, 255, 136, 0.4);
	}
	50% {
		box-shadow:
			0 0 0 12px rgba(0, 255, 136, 0),
			0 0 35px rgba(0, 255, 136, 0.6);
	}
	100% {
		box-shadow:
			0 0 0 0 rgba(0, 255, 136, 0),
			0 0 20px rgba(0, 255, 136, 0.4);
	}
}

@keyframes pulse-glow {
	0%,
	100% {
		filter: brightness(1) drop-shadow(0 0 3px rgba(0, 255, 136, 0.5));
	}
	50% {
		filter: brightness(1.3) drop-shadow(0 0 8px rgba(0, 255, 136, 0.8));
	}
}

@keyframes shimmer {
	0% {
		background-position: -100% 0;
	}
	100% {
		background-position: 200% 0;
	}
}

@keyframes particle-float {
	0% {
		transform: translateY(0) scale(1);
		opacity: 0.9;
	}
	50% {
		transform: translateY(-15px) scale(1.05);
		opacity: 0.65;
	}
	100% {
		transform: translateY(-25px) scale(0.75);
		opacity: 0;
	}
}

/* ========================================
   RESPONSIVE: STAT BAR — better wrap behavior
   - Use container query so layout changes exactly when the
     stats bar becomes too narrow to hold all items in one row.
   - Fallback media-query for older browsers.
   ======================================== */

.user-stats-bar {
	/* enable container queries so the layout adapts at the actual component width */
	container-type: inline-size;
}

/* Two-up layout when the bar is narrower but can still hold two items side-by-side */
@container (max-width: 780px) {
	.user-stats-bar {
		align-items: stretch;
		gap: 0.75rem;
	}
	.user-stats-bar > .stat-item {
		flex: 1 1 calc(50% - 0.5rem);
		min-width: 0;
		justify-content: center;
		text-align: center;
	}
	.user-stats-bar > .stat-item.stat-user-assigned {
		/* don't push to the far right in wrapped mode */
		margin-left: 0;
	}
}

/* Single-column layout when the bar is too narrow for two-up */
@container (max-width: 520px) {
	.user-stats-bar {
		flex-direction: column;
		align-items: stretch;
		gap: 0.5rem;
		padding: 0.75rem;
	}
	.user-stats-bar > .stat-item,
	.user-stats-bar > button.stat-btn {
		flex: 1 1 100%;
		width: 100%;
		justify-content: center;
		text-align: center;
		padding: 0.65rem 0.75rem;
		border-radius: 10px;
	}
	.user-stats-bar > .stat-item .stat-label,
	.user-stats-bar > button.stat-btn .stat-label {
		display: block;
		margin-top: 0.25rem;
		opacity: 0.85;
		font-size: 0.85rem;
	}
	.user-stats-bar > .stat-item .stat-value,
	.user-stats-bar > button.stat-btn .stat-value {
		font-size: 1.15rem;
	}
	.user-stats-bar > .stat-item.stat-user-assigned {
		margin-left: 0;
	}
	/* tone down decorative particles so they don't overflow awkwardly */
	.stat-available-btn.pulse::before {
		left: 8%;
		top: -2px;
	}
	.stat-available-btn.pulse::after {
		right: 10%;
		top: -2px;
	}
}

/* Fallback for browsers without container-query support */
@supports not (container-type: inline-size) {
	@media (max-width: 780px) {
		.user-stats-bar > .stat-item {
			flex: 1 1 calc(50% - 0.5rem);
			min-width: 0;
			justify-content: center;
			text-align: center;
			margin-left: 0;
		}
	}
	@media (max-width: 520px) {
		.user-stats-bar {
			flex-direction: column;
			align-items: stretch;
		}
		.user-stats-bar > .stat-item,
		.user-stats-bar > button.stat-btn {
			flex: 1 1 100%;
			width: 100%;
			justify-content: center;
			text-align: center;
		}
		.stat-available-btn.pulse::before {
			left: 8%;
			top: -2px;
		}
		.stat-available-btn.pulse::after {
			right: 10%;
			top: -2px;
		}
	}
}
