/* ==========================================================================
   FUTPRO — Motor xG → mercado
   components/proprietary/futpro-xg-motor.css
   Todo el CSS está scopeado bajo #futpro-xg
   ========================================================================== */

#futpro-xg {
	/* --- Color --- */
	--fx-bg: #f6f8f7;
	--fx-surface: #ffffff;
	--fx-surface-alt: #eef2f0;
	--fx-ink: #10161d;
	--fx-ink-soft: #46535f;
	--fx-muted: #6b7a86;
	--fx-line: #dde4e2;
	--fx-line-strong: #c3cecb;

	--fx-accent: #0b7a52;
	--fx-accent-dark: #07583b;
	--fx-accent-soft: #e3f2ec;
	--fx-accent-ink: #ffffff;

	--fx-good: #0b7a52;
	--fx-warn: #a35c07;
	--fx-warn-soft: #fdf3e3;
	--fx-bad: #a52822;
	--fx-bad-soft: #fbeceb;

	/* --- Tipografía --- */
	--fx-font: inherit;
	--fx-font-num: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
	--fx-fs-base: 1rem;
	--fx-fs-sm: 0.875rem;
	--fx-fs-xs: 0.8125rem;
	--fx-fs-lg: 1.125rem;
	--fx-fs-xl: 1.5rem;
	--fx-lh: 1.6;

	/* --- Forma --- */
	--fx-radius: 10px;
	--fx-radius-sm: 6px;
	--fx-gap: 16px;
	--fx-pad: 20px;
	--fx-shadow: 0 1px 2px rgba(16, 22, 29, 0.06), 0 8px 24px rgba(16, 22, 29, 0.05);

	box-sizing: border-box;
	margin: 40px 0;
	padding: 0;
	font-family: var(--fx-font);
	font-size: var(--fx-fs-base);
	line-height: var(--fx-lh);
	color: var(--fx-ink);
	background: var(--fx-bg);
	border: 1px solid var(--fx-line);
	border-radius: var(--fx-radius);
	overflow: hidden;
}

#futpro-xg *,
#futpro-xg *::before,
#futpro-xg *::after {
	box-sizing: border-box;
}

/* ---------- Cabecera ---------- */

#futpro-xg .fx-head {
	padding: var(--fx-pad);
	background: linear-gradient(180deg, var(--fx-surface) 0%, var(--fx-bg) 100%);
	border-bottom: 1px solid var(--fx-line);
}

#futpro-xg .fx-kicker {
	margin: 0 0 6px;
	font-size: var(--fx-fs-xs);
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--fx-accent);
}

#futpro-xg .fx-title {
	margin: 0 0 8px;
	font-size: var(--fx-fs-xl);
	line-height: 1.25;
	font-weight: 700;
	color: var(--fx-ink);
}

#futpro-xg .fx-lead {
	margin: 0;
	max-width: 68ch;
	font-size: var(--fx-fs-sm);
	color: var(--fx-ink-soft);
}

/* ---------- Pestañas ---------- */

#futpro-xg .fx-tabs {
	display: flex;
	gap: 2px;
	padding: 0 var(--fx-pad);
	background: var(--fx-surface-alt);
	border-bottom: 1px solid var(--fx-line);
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

#futpro-xg .fx-tab {
	flex: 0 0 auto;
	margin: 0;
	padding: 14px 18px;
	font-family: inherit;
	font-size: var(--fx-fs-sm);
	font-weight: 600;
	line-height: 1.2;
	color: var(--fx-muted);
	background: transparent;
	border: 0;
	border-bottom: 3px solid transparent;
	cursor: pointer;
	white-space: nowrap;
	transition: color 0.18s ease, border-color 0.18s ease;
}

#futpro-xg .fx-tab:hover {
	color: var(--fx-ink);
}

#futpro-xg .fx-tab.is-active {
	color: var(--fx-accent-dark);
	border-bottom-color: var(--fx-accent);
	background: var(--fx-surface);
}

/* ---------- Paneles ---------- */

#futpro-xg .fx-panel {
	display: none;
	padding: var(--fx-pad);
}

#futpro-xg .fx-panel.is-active {
	display: block;
}

#futpro-xg .fx-hidden {
	display: none;
}

/* ---------- Formularios ---------- */

#futpro-xg .fx-fieldset {
	margin: 0 0 var(--fx-gap);
	padding: var(--fx-pad);
	background: var(--fx-surface);
	border: 1px solid var(--fx-line);
	border-radius: var(--fx-radius);
}

#futpro-xg .fx-legend {
	padding: 0 8px;
	margin-left: -8px;
	font-size: var(--fx-fs-xs);
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--fx-accent-dark);
}

#futpro-xg .fx-modes {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	margin-bottom: var(--fx-gap);
	padding-bottom: var(--fx-gap);
	border-bottom: 1px dashed var(--fx-line);
}

#futpro-xg .fx-radio {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

#futpro-xg .fx-radio input {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--fx-accent);
	flex: 0 0 auto;
}

#futpro-xg .fx-radio label {
	margin: 0;
	font-size: var(--fx-fs-sm);
	font-weight: 500;
	color: var(--fx-ink-soft);
	cursor: pointer;
}

#futpro-xg .fx-grid {
	display: grid;
	gap: 12px var(--fx-gap);
	margin-bottom: var(--fx-gap);
}

#futpro-xg .fx-grid:last-child {
	margin-bottom: 0;
}

#futpro-xg .fx-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#futpro-xg .fx-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#futpro-xg .fx-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#futpro-xg .fx-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

#futpro-xg .fx-field {
	display: flex;
	flex-direction: column;
	gap: 5px;
	min-width: 0;
}

#futpro-xg .fx-field label {
	margin: 0;
	font-size: var(--fx-fs-xs);
	font-weight: 600;
	color: var(--fx-ink-soft);
}

#futpro-xg .fx-tag {
	display: inline-block;
	margin-left: 4px;
	padding: 1px 6px;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--fx-accent-dark);
	background: var(--fx-accent-soft);
	border-radius: 999px;
	vertical-align: middle;
}

#futpro-xg .fx-field input,
#futpro-xg .fx-field select {
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 10px 12px;
	font-family: inherit;
	/* 16px evita el zoom automático de iOS */
	font-size: 16px;
	line-height: 1.3;
	color: var(--fx-ink);
	background: var(--fx-surface);
	border: 1px solid var(--fx-line-strong);
	border-radius: var(--fx-radius-sm);
	appearance: none;
	-webkit-appearance: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#futpro-xg .fx-field select {
	padding-right: 34px;
	background-image: linear-gradient(45deg, transparent 50%, var(--fx-muted) 50%), linear-gradient(135deg, var(--fx-muted) 50%, transparent 50%);
	background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
}

#futpro-xg .fx-field input:hover,
#futpro-xg .fx-field select:hover {
	border-color: var(--fx-muted);
}

#futpro-xg .fx-field input:disabled {
	color: var(--fx-muted);
	background: var(--fx-surface-alt);
	cursor: not-allowed;
}

#futpro-xg .fx-field-inline {
	max-width: 280px;
	margin-bottom: 14px;
}

#futpro-xg .fx-hint {
	font-size: 0.75rem;
	line-height: 1.45;
	color: var(--fx-muted);
}

#futpro-xg .fx-note {
	margin: 10px 0 0;
	font-size: var(--fx-fs-xs);
	line-height: 1.55;
	color: var(--fx-muted);
}

#futpro-xg .fx-block {
	margin-bottom: var(--fx-gap);
	padding-bottom: var(--fx-gap);
	border-bottom: 1px dashed var(--fx-line);
}

/* ---------- Botón ---------- */

#futpro-xg .fx-btn {
	display: inline-block;
	padding: 12px 24px;
	font-family: inherit;
	font-size: var(--fx-fs-sm);
	font-weight: 700;
	line-height: 1.2;
	color: var(--fx-accent-ink);
	background: var(--fx-accent);
	border: 0;
	border-radius: var(--fx-radius-sm);
	cursor: pointer;
	transition: background-color 0.18s ease;
}

#futpro-xg .fx-btn:hover {
	background: var(--fx-accent-dark);
}

/* ---------- Salida: lambdas ---------- */

#futpro-xg .fx-lambda {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: var(--fx-gap);
}

#futpro-xg .fx-chip {
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
	padding: 9px 14px;
	font-size: var(--fx-fs-sm);
	background: var(--fx-surface);
	border: 1px solid var(--fx-line);
	border-left: 3px solid var(--fx-accent);
	border-radius: var(--fx-radius-sm);
}

#futpro-xg .fx-chip b {
	font-family: var(--fx-font-num);
	font-size: var(--fx-fs-lg);
	font-weight: 700;
	color: var(--fx-accent-dark);
}

#futpro-xg .fx-chip span {
	color: var(--fx-muted);
	font-size: var(--fx-fs-xs);
}

/* ---------- Tarjetas de resultado ---------- */

#futpro-xg .fx-results {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--fx-gap);
}

#futpro-xg .fx-card {
	padding: var(--fx-pad);
	background: var(--fx-surface);
	border: 1px solid var(--fx-line);
	border-radius: var(--fx-radius);
	box-shadow: var(--fx-shadow);
	min-width: 0;
}

#futpro-xg .fx-card-wide {
	grid-column: 1 / -1;
}

#futpro-xg .fx-h4 {
	margin: 0 0 14px;
	font-size: var(--fx-fs-sm);
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--fx-ink);
}

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

#futpro-xg .fx-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

#futpro-xg .fx-table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: var(--fx-fs-sm);
}

#futpro-xg .fx-table th,
#futpro-xg .fx-table td {
	padding: 9px 10px;
	text-align: right;
	white-space: nowrap;
	border-bottom: 1px solid var(--fx-line);
}

#futpro-xg .fx-table th:first-child,
#futpro-xg .fx-table td:first-child {
	text-align: left;
	white-space: normal;
}

#futpro-xg .fx-table thead th {
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--fx-muted);
	border-bottom: 2px solid var(--fx-line-strong);
}

#futpro-xg .fx-table tbody tr:last-child th,
#futpro-xg .fx-table tbody tr:last-child td {
	border-bottom: 0;
}

#futpro-xg .fx-table .fx-num {
	font-family: var(--fx-font-num);
	font-variant-numeric: tabular-nums;
}

#futpro-xg .fx-table .fx-strong {
	font-weight: 700;
	color: var(--fx-accent-dark);
}

#futpro-xg .fx-table .fx-dim {
	color: var(--fx-muted);
}

/* ---------- Matriz de marcadores ---------- */

#futpro-xg .fx-matrix {
	border-collapse: separate;
	border-spacing: 3px;
	margin: 0 auto;
	font-family: var(--fx-font-num);
	font-size: var(--fx-fs-xs);
	font-variant-numeric: tabular-nums;
}

#futpro-xg .fx-matrix th {
	padding: 4px 6px;
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--fx-muted);
	text-align: center;
	white-space: nowrap;
}

#futpro-xg .fx-matrix .fx-axis {
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--fx-accent-dark);
}

#futpro-xg .fx-matrix td {
	width: 46px;
	padding: 8px 4px;
	text-align: center;
	color: var(--fx-ink);
	background: var(--fx-surface-alt);
	border-radius: 4px;
	transition: transform 0.15s ease;
}

#futpro-xg .fx-matrix td.fx-top {
	box-shadow: inset 0 0 0 2px var(--fx-accent-dark);
	font-weight: 700;
}

#futpro-xg .fx-matrix td:hover {
	transform: scale(1.08);
}

#futpro-xg .fx-scorelist {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 16px 0 0;
	padding: 0;
	list-style: none;
}

#futpro-xg .fx-scorelist li {
	margin: 0;
	padding: 6px 12px;
	font-size: var(--fx-fs-xs);
	background: var(--fx-accent-soft);
	border-radius: 999px;
}

#futpro-xg .fx-scorelist b {
	font-family: var(--fx-font-num);
	color: var(--fx-accent-dark);
}

/* ---------- Bloques de estadísticas ---------- */

#futpro-xg .fx-stats {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
	margin: 0 0 var(--fx-gap);
}

#futpro-xg .fx-stats-4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

#futpro-xg .fx-stat {
	padding: 14px;
	background: var(--fx-surface);
	border: 1px solid var(--fx-line);
	border-radius: var(--fx-radius-sm);
	min-width: 0;
}

#futpro-xg .fx-stat-k {
	display: block;
	margin-bottom: 4px;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--fx-muted);
}

#futpro-xg .fx-stat-v {
	display: block;
	font-family: var(--fx-font-num);
	font-size: var(--fx-fs-lg);
	font-weight: 700;
	line-height: 1.25;
	color: var(--fx-ink);
	word-break: break-word;
}

#futpro-xg .fx-stat-v.fx-pos { color: var(--fx-good); }
#futpro-xg .fx-stat-v.fx-neg { color: var(--fx-bad); }

/* ---------- Veredicto ---------- */

#futpro-xg .fx-verdict {
	margin: 0 0 var(--fx-gap);
	padding: 16px 18px;
	font-size: var(--fx-fs-sm);
	line-height: 1.55;
	border-radius: var(--fx-radius-sm);
	border-left: 4px solid var(--fx-muted);
	background: var(--fx-surface-alt);
	color: var(--fx-ink-soft);
}

#futpro-xg .fx-verdict.is-good {
	background: var(--fx-accent-soft);
	border-left-color: var(--fx-good);
	color: var(--fx-accent-dark);
}

#futpro-xg .fx-verdict.is-warn {
	background: var(--fx-warn-soft);
	border-left-color: var(--fx-warn);
	color: var(--fx-warn);
}

#futpro-xg .fx-verdict.is-bad {
	background: var(--fx-bad-soft);
	border-left-color: var(--fx-bad);
	color: var(--fx-bad);
}

#futpro-xg .fx-verdict b {
	display: block;
	margin-bottom: 3px;
	font-size: var(--fx-fs-base);
}

/* ---------- Medidor de valor ---------- */

#futpro-xg .fx-meter {
	padding: var(--fx-pad);
	background: var(--fx-surface);
	border: 1px solid var(--fx-line);
	border-radius: var(--fx-radius);
}

#futpro-xg .fx-meter-head {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
	font-size: var(--fx-fs-xs);
	font-weight: 600;
	color: var(--fx-muted);
}

#futpro-xg .fx-meter-track {
	position: relative;
	height: 26px;
	background: var(--fx-surface-alt);
	border-radius: 999px;
	overflow: hidden;
}

#futpro-xg .fx-meter-fill {
	position: absolute;
	top: 0;
	bottom: 0;
	background: var(--fx-accent);
	transition: left 0.3s ease, width 0.3s ease, background-color 0.3s ease;
}

#futpro-xg .fx-meter-fill.is-neg {
	background: var(--fx-bad);
}

#futpro-xg .fx-meter-zero {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 2px;
	background: var(--fx-ink);
	opacity: 0.55;
}

#futpro-xg .fx-meter-scale {
	display: flex;
	justify-content: space-between;
	margin-top: 6px;
	font-family: var(--fx-font-num);
	font-size: 0.6875rem;
	color: var(--fx-muted);
}

/* ---------- Histograma ---------- */

#futpro-xg .fx-hist {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

#futpro-xg .fx-hist-row {
	display: grid;
	grid-template-columns: minmax(96px, 128px) 1fr minmax(52px, auto);
	align-items: center;
	gap: 10px;
	font-size: var(--fx-fs-xs);
}

#futpro-xg .fx-hist-lab {
	font-family: var(--fx-font-num);
	color: var(--fx-ink-soft);
	text-align: right;
	white-space: nowrap;
}

#futpro-xg .fx-hist-track {
	position: relative;
	height: 16px;
	background: var(--fx-surface-alt);
	border-radius: 3px;
	overflow: hidden;
	min-width: 0;
}

#futpro-xg .fx-hist-bar {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	background: var(--fx-accent);
	border-radius: 3px;
	transition: width 0.35s ease;
}

#futpro-xg .fx-hist-bar.is-loss {
	background: var(--fx-bad);
	opacity: 0.75;
}

#futpro-xg .fx-hist-val {
	font-family: var(--fx-font-num);
	color: var(--fx-muted);
	white-space: nowrap;
}

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

#futpro-xg .fx-foot {
	padding: var(--fx-pad);
	background: var(--fx-surface-alt);
	border-top: 1px solid var(--fx-line);
}

#futpro-xg .fx-foot p {
	margin: 0 0 10px;
	font-size: var(--fx-fs-xs);
	line-height: 1.6;
	color: var(--fx-muted);
}

#futpro-xg .fx-foot p:last-child {
	margin-bottom: 0;
}

#futpro-xg .fx-legal {
	padding-top: 10px;
	border-top: 1px dashed var(--fx-line-strong);
}

#futpro-xg .fx-legal-strong {
	font-weight: 700;
	color: var(--fx-ink-soft);
}

/* ---------- Foco visible ---------- */

#futpro-xg button:focus-visible,
#futpro-xg input:focus-visible,
#futpro-xg select:focus-visible,
#futpro-xg [tabindex]:focus-visible {
	outline: 3px solid var(--fx-accent);
	outline-offset: 2px;
	border-radius: var(--fx-radius-sm);
}

#futpro-xg input:focus,
#futpro-xg select:focus {
	border-color: var(--fx-accent);
	box-shadow: 0 0 0 3px var(--fx-accent-soft);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
	#futpro-xg .fx-grid-4,
	#futpro-xg .fx-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	#futpro-xg .fx-results { grid-template-columns: 1fr; }
	#futpro-xg .fx-stats,
	#futpro-xg .fx-stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
	#futpro-xg {
		--fx-pad: 14px;
		--fx-gap: 12px;
		--fx-fs-xl: 1.25rem;
		margin: 28px 0;
		border-radius: 8px;
	}

	#futpro-xg .fx-grid-2,
	#futpro-xg .fx-grid-3,
	#futpro-xg .fx-grid-4,
	#futpro-xg .fx-grid-5 { grid-template-columns: 1fr; }

	#futpro-xg .fx-stats,
	#futpro-xg .fx-stats-4 { grid-template-columns: 1fr; }

	#futpro-xg .fx-tabs { padding: 0 8px; }
	#futpro-xg .fx-tab { padding: 12px 12px; }

	#futpro-xg .fx-field-inline { max-width: 100%; }

	#futpro-xg .fx-matrix td { width: 40px; padding: 7px 3px; }

	#futpro-xg .fx-hist-row {
		grid-template-columns: minmax(84px, 100px) 1fr;
		row-gap: 2px;
	}

	#futpro-xg .fx-hist-val { display: none; }

	#futpro-xg .fx-btn { width: 100%; }
}

/* ---------- Movimiento reducido ---------- */

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

	#futpro-xg .fx-matrix td:hover {
		transform: none;
	}
}

/* ---------- Impresión ---------- */

@media print {
	#futpro-xg .fx-tabs,
	#futpro-xg .fx-btn { display: none; }
	#futpro-xg .fx-panel { display: block; }
	#futpro-xg { border-color: #999; box-shadow: none; }
}
