/*
 * Liste des résultats d'une course (course_details.php)
 *
 * Style propre au site DirectRésultats :
 *   - police Poppins (celle du site, fichiers locaux dans fonts/poppins/) ;
 *   - rang dans un rond jaune/orange (repris de l'ancienne carte du site) ;
 *   - noms et clubs en casse normale.
 * Disposition compacte en 4 colonnes, lisible du petit téléphone à l'ordinateur :
 *   (rang) | Nom Prénom / Club / 3e SE-M0 · Homme · Dossard 437 | temps / temps puce | partager
 */

@font-face {
  font-family: "Poppins DR";
  src: url("fonts/poppins/Poppins-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins DR";
  src: url("fonts/poppins/Poppins-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins DR";
  src: url("fonts/poppins/Poppins-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins DR";
  src: url("fonts/poppins/Poppins-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --res-fond: #ffffff;
  --res-survol: #fff8eb;
  --res-trait: #ececec;
  --res-texte: #111317;
  --res-texte-2: #4b5563;
  --res-gris: #6b7280;
  --res-rang: linear-gradient(135deg, #f9d423, #e3a73a);  /* jaune/orange du site */
  --res-femme: #f03484;                                    /* rose déjà utilisé par le site */
  --res-police: "Poppins DR", "Poppins", Arial, sans-serif;
}

/* Filtre par genre : Tous / Hommes / Femmes (boutons segmentés) */
.filtre-genre {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: -0.5rem 0 1rem;
  padding: 4px;
  border: 1px solid #35373b;
  border-radius: 999px;
  background: #1f2125;
  font-family: var(--res-police);
}

.filtre-genre__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0.4rem 0.6rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #d1d5db;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.filtre-genre__btn span {
  font-size: 0.78rem;
  opacity: 0.75;
}

.filtre-genre__btn:hover {
  color: #fff;
}

.filtre-genre__btn[aria-pressed="true"] {
  background: var(--res-rang);
  color: var(--res-texte);
  font-weight: 700;
}

.filtre-genre__btn--f[aria-pressed="true"] {
  background: var(--res-femme);
}

.filtre-genre__btn:focus-visible {
  outline: 3px solid #e3a73a;
  outline-offset: 2px;
}

.aucun-resultat {
  margin: 0 0 3rem;
  padding: 1.5rem 1rem;
  border-radius: 14px;
  background: #1f2125;
  color: #d1d5db;
  font-family: var(--res-police);
  text-align: center;
}

/* Conteneur : une seule carte blanche, lignes séparées par un filet */
#participantsList {
  overflow: hidden;
  margin-bottom: 3rem;          /* espace sous la liste, avant le bas de la page */
  border-radius: 16px;
  background: var(--res-fond);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  font-family: var(--res-police);
}

.participant-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 40px;
  align-items: center;
  gap: 0 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--res-trait);
  background: var(--res-fond);
  color: var(--res-texte);
  transition: background-color 0.15s ease;
}

.participant-row:last-child {
  border-bottom: 0;
}

.participant-row:hover {
  background: var(--res-survol);
}

/* Participantes : toute la ligne en rose (couleur historique du site).
   Textes secondaires foncés pour rester lisibles sur le rose. */
.participant-row.female {
  background: var(--res-femme);
  border-bottom-color: rgba(0, 0, 0, 0.12);
}

.participant-row.female:hover {
  background: #f2559a;
}

.participant-row.female .pr-club,
.participant-row.female .pr-cat,
.participant-row.female .pr-puce-label,
.participant-row.female .pr-ecart {
  color: #2b0a19;
}

.participant-row.female .pr-ecart {
  font-weight: 700;
}

/* Rang : rond jaune/orange, chiffre sombre */
.pr-rang {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--res-rang);
  color: var(--res-texte);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(227, 167, 58, 0.35);
}

/* Rangs à 3-4 chiffres : chiffre réduit pour tenir dans le rond */
.pr-rang--long {
  font-size: 0.8rem;
  letter-spacing: -0.02em;
}

.pr-infos {
  min-width: 0;
}

.pr-nom {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.pr-club {
  margin-top: 1px;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--res-texte-2);
  overflow-wrap: anywhere;
}

.pr-cat {
  margin-top: 3px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--res-gris);
}

.pr-cat strong {
  font-weight: 700;
  color: var(--res-texte);
}

/* « Dossard 437 » ne se coupe jamais en deux lignes */
.pr-dossard {
  white-space: nowrap;
}

/* Temps : aligné à droite */
.pr-temps {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pr-temps-final {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
}

.pr-puce-label {
  margin-top: 3px;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--res-gris);
}

.pr-puce {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
}

.pr-ecart {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: #c2410c;
}

.pr-partage {
  display: flex;
  justify-content: center;
}

.pr-partage .partage-btn {
  margin-top: 0;
}

/* Bouton « Retour en haut » (flottant, en bas à droite) */
.retour-haut {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 1040;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--res-rang);
  color: var(--res-texte);
  font-size: 1.5rem;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  animation: retour-haut-apparait 0.2s ease-out;
  transition: transform 0.15s ease;
}

.retour-haut[hidden] {
  display: none;
}

.retour-haut:hover {
  transform: translateY(-2px);
}

.retour-haut:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

@keyframes retour-haut-apparait {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .retour-haut {
    animation: none;
    transition: none;
  }
}

/* Écrans < 1200 px : à gauche, pour ne jamais recouvrir les boutons « partager »
   (colonne de droite) — à gauche il ne passe que sur les ronds de rang, non cliquables */
@media (max-width: 1199px) {
  .retour-haut {
    right: auto;
    left: 12px;
  }
}

/* Mobile : mêmes colonnes, tailles réduites */
@media (max-width: 576px) {
  #participantsList {
    border-radius: 12px;
  }

  .participant-row {
    grid-template-columns: 36px minmax(0, 1fr) auto 32px;
    gap: 0 8px;
    padding: 12px 10px;
  }

  .pr-rang {
    width: 36px;
    height: 36px;
    font-size: 0.88rem;
  }

  .pr-rang--long {
    font-size: 0.66rem;
  }

  .pr-nom {
    font-size: 0.92rem;
  }

  .pr-club {
    font-size: 0.76rem;
  }

  .pr-cat {
    font-size: 0.72rem;
  }

  .pr-temps-final {
    font-size: 0.98rem;
  }

  .pr-puce-label {
    font-size: 0.56rem;
  }

  .pr-puce {
    font-size: 0.76rem;
  }

  .pr-ecart {
    font-size: 0.64rem;
  }

  .pr-partage .partage-btn {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }
}
