/* ===== Les couleurs et réglages de base de l'application =====
   On reprend exactement les couleurs utilisées dans les wireframes,
   pour que le résultat final ressemble à ce qui a été validé. */

:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --border: #e4e2dc;
  --text: #1b1b18;
  --text-2: #6e6c64;
  --accent: #1e7a5f;
  --accent-soft: #e3f0ea;
  --danger: #d3242c;
  --danger-soft: #fbe7e7;
  --rayon: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
}

input,
label {
  font-family: inherit;
}

/* L'application est centrée et limitée en largeur pour ressembler à un
   écran de téléphone, même quand on la teste sur un grand écran d'ordinateur. */
#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* On cache tous les écrans, et on affiche seulement celui qui est actif.
   C'est app.js qui ajoute/enlève la classe "ecran-actif". */
.ecran {
  display: none;
  flex: 1;
  flex-direction: column;
}

.ecran.ecran-actif {
  display: flex;
}

/* ===== Composants réutilisables ===== */

.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.entete h1 {
  font-size: 20px;
  font-weight: 700;
}

.contenu {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.champ {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.champ label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.champ input {
  height: 50px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--rayon);
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
}

.champ input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.aide {
  font-size: 11.5px;
  color: var(--text-2);
}

.bouton-principal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  background: var(--accent);
  color: #fff;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
}

.bouton-principal:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.bouton-secondaire {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
}

.lien-accent {
  color: var(--accent);
  font-weight: 700;
}

.texte-centre {
  text-align: center;
}

.texte-discret {
  font-size: 13.5px;
  color: var(--text-2);
}

.message-erreur {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  display: none;
}

.message-erreur.visible {
  display: block;
}

.message-confirmation {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  display: none;
}

.message-confirmation.visible {
  display: block;
}

.carte {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

/* ===== Écran de connexion / inscription ===== */

.ecran-auth .contenu {
  padding: 56px 28px 28px;
  justify-content: flex-start;
}

.logo-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.logo-app .badge {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-app h1 {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
}

/* ===== Navigation basse (barre d'onglets) ===== */

.nav-basse {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: 68px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-basse a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 600;
}

.nav-basse a.actif {
  color: var(--accent);
  font-weight: 700;
}

/* ===== Choix du type de sport (écran "Démarrer une activité") ===== */

.choix-sport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 16px 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.choix-sport span {
  font-size: 16px;
}

.choix-sport.choix-sport-actif {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Carte du parcours (écran "Activité en cours") ===== */

.carte-suivi {
  width: 100%;
  height: 190px;
  border-radius: var(--rayon);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* Petites retouches pour que les contrôles Leaflet suivent le style de
   l'application plutôt que leur apparence par défaut un peu datée. */
.carte-suivi .leaflet-control-attribution {
  font-size: 9.5px;
}

/* ===== Bouton urgence flottant ===== */

.bouton-urgence-flottant {
  /* "fixed" (et non "absolute") : le bouton reste ainsi à la même place à
     l'écran même quand on fait défiler une page plus longue que l'écran
     (par exemple la liste de contacts sur l'accueil), au lieu de défiler
     avec le reste du contenu. */
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(211, 36, 44, 0.4);
  font-size: 11px;
  font-weight: 800;
  gap: 3px;
  z-index: 20;
}

/* Pendant les quelques secondes où le bouton attend une confirmation
   (premier clic déjà fait), on le fait pulser pour que ce soit très visible.
   Le "translateY(-50%)" doit rester présent à chaque étape de l'animation,
   sinon le bouton perdrait son centrage vertical pendant qu'il pulse. */
.bouton-urgence-flottant.bouton-urgence-arme {
  animation: pulsationUrgence 0.8s infinite;
}

@keyframes pulsationUrgence {
  0%, 100% { transform: translateY(-50%) scale(1); box-shadow: 0 8px 20px rgba(211, 36, 44, 0.4); }
  50% { transform: translateY(-50%) scale(1.1); box-shadow: 0 8px 26px rgba(211, 36, 44, 0.65); }
}
