/* =====================================================================================
   Habillage « nuit étoilée » de l'application (jk.php), dans l'esprit de la home.
   Chargé en dernier par head.php : il prime sur socle.css, jk.css, grid.css et components.css.
   Les anciennes feuilles posent beaucoup de !important : on en utilise ici aussi quand il faut les battre.
   ===================================================================================== */

:root {
	--jk-night: #0c1238;
	--jk-night-2: #2b1d6e;
	--jk-on-night: #f3f5ff;
	--jk-on-night-2: #b9c0e8;
	--jk-accent: #1f7ae0;
	--jk-accent-hover: #155fb3;
	--jk-accent-soft: rgba(31, 122, 224, .12);
	--jk-orange: #f08a12;
	--jk-green: #2e9d5b;
	--jk-red: #d63b3b;
	--jk-yellow: #e0aa00;
	--jk-purple: #6b55c9;
	--jk-bg: #f3f5fa;
	--jk-surface: #ffffff;
	--jk-fg: #1a2033;
	--jk-fg-2: #5b6380;
	--jk-line: #dde2ee;
	--jk-chip: #e9edf7;
	--jk-radius: 14px;
	--jk-font-display: "Exo 2", "Trebuchet MS", system-ui, sans-serif;
	--jk-font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------- Base ---------- */
html, body { height: auto !important; }
body {
	background: var(--jk-bg) !important;
	color: var(--jk-fg) !important;
	font: 15px/1.45 var(--jk-font-body) !important;
	overflow-x: hidden;
}
body > canvas { display: none !important; } /* ancien fond Trianglify */
a { color: var(--jk-accent); }
:focus-visible { outline: 3px solid var(--jk-accent); outline-offset: 2px; }

.jk-app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Bandeau ---------- */
.jk-top {
	position: relative;
	color: var(--jk-on-night);
	/* Même image que le bandeau de la home (home/img/slide-01.jpg), assombrie pour la lisibilité du texte */
	background:
		url("../../home/img/slide-01.jpg") center / cover no-repeat,
		var(--jk-night);
	background-position: top -125px left -120px;
	background-size: 110%;
	background-position: top -350px left 0px;
	background-size: 100%;
	z-index: 20;
}
.jk-top-bar, .jk-top-title {
	max-width: 1240px;
	margin: 0 auto;
	padding-left: max(16px, env(safe-area-inset-left, 0px));
	padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.jk-top-bar { display: flex; align-items: center; gap: 16px; min-height: 64px; }

.jk-brand { display: inline-flex; align-items: center; gap: 10px; flex: none; text-decoration: none; color: var(--jk-on-night) !important; }
.jk-brand img { width: 38px; height: 38px; object-fit: contain; }
.jk-brand span { font: 800 19px/1 var(--jk-font-display); letter-spacing: .01em; }
.jk-brand b { color: var(--jk-orange); font-weight: 800; }

#slidebar.jk-nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; background: transparent !important; }
.jk-nav-link {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 8px 10px; border-radius: 8px;
	color: var(--jk-on-night-2) !important; text-decoration: none !important;
	font: 600 15px/1.2 var(--jk-font-body); white-space: nowrap;
	transition: background .15s, color .15s;
}
.jk-nav-link .material-icons { font-size: 19px; display: none; } /* icônes visibles seulement dans le menu mobile */
.jk-nav-link:hover { color: var(--jk-on-night) !important; background: rgba(255, 255, 255, .08); }
.jk-nav-link.is-active { color: var(--jk-on-night) !important; background: rgba(255, 255, 255, .12); box-shadow: inset 0 -2px 0 var(--jk-orange); }
/* Liens réduits à une icône (Accueil, Aide) : libellé dans title / aria-label */
.jk-nav-link.jk-nav-icon { width: 40px; height: 40px; padding: 0; justify-content: center; }
.jk-nav-link.jk-nav-icon .material-icons { display: inline-block; font-size: 22px; line-height: 1 !important; }
.jk-nav-sep { width: 1px; height: 22px; margin: 0 6px; background: rgba(255, 255, 255, .18); }
.jk-nav-new { margin-left: 6px; color: #fff !important; background: var(--jk-accent); }
.jk-nav-new:hover { background: var(--jk-accent-hover); }

.jk-burger {
	display: none; margin-left: auto; width: 42px; height: 42px; border: 0; border-radius: 10px;
	background: rgba(255, 255, 255, .1); color: var(--jk-on-night); cursor: pointer;
}

/* Compte (login_panel.php) : bouton avatar + menu déroulant, ou bouton de connexion */
#login_panel { flex: none; margin-left: 8px; display: flex; align-items: center; padding: 0 !important; position: relative; }
.jk-account { position: relative; }
.jk-account-btn, .jk-account-login {
	display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 4px; margin: 0;
	border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; background: rgba(255, 255, 255, .1);
	color: var(--jk-on-night); font: 600 14px/1 var(--jk-font-body); cursor: pointer; transition: background .15s, border-color .15s;
}
.jk-account-btn:hover, .jk-account-login:hover, .jk-account-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .3); }
.jk-account-login { padding: 0 14px 0 8px; }
.jk-account-login .material-icons { font-size: 24px; }
.jk-account-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #dfe5f5; flex: none; }
.jk-account-avatar.is-large { width: 44px; height: 44px; }
.jk-account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jk-account-caret { font-size: 20px !important; opacity: .8; transition: transform .15s; }
.jk-account-btn[aria-expanded="true"] .jk-account-caret { transform: rotate(180deg); }

.jk-account-menu {
	position: absolute; top: calc(100% + 10px); right: 0; z-index: 40; width: 270px; padding: 6px;
	background: var(--jk-surface); color: var(--jk-fg); border: 1px solid var(--jk-line); border-radius: 14px;
	box-shadow: 0 18px 40px rgba(5, 8, 30, .28); animation: jk-menu-in .14s ease-out;
}
.jk-account-menu[hidden] { display: none; }
@keyframes jk-menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.jk-account-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--jk-line); }
.jk-account-head > div { display: grid; gap: 2px; min-width: 0; }
.jk-account-head b { font: 700 16px/1.2 var(--jk-font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jk-account-head span { font-size: 13px; color: var(--jk-fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jk-account-menu a[role="menuitem"] {
	display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 10px;
	color: var(--jk-fg) !important; text-decoration: none !important; font: 600 15px/1.2 var(--jk-font-body);
}
.jk-account-menu a[role="menuitem"] .material-icons { font-size: 20px; color: var(--jk-fg-2) !important; }
.jk-account-menu a[role="menuitem"]:hover, .jk-account-menu a[role="menuitem"]:focus-visible { background: var(--jk-accent-soft); outline: none; }
.jk-account-menu a[role="menuitem"]:hover .material-icons { color: var(--jk-accent) !important; }
.jk-account-menu a.is-danger, .jk-account-menu a.is-danger .material-icons { color: var(--jk-red) !important; }
.jk-account-menu a.is-danger:hover { background: rgba(214, 59, 59, .1); }
.jk-account-sep { height: 1px; margin: 4px 6px; background: var(--jk-line); }
/* Une ancienne règle donne 50 px de hauteur de ligne aux icônes du bandeau : on la neutralise dans le bloc du compte */
#login_panel .material-icons { line-height: 1 !important; height: auto !important; width: auto !important; }

/* Titre de la compétition */
.jk-top-title { padding-top: 18px; padding-bottom: 30px; display: grid; gap: 4px; }
.jk-top-title.has-disc { grid-template-columns: auto minmax(0, 1fr); column-gap: 18px; align-items: center; }
.jk-top-title.has-disc .jk-top-disc { grid-row: span 2; }
.jk-top-title.has-disc .jk-eyebrow { align-self: end; }
.jk-top-title.has-disc #logo { align-self: start; }
.jk-top-disc {
	width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
	background: radial-gradient(circle at 30% 25%, #ffffff, #dfe5f5); box-shadow: 0 0 0 4px rgba(255, 255, 255, .14), 0 10px 30px rgba(5, 8, 30, .45);
}
.jk-top-disc img { width: 58%; height: auto; }
.jk-top-disc.has-logo img { width: 100%; height: 100%; object-fit: cover; }
/* Logo par défaut (icône du sport) : fond blanc translucide, dessin agrandi et centré (Wrapper::discIconStyle) */
.jk-top-disc.is-default {
	position: relative;
	background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .78), rgba(214, 222, 246, .42) 70%, rgba(190, 200, 235, .3));
	-webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
	border: 1px solid rgba(255, 255, 255, .35);
}
.jk-top-disc.is-default img { width: 72%; }
.jk-top-disc.is-default img.is-placed { position: absolute; height: auto; max-width: none; filter: drop-shadow(0 2px 3px rgba(5, 8, 30, .25)); }
@media (max-width: 480px) { .jk-top-disc { width: 56px; height: 56px; } }

/* Compétition sélectionnée : pastille + nom dans la barre du haut, à la place de la marque (bandeau sur deux lignes) */
.jk-top-title.is-inline {
	flex: 1; min-width: 0; max-width: none; margin: 0; padding: 10px 0 !important;
	grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; row-gap: 2px;
}
.jk-top-title.is-inline .jk-top-disc { width: 52px; height: 52px; box-shadow: 0 0 0 3px rgba(255, 255, 255, .14), 0 6px 18px rgba(5, 8, 30, .4); }
.jk-top-title.is-inline .jk-eyebrow { font-size: 11px; }
a.jk-top-title.is-inline { color: inherit !important; text-decoration: none !important; cursor: pointer; border-radius: 12px; }
a.jk-top-title.is-inline .jk-top-disc { transition: transform .2s ease, box-shadow .2s ease; }
a.jk-top-title.is-inline:hover .jk-top-disc { transform: scale(1.06); box-shadow: 0 0 0 3px rgba(255, 255, 255, .3), 0 6px 18px rgba(5, 8, 30, .4); }
a.jk-top-title.is-inline:focus-visible { outline: 2px solid rgba(255, 255, 255, .7); outline-offset: 4px; }
.jk-top-title.is-inline #logo {
	font-size: clamp(20px, 2.6vw, 30px) !important; line-height: 1.1 !important;
	white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis;
}
@media (max-width: 600px) {
	.jk-top-title.is-inline { column-gap: 10px; }
	.jk-top-title.is-inline .jk-top-disc { width: 40px; height: 40px; grid-row: auto; }
	.jk-top-title.is-inline .jk-eyebrow { display: none; }
	.jk-top-title.is-inline #logo { font-size: 18px !important; }
	.jk-top-bar { gap: 8px; }
	.jk-account-caret { display: none !important; } /* plus de place pour le nom de la compétition */
}
.jk-eyebrow { font: 700 12px/1.2 var(--jk-font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--jk-orange); }
.jk-top-title #logo {
	display: block; width: auto !important; height: auto !important; overflow: visible !important; float: none !important;
	color: var(--jk-on-night) !important; font-size: clamp(26px, 4.2vw, 42px) !important; line-height: 1.1 !important;
	white-space: normal !important; text-wrap: balance; margin: 0 !important; padding: 0 !important;
}
.jk-top-title span#logo:not([class*="logo"]) { font-family: var(--jk-font-display) !important; font-weight: 800; }

/* Pages générales (Annuaire, Créer une compétition, Aide, Mon profil) ouvertes depuis une compétition : même bandeau que hors
   compétition (logo du site, titre de la page en grand) ; pastille, nom et onglets de la compétition masqués.
   data-section = action de navigation (setNavActive). Le titre est rempli par majTitrePage (jk.js). */
.jk-brand.is-general-only, .jk-top-title-general { display: none !important; }
body:is([data-section="leagues"], [data-section="new_league"], [data-section="help"], [data-section="myprofile"], [data-section="updprofile"], [data-section="password"]) .jk-brand.is-general-only { display: inline-flex !important; }
body:is([data-section="leagues"], [data-section="new_league"], [data-section="help"], [data-section="myprofile"], [data-section="updprofile"], [data-section="password"]) .jk-top-title-general { display: grid !important; }
body:is([data-section="leagues"], [data-section="new_league"], [data-section="help"], [data-section="myprofile"], [data-section="updprofile"], [data-section="password"]) .jk-top-title.is-inline, body:is([data-section="leagues"], [data-section="new_league"], [data-section="help"], [data-section="myprofile"], [data-section="updprofile"], [data-section="password"]) .jk-champ-nav { display: none !important; }
.jk-top .jk-top-title-general { padding-bottom: 30px; } /* même hauteur que hors compétition */
.jk-nav-back { display: none !important; }
body:is([data-section="leagues"], [data-section="new_league"], [data-section="help"], [data-section="myprofile"], [data-section="updprofile"], [data-section="password"]) .jk-nav-back { display: inline-flex !important; }
.jk-nav-back { box-sizing: border-box; height: 36px; align-self: center; padding-top: 0 !important; padding-bottom: 0 !important; margin-left: 6px; border: 1px solid rgba(255, 255, 255, .3); color: var(--jk-on-night) !important; max-width: 260px; }
.jk-nav-back:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .5); }
.jk-nav-back .material-icons { display: inline-block !important; font-size: 18px; }
.jk-nav-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .jk-nav-back span { display: none; } .jk-nav-back { margin-left: 0; } }
.jk-titre-general { color: var(--jk-on-night); font: 800 clamp(26px, 4.2vw, 42px)/1.1 var(--jk-font-display); text-wrap: balance; }

/* ---------- Contenu ---------- */
#main-content { flex: 1; position: static !important; overflow: visible !important; width: auto !important; padding-block: 24px 64px; }
#main {
	max-width: 1240px; margin: 0 auto !important; padding: 0 max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px)) !important;
	background: none !important;
}

/* ---------- Pastilles et couleurs historiques (.button + classes de couleur globales) ---------- */
.button {
	font: 700 13px/1.2 var(--jk-font-body) !important;
	border-radius: 999px !important;
	padding: 4px 10px !important;
	text-shadow: none !important;
	box-shadow: none !important;
	font-variant-numeric: tabular-nums;
}
.blue, .dashcounter .puceinfo:before   { color: #fff !important; border-color: var(--jk-accent) !important; background: var(--jk-accent) !important; }
.blue:hover                            { background: var(--jk-accent-hover) !important; }
.green                                 { color: #fff !important; border-color: var(--jk-green) !important; background: var(--jk-green) !important; }
.orange                                { color: #fff !important; border-color: var(--jk-orange) !important; background: var(--jk-orange) !important; }
.red, .dashcounter .pucelock:before    { color: #fff !important; border-color: var(--jk-red) !important; background: var(--jk-red) !important; }
.yellow                                { color: #3d2e00 !important; border-color: var(--jk-yellow) !important; background: var(--jk-yellow) !important; }
.purple                                { color: #fff !important; border-color: var(--jk-purple) !important; background: var(--jk-purple) !important; }
.gray                                  { color: var(--jk-fg-2) !important; border-color: var(--jk-chip) !important; background: var(--jk-chip) !important; }
.black                                 { color: #fff !important; border-color: var(--jk-fg) !important; background: var(--jk-fg) !important; }
.white                                 { color: var(--jk-fg) !important; border-color: var(--jk-line) !important; background: var(--jk-surface) !important; }
.disable                               { color: var(--jk-fg-2) !important; border-color: var(--jk-line) !important; background: var(--jk-bg) !important; }
.blue:active, .green:active, .orange:active, .red:active, .gray:active { filter: brightness(.95); }

/* ---------- Tableaux (grid.php, classements, statistiques) ---------- */
.jkgrid, .jkgrid2 { width: 100%; border-collapse: collapse; font-family: var(--jk-font-body) !important; }
.jkgrid th, .jkgrid2 th {
	background: transparent !important; color: var(--jk-fg-2) !important;
	font: 700 12px/1.2 var(--jk-font-body) !important; letter-spacing: .06em; text-transform: uppercase;
	border-bottom: 1px solid var(--jk-line) !important; padding-top: 10px !important; padding-bottom: 10px !important;
}
.jkgrid th a, .jkgrid2 th a { color: var(--jk-fg-2) !important; }
#main th div, #main th span { background: transparent !important; color: inherit; }
.jkgrid td, .jkgrid2 td { font-weight: 600 !important; color: var(--jk-fg); }
.jkgrid tbody tr td, .jkgrid2 tbody tr td { border-top: 0 !important; border-bottom: 1px solid var(--jk-line) !important; }
.jkgrid tbody tr:last-child td, .jkgrid2 tbody tr:last-child td { border-bottom: 0 !important; }
.jkgrid tbody tr:hover, .jkgrid2 tbody tr:hover { background: var(--jk-accent-soft) !important; }
.jkgrid a, .jkgrid2 a { color: var(--jk-fg) !important; }
.jkgrid small, .jkgrid2 small { color: var(--jk-orange) !important; font-weight: 600; }

#main hr { border: 0; border-top: 1px solid var(--jk-line); }

/* ---------- Messages ($cMsg / $aMsg / $dMsg) ---------- */
#msgboxes { font-family: var(--jk-font-body); }

/* ---------- Pied de page ---------- */
/* Même pied de page que la home (home/css/home.css, .hm-footer) : fond nuit dans les deux thèmes */
.jk-footer { background: var(--jk-night); color: var(--jk-on-night-2); font: 400 14px/1.4 var(--jk-font-body); }
.jk-footer-in {
	max-width: 1240px; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
	padding: 18px max(16px, env(safe-area-inset-right, 0px)) 18px max(16px, env(safe-area-inset-left, 0px));
}
.jk-footer-in { align-items: center; }
.jk-footer nav { display: flex; align-items: center; gap: 20px; }
.jk-footer a { color: var(--jk-on-night-2); text-decoration: none; }
.jk-footer a:hover { color: #fff; }
.jk-footer .material-icons { font-size: 20px; vertical-align: middle; }
@media (max-width: 767px) { .jk-footer-in { flex-direction: column; text-align: center; } }

/* Navigation plus serrée quand la place manque */
@media (max-width: 1280px) and (min-width: 1101px) { .jk-nav-link { padding-inline: 7px; font-size: 14px; } }

/* ---------- Onglets de la compétition (sous son nom) ---------- */
.jk-top:has(.jk-champ-nav) .jk-top-title:not(.is-inline) { padding-bottom: 12px; }
.jk-champ-nav {
	max-width: 1240px; margin: 0 auto; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
	padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.jk-champ-nav::-webkit-scrollbar { display: none; }
.jk-champ-tab {
	flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 12px 14px 11px;
	color: var(--jk-on-night-2) !important; text-decoration: none !important; white-space: nowrap;
	font: 600 15px/1.2 var(--jk-font-body); border-bottom: 3px solid transparent; transition: color .15s, border-color .15s;
}
.jk-champ-tab .material-icons { font-size: 18px; }
.jk-champ-tab:hover { color: var(--jk-on-night) !important; border-bottom-color: rgba(255, 255, 255, .25); }
.jk-champ-tab.is-active { color: var(--jk-on-night) !important; border-bottom-color: var(--jk-orange); }
.jk-champ-share { flex: none; align-self: center; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: #25d366; color: #fff !important; text-decoration: none !important; font: 700 14px/1.2 var(--jk-font-body); white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); transition: background .15s; }
.jk-champ-share:hover { background: #1eb655; }
.jk-champ-share .material-icons { font-size: 18px; line-height: 1 !important; }
@media (max-width: 600px) { .jk-champ-share { position: sticky; right: 0; padding: 7px; margin-left: 8px; box-shadow: -10px 0 12px 2px var(--jk-night), 0 2px 8px rgba(0, 0, 0, .2); } .jk-champ-share span { display: none; } } /* toujours visible au bout des onglets qui défilent */

/* Barre du haut : il ne reste que Annuaire et Créer une compétition, plus besoin de menu repliable */
#slidebar.jk-nav { justify-content: flex-end; }
.jk-burger { display: none !important; }
@media (max-width: 600px) {
	.jk-nav-link .material-icons { display: inline-block; }
	.jk-nav-link { font-size: 0 !important; gap: 0; padding: 0; width: 40px; height: 40px; justify-content: center; align-self: center; } /* icônes seules */
	.jk-nav-new { margin-left: 4px; }
	.jk-nav-link .material-icons { font-size: 22px; }
	.jk-champ-tab { padding: 10px 10px 9px; font-size: 14px; }
}

@media (max-width: 480px) {
	.jk-brand span { display: none; }
	.jk-account-btn .jk-account-name, .jk-account-login .jk-account-name { display: none; }
	.jk-account-btn { padding-right: 4px; }
	.jk-account-login { padding: 0 8px; }
	.jk-account-menu { position: fixed; top: 64px; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); width: auto; }
	.jk-top-title { padding-bottom: 22px; }
}
@media (prefers-reduced-motion: reduce) { .jk-nav-link { transition: none; } }
