/**
 * Match Single Page Styles — É Golo Live redesign.
 * Scoreboard escuro + tabs Relato/Estatísticas/Onzes/Previsão + rail lateral.
 *
 * @package SuperPortistas
 * @since 3.0.0
 */

/* ------------------------------------------------------------------ */
/* Base / tokens                                                       */
/* ------------------------------------------------------------------ */

.sp-live-page {
	--eg-display: "Archivo Black", "Archivo", ui-sans-serif, system-ui, sans-serif;
	--eg-live: var(--sp-live, #00e06b);
	--eg-green: var(--sp-porto, #00a24a);
	--eg-yellow: var(--sp-accent, #ffd400);
	--eg-red: var(--sp-danger, #c0362c);
	--eg-ink: var(--sp-ink, #0d0d0c);
	--eg-muted-dark: #8a887f;
	--eg-bar-away: #b5b3ac;
	--eg-draw: #5b5952;
	--eg-xg-away: #b08d00;
	--eg-hairline-dark: #1b1b19;
	--eg-hairline: var(--sp-border, #dbd9d2);
	background: var(--sp-surface-muted, #f4f3ef);
}

html {
	scroll-behavior: smooth;
}

/* Sticky Header (componente existente) */
#match-header-sticky {
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	background-color: rgba(255, 255, 255, 0.95);
	transition: box-shadow 0.3s ease;
}

#match-header-sticky.shadow-lg {
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Alpine.js x-cloak - Hide elements until Alpine is ready */
[x-cloak] {
	display: none !important;
}

/* ------------------------------------------------------------------ */
/* Scoreboard escuro (banda full-width)                                */
/* ------------------------------------------------------------------ */

.sp-msb {
	background: var(--eg-ink);
	color: #fff;
	padding: 40px 48px 0;
}

.sp-msb__inner {
	max-width: 1200px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.sp-msb__meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--eg-muted-dark);
}

.sp-msb__state {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
}

.sp-msb__state--live {
	color: var(--eg-live);
}

.sp-msb__teams {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 32px;
}

.sp-msb__team {
	display: flex;
	align-items: center;
	gap: 20px;
	min-width: 0;
}

.sp-msb__team--home {
	justify-content: flex-end;
	text-align: right;
}

.sp-msb__team-name {
	font-family: var(--eg-display);
	font-style: italic;
	font-size: 36px;
	letter-spacing: -1px;
	line-height: 1.05;
	text-transform: uppercase;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
}

.sp-msb__team-name--away {
	color: var(--eg-muted-dark);
}

.sp-msb__team-logo {
	width: 64px;
	height: 64px;
	flex: none;
	object-fit: contain;
}

.sp-msb__score {
	font-family: var(--eg-display);
	font-style: italic;
	font-size: 96px;
	line-height: 1;
	letter-spacing: -4px;
	white-space: nowrap;
}

.sp-msb__score-vs {
	color: var(--eg-muted-dark);
}

.sp-msb__scorers {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	gap: 32px;
	font-size: 13px;
	font-weight: 600;
	color: var(--eg-bar-away);
}

.sp-msb__scorers[hidden] {
	display: none;
}

.sp-msb__scorers-side--home {
	text-align: right;
}

/* Tabs (Relato / Estatísticas / Onzes / Previsão + secundárias) */
.sp-msb__tabs {
	display: flex;
	align-items: stretch;
	gap: 0;
	border-top: 1px solid var(--eg-hairline-dark);
	font-weight: 800;
	font-size: 14px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.sp-msb__tabs::-webkit-scrollbar {
	display: none;
}

.sp-msb__tab {
	appearance: none;
	background: none;
	border: 0;
	border-bottom: 3px solid transparent;
	padding: 16px 24px;
	margin: 0;
	color: var(--eg-muted-dark);
	font: inherit;
	cursor: pointer;
	white-space: nowrap;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.sp-msb__tab:hover {
	color: #fff;
}

.sp-msb__tab:focus-visible {
	outline: 2px solid var(--eg-live);
	outline-offset: -2px;
}

.sp-msb__tab--active,
.sp-msb__tab--active:hover {
	color: var(--eg-live);
	border-bottom-color: var(--eg-green);
}

.sp-msb__tabs-spacer {
	flex: 1 0 12px;
}

.sp-msb__tab--sec {
	font-size: 12px;
	font-weight: 700;
	padding: 16px 14px;
}

/* ------------------------------------------------------------------ */
/* Corpo: grid 1fr / 380px com rail                                    */
/* ------------------------------------------------------------------ */

.sp-live-body {
	max-width: 1200px;
	margin: 0 auto;
	width: 100%;
	box-sizing: border-box;
}

.sp-live-breadcrumb {
	padding: 16px 48px 0;
}

.sp-live-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 380px;
	align-items: start;
}

.sp-live-main {
	position: relative;
	min-width: 0;
	min-height: 400px;
	padding: 32px 40px 48px 48px;
}

.sp-live-rail {
	display: flex;
	flex-direction: column;
	gap: 24px;
	padding: 32px 24px 48px;
	background: var(--sp-surface-subtle, #efeee8);
	min-height: 100%;
}

.sp-live-rail:empty {
	display: none;
}

.sp-live-rail__section {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* Probabilidade ao vivo içada para bloco próprio no mobile */
.sp-live-mobile-prob {
	display: none;
}

/* Empilhamento genérico dos painéis secundários */
.sp-live-stack > * + * {
	margin-top: 1.5rem;
}

.sp-live-panel-card {
	background: var(--sp-surface, #fff);
	border: 1px solid var(--eg-hairline);
	overflow: hidden;
	margin-top: 0.75rem;
}

.sp-live-empty {
	background: var(--sp-surface, #fff);
	border: 1px solid var(--eg-hairline);
	padding: 2rem 1.5rem;
	text-align: center;
}

.sp-live-empty p {
	margin: 0;
	font-size: 0.875rem;
	color: var(--sp-ink-faint, #6b6963);
}

/* Headings assinatura (Archivo Black itálico + ponto verde) */
.sp-live-heading {
	margin: 0 0 18px;
	font-family: var(--eg-display);
	font-style: italic;
	font-size: 20px;
	line-height: 1.15;
	letter-spacing: -0.02em;
	text-transform: uppercase;
	color: var(--eg-ink);
}

.sp-live-heading--sm {
	font-size: 16px;
	margin-bottom: 12px;
}

.sp-live-heading__dot {
	color: var(--eg-green);
}

/* Loading overlay */
.sp-live-loading {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 4rem;
	background: rgba(244, 243, 239, 0.75);
	min-height: 200px;
}

.sp-live-loading__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.875rem;
	color: var(--sp-ink-muted, #3c3a35);
}

.sp-live-loading__inner p {
	margin: 0;
}

.sp-live-loading__spinner {
	width: 2rem;
	height: 2rem;
	border: 4px solid var(--eg-green);
	border-top-color: transparent;
	border-radius: 50%;
	animation: sp-live-spin 0.8s linear infinite;
}

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

/* ------------------------------------------------------------------ */
/* Relato — timeline                                                   */
/* ------------------------------------------------------------------ */

.sp-relato__feed {
	display: flex;
	flex-direction: column;
}

.sp-relato__empty {
	margin: 0;
	padding: 1.5rem 0;
	font-size: 0.875rem;
	color: var(--sp-ink-faint, #6b6963);
}

.sp-relato__item {
	display: grid;
	grid-template-columns: 64px 24px 1fr;
	gap: 16px;
}

.sp-relato__minute {
	font-family: var(--eg-display);
	font-style: italic;
	font-size: 18px;
	text-align: right;
	color: var(--eg-ink);
	line-height: 1.2;
}

.sp-relato__item--goal .sp-relato__minute {
	color: var(--eg-green);
}

.sp-relato__track {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.sp-relato__dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--eg-ink);
	flex: none;
	margin-top: 5px;
}

.sp-relato__item--goal .sp-relato__dot {
	background: var(--eg-green);
}

.sp-relato__item--yellow .sp-relato__dot {
	background: var(--eg-yellow);
}

.sp-relato__item--red .sp-relato__dot {
	background: var(--eg-red);
}

.sp-relato__line {
	width: 2px;
	flex: 1;
	background: var(--eg-hairline);
}

.sp-relato__item:last-child .sp-relato__line {
	background: transparent;
}

.sp-relato__body {
	padding-bottom: 28px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.sp-relato__badge {
	align-self: flex-start;
	background: var(--eg-green);
	color: #fff;
	font-family: var(--eg-display);
	font-style: italic;
	font-size: 13px;
	padding: 4px 10px;
	text-transform: uppercase;
}

.sp-relato__title {
	font-weight: 800;
	font-size: 16px;
	line-height: 1.2;
	color: var(--eg-ink);
}

.sp-relato__text {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: var(--sp-ink-muted, #3c3a35);
}

/* ------------------------------------------------------------------ */
/* Estatísticas — barras duplas                                        */
/* ------------------------------------------------------------------ */

.sp-statbars {
	max-width: 560px;
}

.sp-statbars__list {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.sp-statbars__row {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.sp-statbars__values {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
	font-size: 14px;
	font-weight: 800;
	color: var(--eg-ink);
}

.sp-statbars__label {
	color: var(--sp-ink-faint, #6b6963);
	font-weight: 700;
	text-align: center;
}

.sp-statbars__bar {
	display: flex;
	height: 10px;
	gap: 2px;
}

.sp-statbars__bar-home {
	flex-grow: 1;
	flex-basis: 0;
	background: var(--eg-green);
}

.sp-statbars__bar-away {
	flex-grow: 1;
	flex-basis: 0;
	background: var(--eg-bar-away);
}

.sp-statbars--compact {
	max-width: none;
}

.sp-statbars--compact .sp-statbars__list {
	gap: 14px;
}

.sp-statbars--compact .sp-statbars__values {
	font-size: 13px;
}

.sp-statbars--compact .sp-statbars__bar {
	height: 8px;
}

.sp-statbars--compact .sp-live-heading {
	font-size: 16px;
	margin-bottom: 14px;
}

/* Espaço entre as barras e os accordions do tab Estatísticas */
.match-tabs-content .sp-statbars {
	margin-bottom: 1.5rem;
}

/* ------------------------------------------------------------------ */
/* Onzes — 2 colunas                                                   */
/* ------------------------------------------------------------------ */

.sp-onzes {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 32px;
}

.sp-onzes__team {
	margin: 0 0 10px;
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
}

.sp-onzes__team-name {
	font-family: var(--eg-display);
	font-style: italic;
	font-size: 18px;
	text-transform: uppercase;
	letter-spacing: -0.02em;
	color: var(--eg-ink);
}

.sp-onzes__col--away .sp-onzes__team-name {
	color: var(--sp-ink-faint, #6b6963);
}

.sp-onzes__team-meta {
	font-size: 12px;
	font-weight: 700;
	color: var(--sp-ink-faint, #6b6963);
}

.sp-onzes__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sp-onzes__player {
	display: grid;
	grid-template-columns: 32px 1fr auto;
	gap: 10px;
	align-items: center;
	border-bottom: 1px solid var(--eg-hairline);
	padding: 8px 0;
	font-size: 14px;
}

.sp-onzes__num {
	font-family: var(--eg-display);
	font-style: italic;
	color: var(--eg-green);
}

.sp-onzes__col--away .sp-onzes__num {
	color: var(--eg-muted-dark);
}

.sp-onzes__num--sub {
	color: var(--eg-muted-dark);
}

.sp-onzes__name {
	font-weight: 700;
	color: var(--eg-ink);
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sp-onzes__nota {
	font-size: 12px;
	font-weight: 600;
	color: var(--sp-ink-faint, #6b6963);
}

.sp-onzes__subs-title {
	margin: 18px 0 4px;
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--sp-ink-faint, #6b6963);
}

.sp-onzes__empty {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--sp-ink-faint, #6b6963);
}

/* ------------------------------------------------------------------ */
/* Previsão — card escuro 1X2 + xG                                     */
/* ------------------------------------------------------------------ */

.sp-prev {
	display: flex;
	flex-direction: column;
	gap: 24px;
	max-width: 560px;
}

.sp-prev .sp-live-heading {
	margin-bottom: 0;
}

.sp-prev__card {
	background: var(--eg-ink);
	color: #fff;
	padding: 24px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.sp-prev__kicker {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--eg-muted-dark);
}

.sp-prev__kicker--now {
	margin-top: 6px;
}

.sp-prev__bar {
	display: flex;
	height: 14px;
	overflow: hidden;
	gap: 0;
}

.sp-prev__seg {
	flex-grow: 1;
	flex-basis: 0;
	min-width: 0;
}

.sp-prev__seg--home {
	background: var(--eg-green);
}

.sp-prev__seg--draw {
	background: var(--eg-draw);
}

.sp-prev__seg--away {
	background: var(--eg-yellow);
}

.sp-prev__legend {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	font-size: 12px;
	font-weight: 700;
}

.sp-prev__legend-home {
	color: var(--eg-live);
}

.sp-prev__legend-draw {
	color: var(--eg-bar-away);
}

.sp-prev__legend-away {
	color: var(--eg-yellow);
}

.sp-prev__xg {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.sp-prev__xg-card {
	border: 2px solid var(--eg-ink);
	padding: 18px;
	text-align: center;
	background: var(--sp-surface, #fff);
}

.sp-prev__xg-value {
	font-family: var(--eg-display);
	font-style: italic;
	font-size: 36px;
	line-height: 1;
}

.sp-prev__xg-value--home {
	color: var(--eg-green);
}

.sp-prev__xg-value--away {
	color: var(--eg-xg-away);
}

.sp-prev__xg-label {
	font-size: 12px;
	font-weight: 700;
	margin-top: 4px;
	color: var(--eg-ink);
}

.sp-prev__analysis {
	margin: 0;
	font-size: 14px;
	line-height: 1.55;
	color: var(--sp-ink-muted, #3c3a35);
}

/* ------------------------------------------------------------------ */
/* Rail — probabilidade ao vivo + homem do jogo                        */
/* ------------------------------------------------------------------ */

.sp-live-prob {
	background: var(--eg-ink);
	color: #fff;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.sp-live-prob__title {
	font-family: var(--eg-display);
	font-style: italic;
	font-size: 15px;
	text-transform: uppercase;
	letter-spacing: -0.01em;
}

.sp-live-prob__title .sp-live-heading__dot {
	color: var(--eg-green);
}

.sp-live-prob__note {
	margin: 0;
	font-size: 12px;
	color: var(--eg-muted-dark);
	font-weight: 600;
	line-height: 1.4;
}

.sp-live-mvp {
	background: var(--sp-surface-muted, #f4f3ef);
	border: 2px solid var(--eg-ink);
	padding: 16px;
	display: flex;
	align-items: center;
	gap: 14px;
}

.sp-live-mvp__info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.sp-live-mvp__name {
	font-family: var(--eg-display);
	font-style: italic;
	font-size: 17px;
	color: var(--eg-ink);
}

.sp-live-mvp__detail {
	font-size: 12px;
	font-weight: 700;
	color: var(--sp-ink-faint, #6b6963);
}

.sp-live-mvp__rating {
	margin-left: auto;
	font-family: var(--eg-display);
	font-style: italic;
	font-size: 30px;
	color: var(--eg-green);
}

/* ------------------------------------------------------------------ */
/* Tab Estatísticas: Accordions (confronto directo / forma recente)    */
/* ------------------------------------------------------------------ */

.match-stats-accordions > .match-stats-accordion-item + .match-stats-accordion-item {
	margin-top: 0.75rem;
}

.match-stats-accordion-item {
	border: 1px solid var(--eg-hairline);
	overflow: hidden;
	background: var(--sp-surface, #fff);
}

.match-stats-accordion-heading {
	margin: 0;
	font-size: 0.9375rem;
	font-weight: 700;
	line-height: 1.5;
}

.match-stats-accordion-trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 0.875rem 1.25rem;
	text-align: left;
	color: var(--eg-ink);
	background: var(--sp-surface-subtle, #efeee8);
	border: none;
	cursor: pointer;
	font: inherit;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.match-stats-accordion-trigger:hover {
	color: var(--eg-green);
}

.match-stats-accordion-trigger:focus-visible {
	outline: 2px solid var(--eg-green);
	outline-offset: -2px;
}

.match-stats-accordion-chevron {
	flex-shrink: 0;
	width: 1.25rem;
	height: 1.25rem;
	margin-left: 0.5rem;
	transition: transform 0.2s ease;
}

.match-stats-accordion-chevron-open {
	transform: rotate(180deg);
}

.match-stats-accordion-panel {
	padding: 1rem 1.25rem 1.25rem;
	border-top: 1px solid var(--eg-hairline);
	background: var(--sp-surface, #fff);
}

.match-stats-accordion-panel > * + * {
	margin-top: 1rem;
}

/* ------------------------------------------------------------------ */
/* HTMX loading states                                                 */
/* ------------------------------------------------------------------ */

.htmx-indicator {
	opacity: 0;
	transition: opacity 0.3s ease;
}

.htmx-request .htmx-indicator {
	opacity: 1;
}

.htmx-request.htmx-indicator {
	opacity: 1;
}

/* ------------------------------------------------------------------ */
/* Responsivo                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1023px) {
	.sp-live-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.sp-live-main {
		padding: 24px 16px 32px;
	}

	.sp-live-rail {
		padding: 24px 16px 32px;
		min-height: 0;
	}

	/* Probabilidade duplicada: no mobile vive no bloco próprio */
	.sp-live-rail__section--prob {
		display: none;
	}

	.sp-live-mobile-prob {
		display: block;
		margin: 16px 16px 0;
	}

	.sp-live-breadcrumb {
		padding: 12px 16px 0;
	}
}

@media (max-width: 767px) {
	.sp-msb {
		padding: 20px 16px 0;
	}

	.sp-msb__inner {
		gap: 14px;
	}

	.sp-msb__meta {
		flex-direction: column;
		align-items: center;
		gap: 6px;
		text-align: center;
		font-size: 11px;
	}

	.sp-msb__teams {
		gap: 12px;
	}

	.sp-msb__team {
		gap: 0;
	}

	/* Score 52px sem escudos */
	.sp-msb__team-logo {
		display: none;
	}

	.sp-msb__team-name {
		font-size: 19px;
		white-space: normal;
		overflow: visible;
	}

	.sp-msb__score {
		font-size: 52px;
		letter-spacing: -2px;
	}

	.sp-msb__scorers {
		gap: 12px;
		font-size: 11px;
	}

	.sp-msb__tabs {
		font-size: 13px;
	}

	.sp-msb__tab {
		flex: none;
		padding: 13px 18px;
	}

	.sp-msb__tab--sec {
		font-size: 11px;
		padding: 13px 12px;
	}

	.sp-msb__tabs-spacer {
		flex: 0 0 8px;
	}

	/* Relato mais compacto */
	.sp-relato__item {
		grid-template-columns: 44px 20px 1fr;
		gap: 10px;
	}

	.sp-relato__minute {
		font-size: 15px;
	}

	.sp-relato__dot {
		width: 10px;
		height: 10px;
	}

	.sp-relato__body {
		padding-bottom: 22px;
		gap: 5px;
	}

	.sp-relato__badge {
		font-size: 11px;
		padding: 3px 8px;
	}

	.sp-relato__title {
		font-size: 14px;
	}

	.sp-relato__text {
		font-size: 13px;
		line-height: 1.45;
	}

	/* Onzes empilhados */
	.sp-onzes {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.sp-onzes__player {
		grid-template-columns: 28px 1fr auto;
		gap: 8px;
		padding: 7px 0;
		font-size: 13px;
	}

	.sp-onzes__nota {
		font-size: 11px;
	}

	/* Previsão compacta */
	.sp-prev__card {
		padding: 16px;
		gap: 10px;
	}

	.sp-prev__bar {
		height: 12px;
	}

	.sp-prev__legend {
		font-size: 11px;
	}

	.sp-prev__xg {
		gap: 10px;
	}

	.sp-prev__xg-card {
		padding: 12px;
	}

	.sp-prev__xg-value {
		font-size: 26px;
	}

	.sp-prev__xg-label {
		font-size: 11px;
		margin-top: 3px;
	}

	.sp-statbars__values {
		font-size: 13px;
	}

	.sp-statbars__bar {
		height: 8px;
	}
}

/* ------------------------------------------------------------------ */
/* Acessibilidade e impressão                                          */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}

	.sp-live-dot,
	.animate-pulse,
	.animate-ping,
	.animate-spin {
		animation: none !important;
	}
}

@media (prefers-contrast: high) {
	.sp-msb__tab--active {
		border-bottom-width: 4px;
	}
}

@media print {
	#match-header-sticky {
		position: static;
	}

	.sp-msb__tabs,
	.sp-live-loading,
	.no-print {
		display: none;
	}
}
