/*
 * Volleyball Pool - modern, responsive, RTL-friendly styling.
 * Loaded after pool.css so these rules win on shared selectors.
 */

:root {
	--vp-accent: #1f6feb;
	--vp-accent-dark: #1a5fd0;
	--vp-bg: #ffffff;
	--vp-bg-alt: #f5f7fa;
	--vp-border: #e2e6ea;
	--vp-text: #1c2733;
	--vp-muted: #6b7785;
	--vp-open: #2e8b57;
	--vp-closed: #b0863b;
	--vp-played: #4a5568;
	--vp-cancelled: #c0392b;
	--vp-radius: 8px;
	--vp-shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

img.vp-image-placeholder {
	background: var(--vp-bg-alt);
	border: 1px solid var(--vp-border);
	box-sizing: border-box;
	object-fit: cover;
}

img.team-photo.vp-image-placeholder,
img.stadium-photo.vp-image-placeholder,
img.league-image.vp-image-placeholder,
img.bonus-question-image.vp-image-placeholder {
	aspect-ratio: 4 / 3;
	border-radius: var(--vp-radius);
	min-height: 72px;
}

img.team-photo.thumb.vp-image-placeholder,
img.stadium-photo.thumb.vp-image-placeholder {
	height: 84px;
	width: 112px;
}

img.flag.vp-image-placeholder {
	border-radius: 50%;
}

ol.volleyball-pool.team-list img.team-photo.thumb.team-list {
	height: 48px;
	margin-inline-end: 10px;
	object-fit: cover;
	vertical-align: middle;
	width: 64px;
}

span.matchdate {
	flex: 2;
}

/* ---------- Shortcode tables ---------- */
div.ranking,
.shortcode table,
table.ranking,
table.pool-ranking,
table.matchinfo,
table.statistics,
table.prediction-table-questions,
table.vp-weekly-ranking {
	color: var(--vp-text);
}

div.ranking {
	background: var(--vp-bg);
	border: 1px solid var(--vp-border);
	border-radius: var(--vp-radius);
	box-shadow: var(--vp-shadow);
	margin: 0 0 18px;
	max-width: 100%;
	overflow-x: auto;
	padding: 0;
	width: 100%;
}

div.ranking h2 {
	align-items: center;
	background: var(--vp-bg);
	border-bottom: 1px solid var(--vp-border);
	color: var(--vp-text);
	display: flex;
	font-size: 1.05rem;
	font-weight: 800;
	justify-content: space-between;
	line-height: 1.4;
	margin: 0;
	padding: 12px 14px;
}

table.ranking,
table.pool-ranking,
table.matchinfo,
table.statistics,
table.prediction-table-questions,
table.vp-weekly-ranking {
	background: var(--vp-bg);
	border: 1px solid var(--vp-border);
	border-collapse: separate;
	border-radius: var(--vp-radius);
	border-spacing: 0;
	box-shadow: var(--vp-shadow);
	margin: 0 0 18px;
	overflow: hidden;
	width: 100%;
}

div.ranking table.ranking {
	border: 0;
	border-radius: 0;
	box-shadow: none;
	margin: 0;
	min-width: 520px;
}

table.ranking th,
table.ranking td,
table.pool-ranking th,
table.pool-ranking td,
table.matchinfo th,
table.matchinfo td,
table.statistics th,
table.statistics td,
table.prediction-table-questions th,
table.prediction-table-questions td,
table.vp-weekly-ranking th,
table.vp-weekly-ranking td {
	border: 0;
	border-bottom: 1px solid var(--vp-border);
	line-height: 1.45;
	padding: 10px 12px;
	vertical-align: middle;
}

table.ranking thead th,
table.pool-ranking thead th,
table.matchinfo thead th,
table.statistics thead th,
table.prediction-table-questions thead th,
table.vp-weekly-ranking thead th {
	background: var(--vp-bg-alt);
	color: var(--vp-muted);
	font-size: .78rem;
	font-style: normal;
	font-weight: 800;
	letter-spacing: 0;
	text-align: center;
	text-transform: uppercase;
	white-space: nowrap;
}

table.ranking tbody tr:nth-child(even),
table.pool-ranking tbody tr:nth-child(even),
table.matchinfo tbody tr:nth-child(even),
table.statistics tbody tr:nth-child(even),
table.prediction-table-questions tbody tr:nth-child(even),
table.vp-weekly-ranking tbody tr:nth-child(even) {
	background: var(--vp-bg-alt);
}

table.ranking tbody tr:hover,
table.pool-ranking tbody tr:hover,
table.matchinfo tbody tr:hover,
table.statistics tbody tr:hover,
table.prediction-table-questions tbody tr:hover,
table.vp-weekly-ranking tbody tr:hover {
	background: rgba(31, 111, 235, .08);
}

table.ranking tbody tr:last-child td,
table.pool-ranking tbody tr:last-child td,
table.matchinfo tbody tr:last-child td,
table.statistics tbody tr:last-child td,
table.prediction-table-questions tbody tr:last-child td,
table.vp-weekly-ranking tbody tr:last-child td {
	border-bottom: 0;
}

table.ranking a,
table.pool-ranking a,
table.matchinfo a,
table.statistics a,
table.prediction-table-questions a,
table.vp-weekly-ranking a {
	box-shadow: none;
	color: var(--vp-accent-dark);
	font-weight: 700;
	text-decoration: none;
}

table.ranking a:hover,
table.pool-ranking a:hover,
table.matchinfo a:hover,
table.statistics a:hover,
table.prediction-table-questions a:hover,
table.vp-weekly-ranking a:hover {
	color: var(--vp-accent);
	text-decoration: underline;
}

table.ranking td,
table.pool-ranking td,
table.matchinfo td,
table.statistics td,
table.prediction-table-questions td {
	font-size: .92rem;
}

table.group-ranking th.team,
table.group-ranking td.team {
	font-weight: 800;
	min-width: 180px;
	text-align: start;
	width: auto;
}

table.group-ranking th.plays,
table.group-ranking td.plays,
table.group-ranking th.wins,
table.group-ranking td.wins,
table.group-ranking th.draws,
table.group-ranking td.draws,
table.group-ranking th.losses,
table.group-ranking td.losses,
table.group-ranking th.points,
table.group-ranking td.points,
table.group-ranking th.goals,
table.group-ranking td.goals {
	background: transparent;
	font-variant-numeric: tabular-nums;
	text-align: center;
	white-space: nowrap;
}

table.group-ranking td.points {
	color: var(--vp-accent-dark);
	font-size: 1rem;
	font-weight: 900;
}

table.group-ranking th.points {
	color: var(--vp-accent-dark);
}

table.group-ranking td.goals,
table.group-ranking th.goals {
	color: var(--vp-muted);
	font-size: .82rem;
	padding: 10px 12px;
}

table.pool-ranking tr.currentuser,
table.matchinfo tr.currentuser,
table.ranking tr.currentuser,
table.vp-weekly-ranking tr.vp-self {
	background: rgba(31, 111, 235, .1);
	font-weight: 800;
}

table.pool-ranking td.user-rank,
td.num-predictions,
td.ranking.score,
table.pool-ranking td.score,
table.statistics td.result {
	font-variant-numeric: tabular-nums;
	text-align: center;
	white-space: nowrap;
}

/* ---------- Match cards (new layout) ---------- */
.matchinfo.new-layout {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
	align-items: stretch;
	width: 100%;
}

.matchinfo.new-layout .matchtype {
	grid-column: 1 / -1;
	font-weight: 600;
	font-size: 1rem;
	color: var(--vp-text);
	margin: 10px 0 0;
	padding: 0 0 8px;
	border-bottom: 2px solid var(--vp-border);
	background: transparent;
}

.matchinfo.new-layout .match-card {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	grid-template-areas:
		"header header header"
		"homeflag vs awayflag"
		"home    vs away"
		"footer footer footer";
	gap: 6px 10px;
	background: var(--vp-bg);
	border: 1px solid var(--vp-border);
	border-radius: var(--vp-radius);
	box-shadow: var(--vp-shadow);
	padding: 14px;
	transition: box-shadow .15s ease, transform .15s ease;
	width: auto;
	margin: 0;
	min-width: 0;
}

.matchinfo.new-layout .match-card:hover {
	box-shadow: 0 4px 12px rgba(16, 24, 40, .12);
	transform: translateY(-1px);
}

.matchinfo.new-layout .match-card.today {
	border-color: var(--vp-accent);
}

.matchinfo.new-layout .match-card-header {
	grid-area: header;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: .85em;
	color: var(--vp-muted);
	flex-wrap: wrap;
}

.matchinfo.new-layout .match-card .flag.home { grid-area: homeflag; justify-self: center; }
.matchinfo.new-layout .match-card .flag.away { grid-area: awayflag; justify-self: center; }
.matchinfo.new-layout .match-card .flag {
	align-items: center;
	display: flex;
	justify-content: center;
	min-height: 44px;
	width: auto;
}
.matchinfo.new-layout .match-card .flag:empty::before {
	background: var(--vp-bg-alt);
	border: 1px dashed var(--vp-border);
	border-radius: 50%;
	content: "";
	height: 38px;
	width: 38px;
}
.matchinfo.new-layout .match-card .flag img {
	border-radius: 50%;
	box-shadow: 0 0 0 1px var(--vp-border);
	height: 44px;
	max-width: 44px;
	object-fit: cover;
	width: 44px;
}

.matchinfo.new-layout .match-card .home,
.matchinfo.new-layout .match-card .away {
	font-size: .98rem;
	font-weight: 600;
	line-height: 1.5;
	min-width: 0;
	text-align: center;
	color: var(--vp-text);
	overflow-wrap: anywhere;
	width: auto;
}
.matchinfo.new-layout .match-card .home { grid-area: home; }
.matchinfo.new-layout .match-card .away { grid-area: away; }

.matchinfo.new-layout .match-card .score {
	grid-area: vs;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	width: auto;
	min-width: 58px;
	font-size: 1rem;
	font-weight: 800;
	color: var(--vp-accent-dark);
	white-space: nowrap;
}

.matchinfo.new-layout .match-card .score a {
	align-items: center;
	background: var(--vp-bg-alt);
	border: 1px solid var(--vp-border);
	border-radius: 999px;
	box-shadow: none;
	color: inherit;
	display: inline-flex;
	justify-content: center;
	min-height: 34px;
	min-width: 54px;
	padding: 4px 10px;
	text-decoration: none;
}

.matchinfo.new-layout .match-card .actual-score {
	font-weight: 700;
	color: var(--vp-accent-dark);
}

.matchinfo.new-layout .match-card-footer {
	grid-area: footer;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-top: 6px;
	padding-top: 8px;
	border-top: 1px solid var(--vp-border);
	font-size: .9em;
}

/* ---------- Statistics match view ---------- */
form[action*="statistics"] {
	background: var(--vp-bg);
	border: 1px solid var(--vp-border);
	border-radius: var(--vp-radius);
	box-shadow: var(--vp-shadow);
	margin: 0 0 18px;
	padding: 16px;
}

form[action*="statistics"] h2[class^="match-"],
form[action*="statistics"] h2[class*=" match-"] {
	color: var(--vp-text);
	font-size: clamp(1.2rem, 1.6vw, 1.55rem);
	font-weight: 800;
	line-height: 1.45;
	margin: 0 0 6px;
	overflow-wrap: anywhere;
}

form[action*="statistics"] .stadium-name {
	align-items: center;
	color: var(--vp-muted);
	display: flex;
	font-size: .95rem;
	font-weight: 600;
	gap: 8px;
	line-height: 1.5;
	margin: 0;
}

form[action*="statistics"] .stadium-name::before {
	background: radial-gradient(circle, var(--vp-accent-dark) 0 3px, var(--vp-bg-alt) 4px);
	border: 1px solid var(--vp-border);
	border-radius: 50%;
	color: var(--vp-accent-dark);
	content: "";
	display: inline-flex;
	height: 26px;
	justify-content: center;
	align-items: center;
	width: 26px;
}

form[action*="statistics"] > p {
	background: var(--vp-bg-alt);
	border: 1px solid var(--vp-border);
	border-radius: var(--vp-radius);
	color: var(--vp-muted);
	font-weight: 600;
	margin: 12px 0 0;
	padding: 10px 12px;
}

table.matchinfo.statistics {
	background: var(--vp-bg);
	border: 1px solid var(--vp-border);
	border-collapse: separate;
	border-radius: var(--vp-radius);
	border-spacing: 0;
	box-shadow: var(--vp-shadow);
	margin: 0 0 18px;
	max-width: 760px;
	overflow: hidden;
	width: 100%;
}

table.matchinfo.statistics th,
table.matchinfo.statistics td {
	border: 0;
	border-bottom: 1px solid var(--vp-border);
	padding: 10px 12px;
	vertical-align: middle;
}

table.matchinfo.statistics thead th {
	background: var(--vp-bg-alt);
	color: var(--vp-text);
	font-size: .86rem;
	font-weight: 800;
	line-height: 1.4;
	text-align: center;
}

table.matchinfo.statistics tbody tr:last-child td {
	border-bottom: 0;
}

table.matchinfo.statistics tbody tr:nth-child(even) {
	background: var(--vp-bg-alt);
}

table.matchinfo.statistics td:first-child {
	font-weight: 700;
	text-align: start;
}

table.matchinfo.statistics td.home,
table.matchinfo.statistics td.away,
table.matchinfo.statistics td.score,
table.matchinfo.statistics td.match-hyphen {
	font-variant-numeric: tabular-nums;
	text-align: center;
}

table.matchinfo.statistics td.score {
	color: var(--vp-accent-dark);
	font-weight: 800;
}

table.matchinfo.statistics tr.currentuser {
	background: rgba(31, 111, 235, .1);
}

/* ---------- Set-result dropdown ---------- */
select.prediction-set {
	min-width: 72px;
	padding: 6px 8px;
	border: 1px solid var(--vp-border);
	border-radius: 8px;
	background: var(--vp-bg);
	color: var(--vp-text);
	font-weight: 600;
	text-align: center;
	cursor: pointer;
}
select.prediction-set:focus {
	outline: none;
	border-color: var(--vp-accent);
	box-shadow: 0 0 0 3px rgba(31, 111, 235, .15);
}

/* ---------- Status badges ---------- */
.match-status {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: .75em;
	font-weight: 700;
	text-transform: none;
	letter-spacing: 0;
	line-height: 1.5;
	color: #fff;
}
.match-status.status-open { background: var(--vp-open); }
.match-status.status-closed { background: var(--vp-closed); }
.match-status.status-played { background: var(--vp-played); }
.match-status.status-cancelled { background: var(--vp-cancelled); }

.match-card.match-status-cancelled { opacity: .72; }
.match-card.match-status-cancelled .home,
.match-card.match-status-cancelled .away { text-decoration: line-through; }

/* ---------- Weekly ranking ---------- */
.vp-weekly-ranking-selector {
	margin: 0 0 12px;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}
.vp-weekly-ranking-selector select {
	padding: 6px 10px;
	border: 1px solid var(--vp-border);
	border-radius: 8px;
	background: var(--vp-bg);
}

table.vp-weekly-ranking {
	width: 100%;
	border-collapse: collapse;
	background: var(--vp-bg);
	border: 1px solid var(--vp-border);
	border-radius: var(--vp-radius);
	overflow: hidden;
}
table.vp-weekly-ranking th,
table.vp-weekly-ranking td {
	padding: 10px 12px;
	text-align: start;
	border-bottom: 1px solid var(--vp-border);
}
table.vp-weekly-ranking thead th {
	background: var(--vp-bg-alt);
	font-weight: 700;
	color: var(--vp-text);
}
table.vp-weekly-ranking tbody tr:last-child td { border-bottom: none; }
table.vp-weekly-ranking tbody tr:nth-child(even) { background: var(--vp-bg-alt); }
table.vp-weekly-ranking tr.vp-self {
	background: rgba(31, 111, 235, .1);
	font-weight: 700;
}

/* ---------- RTL ---------- */
.rtl .matchinfo.new-layout .match-card-header,
[dir="rtl"] .matchinfo.new-layout .match-card-header,
.rtl .matchinfo.new-layout .match-card-footer,
[dir="rtl"] .matchinfo.new-layout .match-card-footer {
	flex-direction: row-reverse;
}

.rtl table.vp-weekly-ranking th,
.rtl table.vp-weekly-ranking td,
[dir="rtl"] table.vp-weekly-ranking th,
[dir="rtl"] table.vp-weekly-ranking td {
	text-align: right;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
	.matchinfo.new-layout {
		grid-template-columns: 1fr;
	}
	.matchinfo.new-layout .match-card .flag img { max-width: 40px; }
	.shortcode table,
	table.ranking,
	table.pool-ranking,
	table.matchinfo,
	table.statistics,
	table.prediction-table-questions,
	table.vp-weekly-ranking {
		display: block;
		max-width: 100%;
		overflow-x: auto;
		white-space: nowrap;
	}
	table.vp-weekly-ranking th,
	table.vp-weekly-ranking td { padding: 8px 10px; }
}
