/*
 * MGC Tournament Manager — front end.
 * Matches the MGC page pattern: dark container (Avada color 8), cards with
 * rgba(255,255,255,.04) background and a 3px top border, uppercase titles.
 * Colours come from Avada's global palette when available, so changing the
 * palette in Avada Theme Options also changes these pieces.
 */

.mgc-tm {
	--mgc-bg: var(--awb-color8, #0d0b14);
	--mgc-card: rgba(255, 255, 255, 0.04);
	--mgc-card-2: rgba(255, 255, 255, 0.07);
	--mgc-line: rgba(255, 255, 255, 0.14);
	--mgc-text: #fff;
	--mgc-muted: rgba(255, 255, 255, 0.62);
	--mgc-red: var(--awb-color5, #e22c2c);
	--mgc-red-dark: var(--awb-color7, #c41a1a);
	--mgc-purple: #7b3cc0;
	--mgc-green: #2fbf71;
	--mgc-radius: 4px;
	--mgc-heading: var(--h3_typography-font-family, inherit);
	color: var(--mgc-text);
	box-sizing: border-box;
}
.mgc-tm *,
.mgc-tm *::before,
.mgc-tm *::after {
	box-sizing: inherit;
}

/* Default tournament page (used when no Avada Layout is set) */
.mgc-page {
	background: var(--mgc-bg);
	padding: 40px 20px 60px;
	max-width: 1180px;
	margin: 0 auto;
}
.mgc-section {
	margin-top: 40px;
}
.mgc-section__title {
	font-family: var(--h2_typography-font-family, inherit);
	font-size: 22px;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: var(--mgc-text);
	margin: 0 0 24px;
	padding-bottom: 14px;
	position: relative;
}
.mgc-section__title::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 40px;
	height: 2px;
	background: var(--mgc-red);
}

/* Grids: equal-height boxes in every row */
.mgc-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 20px;
	align-items: stretch;
	margin-top: 20px;
}
/* Row of boxes: whatever boxes are present share the width equally (2 or 3), same height */
.mgc-grid--3 {
	display: flex;
}
.mgc-grid--3 > * {
	flex: 1 1 0;
}
.mgc-grid--3:empty {
	display: none;
}
@media (max-width: 900px) {
	.mgc-grid--3 {
		flex-direction: column;
	}
}
.mgc-grid > .mgc-tm,
.mgc-grid > .mgc-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.mgc-grid > .mgc-tm > .mgc-card {
	flex: 1;
}

/* Cards */
.mgc-card {
	background: var(--mgc-card);
	border-top: 3px solid var(--mgc-purple);
	border-radius: var(--mgc-radius);
	padding: 28px 24px;
	color: var(--mgc-text);
	height: 100%;
}
.mgc-box {
	display: flex;
	flex-direction: column;
}
.mgc-box__title {
	font-family: var(--mgc-heading);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--mgc-red);
	margin: 0 0 16px;
}
.mgc-box__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	font-size: 14px;
}
.mgc-box__body p {
	margin: 0 0 12px;
}
.mgc-box--cta .mgc-btn--block {
	margin-top: auto;
}
.mgc-muted {
	color: var(--mgc-muted);
}
.mgc-empty {
	color: var(--mgc-muted);
	text-align: center;
	padding: 30px 0;
	margin: 0;
}
.mgc-price {
	font-family: var(--mgc-heading);
	font-size: 34px;
	font-weight: 700;
	line-height: 1;
}
.mgc-price small {
	font-size: 13px;
	font-weight: 400;
	color: var(--mgc-muted);
}

/* Fact rows */
.mgc-facts {
	list-style: none;
	margin: 0;
	padding: 0;
}
.mgc-facts li {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 9px 0;
	border-bottom: 1px solid var(--mgc-line);
	font-size: 14px;
}
.mgc-facts li:last-child {
	border-bottom: 0;
}
.mgc-facts span {
	color: var(--mgc-muted);
}
.mgc-facts strong {
	text-align: right;
}

/* Tags */
.mgc-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 12px;
}
.mgc-tag {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	background: var(--mgc-card-2);
	color: var(--mgc-text);
}
.mgc-tag--registration {
	background: rgba(47, 191, 113, 0.18);
	color: #8ff0bc;
}
.mgc-tag--closed {
	background: rgba(234, 179, 8, 0.18);
	color: #fde68a;
}
.mgc-tag--live {
	background: var(--mgc-red);
	color: #fff;
}
.mgc-tag--live::before {
	content: "● ";
	animation: mgc-blink 1.4s infinite;
}
.mgc-tag--finished {
	background: rgba(123, 60, 192, 0.3);
	color: #d9c2ff;
}
@keyframes mgc-blink {
	50% {
		opacity: 0.3;
	}
}

/* Buttons */
.mgc-btn {
	display: inline-block;
	padding: 12px 22px;
	background: var(--mgc-red);
	color: #fff !important;
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 1px;
	text-transform: uppercase;
	text-decoration: none !important;
	text-align: center;
	border-radius: var(--mgc-radius);
	border: 0;
	transition: background 0.2s;
}
.mgc-btn:hover {
	background: var(--mgc-red-dark);
}
.mgc-btn--ghost {
	background: transparent;
	box-shadow: inset 0 0 0 1px var(--mgc-line);
}
.mgc-btn--ghost:hover {
	background: var(--mgc-card-2);
}
.mgc-btn--block {
	display: block;
	width: 100%;
}

/* Tournament list cards */
.mgc-tcard {
	display: flex;
	flex-direction: column;
	padding: 0;
	overflow: hidden;
}
.mgc-tcard.is-live {
	border-top-color: var(--mgc-red);
}
.mgc-tcard__media {
	display: block;
	aspect-ratio: 16 / 9;
	background: linear-gradient(135deg, rgba(123, 60, 192, 0.35), rgba(226, 44, 44, 0.25));
	overflow: hidden;
}
.mgc-tcard__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s;
}
.mgc-tcard:hover .mgc-tcard__media img {
	transform: scale(1.04);
}
.mgc-tcard__placeholder {
	display: flex;
	height: 100%;
	align-items: center;
	justify-content: center;
	font-family: var(--mgc-heading);
	font-size: 22px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 2px;
	color: rgba(255, 255, 255, 0.5);
}
.mgc-tcard__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 22px 24px 24px;
}
.mgc-tcard__title {
	font-family: var(--mgc-heading);
	font-size: 20px;
	line-height: 1.2;
	margin: 0 0 12px;
	text-transform: uppercase;
}
.mgc-tcard__title a {
	color: var(--mgc-text);
	text-decoration: none;
}
.mgc-tcard__title a:hover {
	color: var(--mgc-red);
}
.mgc-tcard__foot {
	margin-top: auto;
	padding-top: 18px;
}
.mgc-tcard__foot .mgc-btn {
	width: 100%;
}

/* Prizes / standings */
.mgc-podium {
	list-style: none;
	margin: 0;
	padding: 0;
}
.mgc-podium li {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--mgc-line);
}
.mgc-podium li:last-child {
	border-bottom: 0;
}
.mgc-podium__rank {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: var(--mgc-muted);
}
.mgc-podium__p1 strong {
	color: #f5c542;
	font-size: 18px;
}
.mgc-podium__p2 strong {
	color: #d7dbe0;
}
.mgc-podium__p3 strong {
	color: #d38d5f;
}
.mgc-box--result {
	border-top-color: #f5c542;
	margin-bottom: 20px;
}

/* Teams, maps, sponsors */
.mgc-teams {
	margin: 0;
	padding-left: 22px;
}
.mgc-teams li {
	padding: 6px 0;
	border-bottom: 1px solid var(--mgc-line);
}
.mgc-teams li:last-child {
	border-bottom: 0;
}
.mgc-teams span {
	display: block;
	font-size: 12px;
	color: var(--mgc-muted);
}
.mgc-chips {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.mgc-chips li {
	padding: 5px 12px;
	background: var(--mgc-card-2);
	border-radius: var(--mgc-radius);
	font-size: 13px;
}
.mgc-sponsors {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	align-items: center;
}
.mgc-sponsors img {
	max-height: 56px;
	max-width: 140px;
	width: auto;
	height: auto;
	object-fit: contain;
	opacity: 0.85;
	transition: opacity 0.2s;
}
.mgc-sponsors a:hover img {
	opacity: 1;
}
.mgc-prose {
	color: var(--mgc-muted);
	line-height: 1.7;
	margin-top: 30px;
}
.mgc-box .mgc-prose {
	margin-top: 0;
}
.mgc-prose a {
	color: var(--mgc-red);
}

/* Stream */
.mgc-stream {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #000;
	border-top: 3px solid var(--mgc-red);
	border-radius: var(--mgc-radius);
	overflow: hidden;
	margin-bottom: 20px;
}
.mgc-stream iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ------------------------------------------------------------------ */
/* Bracket                                                              */
/* ------------------------------------------------------------------ */
.mgc-bracket {
	--mgc-col: 220px;
	--mgc-gap: 40px;
}
.mgc-bracket__scroll {
	overflow-x: auto;
	padding-bottom: 12px;
	-webkit-overflow-scrolling: touch;
}
.mgc-bracket__tree {
	display: flex;
	gap: var(--mgc-gap);
	min-width: max-content;
}
.mgc-bracket__col {
	display: flex;
	flex-direction: column;
	width: var(--mgc-col);
}
.mgc-bracket__label {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: var(--mgc-muted);
	text-align: center;
	padding-bottom: 10px;
	margin-bottom: 4px;
	border-bottom: 1px solid var(--mgc-line);
	white-space: nowrap;
}
.mgc-bracket__label small {
	color: var(--mgc-red);
	margin-left: 6px;
	font-size: 11px;
}
.mgc-bracket__cells {
	flex: 1;
	display: flex;
	flex-direction: column;
}
.mgc-bracket__cell {
	flex: 1;
	display: flex;
	align-items: center;
	position: relative;
	padding: 8px 0;
}
/* Connectors: out of a match, vertical join, into the next match */
.mgc-bracket__cell.has-next::after {
	content: "";
	position: absolute;
	left: 100%;
	top: 50%;
	width: calc(var(--mgc-gap) / 2);
	border-top: 2px solid var(--mgc-line);
}
.mgc-bracket__cell.has-next::before {
	content: "";
	position: absolute;
	left: calc(100% + var(--mgc-gap) / 2 - 1px);
	border-left: 2px solid var(--mgc-line);
}
.mgc-bracket__cell.has-next.is-top::before {
	top: 50%;
	bottom: 0;
}
.mgc-bracket__cell.has-next.is-bottom::before {
	top: 0;
	bottom: 50%;
}
.mgc-bracket__cell.has-prev .mgc-match::before {
	content: "";
	position: absolute;
	right: 100%;
	top: 50%;
	width: calc(var(--mgc-gap) / 2);
	border-top: 2px solid var(--mgc-line);
}
.mgc-bracket__extra {
	margin-top: 24px;
	width: var(--mgc-col);
}
.mgc-bracket__extra .mgc-bracket__label {
	text-align: left;
	margin-bottom: 10px;
}

/* Match card */
.mgc-match {
	position: relative;
	width: 100%;
	background: var(--mgc-card);
	border-left: 3px solid var(--mgc-line);
	border-radius: var(--mgc-radius);
	font-size: 13px;
}
.mgc-match.is-ready {
	border-left-color: var(--mgc-purple);
}
.mgc-match.is-live {
	border-left-color: var(--mgc-red);
	box-shadow: 0 0 0 1px var(--mgc-red);
}
.mgc-match.is-done {
	border-left-color: var(--mgc-purple);
}
.mgc-match.is-bye {
	opacity: 0.45;
}
.mgc-match__team {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	min-height: 36px;
}
.mgc-match__team + .mgc-match__team {
	border-top: 1px solid var(--mgc-line);
}
.mgc-match__name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mgc-match__score {
	font-weight: 700;
	min-width: 18px;
	text-align: right;
}
.mgc-match__team.is-winner {
	background: rgba(123, 60, 192, 0.22);
	font-weight: 700;
}
.mgc-match__team.is-loser {
	color: var(--mgc-muted);
}
.mgc-match__team.is-tbd .mgc-match__name,
.mgc-match__team.is-empty .mgc-match__name {
	color: var(--mgc-muted);
	font-style: italic;
}
.mgc-match__foot {
	padding: 3px 10px;
	font-size: 10px;
	letter-spacing: 1px;
	text-transform: uppercase;
	border-top: 1px solid var(--mgc-line);
}
.mgc-match__live {
	color: var(--mgc-red);
	font-weight: 700;
}
.mgc-match__live::before {
	content: "● ";
	animation: mgc-blink 1.4s infinite;
}
.mgc-match__note {
	color: var(--mgc-muted);
}

/* Registration fields on the WooCommerce product page */
.mgc-reg-fields {
	margin: 0 0 20px;
	width: 100%;
}
.mgc-reg-row label {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
}
.mgc-reg-row input,
.mgc-reg-players input {
	width: 100%;
	min-width: 0;
	box-sizing: border-box;
}
.mgc-reg-players {
	margin: 0 0 14px;
}
.mgc-reg-players__head,
.mgc-reg-players__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin-bottom: 8px;
}
.mgc-reg-players__head {
	font-weight: 600;
	font-size: 13px;
}
