/*
 * Public /tournaments/ list — one clickable card-row per tournament (date
 * block, name/status/meta, ICO points + capacity, deadline + CTA). Same
 * component also renders player-profile.php's own "My tournaments" panel —
 * see playcross_render_tournament_row()'s own docblock, inc/template-tags.php.
 */

/* ---------------------------------------- Tabs, level filter, search bar */
/* .pc-tab-panel[hidden] base rule comes from bracket.css (enqueued
   alongside this file for tournaments.php). The Upcoming/Completed tab bar
   itself sits in the dark hero band, same placement + look as the
   Overview/Matches/Draws bar on tournament-single.php (.pc-tournament-tabs
   there) — rules mirrored here under their own class since pulling in the
   whole of tournament-single.css just for this would be overkill. */

/* Same trim as tournament-single.php's own hero-with-tabs band
   (.pc-tournament-single-hero) -- .pc-section's default padding-bottom
   (--pc-space-xl) leaves too much empty dark space below the tab row
   otherwise. */
.pc-tournaments-hero {
	padding-bottom: var(--pc-space-sm);
}

.pc-tournaments-tabs-wrap {
	margin-top: var(--pc-space-md);
}

.pc-tournaments-tabs .pc-tab-list {
	display: flex;
	gap: var(--pc-space-md);
	border-bottom: 1px solid var(--pc-dark-border);
}

.pc-tournaments-tabs .pc-tab {
	display: inline-block;
	font-family: var(--pc-font-heading);
	font-size: 0.9rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	background: none;
	border: none;
	border-bottom: 3px solid transparent;
	padding: 0.6rem 0;
	color: var(--pc-dark-text-muted);
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
}

.pc-tournaments-tabs .pc-tab.is-active {
	color: var(--pc-dark-text);
	border-bottom-color: var(--pc-red);
}

.pc-tournaments-tabs .pc-tab:not(.is-active):hover,
.pc-tournaments-tabs .pc-tab:not(.is-active):focus-visible {
	color: var(--pc-amber);
	border-bottom-color: var(--pc-amber);
}

/* Level chips left, Year + Search glued together on the right edge of the
   same row — space-between + margin-left: auto on the right-hand group
   means it still hugs the right edge even if the chip row is short and
   doesn't reach it on its own. Stacks full-width on mobile (below). */
.pc-tournament-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--pc-space-md);
	margin-bottom: var(--pc-space-lg);
}

.pc-level-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	flex: 1 1 auto;
}

/* Year (Completed tab only, shown/hidden by tournaments-filter.js) + Search
   sit side by side as one group, pushed to the toolbar's right edge. */
.pc-tournament-toolbar-right {
	display: flex;
	flex-wrap: wrap;
	gap: var(--pc-space-sm);
	flex: 0 0 auto;
	margin-left: auto;
}

/* Same squared-off, rounded-corner shape as the site's other buttons
   (.pc-btn, components.css) — var(--pc-radius-sm), not a pill — per direct
   feedback that these should look consistent with the rest of the site,
   e.g. the homepage's own buttons. */
.pc-level-chip {
	display: inline-flex;
	align-items: center;
	padding: 0.5rem 0.9rem;
	border-radius: var(--pc-radius-sm);
	border: 1px solid var(--pc-light-border);
	background: var(--pc-light-surface);
	font-family: var(--pc-font-heading);
	font-weight: 700;
	font-size: 0.8125rem;
	color: var(--pc-light-text-muted);
	cursor: pointer;
}

.pc-level-chip:hover {
	border-color: var(--pc-red);
	color: var(--pc-light-text);
}

.pc-level-chip.is-active {
	background: var(--pc-red);
	border-color: var(--pc-red);
	color: var(--pc-light-surface);
}

.pc-tournament-search-field {
	flex: 0 0 auto;
	width: 16rem;
	margin-bottom: 0;
}

.pc-tournament-year-field {
	flex: 0 0 auto;
	width: 9rem;
	margin-bottom: 0;
}

/* Same fix as .pc-btn[hidden] in components.css -- .pc-field's own
   `display: block` is an author-origin rule that otherwise outranks the
   browser's default (lower-priority UA) [hidden]{display:none}, so toggling
   the `hidden` attribute via JS (tournaments-filter.js) had no visual
   effect at all without this. */
.pc-tournament-year-field[hidden] {
	display: none;
}

.pc-tournament-row-list {
	display: flex;
	flex-direction: column;
	gap: var(--pc-space-sm);
}

/* Rebuilt to an exact, fully-specified brief — see
   playcross_render_tournament_row()'s own docblock (template-tags.php) for
   the departures from that brief's own literal values, mirrored from the
   homepage's own "Upcoming tournaments" card
   (playcross_render_tournament_card()/front-page.css) for visual
   consistency between the site's 2 now near-identical tournament-card
   designs: typeface (Barlow/Barlow Condensed -> var(--pc-font-heading)/
   var(--pc-font-body), this theme's own Oswald/IBM Plex Sans), near-
   duplicate hex colors -> this site's own existing tokens, and the 4-state
   status-pill semantics (reusing .pc-badge--soon/--win/--live,
   components.css) instead of the brief's own literal 2-state red/navy one
   -- plus a Withdraw CTA state specific to this row (see that same
   docblock). The whole row is ONE link/grid, not the old flex row of
   separate pieces. */

.pc-tournament-row {
	display: grid;
	grid-template-columns: 112px 4px 1fr 150px 214px;
	grid-template-areas: "date bar main ico action";
	overflow: hidden;
	border-radius: 14px;
	background: var(--pc-light-surface);
	box-shadow: 0 1px 2px rgba(13, 46, 51, 0.09);
	color: inherit;
	text-decoration: none;
	transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.pc-tournament-row:hover,
.pc-tournament-row:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 18px 38px -20px rgba(13, 46, 51, 0.42);
}

/* No focus ring exists anywhere else on the site to stay consistent with
   (grepped) -- same treatment as the homepage's own card. */
.pc-tournament-row:focus-visible {
	outline: 2px solid var(--pc-red);
	outline-offset: 3px;
}

.pc-tournament-row-date {
	grid-area: date;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.15rem;
	padding: 12px 8px;
	background: var(--pc-dark-bg);
}

.pc-tournament-row-month {
	line-height: 1;
	font-family: var(--pc-font-heading);
	font-weight: 700;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.26em;
	color: var(--pc-red);
}

.pc-tournament-row-day {
	line-height: 1;
	font-family: var(--pc-font-heading);
	font-weight: 800;
	font-size: 38px;
	font-variant-numeric: tabular-nums;
	color: #fff;
}

.pc-tournament-row-year {
	line-height: 1;
	font-family: var(--pc-font-body);
	font-weight: 600;
	font-size: 12px;
	letter-spacing: 0.16em;
	color: var(--pc-dark-text-muted);
}

.pc-tournament-row-bar {
	grid-area: bar;
	background: var(--pc-red);
}

.pc-tournament-row-main {
	grid-area: main;
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 10px;
	padding: 22px 28px;
}

.pc-tournament-row-status-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem;
}

/* Reuses .pc-badge/.pc-badge--soon/--win/--live as-is (components.css) for
   color + the pulsing dot -- only sized down for this denser row context,
   same as the homepage card's own scoped override. */
.pc-tournament-row-status-row .pc-badge {
	padding: 0.25rem 0.55rem;
	font-size: 10px;
	letter-spacing: 0.14em;
	white-space: nowrap;
}

.pc-tournament-row-series {
	font-family: var(--pc-font-body);
	font-weight: 600;
	font-size: 11px;
	text-transform: uppercase;
	color: var(--pc-light-text-muted);
}

.pc-tournament-row-title {
	margin: 0;
	font-family: var(--pc-font-heading);
	font-weight: 800;
	font-size: 24px;
	letter-spacing: -0.01em;
	color: var(--pc-light-text);
}

.pc-tournament-row-meta {
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	font-family: var(--pc-font-body);
	font-weight: 600;
	font-size: 14px;
	color: var(--pc-light-text-muted);
}

.pc-tournament-row-meta span:not(:first-child)::before {
	content: "|";
	display: inline-block;
	margin: 0 10px;
	color: var(--pc-light-border);
}

.pc-tournament-row-ico {
	grid-area: ico;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 12px;
	border-left: 1px solid var(--pc-light-border);
}

.pc-tournament-row-ico-badge {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.2rem;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--pc-light-border);
	border-radius: 8px;
	white-space: nowrap;
}

.pc-tournament-row-ico-value {
	font-family: var(--pc-font-body);
	font-weight: 800;
	font-size: 16px;
	color: var(--pc-light-text);
}

.pc-tournament-row-ico-value strong {
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	color: var(--pc-red);
}

.pc-tournament-row-ico-label {
	font-family: var(--pc-font-body);
	font-weight: 600;
	font-size: 8px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--pc-light-text-muted);
}

.pc-tournament-row-spots {
	font-family: var(--pc-font-body);
	font-weight: 600;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	color: var(--pc-light-text-muted);
}

.pc-tournament-row-action {
	grid-area: action;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 12px;
	padding: 22px 26px;
	border-left: 1px solid var(--pc-light-border);
}

.pc-tournament-row-deadline {
	margin: 0;
	font-family: var(--pc-font-body);
	font-weight: 700;
	font-size: 12px;
	text-transform: uppercase;
}

.pc-tournament-row-deadline.is-open {
	color: var(--pc-red);
}

.pc-tournament-row-deadline.is-closed {
	color: var(--pc-light-text);
}

.pc-tournament-row-cta {
	display: block;
	box-sizing: border-box;
	width: 100%;
	padding: 14px;
	border-radius: 9px;
	background: var(--pc-red);
	color: #fff;
	font-family: var(--pc-font-body);
	font-weight: 700;
	font-size: 14px;
	text-align: center;
	transition: background-color 0.2s ease;
}

.pc-tournament-row:hover .pc-tournament-row-cta:not(.is-withdraw),
.pc-tournament-row:focus-visible .pc-tournament-row-cta:not(.is-withdraw) {
	background: var(--pc-dark-bg);
}

/* Withdraw is a distinct, more cautious action from Register/View -- outline
   instead of solid red at rest, inverting to solid red on hover (rather
   than the other 2 states' hover-to-navy) so it never reads as the same
   "go" action wearing a different label. See this row's own existing
   self-service withdrawal, preserved from the pre-redesign version. */
.pc-tournament-row-cta.is-withdraw {
	background: transparent;
	border: 1px solid var(--pc-red);
	color: var(--pc-red);
	padding: 13px 14px;
}

.pc-tournament-row:hover .pc-tournament-row-cta.is-withdraw,
.pc-tournament-row:focus-visible .pc-tournament-row-cta.is-withdraw {
	background: var(--pc-red);
	color: #fff;
}

/* Inverted/dark variant of this exact same row -- one tournament the
   visitor is already registered for, standing out from every other
   (light) card in the list. Same grid/structure/sizes as the base row,
   only colors + 2 texts change -- see playcross_render_tournament_row()'s
   own docblock (template-tags.php) for exactly when this applies. Local
   custom properties (rather than new global tokens in tokens.css) since
   every one of these colors is specific to this single card variant --
   --pc-dark-bg is the one exception, reused as-is since it's genuinely
   the site's own existing header color, not a new one. Every value below
   confirmed directly against a supplied reference. */
.pc-tournament-row--registered {
	--pc-tr-reg-date-bg: #14383f;
	--pc-tr-reg-green: #7bd3ac;
	--pc-tr-reg-green-solid: #1e9e6a;
	--pc-tr-reg-muted: #8fa3aa;
	--pc-tr-reg-secondary: #a9bcc2;
	--pc-tr-reg-coral: #ff6b7b;
	--pc-tr-reg-divider: rgba(255, 255, 255, 0.12);

	background: var(--pc-dark-bg);
	box-shadow: 0 6px 18px rgba(14, 42, 51, 0.22);
}

.pc-tournament-row--registered:hover,
.pc-tournament-row--registered:focus-visible {
	box-shadow: 0 20px 40px -18px rgba(14, 42, 51, 0.55);
}

.pc-tournament-row--registered .pc-tournament-row-date {
	background: var(--pc-tr-reg-date-bg);
}

.pc-tournament-row--registered .pc-tournament-row-month {
	color: var(--pc-tr-reg-green);
}

.pc-tournament-row--registered .pc-tournament-row-day {
	color: #fff;
}

.pc-tournament-row--registered .pc-tournament-row-year {
	color: var(--pc-tr-reg-muted);
}

.pc-tournament-row--registered .pc-tournament-row-bar {
	background: var(--pc-tr-reg-green-solid);
}

.pc-tournament-row--registered .pc-tournament-row-series {
	color: var(--pc-tr-reg-muted);
}

.pc-tournament-row--registered .pc-tournament-row-title {
	color: #fff;
}

.pc-tournament-row--registered .pc-tournament-row-meta {
	color: var(--pc-tr-reg-secondary);
}

.pc-tournament-row--registered .pc-tournament-row-meta span:not(:first-child)::before {
	color: var(--pc-tr-reg-divider);
}

.pc-tournament-row--registered .pc-tournament-row-ico {
	border-left-color: var(--pc-tr-reg-divider);
}

.pc-tournament-row--registered .pc-tournament-row-ico-badge {
	border-color: rgba(255, 255, 255, 0.2);
}

.pc-tournament-row--registered .pc-tournament-row-ico-value {
	color: #fff;
}

.pc-tournament-row--registered .pc-tournament-row-ico-value strong {
	color: var(--pc-tr-reg-coral);
}

.pc-tournament-row--registered .pc-tournament-row-ico-label {
	color: var(--pc-tr-reg-muted);
}

.pc-tournament-row--registered .pc-tournament-row-spots {
	color: var(--pc-tr-reg-secondary);
}

.pc-tournament-row--registered .pc-tournament-row-action {
	border-left-color: var(--pc-tr-reg-divider);
}

/* Deadline's own replacement -- an already-registered visitor is never
   shown a deadline on this card at all (see the PHP). Same weight/size/
   spacing/uppercase treatment as .pc-tournament-row-deadline itself, just
   its own fixed color+copy instead of the open/closed 2-state one. */
.pc-tournament-row-registered-note {
	margin: 0;
	font-family: var(--pc-font-body);
	font-weight: 700;
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--pc-tr-reg-green);
}

.pc-tournament-row--registered .pc-tournament-row-cta {
	background: #fff;
	color: var(--pc-dark-bg);
}

.pc-tournament-row--registered:hover .pc-tournament-row-cta:not(.is-withdraw),
.pc-tournament-row--registered:focus-visible .pc-tournament-row-cta:not(.is-withdraw) {
	background: var(--pc-red);
	color: #fff;
}

@media (max-width: 1024px) {
	.pc-tournament-row {
		grid-template-columns: 88px 4px 1fr 1fr;
		grid-template-areas:
			"date bar main main"
			"date bar ico  action";
	}

	.pc-tournament-row-ico {
		border-left: none;
		border-top: 1px solid var(--pc-light-border);
	}

	.pc-tournament-row-action {
		border-top: 1px solid var(--pc-light-border);
	}
}

@media (max-width: 640px) {
	/* Full stack — the date block flattens from the desktop's centered
	   vertical stack into a horizontal top strip (date inline), same red
	   bar now running full-width underneath it instead of down the side. */
	.pc-tournament-row-list {
		gap: 10px;
	}

	.pc-tournament-row {
		grid-template-columns: 1fr 1fr;
		grid-template-areas:
			"date date"
			"bar bar"
			"main main"
			"ico action";
	}

	.pc-tournament-row-date {
		flex-direction: row;
		justify-content: center;
		align-items: baseline;
		gap: 0.5rem;
		padding: 10px;
	}

	.pc-tournament-row-day {
		font-size: 22px;
	}

	.pc-tournament-row-month {
		font-size: 12px;
	}

	.pc-tournament-row-year {
		font-size: 11px;
	}

	.pc-tournament-row-bar {
		height: 4px;
	}

	.pc-tournament-row-main {
		padding: 18px 20px;
	}

	.pc-tournament-row-title {
		font-size: 20px;
	}

	.pc-tournament-row-ico,
	.pc-tournament-row-action {
		padding: 16px;
	}

	.pc-tournament-toolbar {
		flex-direction: column;
		align-items: stretch;
		gap: var(--pc-space-sm);
	}

	/* Year + Search stay side by side even on mobile (one compact row is
	   tighter than two full-width stacked fields) -- Year keeps a narrow
	   fixed width, Search grows to fill the rest. */
	.pc-tournament-toolbar-right {
		flex-wrap: nowrap;
		width: 100%;
		margin-left: 0;
	}

	.pc-tournament-year-field {
		width: 6.5rem;
	}

	.pc-tournament-search-field {
		flex: 1 1 auto;
		width: auto;
		min-width: 0;
	}

	/* Placeholder/options already say what/how to pick -- the labels would
	   just be extra vertical height on a narrow screen, so they're kept for
	   screen readers only here (same clip technique as the shared
	   .screen-reader-text utility in style.css). */
	.pc-tournament-search-field label,
	.pc-tournament-year-field label {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.pc-tournament-search-field input,
	.pc-tournament-year-field select {
		padding: 0.55rem 0.6rem;
		font-size: 0.9rem;
	}
}
