/* FFSA Résultats : onglets + tableaux Ninja Tables */
.ffsa-res {
	--ffsa-navy: #142D56;
	--ffsa-blue: #1E73BE;
	--ffsa-blue-dark: #1E73BE;
	--ffsa-gray: #C2C6CC;
	--ffsa-light: #F0F2F5;
	--ffsa-line: #E2E6EC;
	--ffsa-text: #0E1A2B;
	--ffsa-muted: #6B7686;
	--ffsa-cond: "Roboto Condensed", "Arial Narrow", sans-serif;
	color: var(--ffsa-text);
	background: #FFFFFF;
	box-sizing: border-box;
	font-synthesis: none;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}
.ffsa-res *, .ffsa-res *::before, .ffsa-res *::after { box-sizing: border-box; }
.ffsa-res [hidden] { display: none !important; }

/* ---------- Onglets (sessions + classement) ---------- */
.ffsa-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.ffsa-res .ffsa-tab {
	display: inline-flex; align-items: center; gap: 12px;
	height: 44px !important; min-height: 0 !important; margin: 0; padding: 0 20px !important;
	border: 0; border-radius: 0;
	background: var(--ffsa-gray); color: #FFFFFF;
	font-family: var(--ffsa-cond) !important; font-size: 18px !important; font-weight: 500 !important; line-height: 1 !important;
	font-style: normal !important; font-stretch: normal !important; text-transform: uppercase !important; letter-spacing: .01em !important;
	cursor: pointer; transition: background-color .15s, color .15s;
}
.ffsa-res .ffsa-tab:hover { background: #AEB3BA; }
.ffsa-res .ffsa-tab[aria-selected="true"] { background: var(--ffsa-blue); }
.ffsa-res .ffsa-tab:focus-visible,
.ffsa-res .ffsa-event:focus-visible,
.ffsa-res .ffsa-more:focus-visible { outline: 3px solid #F5B400; outline-offset: 2px; }
.ffsa-res .ffsa-tab svg { transition: transform .2s; }

/* ---------- Classement ---------- */
.ffsa-classement { margin-bottom: 0; }
.ffsa-classement__bar {
	display: flex; flex-wrap: wrap; align-items: center; gap: 24px 64px;
	padding: 36px 62px; background: var(--ffsa-blue); color: #FFFFFF;
}
.ffsa-res .ffsa-classement__title {
	margin: 0; color: #FFFFFF;
	font-family: var(--ffsa-cond) !important; font-size: 26px !important; font-weight: 500 !important; line-height: 1.1 !important; letter-spacing: 0 !important; font-stretch: normal !important; text-transform: uppercase;
}
.ffsa-res .ffsa-tab--light { height: 56px !important; padding: 0 22px !important; background: rgba(255,255,255,.18); color: #FFFFFF; }
.ffsa-res .ffsa-tab--light:hover { background: rgba(255,255,255,.28); }
.ffsa-res .ffsa-tab--light[aria-selected="true"] { background: #FFFFFF; color: var(--ffsa-blue-dark); }
.ffsa-res .ffsa-tab--light[aria-expanded="true"] svg { transform: rotate(180deg); }
.ffsa-classement__body > .ffsa-panel { padding: 32px 62px 40px; }

/* ---------- Épreuves ---------- */
.ffsa-epreuves { padding: 48px 62px 56px; border-top: 1px solid var(--ffsa-line); }
.ffsa-res .ffsa-epreuves__title {
	margin: 0 0 24px; color: var(--ffsa-blue-dark);
	font-family: var(--ffsa-cond) !important; font-size: 26px !important; font-weight: 500 !important; line-height: 1.1 !important; letter-spacing: 0 !important; font-stretch: normal !important; text-transform: uppercase;
}
.ffsa-events {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px;
	margin-bottom: 32px;
}
.ffsa-res .ffsa-event {
	display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
	min-height: 92px; margin: 0; padding: 14px 16px;
	border: 0; border-bottom: 4px solid transparent; border-radius: 0;
	background: var(--ffsa-light); color: var(--ffsa-text);
	text-align: left !important; align-items: stretch !important; cursor: pointer; transition: background-color .15s, color .15s;
	font-family: "Roboto", sans-serif !important; line-height: 1.2 !important; text-transform: none !important; letter-spacing: 0 !important; font-stretch: normal !important; white-space: normal !important;
}
.ffsa-res .ffsa-event:hover { background: #E4E8EE; }
.ffsa-res .ffsa-event[aria-selected="true"] { background: var(--ffsa-blue); color: #FFFFFF; border-bottom-color: var(--ffsa-navy); }
.ffsa-res .ffsa-event__top { font-family: "Roboto", sans-serif !important; font-weight: 400 !important; letter-spacing: 0 !important; display: flex; text-align: left; align-items: center; justify-content: space-between; gap: 8px; width: 100%; font-size: 14px; line-height: 1.2; opacity: .85; }
.ffsa-res .ffsa-event__name { display: block; font-family: var(--ffsa-cond) !important; font-size: 19px !important; font-weight: 700 !important; line-height: 1.05 !important; letter-spacing: 0 !important; text-transform: uppercase !important; text-align: left; overflow-wrap: normal; word-break: normal; hyphens: none; }

.ffsa-flag { display: inline-flex; flex: none; width: 21px; height: 14px; border: 1px solid rgba(0,0,0,.12); }
.ffsa-flag i { flex: 1; }
.ffsa-flag--h { flex-direction: column; }
.ffsa-flag--txt { width: auto; height: auto; border: 0; font-size: 12px; font-weight: 700; }

.ffsa-tabs--sessions { margin-bottom: 18px; }

/* ---------- Panneau + tableau ---------- */
/* Les règles sont en !important pour passer devant les styles propres à chaque tableau Ninja Tables */
.ffsa-table { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--ffsa-line); background: #FFFFFF; }
.ffsa-res .ffsa-table .ninja_table_wrapper,
.ffsa-res .ffsa-table .footable_parent { margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; }
.ffsa-res .ffsa-table table {
	width: 100% !important; margin: 0 !important; table-layout: fixed !important;
	border: 0 !important; border-collapse: collapse !important; border-spacing: 0 !important;
	background: #FFFFFF !important; box-shadow: none !important;
	font-family: "Roboto", sans-serif !important; font-size: 16px !important; color: var(--ffsa-text) !important;
}
.ffsa-res .ffsa-table colgroup col { width: auto !important; }

/* En-tête */
.ffsa-res .ffsa-table thead tr,
.ffsa-res .ffsa-table thead th { background: #F6F8FA !important; }
.ffsa-res .ffsa-table thead th {
	height: 46px !important; padding: 0 20px !important;
	color: var(--ffsa-muted) !important;
	border: 0 !important; border-bottom: 2px solid var(--ffsa-blue) !important;
	font-family: var(--ffsa-cond) !important; font-size: 15px !important; font-weight: 600 !important; font-style: normal !important;
	letter-spacing: .02em !important; text-transform: uppercase !important; line-height: 1 !important;
	text-align: left !important; vertical-align: middle !important; white-space: nowrap !important;
	overflow: hidden; text-overflow: ellipsis;
}

/* Largeur des colonnes : Pos. | N° | Pilote | Nat. | Temps | Pts */
.ffsa-res .ffsa-table thead th:nth-child(1) { width: 84px !important; }
.ffsa-res .ffsa-table thead th:nth-child(2) { width: 84px !important; }
.ffsa-res .ffsa-table thead th:nth-child(3) { width: auto !important; }
.ffsa-res .ffsa-table thead th:nth-child(4) { width: 96px !important; }
.ffsa-res .ffsa-table thead th:nth-child(5) { width: 150px !important; }
.ffsa-res .ffsa-table thead th:nth-child(6) { width: 84px !important; }

/* Lignes */
.ffsa-res .ffsa-table tbody tr { background: #FFFFFF !important; border: 0 !important; }
.ffsa-res .ffsa-table tbody tr:nth-child(even) { background: #FAFBFC !important; }
.ffsa-res .ffsa-table tbody tr:hover { background: #F4F7FB !important; }
.ffsa-res .ffsa-table tbody td {
	height: 44px !important; padding: 0 20px !important;
	border: 0 !important; border-bottom: 1px solid #ECEFF3 !important;
	background: transparent !important; color: var(--ffsa-text) !important;
	font-family: "Roboto", sans-serif !important; font-size: 16px !important; font-weight: 400 !important; font-style: normal !important;
	line-height: 1.25 !important; text-align: left !important; vertical-align: middle !important;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ffsa-res .ffsa-table tbody tr:last-child td { border-bottom: 0 !important; }

/* Pos. : chiffre italique, top 3 en bleu */
.ffsa-res .ffsa-table tbody td:nth-child(1) {
	font-family: var(--ffsa-cond) !important; font-size: 19px !important; font-weight: 700 !important; font-style: italic !important;
}
.ffsa-res .ffsa-table tbody tr:nth-child(-n+3) td:nth-child(1) { color: var(--ffsa-blue-dark) !important; }
/* N° : gris, précédé de # */
.ffsa-res .ffsa-table tbody td:nth-child(2) { color: var(--ffsa-muted) !important; }
.ffsa-res .ffsa-table tbody td:nth-child(2):not(:empty)::before { content: "#"; }
/* Pilote */
.ffsa-res .ffsa-table tbody td:nth-child(3) { font-weight: 500 !important; }
/* Nat. : drapeau */
.ffsa-res .ffsa-table .azc_flags { display: block !important; width: 22px !important; height: auto !important; margin: 0 !important; border: 1px solid rgba(0,0,0,.08) !important; box-shadow: none !important; }
/* Nat. : drapeau + code pays */
.ffsa-res .ffsa-nat { display: inline-flex; align-items: center; gap: 8px; }
.ffsa-res .ffsa-nat img { display: block !important; width: 22px !important; height: 15px !important; object-fit: cover; margin: 0 !important; border: 1px solid rgba(0,0,0,.08) !important; box-shadow: none !important; }
.ffsa-res .ffsa-nat b { font-family: "Roboto", sans-serif; font-size: 13px; font-weight: 700; color: var(--ffsa-muted); letter-spacing: .02em; }
.ffsa-res .ffsa-sub .ffsa-nat { gap: 5px; }
.ffsa-res .ffsa-sub .ffsa-nat img { width: 16px !important; height: 11px !important; }
.ffsa-res .ffsa-sub .ffsa-nat b { font-size: 12px; font-weight: 400; }
/* Temps et points à droite */
.ffsa-res .ffsa-table th:nth-child(n+5),
.ffsa-res .ffsa-table td:nth-child(n+5) { text-align: right !important; font-variant-numeric: tabular-nums; }
.ffsa-res .ffsa-table tbody td:nth-child(6) { font-weight: 700 !important; }
/* Classement (5 colonnes, la dernière = points) */
.ffsa-classement .ffsa-table tbody td:nth-child(5) { font-weight: 700 !important; }

/* Certains tableaux Ninja Tables ont leurs propres couleurs (règles par #id en !important).
   Le :not(#ffsa-x) donne à nos règles une priorité supérieure. */
.ffsa-res .ffsa-table thead tr:not(#ffsa-x):not(#ffsa-y),
.ffsa-res .ffsa-table thead tr:not(#ffsa-x):not(#ffsa-y) th:not(#ffsa-x) {
	background: #F6F8FA !important; color: var(--ffsa-muted) !important;
	border: 0 !important; border-bottom: 2px solid var(--ffsa-blue) !important;
}
.ffsa-res .ffsa-table tbody tr:not(#ffsa-x):not(#ffsa-y) { background: #FFFFFF !important; }
.ffsa-res .ffsa-table tbody tr:nth-child(even):not(#ffsa-x):not(#ffsa-y) { background: #FAFBFC !important; }
.ffsa-res .ffsa-table tbody tr:not(#ffsa-x):not(#ffsa-y) td:not(#ffsa-x) {
	background: transparent !important; color: var(--ffsa-text) !important;
	border: 0 !important; border-bottom: 1px solid #ECEFF3 !important;
}
.ffsa-res .ffsa-table tbody tr:not(#ffsa-x):not(#ffsa-y) td:nth-child(2):not(#ffsa-x) { color: var(--ffsa-muted) !important; }
.ffsa-res .ffsa-table tbody tr:nth-child(-n+3):not(#ffsa-x):not(#ffsa-y) td:nth-child(1):not(#ffsa-x) { color: var(--ffsa-blue-dark) !important; }

/* Lien « Edit Table » visible quand on est connecté */
.ffsa-res .ffsa-table a[href*="ninja_tables"],
.ffsa-res .ffsa-table .ninja_table_edit_button,
.ffsa-res .ffsa-table .nt_edit_link { display: none !important; }

/* Masque la pagination et la recherche Ninja Tables dans nos panneaux */
/* (on vise les lignes, pas le <table> : FooTable met aussi « footable-filtering » sur le tableau) */
.ffsa-res .ffsa-table tr.footable-paging,
.ffsa-res .ffsa-table tr.footable-filtering,
.ffsa-res .ffsa-table .footable-paging-external,
.ffsa-res .ffsa-table .footable-filtering-external { display: none !important; }
.ffsa-res .ffsa-table table.footable { display: table !important; }

/* Top 10 + « Voir tous » */
.ffsa-panel.is-limited:not(.is-all) .ffsa-table tbody tr:nth-child(n+11) { display: none !important; }

.ffsa-panel__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding-top: 12px; }
.ffsa-res .ffsa-more {
	display: inline-flex; align-items: center; gap: 8px; height: 40px; margin: 0; padding: 0;
	border: 0; background: transparent; color: var(--ffsa-blue-dark);
	font-family: var(--ffsa-cond) !important; font-size: 17px !important; font-weight: 600 !important; letter-spacing: 0 !important; text-transform: none !important; cursor: pointer;
}
.ffsa-res .ffsa-more svg { transition: transform .2s; }
.ffsa-res .ffsa-more[aria-expanded="true"] svg { transform: rotate(180deg); }
.ffsa-res .ffsa-pdf {
	display: inline-flex; align-items: center; gap: 10px; height: 46px; margin-left: auto; padding: 0 20px;
	background: #EFF1F5; color: var(--ffsa-blue-dark) !important; text-decoration: none !important;
	font-family: var(--ffsa-cond) !important; font-size: 17px !important; font-weight: 600 !important; letter-spacing: 0 !important; text-transform: uppercase;
}
.ffsa-res .ffsa-pdf:hover { background: #E3E7ED; }

/* Épreuve sans résultats */
.ffsa-res .ffsa-empty { margin: 0; padding: 24px; background: #F6F8FA; color: var(--ffsa-muted); font-size: 16px; }

/* Ligne « #numéro · drapeau » ajoutée sous le pilote (visible en mobile) */
.ffsa-res .ffsa-sub { display: none; }

/* ---------- Tablette ---------- */

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	.ffsa-classement__bar { flex-direction: column; align-items: stretch; gap: 14px; padding: 20px 16px; }
	.ffsa-res .ffsa-classement__title, .ffsa-res .ffsa-epreuves__title { font-size: 22px !important; }
	.ffsa-tabs--classement { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 6px; }
	.ffsa-res .ffsa-tab--light { height: 52px !important; padding: 0 10px !important; justify-content: center; gap: 8px; font-size: 16px !important; line-height: 1.05 !important; text-align: center; }
	.ffsa-classement__body > .ffsa-panel { padding: 8px 16px 24px; }

	.ffsa-epreuves { padding: 28px 16px 24px; }
	.ffsa-res .ffsa-epreuves__title { margin-bottom: 16px; }
	.ffsa-events { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 16px; padding: 0 16px; scroll-padding: 0 16px; }
	.ffsa-events::-webkit-scrollbar { display: none; }
	.ffsa-res .ffsa-event { flex: 0 0 150px; min-height: 84px; padding: 12px 14px; }
	.ffsa-event__top { font-size: 12px; }
	.ffsa-res .ffsa-event__name { font-size: 18px !important; }

	/* Sessions sur 2 lignes : 2 boutons en haut, 3 en bas */
	.ffsa-tabs--sessions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
	.ffsa-tabs--sessions > .ffsa-tab { grid-column: span 2; }
	.ffsa-tabs--sessions > .ffsa-tab:nth-child(-n+2) { grid-column: span 3; }
	.ffsa-tabs--sessions[data-count="1"] > .ffsa-tab { grid-column: span 6; }
	.ffsa-tabs--sessions[data-count="6"] > .ffsa-tab:nth-child(n) { grid-column: span 2; padding: 0 4px !important; font-size: 15px !important; }
	.ffsa-tabs--sessions[data-count="4"] > .ffsa-tab:nth-child(n) { grid-column: span 3; }
	.ffsa-res .ffsa-tab { height: 40px !important; padding: 0 8px !important; justify-content: center; font-size: 16px !important; }

	/* Tableau compact : on masque N° et Nat., repris sous le nom du pilote */
	.ffsa-table { overflow-x: visible; }
	.ffsa-res .ffsa-table table { table-layout: auto !important; }
	.ffsa-res .ffsa-table colgroup { display: none !important; }
	.ffsa-res .ffsa-table tbody td { overflow: visible; text-overflow: clip; }
	.ffsa-res .ffsa-table th:nth-child(2), .ffsa-res .ffsa-table td:nth-child(2),
	.ffsa-res .ffsa-table th:nth-child(4), .ffsa-res .ffsa-table td:nth-child(4) { display: none !important; }
	.ffsa-res .ffsa-table thead th { height: 40px !important; padding: 0 8px !important; font-size: 12px !important; letter-spacing: .02em !important; width: auto !important; }
	.ffsa-res .ffsa-table thead th:nth-child(1) { width: 52px !important; padding-left: 12px !important; text-overflow: clip; }
	.ffsa-res .ffsa-table thead th:nth-child(5) { width: 80px !important; }
	.ffsa-res .ffsa-table thead th:nth-child(6) { width: 40px !important; }
	.ffsa-res .ffsa-table tbody td { height: 52px !important; padding: 6px 8px !important; font-size: 14px !important; white-space: normal; }
	.ffsa-res .ffsa-table tbody td:nth-child(1) { padding-left: 12px !important; }
	.ffsa-res .ffsa-table tbody td:nth-child(3) { font-size: 15px !important; white-space: normal; }
	.ffsa-classement .ffsa-table thead th:nth-child(5) { width: 56px !important; }
	.ffsa-res .ffsa-table td:last-child { padding-right: 12px !important; }
	.ffsa-res .ffsa-sub { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--ffsa-muted); }
	.ffsa-res .ffsa-sub img { width: 16px; height: auto; }

	.ffsa-panel__foot { gap: 12px; flex-wrap: nowrap; }
	.ffsa-res .ffsa-pdf__name { display: none; }
	.ffsa-res .ffsa-more { text-align: left; line-height: 1.2 !important; }
	.ffsa-res .ffsa-pdf { flex: none; }
	.ffsa-res .ffsa-more { font-size: 16px; }
	.ffsa-res .ffsa-pdf { height: 44px; padding: 0 14px; font-size: 15px; }
	.ffsa-classement .ffsa-pdf { flex: 1; justify-content: center; }
}
