/* MyCourtAccess — composants propres à l'académie.
   Chargé APRÈS style.css : workload calendrier, indice de progression,
   heatmap d'assiduité, onglets de fiche, notation, objectifs.
   Aucune règle de style.css n'est modifiée ici. */

/* Contrôle segmenté : le code utilise la classe « sel » pour l'onglet actif,
   alors que style.css ne stylise que « .active ». On aligne « .sel » sur le
   même rendu (fond clair + ombre + gras), comme sur MyFleetAccess. */
.seg-btn.sel {
  background: var(--surface);
  color: var(--ink);
  font-weight: 620;
  box-shadow: 0 1px 4px rgba(16, 21, 32, .16);
}
[data-theme="dark"] .seg-btn.sel { box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }

/* ---- Onglets de fiche ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; }
.tab {
  appearance: none; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 550; color: var(--muted);
  padding: 10px 14px; border-radius: 10px 10px 0 0; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .2s var(--ease-spring), border-color .2s var(--ease-spring);
}
.tab:hover { color: var(--ink); background: var(--hover); }
.tab.active { color: var(--accent-deep); border-bottom-color: var(--accent); }

/* ---- Indice de progression : anneau + axes ---- */
.pi-head { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.pi-ring { display: grid; place-items: center; position: relative; width: 132px; height: 132px; flex: none; }
.pi-ring svg { transform: rotate(-90deg); width: 132px; height: 132px; }
.pi-track { fill: none; stroke: var(--surface-2); stroke-width: 11; }
.pi-arc { fill: none; stroke: var(--accent); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease-spring); }
.pi-center { position: absolute; text-align: center; line-height: 1.1; }
.pi-center strong { display: block; font-size: 34px; font-weight: 650; letter-spacing: -1px; }
.pi-center span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.pi-axes { display: grid; gap: 11px; flex: 1; min-width: 250px; }
.pi-axis { display: grid; grid-template-columns: 100px 1fr 46px; gap: 10px; align-items: center; font-size: 13px; }
.pi-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pi-bar > i { display: block; height: 100%; border-radius: 99px; background: var(--grad-accent); transition: width .8s var(--ease-spring); }
.pi-axis .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* Variation d'une période à l'autre */
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--muted); }

/* ---- Heatmap d'assiduité ---- */
.heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 3px; width: max-content; }
.heat i { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); display: block; }
.heat i[data-lvl="1"] { background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); }
.heat i[data-lvl="2"] { background: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); }
.heat i[data-lvl="3"] { background: color-mix(in srgb, var(--accent) 78%, var(--surface-2)); }
.heat i[data-lvl="4"] { background: var(--accent); }
.heat i[data-absent="1"] { background: color-mix(in srgb, var(--danger) 58%, var(--surface-2)); }
.heat-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.heat-legend i { width: 12px; height: 12px; border-radius: 3px; display: block; }

/* ---- Workload : calendrier type ClickUp ---- */
.wl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.wl-nav { display: flex; align-items: center; gap: 2px; }
.wl-period { font-weight: 600; min-width: 210px; text-align: center; text-transform: capitalize; }

.wl-scroll { overflow-x: auto; }
.wl-grid { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
/* 7 jours + une colonne de total à droite */
.wl-row { display: grid; grid-template-columns: 216px repeat(7, minmax(0, 1fr)) 92px; border-bottom: 1px solid var(--row-line); }
.wl-row:last-child { border-bottom: 0; }
.wl-row.wl-days { background: var(--surface-2); }

/* Ligne de pied : cumul par jour */
.wl-row.wl-foot { background: var(--surface-2); font-variant-numeric: tabular-nums; }
.wl-row.wl-foot .wl-day-h { font-size: 12.5px; color: var(--ink); font-weight: 600; display: flex; align-items: center; justify-content: center; }
.wl-row.wl-foot .wl-corner { font-weight: 600; color: var(--ink); }

/* Colonne de total */
.wl-total-h { border-left: 1px solid var(--line) !important; background: var(--surface-2); }
.wl-cell.wl-total {
  border-left: 1px solid var(--line);
  align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  font-variant-numeric: tabular-nums; font-size: 13px;
}

/* Cumul d'heures d'une cellule : discret, poussé en bas */
.wl-cell-h {
  margin-top: auto; align-self: flex-end;
  font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--muted); padding-top: 3px;
}
.wl-day-h { padding: 9px 8px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); border-left: 1px solid var(--row-line); }
.wl-day-h.today { color: var(--accent-deep); background: var(--accent-soft); }
.wl-day-h span { display: block; font-size: 17px; color: var(--ink); font-weight: 650; }
.wl-corner { padding: 9px 14px; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; }

.wl-coach { padding: 12px 14px; display: flex; gap: 10px; align-items: center; min-width: 0; }
.wl-coach .cli-avatar { flex: none; }
.wl-coach-meta { min-width: 0; flex: 1; }
.wl-coach-meta strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-cap { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.wl-gauge { height: 5px; border-radius: 99px; background: var(--surface-2); margin-top: 5px; overflow: hidden; }
.wl-gauge > i { display: block; height: 100%; border-radius: 99px; background: var(--ok); transition: width .5s var(--ease-spring); }
.wl-gauge.busy > i { background: var(--warn); }
.wl-gauge.over > i { background: var(--danger); }

.wl-cell { border-left: 1px solid var(--row-line); padding: 6px; min-height: 84px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wl-cell.today { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.wl-cell.off { background: var(--surface-2); }

.wl-ev {
  border: 0; text-align: left; cursor: pointer; font: inherit; width: 100%;
  border-radius: 7px; padding: 5px 7px; min-width: 0;
  background: var(--accent-soft); color: var(--accent-deep);
  border-left: 3px solid var(--accent);
  transition: transform .2s var(--ease-spring), box-shadow .2s var(--ease-spring);
}
.wl-ev:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.wl-ev strong { display: block; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-ev span { font-size: 10.5px; opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.wl-ev.t-collectif { background: var(--info-soft); color: var(--info); border-left-color: var(--info); }
.wl-ev.t-physique { background: var(--warn-soft); color: var(--warn); border-left-color: var(--warn); }
.wl-ev.t-match { background: var(--danger-soft); color: var(--danger); border-left-color: var(--danger); }
.wl-ev.done { opacity: .6; }
.wl-ev.annulee { opacity: .5; text-decoration: line-through; }
.wl-more { font-size: 10.5px; color: var(--muted); text-align: center; }

/* Vue mois */
.wl-month-scroll { overflow-x: auto; }
.wl-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.wl-month .wl-day-h { border-bottom: 1px solid var(--row-line); background: var(--surface-2); }
.wl-mcell { border-left: 1px solid var(--row-line); border-top: 1px solid var(--row-line); min-height: 110px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wl-mcell.dim { background: var(--surface-2); }
.wl-mcell.today { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.wl-mdate { font-size: 11.5px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; }
.wl-mcell.today .wl-mdate { color: var(--accent-deep); }
.wl-mh { font-variant-numeric: tabular-nums; font-weight: 500; }

/* Légende des types de séance */
.wl-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; }
.wl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wl-legend i { width: 10px; height: 10px; border-radius: 3px; display: block; }

/* ---- Curseurs de notation 0-10 ---- */
.rate-group { margin-bottom: 18px; }
.rate-group > h4 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rate-row { display: grid; grid-template-columns: 1fr 160px 34px; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--row-line); }
.rate-row:last-child { border-bottom: 0; }
.rate-row label { font-size: 13px; }
.rate-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.rate-val { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }

/* ---- Chronologie / historique ---- */
.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.timeline li { display: grid; grid-template-columns: 21px 1fr; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 10px; top: 20px; bottom: -2px; width: 1px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.tl-dot { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-deep); z-index: 1; }
.tl-dot svg { width: 12px; height: 12px; }
.tl-body strong { display: block; font-size: 13.5px; }
.tl-body .muted { font-size: 12px; }

/* ---- Objectifs ---- */
.goal { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; padding: 11px 0; border-bottom: 1px solid var(--row-line); }
.goal:last-child { border-bottom: 0; }
.goal-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.goal-bar > i { display: block; height: 100%; border-radius: 99px; background: var(--grad-accent); }

/* ---- Solde de pack d'heures ---- */
.pack-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.pack-box.low { background: var(--warn-soft); color: var(--warn); }
.pack-box.void { background: var(--danger-soft); color: var(--danger); }

/* ---- Divers ---- */
.stat-inline { display: flex; gap: 26px; flex-wrap: wrap; }
.stat-inline > div > span { display: block; font-size: 11.5px; color: var(--muted); }
.stat-inline > div > strong { font-size: 19px; font-weight: 650; letter-spacing: -.4px; }
.player-head { display: flex; gap: 16px; align-items: center; }
.avatar-lg { width: 60px; height: 60px; font-size: 21px; border-radius: 18px; }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .wl-row { grid-template-columns: 168px repeat(7, minmax(0, 1fr)) 80px; }
}
@media (max-width: 900px) {
  .wl-scroll .wl-grid { min-width: 960px; }
  .wl-month { min-width: 700px; }
  .pi-axis { grid-template-columns: 88px 1fr 40px; }
  .rate-row { grid-template-columns: 1fr 110px 30px; }
  .stat-inline { gap: 18px; }
}

/* Nom de l'académie courante, sous le logo de la barre latérale */
.nav-scope {
  display: block; margin-top: 6px; font-size: 11.5px; font-weight: 600;
  color: var(--accent-deep); background: var(--accent-soft);
  padding: 3px 9px; border-radius: 99px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

/* ---- Compléments au système de base ---- */
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; background-image: none; }
.btn.danger:hover { filter: brightness(1.06); }
.modal-box.wide { width: 980px; }
.kpi-grid.four { grid-template-columns: repeat(4, 1fr); }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid label.span2 { grid-column: 1 / -1; }
.card + .card { margin-top: 18px; }
.card-head .spacer { flex: 1; }

@media (max-width: 1200px) { .kpi-grid.four { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) {
  .kpi-grid.four { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }

  /* .card-head est en flex non-wrap dans style.css : sur mobile, un long CTA
     (« Émettre toutes les factures ») pousse la ligne hors de la carte. */
  .card-head { flex-wrap: wrap; }
  .card-head .btn { flex: 1 1 auto; justify-content: center; }

  /* La navigation de période est incompressible (libellé 210px + 2 boutons) */
  .wl-nav { flex: 1 1 100%; justify-content: space-between; }
  .wl-period { min-width: 0; flex: 1; font-size: 13px; }
  .wl-head > .seg, .wl-head > .input { flex: 1 1 auto; }
}

/* ---- Cartes d'abonnement (repris de MyFleetAccess) ---- */
.billing-seg { margin: 2px 0 16px; }
.billing-seg .seg-btn { display: inline-flex; align-items: center; gap: 7px; }
/* minmax(0,1fr) et non 1fr : sans ça les colonnes gardent la largeur de leur
   contenu et débordent la modale (défilement horizontal, carte Premium coupée). */
.plans-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch; margin-top: 4px; }
.plan-card {
  position: relative;
  min-width: 0;
  display: flex; flex-direction: column; gap: 7px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 18px 18px;
  background: var(--surface);
}
/* Le texte des puces peut passer à la ligne au lieu d'élargir la carte */
.plan-feats li > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.plan-card.popular {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent), var(--shadow-lift), var(--hi);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface) 55%);
}
.plan-pop {
  position: absolute; top: 14px; right: 14px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--grad-accent); color: #fff;
  font-size: 11px; font-weight: 700;
}
[data-theme="dark"] .plan-pop { color: #06231a; }
.plan-card h3 { font-size: 19px; margin: 0; }
.plan-desc { font-size: 12.5px; min-height: 34px; margin: 0; }
.plan-price { display: flex; align-items: baseline; gap: 2px; }
.plan-price .cur { font-size: 20px; font-weight: 660; }
.plan-price .amount { font-size: 38px; font-weight: 740; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.plan-price .per { color: var(--muted); font-size: 14px; margin-left: 2px; }
.plan-note { font-size: 12px; }
.plan-feats { list-style: none; margin: 12px 0 16px; padding: 12px 0 0; border-top: 1px solid var(--row-line); display: flex; flex-direction: column; gap: 9px; flex: 1; }
.plan-feats li { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; }
.plan-feats .chk {
  width: 19px; height: 19px; flex: none; margin-top: 1px;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-deep);
  display: grid; place-items: center;
}
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none !important; filter: none !important; }
@media (max-width: 900px) {
  .plans-grid { grid-template-columns: 1fr; }
  .plan-desc { min-height: 0; }
}

/* ---- Photos (joueurs / personnel) : l'avatar devient l'image ---- */
.cli-avatar.avatar-img, img.avatar-img { object-fit: cover; padding: 0; }
img.cli-avatar { width: 34px; height: 34px; border-radius: 10px; }
img.cli-avatar.avatar-lg { width: 60px; height: 60px; border-radius: 18px; }

/* Autorise le rétrécissement des enfants de grille (cf. correctif de style.css) */
.pi-axes > *, .wl-cell > *, .wl-mcell > * { min-width: 0; }
