/* BoostPrep — Your Stats Cards (Phase 2) */

/*
 * The grid is sized by its own container (the page content area), not the
 * viewport, so it lays out correctly next to the account sidebar. The
 * @media rules further down remain as a fallback for older browsers; the
 * @container rules at the end of this file override them where supported.
 */
.bp-stats-scope {
	container-type: inline-size;
}

.bp-stats-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 20px;
}

.bp-stat-card {
	position: relative;
	background: #fff;
	border: 2px solid #e2e7ed;
	border-radius: 5px;
	padding: 20px;
	transition: all 0.2s ease;
	min-width: 0;
}

/*
 * Tone borders removed (July 2026 hot fix): all cards use the neutral
 * #e2e7ed border. The renderer still outputs .bp-stat-card--tone-* classes;
 * they are intentionally unstyled so this can be reverted in CSS alone.
 */

.bp-stat-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
	z-index: 10;
}

.bp-stat-label {
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
	margin-bottom: 8px;
	text-align: center;
	padding: 0 10px;
}

.bp-stat-value {
	font-size: 1.3rem; /* Same size at all screen widths (July 2026 tweak). */
	font-weight: 700;
	line-height: 1;
	text-align: center;
}

.bp-stat-subtext {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 2px solid #e2e7ed;
	font-size: 13px;
	color: #7b8794;
	line-height: 1.4;
	text-align: center;
}

.bp-stat-card .bp-feat-tooltip-wrap {
	position: absolute;
	top: 14px;
	right: 14px;
	margin-left: 0;
}

/*
 * Tooltip panel inside stat cards: anchor to the right edge of the trigger
 * instead of centering, so it cannot run off the right side of the screen.
 * The arrow moves with it. Width is capped for small viewports.
 */
.bp-stat-card .bp-feat-tooltip-panel {
	left: auto;
	right: -8px;
	transform: none;
	width: min(400px, 82vw);
}

.bp-stat-card .bp-feat-tooltip-panel__card::before,
.bp-stat-card .bp-feat-tooltip-panel__card::after {
	left: auto;
	right: 12px;
	transform: none;
}

@keyframes bp-shimmer {
	0% {
		background-position: -600px 0;
	}
	100% {
		background-position: 600px 0;
	}
}

.shimmer {
	background: linear-gradient(90deg, #ebebeb 25%, #f5f5f5 50%, #ebebeb 75%);
	background-size: 600px 100%;
	animation: bp-shimmer 1.4s infinite linear;
	border-radius: 4px;
}

.bp-stat-card--loading {
	pointer-events: none;
}

.bp-stat-card--loading:hover {
	transform: none;
	box-shadow: none;
}

.skel-label {
	height: 14px;
	width: 110px;
	margin: 0 auto 10px;
}

.skel-value {
	height: 28px;
	width: 80px;
	margin: 0 auto;
}

.skel-subtext {
	height: 13px;
	width: 80%;
	border-top: none;
	margin: 28px auto 0;
}

@media (max-width: 1024px) {
	.bp-stats-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 767px) {
	.bp-stats-grid {
		grid-template-columns: 1fr;
	}
}

.bpcc-dashboard-stats-async__error {
	margin: 0;
	padding: 12px 16px;
	font-size: 14px;
	color: #7b8794;
}

/*
 * Container-based breakpoints (modern browsers). These react to the width
 * of the stats area itself, so the sidebar no longer causes overflow.
 * Every container width is covered by exactly one block, overriding the
 * viewport @media fallbacks above.
 */
@container (min-width: 901px) {
	.bp-stats-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@container (min-width: 561px) and (max-width: 900px) {
	.bp-stats-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@container (max-width: 560px) {
	.bp-stats-grid {
		grid-template-columns: 1fr;
	}
}
