body {
  background-color: whitesmoke;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 20px;
  overflow: hidden;
}

/*page nom train*/
.nameTrain {
  background-color: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 500px;
}

/* Section des trains */
#trains {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

/* Chaque train */
#trains section {
  background-color: #e3e8ff;
  padding: 12px 16px;
  border-radius: 8px;
}

#trains section a {
  text-decoration: none;
  color: #1e40af;
  font-weight: 600;
  display: block;
}

#trains section:hover {
  background-color: #c7d2fe;
  transform: scale(1.02);
}

/* Bouton "+" */
#addButton {
  display: inline-block;
  padding: 12px 20px;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  background-color: #3b82f6;
  border: none;
  border-radius: 50%;
}

#addButton:hover {
  background-color: #2563eb;
  transform: scale(1.1);
}

/*page d'ajout avec carte*/
.formAdd {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 20px;
  background-color: rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  z-index: 1000;
}

.formAdd .addDisplay {
  background-color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  border-radius: 10px;
  max-width: 500px;
}

.addDisplay {
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
}

.add {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

form.add input {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

form.add input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 4px rgba(59, 130, 246, 0.5);
  outline: none;
}

/*sur tablette*/
@media (max-width: 576px) and (min-width: 381px) {
  .formAdd .addDisplay {
    margin-right: 20px;
  }

  .formAdd {
    width: 100%;
    max-width: 576px;
    padding: 1.5rem;
    padding-top: 50px;
  }

  .addDisplay {
    max-height: 88vh;
    padding: 1.5rem;
  }

  .add input {
    width: 100%;
    box-sizing: border-box;
  }

  .poids label,
  .poids input {
    width: 100%;
  }
}

/*sur tel*/
@media (max-width: 380px) {
  .formAdd .addDisplay {
    margin-right: 30px;
  }

  .formAdd {
    width: 95%;
    max-width: 350px;
    padding: 1rem;
    padding-top: 20px;
  }

  .addDisplay {
    max-height: 85vh;
    padding: 1rem;
  }

  .add input {
    width: 100%;
    box-sizing: border-box;
  }

  .poids label,
  .poids input {
    width: 100%;
  }
}

/* Section poids */
.poids {
  display: flex;
  gap: 10px;
  align-items: center;
}

.poids label {
  flex: 1;
}

.poids input {
  flex: 1;
}

/* Boutons du formulaire */
.addDisplay button {
  padding: 10px 16px;
  margin-top: 10px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.addDisplay .addButton {
  /* Ajouter bouton */
  background-color: #10b981;
  color: #fff;
}

.addDisplay .exitButton {
  /* Exit bouton */
  background-color: #ef4444;
  color: #fff;
}

.addDisplay .vehicleAddButton {
  /* Ajouter wagon */
  margin-top: 20px;
  background-color: #3b82f6;
  color: #fff;
}

.addDisplay button:hover {
  transform: scale(1.05);
}

.addDisplay button:active {
  transform: scale(0.95);
}

/*page de calcul*/
main {
  background-color: #fff;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 600px;
}

/* Formulaire de calcul */
form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

form section.form {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 12px;
  margin-top: 20px;
  background-color: #e3e8ff;
  border-radius: 8px;
}

form section.form label {
  flex: 1;
  font-weight: 600;
  color: #1e40af;
}

form section.form input {
  width: 60px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  text-align: center;
}

form section.form input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 4px rgba(59, 130, 246, 0.5);
  outline: none;
}

form section.form input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6; /* couleur bleue cohérente */
}

/* Boutons */
form button {
  padding: 12px 18px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
}

#buttonCalcul {
  background-color: #10b981;
  color: #fff;
}

#exit {
  background-color: #ef4444;
  color: #fff;
}

form button:hover {
  transform: scale(1.05);
}

form button:active {
  transform: scale(0.95);
}

/* Section résultat */
.result {
  margin-top: 20px;
  font-size: 25px;
  padding: 15px;
  border-radius: 10px;
  font-weight: 600;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
