/**
 * SoccerTrack — Portal Público · Estilos de pestañas y tablas
 *
 * Paleta:
 *   --st-green-primary : #3CBC20  (verde corporativo)
 *   --st-navy          : #0E0C19  (fondo oscuro)
 *   --st-charcoal      : #3C3A47  (gris oscuro)
 *   --st-white         : #FFFFFF
 *   --st-light-bg      : #F4F6F8
 *
 * Tipografía: Abril Fatface (headings) · Poppins (body)
 */

/* =========================================================
   Variables
   ========================================================= */
:root {
	--st-green-primary: #3CBC20;
	--st-green-dark:    #2fa318;
	--st-navy:          #0E0C19;
	--st-charcoal:      #3C3A47;
	--st-white:         #ffffff;
	--st-light-bg:      #f4f6f8;
	--st-border:        #d8dde3;
	--st-radius:        6px;
	--st-shadow:        0 2px 8px rgba(14, 12, 25, 0.08);
	--st-font-heading:  'Abril Fatface', Georgia, serif;
	--st-font-body:     'Poppins', system-ui, sans-serif;
}

/* =========================================================
   Contenedor del portal
   ========================================================= */
.st-portal {
	font-family: var(--st-font-body);
	color: var(--st-charcoal);
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 16px 48px;
}

.st-portal *,
.st-portal *::before,
.st-portal *::after {
	box-sizing: border-box;
}

/* =========================================================
   Navegación de pestañas
   ========================================================= */
.st-tabs-nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px;
	border-bottom: 2px solid var(--st-border);
	margin-bottom: 24px;
	padding: 0;
	list-style: none;
}

.st-tabs-nav li {
	margin: 0;
	padding: 0;
}

.st-tab-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 20px;
	font-family: var(--st-font-body);
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--st-charcoal);
	background: transparent;
	border: none;
	border-bottom: 3px solid transparent;
	cursor: pointer;
	transition: color 0.15s, border-color 0.15s;
	position: relative;
	top: 2px;
}

.st-tab-btn:hover {
	color: var(--st-green-primary);
}

.st-tab-btn[aria-selected="true"] {
	color: var(--st-green-primary);
	border-bottom-color: var(--st-green-primary);
}

/* =========================================================
   Paneles de pestañas
   ========================================================= */
.st-tab-panel {
	display: none;
	animation: stFadeIn 0.2s ease;
}

.st-tab-panel[aria-hidden="false"] {
	display: block;
}

@keyframes stFadeIn {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Encabezado de sección
   ========================================================= */
.st-section-title {
	font-family: var(--st-font-heading);
	font-size: 1.4rem;
	color: var(--st-navy);
	margin: 0 0 16px;
}

/* =========================================================
   Tabla base (posiciones, fixture, tribunal)
   ========================================================= */
.st-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border-radius: var(--st-radius);
	box-shadow: var(--st-shadow);
}

.st-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
	background: var(--st-white);
}

.st-table thead th {
	background: var(--st-navy);
	color: var(--st-white);
	font-weight: 600;
	text-align: left;
	padding: 10px 14px;
	white-space: nowrap;
}

.st-table thead th:first-child {
	border-radius: var(--st-radius) 0 0 0;
}

.st-table thead th:last-child {
	border-radius: 0 var(--st-radius) 0 0;
}

.st-table tbody tr:nth-child(even) {
	background: var(--st-light-bg);
}

.st-table tbody tr:hover {
	background: #e8f7e4;
}

.st-table td {
	padding: 9px 14px;
	border-bottom: 1px solid var(--st-border);
	vertical-align: middle;
}

.st-table tbody tr:last-child td {
	border-bottom: none;
}

/* =========================================================
   Tabla de posiciones — columnas numéricas centradas
   ========================================================= */
.st-standings-table td:not(:nth-child(1)):not(:nth-child(2)),
.st-standings-table th:not(:nth-child(1)):not(:nth-child(2)) {
	text-align: center;
}

.st-standings-table .st-rank {
	font-weight: 700;
	color: var(--st-navy);
	width: 36px;
}

.st-standings-table .st-pts {
	font-weight: 700;
	color: var(--st-green-primary);
	font-size: 1rem;
}

.st-team-logo {
	width: 28px;
	height: 28px;
	object-fit: contain;
	border-radius: 3px;
	vertical-align: middle;
	margin-right: 8px;
	flex-shrink: 0;
}

/* =========================================================
   Fixture — tarjetas de partido
   ========================================================= */
.st-fixture-rounds {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.st-round-header {
	font-family: var(--st-font-heading);
	font-size: 1rem;
	color: var(--st-charcoal);
	margin: 0 0 8px;
	padding-bottom: 4px;
	border-bottom: 1px solid var(--st-border);
}

.st-match-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	background: var(--st-white);
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius);
	padding: 12px 16px;
	margin-bottom: 8px;
	box-shadow: var(--st-shadow);
}

.st-match-card--libre {
	background: #f9f9f9;
	border-style: dashed;
	border-color: #ddd;
	opacity: .75;
}

.st-match-card--libre .st-match-team {
	opacity: .6;
}

.st-match-team {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	font-weight: 600;
}

.st-match-team--away {
	flex-direction: row-reverse;
	text-align: right;
}

.st-match-score {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 1.4rem;
	font-weight: 700;
	color: var(--st-navy);
	min-width: 80px;
	justify-content: center;
}

.st-match-score-sep {
	color: var(--st-border);
	font-weight: 300;
}

.st-match-meta {
	font-size: 0.75rem;
	color: #888;
	margin-top: 4px;
	text-align: center;
}

.st-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 20px;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.st-badge--finished  { background: #e0f9da; color: #1a7a0d; }
.st-badge--scheduled { background: #e8e8f0; color: var(--st-charcoal); }
.st-badge--live      { background: #fff0e0; color: #b85c00; }

/* =========================================================
   Equipos — cuadrícula
   ========================================================= */
.st-teams-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 16px;
}

.st-team-card {
	background: var(--st-white);
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius);
	padding: 20px 16px;
	text-align: center;
	box-shadow: var(--st-shadow);
	transition: transform 0.15s, box-shadow 0.15s;
}

.st-team-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(14, 12, 25, 0.12);
}

.st-team-card__logo {
	width: 64px;
	height: 64px;
	object-fit: contain;
	margin: 0 auto 10px;
	display: block;
}

/* Avatar generado por iniciales (fallback sin logo) */
.st-team-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	font-family: var(--st-font-body, 'Poppins', sans-serif);
	font-weight: 700;
	color: #fff;
	text-transform: uppercase;
	flex-shrink: 0;
	/* tamaño por defecto: contexto de tabla/fixture */
	width: 28px;
	height: 28px;
	font-size: 0.6rem;
	margin-right: 8px;
	vertical-align: middle;
}

/* Tamaño grande para tarjetas de equipos */
.st-team-card .st-team-avatar,
.st-team-card__logo.st-team-avatar {
	width: 64px;
	height: 64px;
	font-size: 1.4rem;
	margin: 0 auto 10px;
	display: flex;
}

.st-team-card__name {
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--st-navy);
}

/* =========================================================
   Tribunal disciplinario
   ========================================================= */

/* Secciones */
.st-tribunal-section {
	margin-bottom: 2rem;
}

.st-tribunal-section--pending {
	border: 2px solid #f5c6c6;
	border-radius: var(--st-radius);
	padding: 16px 20px;
	background: #fff8f8;
}

.st-tribunal-notice {
	font-size: 0.85rem;
	color: #7a3030;
	margin: 0 0 12px;
	font-style: italic;
}

/* Título de sección con badge de fecha */
.st-subsection-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-family: var(--st-font-body);
	font-size: 1rem;
	font-weight: 700;
	color: var(--st-navy);
	margin: 0 0 12px;
}

.st-round-badge {
	display: inline-block;
	padding: 2px 10px;
	background: var(--st-charcoal);
	color: #fff;
	border-radius: 20px;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

/* Estado en tabla de pendientes */
.st-badge--pending {
	background: #fef3cd;
	color: #856404;
}

/* Estados de sanciones resueltas */
.st-sanction-status--active {
	color: #c0392b;
	font-weight: 700;
}

.st-sanction-status--served {
	color: #27ae60;
}

/* Columna incidente con icono de tarjeta */
.st-card-label {
	font-size: 0.82rem;
	font-weight: 600;
	vertical-align: middle;
}

/* =========================================================
   Descarga de bases
   ========================================================= */
.st-download-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 28px;
	background: var(--st-green-primary);
	color: var(--st-white);
	font-family: var(--st-font-body);
	font-size: 1rem;
	font-weight: 700;
	border-radius: var(--st-radius);
	text-decoration: none;
	transition: background 0.15s;
	margin-top: 16px;
}

.st-download-btn:hover {
	background: var(--st-green-dark);
	color: var(--st-white);
	text-decoration: none;
}

/* =========================================================
   Estado de carga / error
   ========================================================= */
.st-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px;
	color: #999;
	gap: 12px;
	font-size: 0.9rem;
}

.st-spinner {
	width: 20px;
	height: 20px;
	border: 3px solid var(--st-border);
	border-top-color: var(--st-green-primary);
	border-radius: 50%;
	animation: stSpin 0.7s linear infinite;
}

@keyframes stSpin {
	to { transform: rotate(360deg); }
}

.st-error-msg {
	background: #fdecea;
	border: 1px solid #f5c6cb;
	border-radius: var(--st-radius);
	padding: 14px 18px;
	color: #721c24;
	font-size: 0.9rem;
}

.st-empty-msg {
	text-align: center;
	padding: 40px;
	color: #aaa;
	font-size: 0.9rem;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 640px) {
	.st-tab-btn {
		padding: 8px 12px;
		font-size: 0.8rem;
	}

	.st-match-card {
		flex-direction: column;
		gap: 8px;
		text-align: center;
	}

	.st-match-team--away {
		flex-direction: row;
		text-align: left;
	}

	.st-match-score {
		font-size: 1.6rem;
	}

	.st-teams-grid {
		grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	}
}

/* =========================================================
   Fixture — navegación por jornada
   ========================================================= */
.st-round-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 20px;
}

.st-round-btn {
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border: 2px solid var(--st-border);
	border-radius: 50px;
	background: var(--st-white);
	color: var(--st-charcoal);
	font-family: var(--st-font-body);
	font-size: .85rem;
	font-weight: 700;
	cursor: pointer;
	transition: border-color .15s, background .15s, color .15s;
}

.st-round-btn:hover:not(:disabled) {
	border-color: var(--st-green-primary);
	color: var(--st-green-primary);
}

.st-round-btn--active {
	background: var(--st-green-primary);
	border-color: var(--st-green-primary);
	color: #fff !important;
}

.st-round-btn--done {
	border-color: #b0d9a8;
	color: #3a8a2e;
	background: #f0fbee;
}

.st-round-btn--locked {
	opacity: .45;
	cursor: not-allowed;
}

.st-fixture-current {
	animation: stFadeIn .2s ease;
}

.st-match-center {
	text-align: center;
	flex-shrink: 0;
}

/* =========================================================
   Tabla posiciones — indicadores de zona
   ========================================================= */
.st-standings-table tr[data-zone="playoff"] td:first-child {
	border-left: 4px solid var(--st-green-primary);
}

.st-standings-table tr[data-zone="danger"] td:first-child {
	border-left: 4px solid #e74c3c;
}

/* =========================================================
   Tab: Bases del torneo
   ========================================================= */
.st-bases-wrap {
	max-width: 860px;
	margin: 0 auto;
	text-align: center;
}

.st-bases-desc {
	color: var(--st-charcoal);
	margin-bottom: 20px;
	font-size: 0.95rem;
}

.st-btn--lg {
	padding: 14px 32px;
	font-size: 1rem;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.st-bases-preview {
	margin-top: 28px;
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius);
	overflow: hidden;
	box-shadow: var(--st-shadow);
	background: #fff;
}

.st-bases-iframe {
	display: block;
	width: 100%;
	height: 640px;
	border: none;
}

@media (max-width: 600px) {
	.st-bases-iframe {
		height: 420px;
	}
}

/* ─── Play-offs bracket ──────────────────────────────────────────────── */

.st-playoffs-bracket {
	margin-top: 40px;
	padding-top: 32px;
	border-top: 2px solid var(--st-border, #e0e0e0);
}

.st-bracket-round {
	margin-bottom: 28px;
}

.st-bracket-round-title {
	font-family: var(--st-font-body, 'Poppins', sans-serif);
	font-size: 1rem;
	font-weight: 700;
	color: var(--st-charcoal, #3C3A47);
	text-transform: uppercase;
	letter-spacing: .06em;
	margin: 0 0 12px;
	padding: 6px 14px;
	background: var(--st-green-primary, #3CBC20);
	color: #fff;
	border-radius: 6px;
	display: inline-block;
}

.st-bracket-matches {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
}

/* Octavos (8 partidos) → 4 columnas en pantallas anchas */
.st-bracket-matches--8 {
	grid-template-columns: repeat(4, 1fr);
}

/* Final / 3er puesto (1 partido) → ancho completo */
.st-bracket-matches--1 {
	grid-template-columns: 1fr;
}

.st-bracket-matches .st-match-card {
	border: 2px solid var(--st-green-primary, #3CBC20);
}

/* Final: borde dorado */
.st-bracket-round:last-child .st-match-card {
	border-color: #f1c40f;
	box-shadow: 0 2px 12px rgba(241, 196, 15, .25);
}

@media (max-width: 700px) {
	.st-bracket-matches,
	.st-bracket-matches--8 {
		grid-template-columns: 1fr;
	}
}
