/*
  The tournament page's Standings table (partials/tournament_standings.html) and the team-name pencil that is also used
  in the Attendees list (partials/team_name_heading.html, static/js/team_name.js).
  Design: claude/standings-table-design.md. The table is not sortable: it is already in the tournament's own rank order.

  Rank badge and record pill (.gt-rk, .gt-pill) are written to be reused by the other Standings tables later.
  Colors follow Bootstrap's light / dark variables; the blue of an army's title and the gold of the Points/Figures pill are
  fixed because they read well on both.
*/

.gt-st {
	--gt-line: var(--bs-border-color, #dee2e6);
	--gt-line-soft: var(--bs-border-color-translucent, rgba(0, 0, 0, .12));
	--gt-muted: var(--bs-secondary-color, #6c757d);
	--gt-gold: var(--c-primary, #bfa85e);
	--gt-title: #0a6aa8;
	--gt-good: #146c43;
	width: 100%;
	border-collapse: collapse;
	text-align: left;
	font-size: .95rem;
}
html[data-bs-theme=dark] .gt-st { --gt-title: #7cc4ee; --gt-good: #6fe0a8; }

.gt-st thead th {
	padding: .45rem .4rem;
	font-size: .7rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--gt-muted);
	border-bottom: 1px solid var(--gt-line);
	white-space: nowrap;
}
.gt-st-c-rank, .gt-st-c-rec, .gt-st-c-sos, .gt-st-c-dom { text-align: center; }

.gt-st td { padding: .35rem .4rem; vertical-align: middle; }
.gt-st tbody.gt-st-group + tbody.gt-st-group > tr:first-child > td { border-top: 1px solid var(--gt-line); }
.gt-st .gt-st-rank, .gt-st .gt-st-rec, .gt-st .gt-st-sos, .gt-st .gt-st-dom { text-align: center; white-space: nowrap; }
.gt-st .gt-st-rank { width: 3.4rem; }
.gt-st .gt-st-rec { width: 5rem; }
.gt-st .gt-st-sos, .gt-st .gt-st-dom {
	width: 4rem;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .8rem;
	color: var(--gt-muted);
}
.gt-st .gt-st-who { width: 1%; min-width: 9rem; white-space: nowrap; }       /* hugs the longest name, so the armies get the rest */
.gt-st .gt-st-armies { min-width: 16rem; }

/* Players that are not playing (dropped / inactive): a grey band behind the row, the colors drained and the text a little
   lighter. The Inactive tag says why. */
.gt-st tr.gt-st-off { background: rgba(128, 128, 128, .18); }
.gt-st .gt-st-off > td { filter: grayscale(1); }
.gt-st .gt-st-off > td > * { opacity: .7; }

/* ---- Rank badge and record pill ---- */
.gt-rk {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.1rem;
	padding: .1rem .5rem;
	border-radius: 9px;
	border: 1px solid var(--gt-line);
	background: rgba(128, 128, 128, .08);
	color: var(--gt-muted);
	font-size: .78rem;
	font-weight: 700;
	white-space: nowrap;          /* a tie stays on one line: T-29 */
}
.gt-rk-1 { background: rgba(255, 193, 7, .2); border-color: rgba(190, 150, 0, .6); color: #8a6a00; }
.gt-rk-2 { background: rgba(150, 160, 175, .22); border-color: rgba(120, 130, 145, .6); color: #566070; }
.gt-rk-3 { background: rgba(230, 126, 34, .16); border-color: rgba(200, 110, 30, .5); color: #a5551a; }
html[data-bs-theme=dark] .gt-rk-1 { color: #f3dc9b; }
html[data-bs-theme=dark] .gt-rk-2 { color: #d6dbe3; }
html[data-bs-theme=dark] .gt-rk-3 { color: #f0a368; }

.gt-pill {
	display: inline-block;
	min-width: 3.6rem;
	padding: .1rem .55rem;
	border-radius: 9px;
	border: 1px solid var(--gt-line);
	background: rgba(128, 128, 128, .1);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .78rem;
	font-weight: 700;
	text-align: center;
	white-space: nowrap;
}
.gt-pill-und { background: rgba(25, 135, 84, .14); border-color: rgba(25, 135, 84, .4); color: var(--gt-good); }   /* no losses */

/* ---- A player's name and tags ---- */
.gt-st .gt-st-name { font-weight: 600; }
.gt-st-c {
	margin-left: .35rem;
	padding: 0 .3rem;
	border-radius: 5px;
	border: 1px solid rgba(220, 53, 69, .3);
	background: rgba(220, 53, 69, .12);
	color: #b02a37;
	font-size: .65rem;
	font-weight: 700;
}
html[data-bs-theme=dark] .gt-st-c { color: #f1949d; }
.gt-st-tag {
	margin-left: .4rem;
	padding: .02rem .4rem;
	border-radius: 6px;
	border: 1px solid transparent;
	font-size: .65rem;
	font-weight: 700;
	white-space: nowrap;
}
.gt-st-tag-in { background: rgba(191, 168, 94, .2); border-color: rgba(191, 168, 94, .5); color: #7d6a2a; }
html[data-bs-theme=dark] .gt-st-tag-in { color: #f3dc9b; }
.gt-st-tag-off { background: rgba(120, 130, 145, .2); color: var(--gt-muted); }

/* ---- Armies: title, then the roster with the pill and buttons following it ---- */
.gt-st-army { display: flex; align-items: baseline; gap: .45rem; margin-bottom: .25rem; }
.gt-st-army:last-child { margin-bottom: 0; }
.gt-st-num { flex: none; font-size: .75rem; font-weight: 700; color: var(--gt-muted); }
.gt-st-abody { flex: 1 1 auto; min-width: 0; font-size: .86rem; line-height: 1.45; }
.gt-st-title { font-size: .78rem; font-weight: 700; color: var(--gt-title); }
.gt-st-tools {          /* the pill and the buttons wrap as one piece */
	display: inline-flex;
	align-items: center;
	gap: .3rem;
	margin-left: .2rem;
	white-space: nowrap;
	vertical-align: middle;
}
.gt-st-pts {
	padding: .02rem .5rem;
	border-radius: 9px;
	border: 1px solid rgba(191, 168, 94, .4);
	background: rgba(191, 168, 94, .14);
	color: #7d6a2a;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .74rem;
	font-weight: 600;
}
html[data-bs-theme=dark] .gt-st-pts { color: #f3dc9b; }
.gt-st-btn {
	display: inline-flex;
	align-items: center;
	padding: 0 .45rem;
	border: 1px solid var(--gt-line);
	border-radius: 7px;
	background: transparent;
	color: var(--gt-muted) !important;
	font-size: .68rem;
	line-height: 1.5;
	text-decoration: none !important;
	cursor: pointer;
}
.gt-st-btn:hover { border-color: var(--gt-gold); color: var(--bs-body-color) !important; }
.gt-st-copy svg { width: .78rem; height: .78rem; fill: none; stroke: currentColor; stroke-width: 2; }
.gt-st-submit { display: block; margin-top: .25rem; font-size: .75rem; }

/* The site gives every <button> a blue fill with !important, a gold one on hover, and its own padding and size (base.html,
   styles.css). These are small quiet controls like the Builder and PCS links beside them, so each state is undone here;
   the selectors start with html[data-bs-theme] so they win over the site's light and dark rules. */
html[data-bs-theme] .gt-st .gt-st-copy,
html[data-bs-theme] .gt-st .gt-st-copy:hover,
html[data-bs-theme] .gt-st .gt-st-copy:focus,
html[data-bs-theme] .gt-st .gt-st-copy:active {
	background: transparent !important;
	background-color: transparent !important;
	border: 1px solid var(--gt-line) !important;
	border-radius: 7px !important;
	padding: 0 .35rem !important;
	font-size: .68rem !important;
	line-height: 1.5 !important;
	color: var(--gt-muted) !important;
	box-shadow: none !important;
	transition: none !important;
}
html[data-bs-theme] .gt-st .gt-st-copy:hover { border-color: var(--gt-gold) !important; color: var(--bs-body-color) !important; }
html[data-bs-theme] .gt-st .gt-st-copy.gt-st-copied { border-color: rgba(25, 135, 84, .6) !important; color: var(--gt-good) !important; }

/* ---- Teams ---- */
.gt-st-teams .gt-st-headfill { padding: 0; }
.gt-st-teams .gt-st-teamcell { padding-top: .6rem; padding-bottom: .1rem; vertical-align: bottom; }
.gt-st-teams .gt-st-member > .gt-st-who { padding-left: 1.4rem; }
.gt-st-teams .gt-st-member > td { padding-top: .4rem; padding-bottom: .4rem; vertical-align: top; }       /* a member's name lines up with the top of their armies */
.gt-st-teams .gt-st-member:last-child > td { padding-bottom: .6rem; }
.gt-st-teams .gt-st-member + .gt-st-member > td:not([rowspan]) { border-top: 1px dotted var(--gt-line-soft); }

.gt-team { display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; vertical-align: middle; }
.gt-team-name {
	max-width: 22rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 1rem;
	font-weight: 700;
}
.gt-team-madeup { font-weight: 600; }
.gt-team-edit {
	flex: none;
	display: inline-flex;
	align-items: center;
	padding: .15rem;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--bs-secondary-color, #6c757d);
	cursor: pointer;
}
.gt-team-edit[hidden] { display: none; }
html[data-bs-theme] .gt-team .gt-team-edit,
html[data-bs-theme] .gt-team .gt-team-edit:focus,
html[data-bs-theme] .gt-team .gt-team-edit:active {
	background: transparent !important;
	border: 0 !important;
	padding: .15rem !important;
	color: var(--bs-secondary-color, #6c757d) !important;
	box-shadow: none !important;
}
html[data-bs-theme] .gt-team .gt-team-edit:hover { background: rgba(128, 128, 128, .15) !important; color: var(--bs-body-color) !important; }
.gt-team-edit svg { width: .85rem; height: .85rem; fill: none; stroke: currentColor; stroke-width: 2; }
.gt-team-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; max-width: 100%; }
html[data-bs-theme] .gt-team-form input[type=text] {
	width: 15rem;
	max-width: 100%;
	padding: .15rem .45rem;
	border: 1px solid var(--bs-border-color, #ced4da);
	border-radius: 7px;
	background: var(--bs-body-bg);
	color: var(--bs-body-color);
	font-size: .9rem;
}
.gt-team-form button {
	padding: .1rem .5rem;
	border: 1px solid var(--bs-border-color, #ced4da);
	border-radius: 7px;
	background: transparent;
	color: var(--bs-body-color);
	font-size: .8rem;
	cursor: pointer;
}
html[data-bs-theme] .gt-team-form button,
html[data-bs-theme] .gt-team-form button:hover,
html[data-bs-theme] .gt-team-form button:focus {
	background: transparent !important;
	border: 1px solid var(--bs-border-color, #ced4da) !important;
	border-radius: 7px !important;
	padding: .1rem .5rem !important;
	font-size: .8rem !important;
	color: var(--bs-body-color) !important;
}
html[data-bs-theme] .gt-team-form button[type=submit] { border-color: var(--gt-gold, #bfa85e) !important; font-weight: 600; }
html[data-bs-theme] .gt-team-form button:hover { border-color: var(--gt-gold, #bfa85e) !important; }
.gt-team-msg { flex-basis: 100%; font-size: .75rem; color: #dc3545; }

/* ---- Phone: each player (or team heading) is a line of rank / name / record / SoS, the armies below ---- */
@media (max-width: 767.98px) {
	.gt-st thead { display: none; }
	.gt-st, .gt-st tbody, .gt-st tr, .gt-st td { display: block; }
	.gt-st tbody.gt-st-group + tbody.gt-st-group { border-top: 1px solid var(--gt-line); }
	.gt-st tbody.gt-st-group + tbody.gt-st-group > tr:first-child > td { border-top: 0; }
	.gt-st tr.gt-st-single, .gt-st tr.gt-st-head {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr) auto auto auto;
		align-items: center;
		column-gap: .5rem;
		padding: .55rem 0 0;
	}
	.gt-st tr.gt-st-single > td, .gt-st tr.gt-st-head > td { padding: 0 0 .1rem; }
	.gt-st .gt-st-rank, .gt-st .gt-st-rec, .gt-st .gt-st-sos, .gt-st .gt-st-dom { width: auto; }
	.gt-st .gt-st-who { min-width: 0; white-space: normal; }
	.gt-st .gt-st-teamcell { padding: 0 !important; }
	.gt-st .gt-st-headfill { display: none; }
	.gt-st tr.gt-st-single > .gt-st-armies { grid-column: 1 / -1; padding: .35rem 0 .6rem; }
	.gt-st-teams .gt-st-member { padding: 0 0 .1rem .9rem; }
	.gt-st-teams .gt-st-member > td { padding: .15rem 0; border-top: 0 !important; }
	.gt-st-teams .gt-st-member > .gt-st-who { padding-left: 0; }
	.gt-st-teams .gt-st-member > .gt-st-armies { min-width: 0; padding-bottom: .5rem; }
	.gt-team-name { max-width: 100%; }
	.gt-st .gt-st-armies { min-width: 0; }
}

/* ---- The Attendees list in a team tournament (partials/tournament_attendees.html) ---- */
.attendeesTable .attendeeTeamRow > td { padding-top: .7rem; padding-bottom: .1rem; border-bottom: 0; }
.attendeesTable .attendeeTeamRow + .attendeeRow > td { border-top: 0; }


/* =====================================================================================================================
   Sortable standings (partials/standings_overall.html): the Convention, Series, League and Season Standings panels, and
   later the Player Rankings. Same look as the tournament table above (rank badge, SoS, quiet lines), but every number has
   its own sortable column, so there is no record pill. bootstrap-table draws the header and the sort arrows.
   ===================================================================================================================== */
.gt-sx-tools { display: none; }
.gt-sec .standingsBox .bootstrap-table .fixed-table-container { border: 0 !important; }
.gt-sec .standingsBox .bootstrap-table .fixed-table-body { overflow-x: auto; }
table.gt-sx {
	--gt-line: var(--bs-border-color, #dee2e6);
	--gt-muted: var(--bs-secondary-color, #6c757d);
	--gt-gold: var(--c-primary, #bfa85e);
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	background: transparent;
	--bs-table-bg: transparent;
	font-size: .95rem;
}
table.gt-sx > :not(caption) > * > * { background: transparent; border-width: 0; box-shadow: none; }
.gt-sx thead th { padding: 0 !important; border-bottom: 1px solid var(--gt-line) !important; vertical-align: bottom; text-align: center; }
.gt-sx thead th.text-start { text-align: left; }
.gt-sx thead th .fht-cell { display: none; }
.gt-sx thead th .th-inner {
	display: inline-flex;
	align-items: center;
	gap: .3rem;
	width: auto;
	padding: .45rem .4rem !important;
	font-size: .7rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--gt-muted);
	white-space: nowrap;
	background-image: none !important;
	cursor: default;
}
.gt-sx thead th .th-inner.sortable { cursor: pointer; }
.gt-sx thead th .th-inner.sortable::after { content: "\2195"; opacity: .3; font-size: .8rem; letter-spacing: 0; }
.gt-sx thead th .th-inner.sortable:hover { color: var(--bs-body-color); }
.gt-sx thead th .th-inner.sortable:hover::after { opacity: .7; }
.gt-sx thead th .th-inner.sortable.asc, .gt-sx thead th .th-inner.sortable.desc { color: var(--gt-gold); }
.gt-sx thead th .th-inner.sortable.asc::after { content: "\2191"; opacity: 1; font-size: .85rem; }
.gt-sx thead th .th-inner.sortable.desc::after { content: "\2193"; opacity: 1; font-size: .85rem; }
.gt-sx tbody td { padding: .35rem .4rem; vertical-align: middle; border-top: 1px solid var(--gt-line) !important; border-bottom: 0 !important; text-align: center; }
.gt-sx tbody tr:first-child td { border-top: 0 !important; }
.gt-sx tbody tr:hover > td { background: rgba(128, 128, 128, .09); }
.gt-sx td.text-start { text-align: left; white-space: nowrap; }
.gt-sx .gt-sx-rank { width: 3.4rem; }
.gt-sx .gt-sx-who { width: 1%; min-width: 9rem; }
.gt-sx .gt-sx-num { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; font-variant-numeric: tabular-nums; }
.gt-sx .gt-sx-zero { color: var(--gt-muted); opacity: .6; }
.gt-sx .gt-sx-sos { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; color: var(--gt-muted); }

/* The site gives every <button> a blue fill; "Show all" and "All columns" are quiet outlined buttons. */
html[data-bs-theme] .standingsShowAll,
html[data-bs-theme] .standingsShowAll:hover,
html[data-bs-theme] .gt-sx-allcols,
html[data-bs-theme] .gt-sx-allcols:hover {
	background: transparent !important;
	border: 1px solid var(--bs-border-color) !important;
	border-radius: 8px !important;
	padding: .25rem .9rem !important;
	font-size: .8rem !important;
	color: var(--bs-secondary-color) !important;
	box-shadow: none !important;
}
html[data-bs-theme] .standingsShowAll:hover, html[data-bs-theme] .gt-sx-allcols:hover { border-color: var(--c-primary, #bfa85e) !important; color: var(--bs-body-color) !important; }
.standingsShowAll { display: block; margin: .6rem auto 0; }
html[data-bs-theme] .gt-sx-allcols[aria-pressed=true] { border-color: var(--c-primary, #bfa85e) !important; color: var(--bs-body-color) !important; }

/* When the table does not fit its box (a phone, a narrow window: the panel is narrower than the window, and long names need
   room), standings_columns.js squeezes it a step at a time and stops at the first step that fits. It measures the table
   itself, so nothing is hidden before it has to be, whatever the screen or the names. The steps add up:
     gt-sx-tight   less padding around the cells
     gt-sx-tighter + no avatars, long names cut short with "..."
     gt-sx-narrow  + the less important columns (gt-sx-hide-sm) wait behind an "All columns" button; with all columns shown
                     the table scrolls sideways and the rank and name stay in view */
.gt-sx-tight .gt-sx tbody td { padding: .35rem .25rem; }
.gt-sx-tight .gt-sx thead th .th-inner { padding: .45rem .25rem !important; gap: .2rem; letter-spacing: .03em; }
.gt-sx-tight .gt-sx .gt-sx-rank { width: 2.8rem; }
.gt-sx-tight .gt-sx .gt-rk { min-width: 1.8rem; padding: .05rem .35rem; font-size: .74rem; }

.gt-sx-tighter .gt-sx .avatarSlot { display: none; }       /* the 40px the picture takes is worth more to the name */
.gt-sx-tighter .gt-sx .gt-sx-who { min-width: 0; }
.gt-sx-tighter .gt-sx td.gt-sx-who { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }

.gt-sx-narrow .gt-sx-tools { display: flex; justify-content: flex-end; margin: 0 0 .35rem; }
.gt-sx-narrow .gt-sx .gt-sx-hide-sm { display: none; }
.gt-sx-narrow.gt-sx-all .gt-sx .gt-sx-hide-sm { display: table-cell; }
.gt-sx-narrow .gt-sx thead th .th-inner { padding: .45rem .2rem !important; gap: .15rem; letter-spacing: .02em; }
.gt-sx-narrow .gt-sx tbody td { padding: .35rem .2rem; }
.gt-sx-narrow .gt-sx .gt-sx-rank { width: 2.6rem; }
.gt-sx-narrow .gt-sx td.gt-sx-who { max-width: 5.8rem; }
.gt-sx-narrow .gt-sx .gt-rk { min-width: 1.7rem; padding: .05rem .3rem; font-size: .72rem; }
.gt-sx-narrow.gt-sx-all .gt-sx td.gt-sx-who, .gt-sx-narrow.gt-sx-all .gt-sx th.gt-sx-who { width: 7.5rem; min-width: 7.5rem; max-width: 7.5rem; }
.gt-sx-narrow.gt-sx-all .gt-sx .gt-sx-rank, .gt-sx-narrow.gt-sx-all .gt-sx .gt-sx-who { position: sticky; z-index: 1; background: var(--bs-tertiary-bg) !important; }
.gt-sx-narrow.gt-sx-all .gt-sx .gt-sx-rank { left: 0; }
.gt-sx-narrow.gt-sx-all .gt-sx .gt-sx-who { left: 2.6rem; }
