/* Import d'une police plus agréable */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');

/* --- Variables de couleur --- */
:root {
  --primary-color: #005a9c;
  --background-color: #f0f4f8;
  --container-bg: #ffffff;
  --correct-bg: #d4edda;
  --incorrect-bg: #f8d7da;
  --text-color: #333;
  --border-color: #ccc;
  --shadow-color: rgba(0,0,0,0.1);
}

/* --- Styles Généraux --- */
body {
  font-family: 'Lato', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 1em;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header h1 {
  color: var(--primary-color);
  text-align: center;
}

main {
  width: 100%;
  max-width: 1000px;
}

/* --- Mise en page --- */
.exercise-zone {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2em;
}

/* Pour les écrans larges, passage en deux colonnes */
@media (min-width: 768px) {
  .exercise-zone {
    grid-template-columns: 300px 1fr;
  }
}

/* --- Style de la figure et de la feuille de travail --- */
.figure-container {
  text-align: center;
}

.worksheet {
  background-color: var(--container-bg);
  border-radius: 8px;
  padding: 1.5em;
  box-shadow: 0 4px 15px var(--shadow-color);
}

#given-lengths {
  font-weight: bold;
  font-size: 1.1em;
  line-height: 1.5;
}

svg text.label {
  font-size: 1.1em;
  fill: #000;
  font-weight: bold;
}

.angle-droit {
  fill: none;
  stroke: black;
  stroke-width: 2;
}

/* --- Champs de formulaire et boutons --- */
input, select {
  padding: 0.4em;
  margin: 0 0.2em;
  font-size: 1em;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  text-align: center;
  transition: border-color 0.3s, background-color 0.3s;
}

input:focus, select:focus {
  border-color: var(--primary-color);
  outline: none;
}

input.correct { background-color: var(--correct-bg); }
input.incorrect { background-color: var(--incorrect-bg); }

button {
  padding: 0.6em 1.2em;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  border: none;
  border-radius: 5px;
  transition: background-color 0.3s, transform 0.1s;
}

#new-exercise-btn, #solution-btn {
  background-color: #6c757d;
  color: white;
  margin-bottom: 1em;
}

#check-btn {
  background-color: var(--primary-color);
  color: white;
}

button:hover {
  opacity: 0.9;
}

button:active {
  transform: translateY(1px);
}

.form-actions {
  margin-top: 1.5em;
  display: flex;
  gap: 1em;
}

.equation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* --- Feedback et Solution --- */
.solution {
  margin-top: 1em;
  background-color: #e8f5e9;
  padding: 1em;
  border-radius: 6px;
  display: none; /* Caché par défaut */
}

#feedback-message {
    margin-top: 1em;
    font-weight: bold;
}

/* Pour les lecteurs d'écran seulement */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

fieldset {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.5em 1em 1em 1em;
  margin-bottom: 1.5em;
}

legend {
  font-weight: bold;
  color: var(--primary-color);
  padding: 0 0.5em;
}