/**
 * [ctlive_results] — rich multi-stat results board.
 * Responsive: 5-column table on desktop, cards on mobile. Themed off the shared
 * --ltf-ct-* custom properties (set by LTF_CT_Style) so it matches the host site.
 */

.ltf-ct-results {
	font-family: var(--ltf-ct-font, inherit);
	color: var(--ltf-ct-text, #1d2433);
	font-size: 16px;
	line-height: 1.3;
	container-type: inline-size; /* drive the table↔cards switch off the widget's OWN width */
}

.ltf-ct-results *,
.ltf-ct-results *::before,
.ltf-ct-results *::after { box-sizing: border-box; }

.ltf-ct-results__title {
	font-size: 1.6em;
	font-weight: 800;
	margin: 0 0 .6em;
}

/* ---- loading state: shown on a user switch (tab / dropdown), NOT on the
       silent 35s refresh. Dims the board and floats a gold spinner so the
       ~0.5-2s server round-trip reads as "working", never "nothing happened". ---- */
.ltf-ct-results__inner { position: relative; }
.ltf-ct-results.is-loading .ltf-ct-results__inner {
	opacity: .5;
	transition: opacity .12s ease;
	pointer-events: none;
}
.ltf-ct-results.is-loading .ltf-ct-results__inner::after {
	content: "";
	position: absolute;
	top: 46px;
	left: 50%;
	width: 30px;
	height: 30px;
	margin-left: -15px;
	border: 3px solid var(--ltf-ct-border, #d3d8e0);
	border-top-color: var(--ltf-ct-primary, #c2a14d);
	border-radius: 50%;
	animation: ltf-ct-spin .7s linear infinite;
}
@keyframes ltf-ct-spin { to { transform: rotate(360deg); } }
@media ( prefers-reduced-motion: reduce ) {
	.ltf-ct-results.is-loading .ltf-ct-results__inner::after { animation-duration: 2s; }
}

/* ---- distance tabs ---- */
.ltf-ct-results__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 14px;
}
.ltf-ct-results__tab {
	font: inherit;
	font-weight: 700;
	padding: 8px 16px;
	border: 1px solid var(--ltf-ct-border, #d3d8e0);
	border-radius: 999px;
	background: var(--ltf-ct-row-bg, #fff);
	color: var(--ltf-ct-text, #1d2433);
	cursor: pointer;
}
.ltf-ct-results__tab.is-active {
	background: var(--ltf-ct-header-bg, #243056);
	color: var(--ltf-ct-header-text, #fff);
	border-color: var(--ltf-ct-header-bg, #243056);
}

/* ---- control dropdowns ---- */
.ltf-ct-results__controls {
	display: flex;
	gap: 14px;
	margin-bottom: 18px;
}
.ltf-ct-dd { position: relative; flex: 1 1 0; min-width: 0; }
.ltf-ct-dd__btn {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	font: inherit;
	text-align: left;
	padding: 10px 38px 10px 18px;
	border: 1px solid var(--ltf-ct-border, #d3d8e0);
	border-radius: 999px;
	background: var(--ltf-ct-row-bg, #fff);
	color: var(--ltf-ct-text, #1d2433);
	cursor: pointer;
	position: relative;
}
.ltf-ct-dd__btn:hover { border-color: var(--ltf-ct-primary, #243056); }
.ltf-ct-dd__kicker {
	font-size: .72em;
	font-weight: 600;
	color: var(--ltf-ct-text-light, #6b7280);
	letter-spacing: .02em;
}
.ltf-ct-dd__value {
	font-size: 1.02em;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}
.ltf-ct-dd__caret {
	position: absolute;
	right: 16px;
	top: 50%;
	width: 9px; height: 9px;
	border-right: 2px solid var(--ltf-ct-text-light, #6b7280);
	border-bottom: 2px solid var(--ltf-ct-text-light, #6b7280);
	transform: translateY(-70%) rotate(45deg);
	transition: transform .15s ease;
}
.ltf-ct-dd.is-open .ltf-ct-dd__caret { transform: translateY(-30%) rotate(225deg); }

.ltf-ct-dd__menu {
	position: absolute;
	z-index: 30;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var(--ltf-ct-row-bg, #fff);
	border: 1px solid var(--ltf-ct-border, #d3d8e0);
	border-radius: 14px;
	box-shadow: 0 12px 30px rgba(20, 28, 50, .16);
	max-height: 340px;
	overflow-y: auto;
}
.ltf-ct-dd__menu[hidden] { display: none; }
.ltf-ct-dd__opt {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font: inherit;
	text-align: left;
	padding: 11px 14px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: var(--ltf-ct-text, #1d2433);
	cursor: pointer;
}
.ltf-ct-dd__opt:hover { background: var(--ltf-ct-hover-bg, #f1f3f7); }
.ltf-ct-dd__opt.is-active {
	background: var(--ltf-ct-header-bg, #243056);
	color: var(--ltf-ct-header-text, #fff);
}
.ltf-ct-dd__opt-label { font-weight: 600; }
.ltf-ct-dd__opt-count { color: var(--ltf-ct-text-light, #6b7280); font-variant-numeric: tabular-nums; font-size: .92em; }
.ltf-ct-dd__opt.is-active .ltf-ct-dd__opt-count { color: rgba(255,255,255,.75); }

/* ---- mat heading + progress ---- */
.ltf-ct-results__mat {
	font-size: 1.35em;
	font-weight: 800;
	margin: 4px 0 10px;
}
/* spacing between cascade sections (a mat block following the previous board) */
.ltf-ct-results__board + .ltf-ct-results__matbar { margin-top: 26px; }
.ltf-ct-results__progress {
	position: relative;
	height: 26px;
	border-radius: 6px;
	background: var(--ltf-ct-bg-alt, #c7ccd6);
	margin-bottom: 18px;
}
.ltf-ct-results__progress-fill {
	position: absolute;
	left: 0; top: 0; bottom: 0;
	border-radius: 6px 0 0 6px;
	background: var(--ltf-ct-header-bg, #243056);
	min-width: 4px;
}
.ltf-ct-results__progress-pin {
	position: absolute;
	left: 0; top: 0; bottom: 0;
	display: flex;
	align-items: center;
	padding: 0 10px;
	color: var(--ltf-ct-header-text, #fff);
	font-size: .72em;
	font-weight: 700;
	white-space: nowrap;
}
.ltf-ct-results__progress-flag {
	position: absolute;
	right: 8px; top: 50%;
	width: 12px; height: 12px;
	transform: translateY(-50%);
	opacity: .55;
	background: linear-gradient(45deg, var(--ltf-ct-text-light,#6b7280) 25%, transparent 25%, transparent 50%, var(--ltf-ct-text-light,#6b7280) 50%, var(--ltf-ct-text-light,#6b7280) 75%, transparent 75%);
	background-size: 6px 6px;
}

/* ---- board: shared grid for head + rows ---- */
.ltf-ct-results__head,
.ltf-ct-results__row {
	display: grid;
	grid-template-columns: minmax(0,1fr) 84px 84px 110px 96px 104px;
	align-items: center;
	gap: 8px;
}
.ltf-ct-results__head {
	padding: 0 18px 8px;
	font-size: .74em;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--ltf-ct-text-light, #6b7280);
	border-bottom: 1px solid var(--ltf-ct-border, #e2e5ec);
}
.ltf-ct-results__head .ltf-ct-c-ov,
.ltf-ct-results__head .ltf-ct-c-gn,
.ltf-ct-results__head .ltf-ct-c-dv,
.ltf-ct-results__head .ltf-ct-c-pc,
.ltf-ct-results__head .ltf-ct-c-ch { text-align: center; }

.ltf-ct-results__row {
	padding: 14px 18px;
	background: var(--ltf-ct-row-bg, #fff);
	border-radius: 10px;
	margin-top: 8px;
	box-shadow: 0 1px 0 var(--ltf-ct-border, #e8eaf0);
}
.ltf-ct-c-ath { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ltf-ct-results__rankm {
	display: none;
	font-size: 1.1em;
	font-weight: 800;
	min-width: 22px;
	text-align: center;
}
.ltf-ct-results__who { display: flex; flex-direction: column; min-width: 0; }
.ltf-ct-results__name { font-weight: 800; font-size: 1.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.ltf-ct-results__name--link { color: inherit; text-decoration: none; display: inline-flex; align-items: baseline; gap: 0.15em; }
a.ltf-ct-results__name--link:hover,
a.ltf-ct-results__name--link:focus { color: var(--lt-gold, #c2a14d); text-decoration: underline; text-underline-offset: 2px; }
.ltf-ct-results__name-ext { font-size: 0.72em; font-weight: 700; opacity: 0.6; }
a.ltf-ct-results__name--link:hover .ltf-ct-results__name-ext { opacity: 1; }
.ltf-ct-results__meta { color: var(--ltf-ct-text-light, #6b7280); font-size: .86em; margin-top: 2px; }

.ltf-ct-c-ov, .ltf-ct-c-gn, .ltf-ct-c-dv, .ltf-ct-c-pc, .ltf-ct-c-ch { text-align: center; }
.ltf-ct-c-ov { font-weight: 700; color: var(--ltf-ct-text-light,#6b7280); }
.ltf-ct-c-gn, .ltf-ct-c-dv { font-weight: 700; }
.ltf-ct-c-dv small, .ltf-ct-c-pc small { display: block; font-size: .76em; font-weight: 600; color: var(--ltf-ct-text-light, #6b7280); }
.ltf-ct-c-ch { font-weight: 800; font-size: 1.12em; }

.ltf-ct-results__empty {
	padding: 28px 0;
	text-align: center;
	color: var(--ltf-ct-text-light, #6b7280);
}

/* ---- cards layout: when the widget's OWN box is narrow (mobile OR a sidebar rail) ---- */
@container (max-width: 640px) {
	.ltf-ct-results__controls { gap: 10px; }
	.ltf-ct-results__head { display: none; }
	.ltf-ct-results__row {
		grid-template-columns: auto 1fr auto;
		grid-template-areas: "rank who chip";
		column-gap: 12px;
		row-gap: 2px;
		padding: 14px;
	}
	.ltf-ct-results__rankm { display: block; grid-area: rank; align-self: center; }
	.ltf-ct-c-ath { grid-area: who; gap: 0; }
	.ltf-ct-c-ch { grid-area: chip; align-self: center; text-align: right; }
	/* Gender + Division hidden on the card; pace tucks under the chip time. */
	.ltf-ct-c-ov, .ltf-ct-c-gn, .ltf-ct-c-dv { display: none; }
	.ltf-ct-c-pc {
		grid-area: chip;
		text-align: right;
		align-self: end;
		font-size: .82em;
		font-weight: 600;
		color: var(--ltf-ct-text-light, #6b7280);
		margin-top: 18px;
	}
	.ltf-ct-c-pc small { display: inline; }
	.ltf-ct-c-ch { align-self: start; }
}
