/**
 * Classement Poker — page « Statistiques » (préfixe .apist).
 * Bootstrap 3 est chargé sur les pages du plugin : tailles en px et
 * remises à zéro locales.
 */

.apist {
	--surface: #fcfcfb;
	--ink: #0b0b0b;
	--ink-2: #52514e;
	--muted: #898781;
	--grid: #e1e0d9;
	--axis: #c3c2b7;
	--border: rgba(11, 11, 11, 0.1);
	--accent: #2a78d6;
	--gold: #c99a2e;
	color: var(--ink);
	font-size: 13px;
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
	max-width: 1600px;
}
.apist *, .apist-tip * { box-sizing: border-box; }
.apist h1, .apist h2, .apist h3, .apist h4 { font-family: inherit; line-height: 1.3; }
.apist label { margin: 0; font-weight: 400; }

/* En-tête : même présentation que les autres pages du plugin */
.apist .apist-title { margin: 0 0 12px; padding: 6px 0 14px; border-bottom: 1px solid #ccc; font-size: 28px; font-weight: 700; }
.apist-intro { margin: 0 0 16px; color: #555; font-size: 13.5px; line-height: 1.5; }

.apist-status { padding: 40px; text-align: center; color: var(--ink-2); }
.apist-status.is-error { color: #a12622; }

/* Filtres */
.apist-filterbox { background: #fff; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; }
.apist-filterbox > summary { display: flex; align-items: center; gap: 14px; padding: 11px 16px; cursor: pointer; }
.apist-summary { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.apist-filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 4px 16px 14px; }
.apist .apist-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.apist-field > span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2); }
.apist input[type="date"], .apist input[type="search"], .apist input[type="number"], .apist select {
	height: 32px; min-height: 32px; margin: 0; font-size: 13px; line-height: 1.4; border: 1px solid #c3c4c7; border-radius: 6px; background-color: #fff;
}
.apist select { max-width: 280px; padding-right: 26px; }
.apist input.apist-num { width: 90px; }
.apist input.apist-picker { width: 270px; max-width: 100%; }
.apist .apist-check { display: inline-flex; align-items: center; gap: 6px; height: 32px; }
.apist .apist-check input { margin: 0; }
.apist .button { margin: 0; }

.apist-multi { position: relative; }
.apist-multi > summary {
	display: flex; align-items: center; justify-content: space-between; gap: 8px; list-style: none; cursor: pointer;
	height: 32px; min-width: 130px; max-width: 240px; padding: 0 10px; border: 1px solid #c3c4c7; border-radius: 6px; background: #fff;
}
.apist-multi > summary span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.apist-multi > summary::-webkit-details-marker { display: none; }
.apist-multi > summary::after { content: "▾"; color: var(--muted); }
.apist-multi.is-set > summary { border-color: var(--accent); background: #eef5fd; }
.apist-multi-list {
	position: absolute; z-index: 50; top: 36px; left: 0; min-width: 100%; max-width: 360px; width: max-content; max-height: 320px; overflow: auto;
	background: #fff; border: 1px solid #c3c4c7; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); padding: 6px;
}
.apist .apist-multi-list label { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 4px; cursor: pointer; }
.apist .apist-multi-list label:hover { background: #f3f2ef; }
.apist .apist-multi-list input { margin: 0; }

/* Onglets */
.apist-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--grid); margin-bottom: 16px; }
.apist-tabs button {
	background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: 10px 16px;
	font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.apist-tabs button:hover { color: var(--ink); }
.apist-tabs button.is-active { color: var(--ink); border-bottom-color: var(--accent); }

/* Tuiles et cartes */
.apist-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.apist-kpi { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.apist-kpi-label { font-size: 12px; color: var(--ink-2); }
.apist-kpi-value { font-size: 24px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.apist-kpi-value .apist-link { font-size: 18px; font-weight: 600; }
.apist-kpi-note { font-size: 11.5px; color: var(--muted); }

.apist-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; min-width: 0; }
.apist .apist-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 650; }
.apist .apist-card h4 { margin: 16px 0 8px; font-size: 13px; font-weight: 600; }
.apist-sub { margin: 0 0 10px; color: var(--ink-2); font-size: 12px; }
.apist-grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 14px; margin-bottom: 14px; }
.apist-grid-cards.is-tops { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.apist-grid-cards > .apist-card { margin: 0; }
.apist-subfilters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 14px; }
.apist-subfilters .apist-sub { margin: 0 0 7px; }
.apist-empty { padding: 22px; text-align: center; color: var(--muted); }

/* Graphiques */
.apist-plot { width: 100%; min-height: 40px; overflow: hidden; }
.apist-plot svg { display: block; font-family: inherit; }
.apist-grid { stroke: var(--grid); stroke-width: 1; }
.apist-plot line.apist-grid { display: inline; }
.apist-axis, .apist-cross { stroke: var(--axis); stroke-width: 1; }
.apist-cross { stroke: var(--muted); pointer-events: none; }
.apist-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.apist-axisname, .apist-endlabel { fill: var(--ink-2); font-size: 11.5px; }
.apist-endlabel { font-weight: 600; }
.apist-ring { stroke: var(--surface); stroke-width: 2; }
.apist-halo { fill: none; stroke: var(--ink); stroke-width: 1.5; pointer-events: none; }
.apist-hit { fill: transparent; }
rect.apist-hit:hover, rect.apist-hit:focus-visible { outline: none; }
.apist-plot rect.apist-hit:focus-visible { stroke: var(--accent); stroke-width: 1.5; }

.apist-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 8px; color: var(--ink-2); font-size: 12px; }
.apist-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.apist-legend-key { width: 11px; height: 11px; border-radius: 3px; }
.apist-legend-key.is-line { width: 16px; height: 3px; border-radius: 2px; }

.apist-tip {
	position: fixed; z-index: 100000; display: none; pointer-events: none; max-width: 300px; padding: 8px 11px;
	background: #fff; color: #0b0b0b; border: 1px solid rgba(11, 11, 11, 0.14); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16); font-size: 12px;
}
.apist-tip-title { color: #52514e; margin-bottom: 3px; }
.apist-tip-row { color: #52514e; }
.apist-tip-row strong { color: #0b0b0b; }
.apist-tip-key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.apist-bars { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.apist-bar-row { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; align-items: center; gap: 10px; }
.apist .apist-bar-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
.apist-bar-track { height: 14px; }
.apist-bar-fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.apist-bar-value { font-variant-numeric: tabular-nums; text-align: right; min-width: 40px; }

.apist-heat { display: grid; grid-template-columns: 46px repeat(12, minmax(34px, 1fr)) 56px; gap: 2px; min-width: 560px; }
.apist-heat-head { font-size: 11px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.apist-heat-year, .apist-heat-total { font-size: 12px; color: var(--ink-2); align-self: center; font-variant-numeric: tabular-nums; }
.apist-heat-total { text-align: right; font-weight: 600; }
.apist-heat-cell { height: 28px; border-radius: 4px; background: #f0efec; font-size: 11px; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }

.apist-seg { display: flex; gap: 2px; height: 28px; margin: 8px 0; }
.apist-seg-part { display: flex; align-items: center; padding-left: 7px; min-width: 3px; flex-basis: 0; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Tableaux */
.apist-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.apist-tools .apist-export { margin-left: auto; }
.apist-scroll { overflow-x: auto; max-width: 100%; }
.apist-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 12.5px; }
.apist-table th, .apist-table td { padding: 7px 10px; border-bottom: 1px solid #eceae4; text-align: left; white-space: nowrap; }
.apist-table th { background: #f6f5f1; color: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.apist-table th button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.apist-table th button:hover { color: var(--ink); }
.apist-table th[aria-sort] { color: var(--ink); background: #ecebe4; }
.apist-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.apist-table tbody tr:hover { background: #f4f8fd; }
.apist-table tbody tr.is-win { background: #fdf5df; }
.apist-table tbody tr.is-podium { background: #fbfaf4; }
#apist .apist-table td:first-child, #apist .apist-table th:first-child { position: sticky; left: 0; background-color: inherit; }
#apist .apist-table td:first-child { background: #fff; }
#apist .apist-table th:first-child { background: #f6f5f1; z-index: 1; }
#apist .apist-table tr.is-win td:first-child { background: #fdf5df; }
#apist .apist-table tr.is-podium td:first-child { background: #fbfaf4; }
.apist-table td.apist-empty { text-align: center; }
.apist-table .apist-winners { display: inline-block; max-width: 420px; white-space: normal; }
.apist-compare td.is-best { font-weight: 700; }
.apist-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.apist-pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 10px; color: var(--ink-2); }

.apist .apist-link { background: none; border: 0; padding: 0; margin: 0; color: #1c5cab; cursor: pointer; font-size: inherit; font-family: inherit; text-align: left; }
.apist .apist-link:hover { text-decoration: underline; }

/* Fiche joueur */
.apist-identity { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.apist-avatar {
	width: 54px; height: 54px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
	background: #eceae4; color: var(--ink-2); font-size: 22px; font-weight: 700;
}
.apist .apist-identity h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.apist-badge { display: inline-block; padding: 2px 9px; margin-right: 6px; border-radius: 20px; background: #eceae4; color: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.apist-badge.is-live { background: #e2f3e2; color: #006300; }

/* Hall of Fame */
.apist-champions { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 12px; margin-top: 8px; }
.apist-champion { background: #fff; border: 1px solid var(--border); border-top: 4px solid var(--gold); border-radius: 10px; padding: 12px 14px; }
.apist-champion-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.apist-champion-head .apist-badge { margin: 0; }
.apist .apist-champion ol { list-style: none; margin: 0; padding: 0; }
.apist-champion li { display: flex; align-items: center; gap: 8px; margin: 0; padding: 5px 6px; border-radius: 6px; }
.apist-champion li.rank-1 { background: #fdf5df; font-size: 15px; font-weight: 650; }
.apist-champion-points { margin-left: auto; color: var(--ink-2); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.apist-medal { font-size: 16px; }
.apist-section { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px; margin: 24px 0 12px; }
.apist .apist-section h2 { margin: 0; font-size: 20px; font-weight: 700; }
.apist .apist-record ol { list-style: none; margin: 6px 0 0; padding: 0; }
.apist-record li { display: flex; align-items: center; gap: 10px; margin: 0; padding: 6px 0; border-top: 1px solid #eceae4; }
.apist-record-rank { width: 22px; height: 22px; flex: none; border-radius: 50%; background: #eceae4; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.apist-record li.is-first .apist-record-rank { background: var(--gold); color: #0b0b0b; }
.apist-record li.is-first .apist-record-name, .apist-record li.is-first .apist-record-value { font-weight: 700; }
.apist-record-name { display: flex; flex-direction: column; min-width: 0; }
.apist-record-name small { color: var(--muted); font-weight: 400; font-size: 11px; }
.apist-record-value { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }

.apist-round-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 0 18px; }
.apist-round-tables > div { overflow-x: auto; }

@media (max-width: 782px) {
	.apist-filters .apist-field { flex: 1 1 140px; }
	.apist select, .apist-multi > summary { max-width: 100%; width: 100%; }
	.apist-tabs button { padding: 8px 10px; font-size: 13px; }
	.apist-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.apist-kpi-value { font-size: 20px; }
}
