/* =====================================================================
   stats.css — shared styles for all stats pages
   Colours: navy #00386e, red #c90009, stripe-bg #dce4ec
   ===================================================================== */

/* ---------- page container ---------- */
.stats-page {
	max-width: 740px;
	margin: 0 auto;
	padding: 24px 16px 48px;
}

.stats-page-wide {
	max-width: 1100px;
	margin: 0 auto;
	padding: 24px 16px 48px;
}

/* ---------- round badge ---------- */
.week-badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: #fff;
	background: #c90009;
	padding: 3px 10px;
	border-radius: 20px;
}

.week-badge-wrap {
	text-align: center;
	margin-bottom: 6px;
}

/* ---------- tournament header (shared) ---------- */
.tourney-header {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	margin-bottom: 18px;
}

.tourney-name-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0;
}

.tourney-name-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.tourney-name {
	font-size: 22px;
	font-weight: 700;
	color: #00386e;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.tourney-logo {
	width: 74px;
	height: 74px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid #e8edf3;
	flex-shrink: 0;
}

.tourney-event-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 700;
	color: #4a5568;
}

.tourney-name-wrap:has(.tourney-logo) .tourney-event-badge {
	margin-top: -20px;
}

.tourney-event-icon {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	object-fit: contain;
	box-shadow: 0 1px 4px rgba(0,0,0,.18);
}

/* ---------- page title ---------- */
.stats-title {
	font-size: 22px;
	font-weight: 700;
	color: #00386e;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	text-align: center;
	margin-bottom: 16px;
}

/* ---------- subtitle / helper text ---------- */
.stats-subtitle {
	font-size: 12px;
	color: #888;
	text-align: center;
	margin-bottom: 16px;
	line-height: 1.5;
}

/* ---------- season / filter selector ---------- */
.season-select-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 12px;
	color: #555;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	margin-bottom: 16px;
}

.season-select-wrap select {
	font-family: 'Roboto Condensed', sans-serif;
	font-size: 13px;
	font-weight: 700;
	color: #00386e;
	background: #eef2f7;
	border: 1px solid #dce4ec;
	border-radius: 20px;
	padding: 4px 12px;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	outline: none;
}

.season-select-wrap select:hover { background: #dce4ec; }

/* ---------- card ---------- */
.card {
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 8px rgba(0,0,0,.04);
	overflow: hidden;
	margin-bottom: 20px;
}

.card-hd {
	background: #00386e;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	padding: 9px 14px;
}

/* ---------- loading overlay ---------- */
#table_team,
.card,
body {
	position: relative;
}

.stats-loading-overlay {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	min-height: 88px;
	background: rgba(255, 255, 255, .76);
	z-index: 20;
}

body > .stats-loading-overlay {
	position: fixed;
	min-height: 100vh;
	background: rgba(220, 228, 236, .78);
	z-index: 10000;
}

.stats-is-loading > .stats-loading-overlay {
	display: flex;
}

.stats-loading-box {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: #00386e;
	background: #fff;
	border: 1px solid #dce4ec;
	border-radius: 8px;
	box-shadow: 0 2px 12px rgba(0, 56, 110, .14);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .12em;
	padding: 11px 14px;
	text-transform: uppercase;
}

.stats-loading-spinner {
	width: 18px;
	height: 18px;
	border: 3px solid #dce4ec;
	border-top-color: #c90009;
	border-radius: 50%;
	animation: stats-spin .75s linear infinite;
}

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

/* ---------- shared stats table ---------- */
.stats-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.stats-table a { color: inherit; text-decoration: none; }
.stats-table a:hover { color: #00386e; text-decoration: underline; }

/* blue section header row */
.stats-table tr.tbl-section-header th {
	background: #00386e;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	padding: 7px 10px;
	text-align: left;
}

/* light column sub-header */
.stats-table tr.tbl-col-header th {
	font-size: 9px;
	font-weight: 700;
	letter-spacing: .10em;
	text-transform: uppercase;
	color: #6b7a90;
	padding: 5px 8px;
	text-align: center;
	border-bottom: 1px solid #e4e9f0;
	background: none;
}

.stats-table tr.tbl-col-header th.col-left { text-align: left; }

/* sortable link in col header */
.stats-table tr.tbl-col-header th a {
	color: #6b7a90;
	text-decoration: underline dotted;
}

.stats-table tr.tbl-col-header th a:hover { color: #00386e; }

/* data cells */
.stats-table td {
	padding: 10px 8px;
	border-bottom: 1px solid #f2f4f8;
	vertical-align: middle;
}

.stats-table tr:last-child td { border-bottom: none; }
.stats-table tbody tr:hover td { background: #f7f9fc !important; }

/* logged-in team highlight */
.stats-table tr.my-team td {
	font-weight: 700;
	background: rgba(0, 56, 110, 0.06) !important;
	color: #00386e;
}
.stats-table tr.my-team td:first-child {
	border-left: 3px solid #00386e;
	padding-left: 5px;
}

/* H2H captain result cells */
.stats-table td.h2h-win  { background: #bbf7d0 !important; color: #065f46 !important; font-weight: 700; text-align: center; border: 1px solid #fff; }
.stats-table td.h2h-loss { background: #fecaca !important; color: #991b1b !important; font-weight: 700; text-align: center; border: 1px solid #fff; }
.stats-table td.h2h-tie  { background: #e2e8f0 !important; color: #475569 !important; font-weight: 700; text-align: center; border: 1px solid #fff; }

/* ---------- player profile card ---------- */
.player-header-card {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 20px;
	margin-bottom: 20px;
}

/* Sharp headshot — oversized img clipped to portrait wrapper */
.player-header-card .hs-wrap-lg {
	position: relative;
	width: 130px;
	height: 165px;
	overflow: hidden;
	flex-shrink: 0;
	border-radius: 8px;
	border: 1px solid #dce4ec;
}
.player-header-card .hs-wrap-lg img.headshot_large {
	position: absolute;
	width: 390px;
	height: auto;
	left: 50%;
	top: -22px;
	transform: translateX(-50%);
	border: none;
	border-radius: 0;
	margin: 0;
	flex-shrink: unset;
}

.player-info { flex: 1; min-width: 0; }

.player-name {
	font-size: 20px;
	font-weight: 700;
	color: #00386e;
	margin-bottom: 2px;
}

.player-team {
	font-size: 14px;
	color: #555;
	margin-bottom: 12px;
	border-bottom: 1px solid #dce4ec;
	padding-bottom: 10px;
}

.player-team a { color: #00386e; text-decoration: none; }
.player-team a:hover { text-decoration: underline dotted; }

.player-stats-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px 16px;
	font-size: 13px;
}

.player-stats-grid span.label { color: #888; }
.player-stats-grid span.rank  { font-size: 11px; color: #aaa; }

/* ---------- get history button ---------- */
.btn-get {
	display: inline-block;
	background: #00386e;
	color: #fff;
	font-family: 'Roboto Condensed', sans-serif;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 8px 20px;
	border: none;
	border-radius: 20px;
	cursor: pointer;
	text-decoration: none;
	margin: 12px 0;
}

.btn-get:hover { background: #004f9f; }

/* ---------- h2h team selector ---------- */
.h2h-selector {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.h2h-selector select {
	font-family: 'Roboto Condensed', sans-serif;
	font-size: 13px;
	color: #00386e;
	background: #eef2f7;
	border: 1px solid #dce4ec;
	border-radius: 20px;
	padding: 6px 14px;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	outline: none;
	min-width: 180px;
}

.h2h-selector select:hover { background: #dce4ec; }

.h2h-vs {
	font-size: 12px;
	font-weight: 700;
	color: #888;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* series result text */
.series-result {
	text-align: center;
	font-size: 14px;
	font-weight: 700;
	color: #00386e;
	padding: 12px;
	background: #f0f4f8;
	border-top: 1px solid #dce4ec;
}

/* ---------- responsive ---------- */
@media (max-width: 700px) {
	.stats-page, .stats-page-wide { padding: 12px 8px 32px; }
	.stats-title { font-size: 17px; }
	.tourney-name { font-size: 17px; }
	.tourney-logo { width: 36px; height: 36px; }
	.tourney-name-wrap:has(.tourney-logo) .tourney-event-badge { margin-top: 2px; }
	.tourney-event-badge { font-size: 11px; }
	.tourney-event-icon { width: 18px; height: 18px; }
	.card { overflow-x: auto; display: grid; grid-template-columns: minmax(max-content, 1fr); }
	.stats-table { font-size: 3.5vw; white-space: nowrap; }
	.stats-table td { padding: 8px 3px; }
	.player-header-card { flex-direction: column; align-items: center; justify-items: center; gap: 12px; text-align: center; }
	.player-header-card .player-team { border-bottom: none; padding-bottom: 0; }
	.player-stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- mvp season cards ---------- */
#mvp-seasons {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	align-items: start;
}

.mvp-season-card {
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 8px rgba(0,0,0,.04);
	overflow: hidden;
}

.mvp-season-hd {
	background: #00386e;
	color: #fff;
	padding: 9px 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.mvp-season-year {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .10em;
	text-transform: uppercase;
}

.mvp-headshot-wrap {
	background: #f4f7fb;
	display: flex;
	justify-content: center;
	padding: 14px 0 10px;
	border-bottom: 1px solid #eef2f7;
}

.mvp-headshot-circle {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	overflow: hidden;
	border: 3px solid #fff;
	box-shadow: 0 1px 4px rgba(0,0,0,.15);
	position: relative;
	flex-shrink: 0;
}

.mvp-headshot {
	position: absolute;
	width: 190px;
	height: auto;
	left: 50%;
	top: -10px;
	transform: translateX(-50%);
}

.mvp-podium {
	display: flex;
	flex-direction: column;
	gap: 1px;
	background: #eef2f7;
}

.mvp-player {
	background: #fff;
	padding: 10px 14px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.mvp-rank-badge {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .02em;
	flex-shrink: 0;
}

.mvp-rank-1 .mvp-rank-badge { background: #fff3cd; color: #856404; border: 1px solid #f0c040; }
.mvp-rank-2 .mvp-rank-badge { background: #e2e8f0; color: #475569; border: 1px solid #b0bec5; }
.mvp-rank-3 .mvp-rank-badge { background: #fde8d8; color: #7c4a1e; border: 1px solid #e8a070; }

.mvp-player-info {
	flex: 1;
	min-width: 0;
}

.mvp-player-name {
	font-size: 13px;
	font-weight: 700;
	color: #00386e;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.mvp-player-name a { color: inherit; text-decoration: none; }
.mvp-player-name a:hover { text-decoration: underline; }

.mvp-player-team {
	font-size: 11px;
	color: #888;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.mvp-player-team a { color: inherit; text-decoration: none; }
.mvp-player-team a:hover { color: #00386e; text-decoration: underline; }

.mvp-player-pts {
	font-size: 13px;
	font-weight: 700;
	color: #333;
	white-space: nowrap;
	flex-shrink: 0;
}

.mvp-rank-1 .mvp-player-pts { color: #00386e; }

@media (max-width: 900px) {
	#mvp-seasons { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
	#mvp-seasons { grid-template-columns: 1fr; }
}

/* ---------- champions ---------- */
#champion-seasons {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	align-items: start;
}

.champion-season-card {
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 8px rgba(0,0,0,.04);
	overflow: hidden;
}

.champion-season-hd {
	background: #00386e;
	color: #fff;
	padding: 9px 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.champion-season-year {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .10em;
	text-transform: uppercase;
}

.champion-podium {
	display: flex;
	flex-direction: column;
	gap: 1px;
	background: #eef2f7;
}

.champion-team {
	background: #fff;
	padding: 10px 14px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.champion-rank-badge {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .02em;
	flex-shrink: 0;
}

.champion-rank-1 .champion-rank-badge { background: #fff3cd; color: #856404; border: 1px solid #f0c040; }
.champion-rank-2 .champion-rank-badge { background: #e2e8f0; color: #475569; border: 1px solid #b0bec5; }
.champion-rank-3 .champion-rank-badge { background: #fde8d8; color: #7c4a1e; border: 1px solid #e8a070; }

.champion-team-info {
	flex: 1;
	min-width: 0;
}

.champion-team-name {
	font-size: 13px;
	font-weight: 400;
	color: #00386e;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.champion-team-name a { color: inherit; text-decoration: none; }
.champion-team-name a:hover { text-decoration: underline; }

.champion-team-pts {
	font-size: 13px;
	font-weight: 700;
	color: #333;
	white-space: nowrap;
	flex-shrink: 0;
}

.champion-rank-1 .champion-team-pts { color: #00386e; }

@media (max-width: 900px) {
	#champion-seasons { grid-template-columns: 1fr; }

	.champion-team-name {
		white-space: normal;
		overflow: visible;
		text-overflow: clip;
	}
}

@media (max-width: 600px) {
	#champion-seasons { grid-template-columns: 1fr; }
}

.champ-badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 7px;
	border-radius: 10px;
	vertical-align: middle;
	margin-left: 6px;
	letter-spacing: 0.3px;
}
.champ-trophy {
	background: #fff3cd;
	color: #856404;
	border: 1px solid #f0c040;
}
.champ-current {
	background: #d1ecf1;
	color: #0c5460;
	border: 1px solid #bee5eb;
}

/* ---------- tournament library ---------- */
.lib-logo {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid #e8edf3;
	vertical-align: middle;
}

.yr-chip {
	display: inline-block;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .05em;
	color: #fff;
	background: #00386e;
	padding: 2px 8px;
	border-radius: 10px;
	text-decoration: none;
	margin: 2px 2px 2px 0;
}

.yr-chip:hover { background: #005099; }
