/* ==========================================================================
   FDF Datos - modulos estadisticos
   Densidad tipo DataFactory con la paleta de FDF Estadio (estadio de noche).
   ========================================================================== */

.fdf-modulo {
	--fdf-navy: #0b1b2b;
	--fdf-navy-2: #12293f;
	--fdf-navy-3: #1b3a55;
	--fdf-celeste: #4cc3f0;
	--fdf-celeste-osc: #1e9bd0;
	--fdf-texto: #14212e;
	--fdf-texto-2: #64748b;
	--fdf-linea: #e2e8f0;
	--fdf-fondo: #ffffff;
	--fdf-fondo-alt: #f6f8fa;
	--fdf-vivo: #e63946;
	--fdf-radio: 6px;
	--fdf-cond: "Barlow Condensed", "Oswald", "Arial Narrow", system-ui, sans-serif;

	background: var(--fdf-fondo);
	border: 1px solid var(--fdf-linea);
	border-radius: var(--fdf-radio);
	overflow: hidden;
	margin: 0 0 1.75rem;
	color: var(--fdf-texto);
	font-family: var(--fdf-cond);
	font-size: 15px;
	line-height: 1.25;
}

.fdf-modulo * {
	box-sizing: border-box;
}

/* ---------- Cabezal ---------- */

.fdf-modulo__cabezal {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.6rem 0.85rem;
	background: var(--fdf-navy);
	background: linear-gradient(180deg, var(--fdf-navy-2) 0%, var(--fdf-navy) 100%);
	border-bottom: 3px solid var(--fdf-celeste);
}

.fdf-modulo__titulo {
	margin: 0;
	padding: 0;
	color: #fff;
	font-family: var(--fdf-cond);
	font-size: 1.05rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	line-height: 1.2;
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.fdf-modulo__link {
	color: var(--fdf-celeste);
	font-size: 0.78rem;
	font-weight: 500;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
}

.fdf-modulo__link:hover,
.fdf-modulo__link:focus {
	color: #fff;
	text-decoration: underline;
}

.fdf-badge {
	background: var(--fdf-celeste);
	color: var(--fdf-navy);
	font-size: 0.65rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 0.15rem 0.4rem;
	border-radius: 3px;
}

/* Punto rojo pulsante del modulo en vivo */
.fdf-punto {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--fdf-vivo);
	display: inline-block;
	animation: fdf-latido 1.6s ease-in-out infinite;
}

@keyframes fdf-latido {
	0%, 100% { opacity: 1; transform: scale(1); }
	50% { opacity: 0.45; transform: scale(0.8); }
}

/* ---------- Tablas ---------- */

.fdf-tabla {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
	font-variant-numeric: tabular-nums;
}

.fdf-tabla th,
.fdf-tabla td {
	padding: 0.42rem 0.3rem;
	text-align: center;
	border: 0;
	border-bottom: 1px solid var(--fdf-linea);
	font-size: 0.92rem;
}

.fdf-tabla thead th {
	background: var(--fdf-fondo-alt);
	color: var(--fdf-texto-2);
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	border-bottom: 1px solid var(--fdf-linea);
}

.fdf-tabla thead th abbr {
	text-decoration: none;
	border: 0;
	cursor: help;
}

.fdf-tabla tbody tr:nth-child(even) {
	background: var(--fdf-fondo-alt);
}

.fdf-tabla tbody tr:hover {
	background: rgba(76, 195, 240, 0.12);
}

.fdf-tabla tbody tr:last-child td {
	border-bottom: 0;
}

.fdf-col-pos {
	width: 30px;
	color: var(--fdf-texto-2);
	font-size: 0.82rem;
}

.fdf-col-equipo,
.fdf-col-jugador {
	text-align: left;
	padding-left: 0.6rem;
	max-width: 0;
	width: 100%;
}

/* Contenedor flex propio: muchos temas ponen display:block en las imagenes de
   tabla, lo que tiraba el nombre del equipo a otro renglon y centrado. */
.fdf-modulo .fdf-equipo-caja,
.fdf-modulo .fdf-jugador-caja {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	min-width: 0;
	text-align: left;
}

.fdf-modulo .fdf-jugador-datos {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.15;
}

.fdf-col-destacada {
	font-weight: 700;
	color: var(--fdf-navy);
	background: rgba(76, 195, 240, 0.09);
	width: 44px;
}

.fdf-dif {
	color: var(--fdf-texto-2);
	width: 42px;
}

/* Franja celeste en el lider, mas discreta para zona de copas */
.fdf-fila--lider td:first-child {
	box-shadow: inset 3px 0 0 var(--fdf-celeste);
}

.fdf-fila--copa td:first-child {
	box-shadow: inset 3px 0 0 var(--fdf-celeste-osc);
	opacity: 1;
}

.fdf-modulo .fdf-escudo {
	width: 22px;
	height: 22px;
	object-fit: contain;
	vertical-align: middle;
	flex: 0 0 auto;
	display: inline-block;
	max-width: none;
	margin: 0;
}

.fdf-escudo--vacio {
	display: inline-block;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--fdf-linea);
	flex: 0 0 auto;
}

.fdf-equipo-nombre {
	vertical-align: middle;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fdf-equipo-sigla {
	display: none;
	vertical-align: middle;
	font-weight: 600;
	letter-spacing: 0.03em;
}

.fdf-col-jugador .fdf-jugador {
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fdf-col-jugador .fdf-club {
	color: var(--fdf-texto-2);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---------- Partidos ---------- */

.fdf-partidos {
	list-style: none;
	margin: 0;
	padding: 0;
}

.fdf-partido {
	display: grid;
	grid-template-columns: 1fr 84px 1fr;
	grid-template-areas:
		"local centro visita"
		"meta meta meta";
	align-items: center;
	gap: 0.3rem 0.5rem;
	padding: 0.55rem 0.7rem;
	border-bottom: 1px solid var(--fdf-linea);
	margin: 0;
}

.fdf-partido:last-child {
	border-bottom: 0;
}

.fdf-partido:nth-child(even) {
	background: var(--fdf-fondo-alt);
}

.fdf-partido.is-vivo {
	background: rgba(230, 57, 70, 0.06);
	box-shadow: inset 3px 0 0 var(--fdf-vivo);
}

.fdf-partido__equipo {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	min-width: 0;
	font-weight: 500;
}

.fdf-partido__equipo--local {
	grid-area: local;
	justify-content: flex-end;
	text-align: right;
}

.fdf-partido__equipo--visita {
	grid-area: visita;
	justify-content: flex-start;
	text-align: left;
}

.fdf-partido__equipo .fdf-equipo-nombre {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fdf-partido__equipo .fdf-escudo {
	margin: 0;
	width: 26px;
	height: 26px;
}

.fdf-partido__centro {
	grid-area: centro;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.1rem;
}

.fdf-marcador {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--fdf-navy);
	letter-spacing: 0.02em;
	font-variant-numeric: tabular-nums;
	background: var(--fdf-fondo);
	border: 1px solid var(--fdf-linea);
	border-radius: 4px;
	padding: 0.05rem 0.45rem;
	min-width: 62px;
	display: inline-block;
}

.fdf-marcador i {
	font-style: normal;
	color: var(--fdf-texto-2);
	margin: 0 0.2rem;
}

.fdf-hora {
	font-size: 1rem;
	font-weight: 600;
	color: var(--fdf-navy);
	background: var(--fdf-fondo);
	border: 1px solid var(--fdf-linea);
	border-radius: 4px;
	padding: 0.05rem 0.45rem;
	min-width: 62px;
	display: inline-block;
}

.fdf-hora--sin {
	font-size: 0.72rem;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--fdf-texto-2);
}

.fdf-penales {
	font-size: 0.7rem;
	color: var(--fdf-texto-2);
	text-transform: uppercase;
}

.fdf-vivo {
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: #fff;
	background: var(--fdf-vivo);
	border-radius: 3px;
	padding: 0.05rem 0.3rem;
	text-transform: uppercase;
}

.fdf-final {
	font-size: 0.66rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--fdf-texto-2);
	border: 1px solid var(--fdf-linea);
	border-radius: 3px;
	padding: 0.02rem 0.28rem;
}

.fdf-partido__meta {
	grid-area: meta;
	display: flex;
	justify-content: center;
	gap: 0.5rem;
	font-size: 0.72rem;
	color: var(--fdf-texto-2);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.fdf-partido__goles {
	grid-column: 1 / -1;
	font-size: 0.75rem;
	color: var(--fdf-texto-2);
	text-align: center;
	padding-top: 0.15rem;
}

/* ---------- Selector de fechas ---------- */

.fdf-fechas {
	display: flex;
	gap: 0.25rem;
	overflow-x: auto;
	padding: 0.5rem 0.7rem;
	background: var(--fdf-fondo-alt);
	border-bottom: 1px solid var(--fdf-linea);
	scrollbar-width: thin;
}

.fdf-fecha-btn {
	flex: 0 0 auto;
	min-width: 32px;
	padding: 0.25rem 0.45rem;
	border: 1px solid var(--fdf-linea);
	border-radius: 3px;
	background: var(--fdf-fondo);
	color: var(--fdf-texto-2);
	font-family: var(--fdf-cond);
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.fdf-fecha-btn:hover {
	border-color: var(--fdf-celeste);
	color: var(--fdf-navy);
}

.fdf-fecha-btn.is-activa {
	background: var(--fdf-navy);
	border-color: var(--fdf-navy);
	color: #fff;
}

.fdf-fecha-btn:focus-visible {
	outline: 2px solid var(--fdf-celeste);
	outline-offset: 1px;
}

.fdf-fecha-panel {
	display: none;
}

.fdf-fecha-panel.is-activa {
	display: block;
}

.fdf-fecha-titulo {
	margin: 0;
	padding: 0.4rem 0.7rem;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--fdf-texto-2);
	background: var(--fdf-fondo-alt);
	border-bottom: 1px solid var(--fdf-linea);
}

/* ---------- Pie ---------- */

.fdf-vermas {
	display: block;
	padding: 0.55rem;
	text-align: center;
	background: var(--fdf-fondo-alt);
	border-top: 1px solid var(--fdf-linea);
	color: var(--fdf-navy);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	text-decoration: none;
}

.fdf-vermas:hover,
.fdf-vermas:focus {
	background: var(--fdf-celeste);
	color: var(--fdf-navy);
}

.fdf-fuente {
	margin: 0;
	padding: 0.35rem 0.7rem;
	font-size: 0.68rem;
	color: var(--fdf-texto-2);
	text-align: right;
	letter-spacing: 0.03em;
	border-top: 1px solid var(--fdf-linea);
}

.fdf-vacio p {
	margin: 0;
	padding: 1rem;
	color: var(--fdf-texto-2);
	text-align: center;
	font-size: 0.9rem;
}

.fdf-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- Version compacta (sidebar) ---------- */

.fdf-posiciones--compacta {
	font-size: 14px;
}

.fdf-posiciones--compacta .fdf-oculta-movil {
	display: none;
}

.fdf-posiciones--compacta .fdf-tabla th,
.fdf-posiciones--compacta .fdf-tabla td {
	padding: 0.34rem 0.25rem;
}

.fdf-posiciones--compacta .fdf-escudo {
	width: 18px;
	height: 18px;
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
	.fdf-oculta-movil {
		display: none;
	}

	.fdf-equipo-nombre {
		display: none;
	}

	.fdf-equipo-sigla {
		display: inline;
	}

	.fdf-partido {
		grid-template-columns: 1fr 76px 1fr;
	}

	.fdf-tabla th,
	.fdf-tabla td {
		font-size: 0.88rem;
	}

	.fdf-col-jugador .fdf-jugador {
		font-size: 0.85rem;
	}
}

/* ---------- Modo oscuro ----------
   Soporta el toggle del tema (clase en body o data-theme) y la preferencia
   del sistema. */

body.dark-mode .fdf-modulo,
body.dark .fdf-modulo,
[data-theme="dark"] .fdf-modulo {
	--fdf-texto: #e6edf3;
	--fdf-texto-2: #94a3b8;
	--fdf-linea: #22364a;
	--fdf-fondo: #0f2133;
	--fdf-fondo-alt: #142a3f;
	border-color: #22364a;
}

body.dark-mode .fdf-marcador,
body.dark .fdf-marcador,
[data-theme="dark"] .fdf-marcador,
body.dark-mode .fdf-hora,
body.dark .fdf-hora,
[data-theme="dark"] .fdf-hora {
	color: #fff;
	background: #0b1b2b;
	border-color: #22364a;
}

body.dark-mode .fdf-col-destacada,
body.dark .fdf-col-destacada,
[data-theme="dark"] .fdf-col-destacada {
	color: #fff;
	background: rgba(76, 195, 240, 0.14);
}

body.dark-mode .fdf-vermas,
body.dark .fdf-vermas,
[data-theme="dark"] .fdf-vermas {
	color: var(--fdf-celeste);
}

@media (prefers-color-scheme: dark) {
	body:not(.light-mode):not(.light) .fdf-modulo {
		--fdf-texto: #e6edf3;
		--fdf-texto-2: #94a3b8;
		--fdf-linea: #22364a;
		--fdf-fondo: #0f2133;
		--fdf-fondo-alt: #142a3f;
		border-color: #22364a;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fdf-punto {
		animation: none;
	}

	.fdf-fecha-btn {
		transition: none;
	}
}
