/* BikeTraining – dark instrument-panel dashboard, matching jimbevard.com's black/blue theme */

.bt-training-dashboard {
	--bt-ink: #0b0d10;
	--bt-surface: #14171b;
	--bt-surface-2: #1b1f24;
	--bt-line: #262b31;
	--bt-text: #e9edf1;
	--bt-text-muted: #8b95a1;
	--bt-accent: #1c8fe0;
	--bt-accent-dim: #1c8fe022;
	--bt-gold: #d1a35c;
	--bt-gold-dim: #d1a35c22;
	--bt-good: #4ade80;
	--bt-bad: #f87171;
	--bt-radius: 4px;
	--bt-radius-sm: 3px;
	--bt-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Open Sans", sans-serif;
	--bt-font-display: "Oswald", "Arial Narrow", "Helvetica Neue Condensed", sans-serif;
}

.bt-training-dashboard {
	max-width: 100%;
	margin: 0 auto;
	font-family: var(--bt-font);
	background: var(--bt-ink);
	color: var(--bt-text);
	border-radius: var(--bt-radius);
	-webkit-font-smoothing: antialiased;
}

.bt-training-dashboard a {
	color: var(--bt-accent);
}

/* Hero */
.bt-hero {
	position: relative;
	min-height: 340px;
	display: flex;
	align-items: flex-end;
	overflow: hidden;
	border-radius: var(--bt-radius) var(--bt-radius) 0 0;
	background: var(--bt-ink);
}

.bt-hero__img {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: min(100%, 1200px);
	transform: translateX(-50%);
	background-size: cover;
	background-position: 62% 18%;
	filter: saturate(1.05) contrast(1.05);
}

.bt-hero__scrim {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(90deg, var(--bt-ink) 0%, rgba(11, 13, 16, 0.72) 32%, rgba(11, 13, 16, 0.15) 60%, rgba(11, 13, 16, 0.55) 100%),
		linear-gradient(0deg, var(--bt-ink) 0%, rgba(11, 13, 16, 0.05) 40%, rgba(11, 13, 16, 0.35) 100%);
}

.bt-hero__content {
	position: relative;
	z-index: 2;
	padding: 2.5em min(6vw, 2.5em) 2em;
	max-width: 640px;
}

.bt-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	font-size: 0.78em;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #c7d0da;
	margin: 0 0 0.9em;
}

.bt-eyebrow-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--bt-gold);
	flex-shrink: 0;
	display: inline-block;
}

.bt-hero-title {
	font-family: var(--bt-font-display);
	font-weight: 700;
	letter-spacing: -0.01em;
	line-height: 0.95;
	margin: 0;
	text-transform: uppercase;
	text-wrap: balance;
	font-size: clamp(2.2em, 5.5vw, 3.4em);
	color: #fff;
}


/* Page body */
.bt-page {
	padding: 1.75em min(6vw, 2.5em) 2.25em;
}

/* Notice */
.bt-notice {
	padding: 1em 1.25em;
	border-radius: var(--bt-radius-sm);
	margin: 0 0 1em;
	border: 1px solid var(--bt-line);
	background: var(--bt-surface);
}

.bt-notice-warning {
	border-left: 3px solid var(--bt-gold);
}

/* Targets row */
.bt-targets {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em 1em;
	padding-bottom: 1.5em;
	border-bottom: 1px solid var(--bt-line);
	margin-bottom: 1.5em;
	font-size: 0.92em;
}

.bt-targets--stale {
	opacity: 0.6;
}

.bt-targets-label {
	color: var(--bt-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 700;
	font-size: 0.85em;
}

.bt-targets-value {
	color: var(--bt-text);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* Lazy-load spinner */
.bt-dashboard-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1em;
	padding: 3em 1em;
	color: var(--bt-text-muted);
}

.bt-spinner {
	width: 32px;
	height: 32px;
	border: 3px solid var(--bt-line);
	border-top-color: var(--bt-accent);
	border-radius: 50%;
	animation: bt-spin 0.8s linear infinite;
}

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

.bt-loading-text {
	font-size: 0.95em;
	margin: 0;
}

/* AI Insight — coach's note. Full-size version stands alone; the --event
   modifier is a more compact variant nested under an event card's tiles. */
.bt-ai-insight-label {
	display: inline-block;
	font-size: 0.75em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--bt-gold);
	margin-bottom: 0.75em;
}

.bt-ai-insight p {
	margin: 0 0 0.9em;
	font-size: 0.98em;
	line-height: 1.65;
	color: #d3d9e0;
}

.bt-ai-insight p:last-child {
	margin-bottom: 0;
}

.bt-ai-insight--event {
	margin-top: 1.1em;
	padding-top: 1.1em;
	border-top: 1px solid var(--bt-line);
}

.bt-ai-insight--event .bt-ai-insight-label {
	font-size: 0.7em;
	margin-bottom: 0.5em;
}

.bt-ai-insight--event p {
	font-size: 0.88em;
	line-height: 1.55;
}

/* Horizontal stat strips (Most Recent Ride, Best 7 Days, period panels) */
.bt-strip-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5em 1em;
	margin-bottom: 1.15em;
}

.bt-strip-title {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	font-size: 0.78em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--bt-text-muted);
}

.bt-strip-title svg {
	width: 14px;
	height: 14px;
	color: var(--bt-gold);
	flex-shrink: 0;
}

.bt-strip-dates {
	font-size: 0.85em;
	color: var(--bt-text-muted);
}

.bt-strip-tiles {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25em 0;
}

.bt-tile {
	flex: 1 1 110px;
	padding: 0 1.5em;
	border-left: 1px solid var(--bt-line);
}

.bt-tile:first-child {
	border-left: none;
	padding-left: 0;
}

.bt-tile-label {
	display: block;
	font-size: 0.72em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--bt-text-muted);
	margin-bottom: 0.4em;
}

.bt-tile-value {
	font-family: var(--bt-font-display);
	font-weight: 700;
	font-size: 1.7em;
	color: var(--bt-text);
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.01em;
}

.bt-tile-value small {
	font-family: var(--bt-font);
	font-size: 0.5em;
	font-weight: 500;
	color: var(--bt-text-muted);
	margin-left: 0.3em;
	text-transform: none;
	letter-spacing: normal;
}

.bt-tile.is-best .bt-tile-value {
	color: var(--bt-gold);
}

/* Lower-is-better metrics (currently just avg HR) get a distinct color from
   the gold "higher is better" highlight, so a low HR doesn't read as an
   arbitrary achievement color-matched to a big distance/power number. */
.bt-tile.is-best-low .bt-tile-value {
	color: var(--bt-good);
}

.bt-tile--bar {
	display: flex;
	flex-direction: column;
}

.bt-tile-bar {
	height: 6px;
	background: var(--bt-surface-2);
	border-radius: 999px;
	overflow: hidden;
	margin: 0.65em 0 0.35em;
}

.bt-tile-bar .bt-progress-fill {
	display: block;
	height: 100%;
}

.bt-tile-pct {
	font-size: 0.78em;
	font-weight: 700;
	color: var(--bt-accent);
	font-variant-numeric: tabular-nums;
}

.bt-tile-date {
	display: block;
	font-size: 0.72em;
	color: var(--bt-text-muted);
	margin-top: 0.35em;
}

/* "vs previous period" compare readout, shown per-tile when compare mode is on */
.bt-tile-compare {
	display: block;
	margin-top: 0.35em;
	font-size: 0.75em;
	font-weight: 600;
	color: var(--bt-text-muted);
	font-variant-numeric: tabular-nums;
}

.bt-tile-compare[hidden] {
	display: none;
}

.bt-tile-compare.is-up {
	color: var(--bt-good);
}

.bt-tile-compare.is-down {
	color: var(--bt-bad);
}

/* Metric delta chip — always-on comparison vs the 90-day baseline (FTP: vs max, HR: vs min) */
.bt-metric-delta {
	display: inline-block;
	margin-top: 0.35em;
	font-size: 0.72em;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--bt-text-muted);
}

.bt-metric-delta--up {
	color: var(--bt-good);
}

.bt-metric-delta--down {
	color: var(--bt-bad);
}

@media (max-width: 700px) {
	.bt-tile {
		flex-basis: 45%;
		border-left: none;
		padding-left: 0;
		margin-bottom: 0.5em;
	}
}

/* Card layout */
.bt-metric-card {
	width: 100%;
	margin-bottom: 1em;
}

.bt-block-separator {
	margin: 2em 0 1.5em;
	border: 0;
	height: 1px;
	background: var(--bt-line);
}

.bt-period-total--box {
	background: var(--bt-surface);
	border: 1px solid var(--bt-line);
	border-radius: var(--bt-radius);
	padding: 1.4em 1.5em;
	height: 100%;
}

.bt-best-week-dates {
	font-size: 0.85em;
	color: var(--bt-text-muted);
	margin: 0 0 1em;
}

.bt-period-total-header {
	display: inline-block;
	font-size: 0.75em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	color: var(--bt-text-muted);
	margin-bottom: 1em;
}

.bt-best-week-stats {
	display: flex;
	gap: 1.5em;
	margin-bottom: 0.6em;
	flex-wrap: wrap;
}

.bt-best-week-stats--big {
	gap: 1.75em;
	margin-bottom: 1.1em;
}

.bt-best-week-stat-block {
	display: flex;
	align-items: baseline;
	gap: 0.35em;
}

.bt-best-week-stat-value {
	font-family: var(--bt-font-display);
	font-weight: 700;
	font-size: 1.85em;
	color: var(--bt-text);
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.01em;
}

.bt-best-week-stat-unit {
	font-size: 0.82em;
	font-weight: 500;
	color: var(--bt-text-muted);
}

.bt-best-week-bars {
	display: grid;
	gap: 0.75em;
}

.bt-best-week-bars--prominent {
	gap: 0.75em;
}

.bt-best-week-bar-row {
	display: grid;
	grid-template-columns: 72px 1fr 3.4em;
	align-items: center;
	gap: 0.7em;
}

.bt-best-week-bar-label {
	font-size: 0.75em;
	font-weight: 600;
	color: var(--bt-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.bt-progress-bar,
.bt-progress-bar--best,
.bt-progress-bar--best-prominent {
	position: relative;
	height: 14px;
	background: var(--bt-surface-2);
	border-radius: 999px;
	overflow: visible;
}

.bt-bar-value {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 0.72em;
	font-weight: 800;
	color: #0b0d10;
	white-space: nowrap;
	line-height: 1;
	pointer-events: none;
}

.bt-progress-fill {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--bt-accent), #56b8ff);
}

.bt-best-week-bar-pct {
	font-size: 0.82em;
	font-weight: 700;
	color: var(--bt-accent);
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* Last 7 Days' inline FTP row (value + always-on delta, no bar) */
.bt-ftp-inline {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5em;
	margin-top: 1.1em;
	padding-top: 1.1em;
	border-top: 1px solid var(--bt-line);
}

.bt-ftp-inline-item {
	font-size: 0.85em;
	font-weight: 600;
	color: var(--bt-text);
	font-variant-numeric: tabular-nums;
	display: flex;
	align-items: baseline;
	gap: 0.5em;
}

/* Period selector: tabs + compare */
.bt-period-selector {
	margin-bottom: 1.75em;
}

.bt-period-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.75em;
	margin-bottom: 1em;
}

.bt-period-tabs {
	display: inline-flex;
	border: 1px solid var(--bt-line);
	border-radius: 999px;
	padding: 0.2em;
	background: var(--bt-surface);
}

.bt-period-tab {
	appearance: none;
	border: none;
	background: transparent;
	color: var(--bt-text-muted);
	font-family: inherit;
	font-size: 0.82em;
	font-weight: 600;
	padding: 0.5em 1em;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.bt-period-tab.is-active {
	background: var(--bt-accent);
	color: #fff;
}

.bt-compare-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	font-size: 0.85em;
	font-weight: 600;
	color: var(--bt-text-muted);
	cursor: pointer;
}

.bt-compare-options {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1em;
	padding: 0.75em 1em;
	margin-bottom: 1em;
	background: var(--bt-surface);
	border: 1px solid var(--bt-line);
	border-radius: var(--bt-radius-sm);
	font-size: 0.85em;
	color: var(--bt-text-muted);
}

.bt-compare-options[hidden] {
	display: none;
}

.bt-compare-options label {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	cursor: pointer;
}

.bt-compare-options select {
	background: var(--bt-surface-2);
	color: var(--bt-text);
	border: 1px solid var(--bt-line);
	border-radius: var(--bt-radius-sm);
	padding: 0.3em 0.5em;
}

.bt-period-panels {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1em;
}

.bt-period-panels.is-comparing {
	grid-template-columns: 1fr 1fr;
}

@media (max-width: 700px) {
	.bt-period-panels.is-comparing {
		grid-template-columns: 1fr;
	}
}

.bt-period-panel {
	background: var(--bt-surface);
	border: 1px solid var(--bt-line);
	border-radius: var(--bt-radius);
	padding: 1.4em 1.5em;
}

.bt-period-panel[hidden] {
	display: none;
}

/* Per-event cards */
.bt-events-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 1em;
	margin-bottom: 1.75em;
}

.bt-event-card-target {
	font-size: 0.95em;
	font-weight: 600;
	color: var(--bt-text);
	font-variant-numeric: tabular-nums;
	margin-bottom: 0.35em;
}

.bt-event-card-block-label {
	font-size: 0.75em;
	color: var(--bt-text-muted);
	margin-bottom: 1.1em;
}

/* 90-day rides table */
.bt-table-heading {
	font-size: 1em;
	font-weight: 700;
	color: var(--bt-text);
	margin: 0 0 1em;
}

/*
 * The header row and date column are frozen via position: sticky, which needs
 * a real scrolling ancestor to track. The site theme sets `overflow-y: auto`
 * on <body> itself, which silently makes body -- not the page's actual
 * scroller -- the "nearest scroll container" for every sticky element on the
 * site, and body's own scrollTop never moves. So instead of relying on the
 * page scroll, this wrapper is its own deliberate scroll container sized to
 * a comfortable share of the viewport.
 */
.bt-table-wrap {
	max-height: 65vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--bt-line);
	border-radius: var(--bt-radius);
}

/* No horizontal scrolling: CSS forces overflow-x to `auto` too whenever
   overflow-y isn't `visible`, so avoid needing it -- drop secondary columns
   on narrow screens so all columns always fit without a second scroll axis. */
@media (max-width: 640px) {
	.bt-rides-table th:nth-child(4),
	.bt-rides-table td:nth-child(4),
	.bt-rides-table th:nth-child(6),
	.bt-rides-table td:nth-child(6),
	.bt-rides-table th:nth-child(7),
	.bt-rides-table td:nth-child(7) {
		display: none;
	}

	.bt-rides-table th,
	.bt-rides-table td {
		padding: 0.5em 0.6em;
	}

	.bt-table-wrap {
		max-height: 50vh;
	}
}

.bt-rides-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 0.85em;
	font-family: var(--bt-font);
	font-variant-numeric: tabular-nums;
}

.bt-rides-table th {
	position: sticky;
	top: 0;
	z-index: 2;
	text-align: left;
	padding: 0.6em 0.85em;
	background: var(--bt-surface-2);
	border-bottom: 1px solid var(--bt-line);
	font-weight: 700;
	text-transform: uppercase;
	font-size: 0.7em;
	letter-spacing: 0.05em;
	color: var(--bt-text-muted);
	white-space: nowrap;
}

.bt-rides-table td {
	padding: 0.5em 0.85em;
	border-bottom: 1px solid var(--bt-line);
	color: var(--bt-text);
}

/* Frozen first column (date) */
.bt-rides-table th:first-child,
.bt-rides-table td:first-child {
	position: sticky;
	left: 0;
	z-index: 1;
	background: var(--bt-ink);
	box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.4);
}

.bt-rides-table th:first-child {
	z-index: 3;
	background: var(--bt-surface-2);
}

.bt-rides-table tr:last-child td {
	border-bottom: none;
}

.bt-rides-row--rest td {
	color: var(--bt-text-muted);
	opacity: 0.45;
}

.bt-rides-row--best {
	background: var(--bt-gold-dim);
}

.bt-rides-row--best td:first-child {
	background: var(--bt-gold-dim);
}

.bt-rides-cell--best {
	color: var(--bt-gold) !important;
	font-weight: 700;
	font-size: 0.95em;
}

.bt-rides-cell--best-low {
	color: var(--bt-good) !important;
	font-weight: 700;
	font-size: 0.95em;
}
