/* ============================================================
   CALCULATEUR VMA (js/vma-calculator.js)

   Habillé comme le reste de l'app : cartes sur --surface à bordure
   fine, titres de carte en --fs-lg, libellés en petites capitales,
   chiffres en tabular-nums. AUCUNE couleur en dur : tout vient des
   tokens, donc le thème clair suit sans règle à part (l'ancienne
   feuille, pensée pour le seul fond sombre, devait être ré-habillée à
   coups de !important).

   Couleurs :
     · intensité (90 → 110 % VMA) : la palette des zones, --zone-2 à
       --zone-5, portée par une pastille — le texte reste en --text ;
     · niveau du test de Cooper : --lvl, posé en ligne depuis les tokens ;
     · le reste : la teinte de la course à pied (--sport-run).
   ============================================================ */

#tab-vma { container-type: inline-size; }

.vc-lab { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.vc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ic, var(--lvl, var(--text-3))); flex: none; }
.vc-i1 { --ic: var(--zone-2); }
.vc-i2 { --ic: var(--zone-3); }
.vc-i3 { --ic: var(--zone-4); }
.vc-i4 { --ic: var(--zone-5); }
.vc-i5 { --ic: color-mix(in srgb, var(--zone-5) 62%, var(--sport-bike)); }

/* --- Bandeau : la VMA, son curseur, son champ --------------------------- */
.vc-band {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px;
  padding: 16px; margin-bottom: 16px;
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--sport-run) 34%, var(--border));
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--sport-run) 18%, transparent), transparent 62%),
    var(--surface);
}
.vc-band-val { display: flex; flex-direction: column; gap: 4px; }
.vc-band-val strong, .vc-result-val {
  font-size: clamp(34px, 9cqw, 56px); font-weight: 700; line-height: 1; letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap;
}
.vc-band-val small, .vc-result-val small { margin-left: 0.22em; font-size: 0.4em; font-weight: 600; letter-spacing: 0; color: var(--text-2); }
.vc-band-set { min-width: 0; align-self: center; }
.vc-band-num { display: flex; flex-direction: column; gap: 6px; }

.vc-slider { display: block; width: 100%; height: 22px; margin: 0; accent-color: var(--sport-run); cursor: pointer; }
.vc-slider-ends { display: flex; justify-content: space-between; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Champ suivi de son unité. */
.vc-unit-input { position: relative; display: block; }
.vc-unit-input .form-input { width: 100%; padding-right: 54px; font-variant-numeric: tabular-nums; }
.vc-unit-input > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: var(--fs-sm); color: var(--text-3); pointer-events: none; }

/* --- Cartes et colonnes --------------------------------------------------- */
.vc-body { display: flex; flex-direction: column; gap: 16px; }
.vc-duo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.vc-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.vc-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.vc-title { margin: 0; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.vc-type { align-self: flex-start; margin-bottom: 0; }

/* --- Tableaux -------------------------------------------------------------- */
.vc-scroll { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.vc-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.vc-table th, .vc-table td { padding: 10px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.vc-table th:first-child, .vc-table td:first-child { text-align: left; padding-left: 0; }
.vc-table th:last-child, .vc-table td:last-child { padding-right: 0; }
.vc-table thead th { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.vc-table thead th .vc-dot, .vc-table tbody th .vc-dot { margin-right: 6px; }
.vc-table tbody th { font-weight: 600; color: var(--text); }
.vc-table tbody td { color: var(--text-2); }
.vc-table tbody tr:last-child th, .vc-table tbody tr:last-child td { border-bottom: 0; }
/* 100 % VMA : la colonne (ou la ligne) de référence. */
.vc-table td.is-ref, .vc-table tr.is-ref td { color: var(--text); font-weight: 700; }
.vc-table thead th.is-ref { color: var(--text); }
.vc-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-2); }
.vc-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* --- Courses : une tuile par distance ------------------------------------ */
.vc-races { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.vc-race { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.vc-race-head { display: flex; flex-direction: column; gap: 1px; }
.vc-race-head strong { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.vc-race-head span, .vc-race-pace { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.vc-race-time { margin-top: 6px; font-size: var(--fs-2xl); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.vc-bar { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.vc-bar i { display: block; height: 100%; border-radius: 3px; background: var(--lvl, var(--sport-run)); transition: width .3s ease; }
.vc-foot { margin: 0; font-size: var(--fs-xs); line-height: 1.6; color: var(--text-3); }

/* --- Test de Cooper : résultat et grille de niveaux ---------------------- */
.vc-result {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  margin-top: 4px; padding: 16px; border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--lvl) 40%, var(--border));
  background: color-mix(in srgb, var(--lvl) 9%, var(--surface));
}
.vc-result .vc-bar { align-self: stretch; height: 8px; border-radius: 4px; margin-top: 2px; }
.vc-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--lvl) 50%, transparent);
  background: color-mix(in srgb, var(--lvl) 14%, transparent);
  font-size: var(--fs-xs); font-weight: 600; color: var(--text);
}
.vc-formula { margin: 0; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.vc-levels { display: flex; flex-direction: column; gap: 4px; }
.vc-level { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid transparent; border-radius: var(--r-md); color: var(--text-2); }
.vc-level-name { flex: 1; min-width: 0; font-size: var(--fs-md); }
.vc-level-range { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.vc-level-range strong { font-size: var(--fs-sm); font-weight: 500; }
.vc-level-range small { font-size: var(--fs-xs); color: var(--text-3); }
.vc-level.is-on { color: var(--text); border-color: color-mix(in srgb, var(--lvl) 45%, var(--border)); background: color-mix(in srgb, var(--lvl) 10%, transparent); }
.vc-level.is-on .vc-level-name, .vc-level.is-on .vc-level-range strong { font-weight: 700; }

/* Lancer le test, enregistrer, historique */
.cooper-card-head { display: flex; align-items: center; gap: 12px; }
.cooper-card-ico {
  flex: none; width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sport-run); background: color-mix(in srgb, var(--sport-run) 14%, transparent);
}
.cooper-card-ico svg { width: 18px; height: 18px; }
.cooper-card-title { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.cooper-card-sub { font-size: var(--fs-xs); color: var(--text-2); margin-top: 2px; }
.cooper-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.45; }
.cooper-steps strong { color: var(--text); }
.cooper-tip, .cooper-src, .cooper-current { font-size: var(--fs-xs); color: var(--text-2); line-height: 1.5; margin: 0; display: flex; gap: 6px; align-items: flex-start; }
.cooper-tip svg, .cooper-src svg { flex: none; width: 14px; height: 14px; margin-top: 2px; }
.cooper-src { color: var(--text); }
.cooper-launch-btn, .cooper-save-btn { width: 100%; justify-content: center; min-height: 48px; }
.cooper-hist { display: flex; flex-direction: column; }
.cooper-hist-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.cooper-hist-row:first-child { border-top: none; }
.cooper-hist-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cooper-hist-date { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.cooper-hist-what { font-size: var(--fs-xs); color: var(--text-2); }
.cooper-hist-val { font-size: var(--fs-lg); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cooper-hist-val small { font-size: 11px; font-weight: 500; color: var(--text-2); }
.cooper-hist-delta { margin-left: 6px; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
.cooper-hist-delta.is-up { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.cooper-hist-delta.is-down { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.cooper-hist-del { flex: none; padding: 4px; }
.cooper-hist-del svg { width: 14px; height: 14px; }

/* Téléphone : les six colonnes du tableau tiennent sans défilement. */
@container (max-width: 480px) {
  .vc-card { padding: 16px 14px; }
  .vc-scroll { margin: 0 -14px; padding: 0 14px; }
  .vc-table { font-size: var(--fs-sm); }
  .vc-table th, .vc-table td { padding: 9px 4px; }
  .vc-table thead th { font-size: 11px; letter-spacing: 0; }
  .vc-table thead th .vc-dot { width: 6px; height: 6px; margin-right: 4px; }
}

/* --- Écran large : le chiffre, le curseur et le champ sur une ligne ;
       deux cartes de front ; six courses sur une rangée ---------------- */
@container (min-width: 620px) {
  .vc-band { grid-template-columns: auto minmax(0, 1fr) 150px; align-items: center; gap: 28px; padding: 20px 24px; }
  .vc-races { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container (min-width: 860px) {
  .vc-duo { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px 20px; }
  .vc-body > .vc-duo:has(.vc-col) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@container (min-width: 1040px) {
  .vc-races { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
