/* Palette de verts */
:root {
  --green-dark: #14532d;
  --green: #22c55e;
  --green-light: #bbf7d0;
  --green-pale: #f0fdf4;
  --green-accent: #4ade80;
  --white: #fff;
  --shadow: rgba(20, 83, 45, 0.08);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--green-pale);
  font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
  color: var(--green-dark);
  width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header, footer {
  background: var(--green);
  color: var(--white);
  text-align: center;
  padding: 1.5rem 0;
  border-radius: 0 0 2rem 2rem;
  box-shadow: 0 2px 8px var(--shadow);
}

main, .main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* TITRES */
.title {
  font-size: 2.2rem;
  font-weight: bold;
  margin: 2rem 0 0 0;
  color: var(--green-dark);
  letter-spacing: 1px;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  position: relative;
  text-align: center !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box;
  overflow-x: auto;
}

.title-with-bar {
  width: calc(100vw - 200px); /* 200px = largeur de la sidebar */
  text-align: center;
  position: fixed;
  top: 0;
  left: 220px; /* décale le titre après la sidebar */
  /* retire transform: translateX(-50%); */
  z-index: 100;
  background: var(--green-pale, #f0fdf4);
  padding-top: 2rem;
  padding-bottom: 0;
  margin: 0;
  box-shadow: 0 2px 8px var(--shadow);
}

/* Pour éviter que le contenu ne passe sous le titre fixe */
body, main, .main-content {
  padding-top: 8rem; /* ajuste selon la hauteur réelle de .title-with-bar */
}

.title-with-bar .title {
  font-size: 2.2rem;
  font-weight: bold;
  color: var(--green-dark);
  letter-spacing: 1px;
  background: none;
  margin-top :0;
  margin-bottom: 1rem; /* ou 0.2rem si tu veux un léger espace */
  display: inline-block;
  position: relative;
  z-index: 2;
}

.title-bar {
  width: 100vw;
  height: 7px;
  background: #14532d;
  border-radius: 0px;
  margin: 0 auto;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0px;
  z-index: 1;
}

.subtitle {
  font-weight: bold;
}


/* Sidebar */
.sidebar-nav {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 220px;
  background: #114329;
  color: #f0fdf4;
  border-radius: 0.1rem;
  box-shadow: 2px 0 12px var(--shadow);
  padding: 3rem 0.5rem;
  margin: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow: hidden;
}

.sidebar-nav li {
  width: 90%;
  margin: 1.2rem 0;
  padding: 0;
  background: transparent;
  border-radius: 1rem;
  text-align: center;
  transition: background 0.2s;
  display: flex;
  justify-content: center;
}

.sidebar-nav a {
  width: 100%;
  color: #14532d;
  font-weight: bold;
  font-size: 1.15rem;
  padding: 0.6rem 0;
  border-radius: 1rem;
  display: block;
  text-align: center;
  text-decoration: none;
  background: linear-gradient(90deg, #e6f9ed 0%, #e6f9ed 100%);
  background-size: 200% 100%;
  background-position: 100% 0;
  transition: 
    color 0.2s,
    background-position 0.4s cubic-bezier(.4,2,.6,1),
    box-shadow 0.2s;
  box-shadow: 0 1px 6px var(--shadow);
  position: relative;
  overflow: hidden;
}

.sidebar-nav a:hover, .sidebar-nav a:focus {
  color: #114329;
  background-position: 0 0;
  box-shadow: 0 4px 16px var(--shadow);
}

.sidebar-nav a::before {
  content: "";
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, #bbf7d0 0%, #e6f9ed 100%);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: 1rem;
}

.sidebar-nav a:hover::before, .sidebar-nav a:focus::before {
  opacity: 1;
}

@media (max-width: 600px) {
  .sidebar-nav {
    width: 100vw;
    height: auto;
    flex-direction: row;
    border-radius: 0 0 1.5rem 1.5rem;
    padding: 1rem 0.2rem;
  }
  .sidebar-nav li {
    width: auto;
    margin: 0 0.5rem;
  }
  .sidebar-nav a {
    min-width: 90px;
    font-size: 1rem;
    padding: 0.5rem 0.7rem;
  }
}

/* Listes leçons et exercices */
#lecon_list_div, #exercise_list_div {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#lecon_list_div ul, #exercise_list_div ul,#exercise_list_div ul {
  padding: 0;
  margin: 0 auto;
  list-style: none;
}

#lecon_list_div > ul > li,
#exercise_list_div > ul > li,#exercise_list_div > ul > div > li{
  display: block;
  text-align: center;
  border-radius: 1.2rem;
  background: var(--white, #fff);
  margin: 1rem auto;
  box-shadow: 0 1px 6px var(--shadow, rgba(20, 83, 45, 0.08));
  font-size: 1.1rem;
  cursor: pointer;
  transition: box-shadow 0.2s, background 0.2s;
  position: relative;
  padding: 0;
  overflow: hidden;
  max-width: 900px;
  width: 90vw;
}

#lecon_list_div > ul > li:hover, #exercise_list_div > ul > li:hover ,#exercise_list_div > ul > div > li:hover {
  box-shadow: 0 4px 16px var(--shadow, rgba(20, 83, 45, 0.12));
  background: var(--green-pale, #f0fdf4);
}

/* Liens leçon/exercice : bulle cliquable, texte sur une ligne, pas de changement de couleur */
.lecon-link, .exercise-link {
  padding: 1.2rem 1.5rem;
  border-radius: 1.2rem;
  display: block;
  width: 100%;
  height: 100%;
  color: var(--green-dark, #14532d);
  text-decoration: none !important;
  border: none !important;
  background: none;
  text-align: center;
  font-weight: normal;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: none;
}

.lecon-link:hover, .lecon-link:focus,
.exercise-link:hover, .exercise-link:focus {
  color: var(--green-dark, #14532d);
  background: none;
  text-decoration: none !important;
  border: none !important;
}

/* Divers */
.lecon_subtitle {
  font-size: 1.3rem;
  color: var(--green);
  margin-bottom: 1.2rem;
  text-align: center;
}

.lecon_content, .lecon_pdf {
  background: var(--green-light);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 2px 12px var(--shadow);
  margin: 1rem auto 2rem auto;
  max-width: 700px;
  text-align: center;
}

.lecon_pdf iframe {
  border-radius: 1rem;
  border: none;
  box-shadow: 0 1px 8px var(--shadow);
  margin-bottom: 1rem;
}

label {
  font-size: 1.1rem;
  margin: 0.5rem 0;
  display: block;
  text-align: center;
}



select:hover{
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-light);
  background: var(--green-light);
}

select, button, input[type="text"], input[type="number"] {
  display: block;
  margin: 0.5rem auto 1.5rem auto;
  padding: 0.7rem 1.2rem;
  border-radius: 1.2rem;
  border: 1px solid var(--green-accent);
  background: var(--white);
  font-size: 1rem;
  transition: border 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px var(--shadow);
  outline: none;
}

select:focus, button:focus, input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-light);
}

button {
  background: linear-gradient(90deg, var(--green-accent), var(--green));
  color: var(--white);
  font-weight: bold;
  cursor: pointer;
  border: none;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
  transition: background 0.2s, transform 0.1s;
}

button:hover {
  background: linear-gradient(90deg, var(--green), var(--green-accent));
  transform: translateY(-2px) scale(1.03);
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--white) url("data:image/svg+xml;utf8,<svg fill='none' stroke='%2314532d' stroke-width='3' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 0.5rem center/1.2em 1.2em;
  /*padding: 0.7rem 1.2rem 0.7rem 1.2rem;*/
  padding: 0.7rem 2rem;
  font-size: 1rem;
  text-align: center;
  text-align-last: center;
  box-shadow: 0 1px 4px var(--shadow);
  outline: none;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--green-accent);
  border-radius: 1.2rem;
}

/* Pour masquer la flèche sur Edge/IE */
select::-ms-expand {
  display: none;
}

#exo1, #exo2, #exo3 {
  background: var(--white);
  margin: 1rem auto;
  padding: 1.2rem 1.5rem;
  border-radius: 1.2rem;
  box-shadow: 0 1px 6px var(--shadow);
  font-size: 1.1rem;
  max-width: 700px;
  min-height: 2.5rem;
  text-align: left;
  transition: box-shadow 0.2s;
  color: var(--green-dark);
}

#exo1:empty, #exo2:empty, #exo3:empty {
  background: transparent;
  box-shadow: none;
  min-height: 0;
  padding: 0;
}

a, a:visited {
  color: var(--green-dark);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
  border-radius: 0.3rem;
  padding: 0.1rem 0.3rem;
}

a:hover {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-light);
}



@media (max-width: 800px) {
  .lecon_content, .lecon_pdf, #lecon_list_div ul, #exercise_list_div ul, #exo1, #exo2, #exo3 {
    max-width: 98vw;
    padding: 1rem;
  }
  .title {
    font-size: 1.5rem;
  }
}

::-webkit-scrollbar {
  width: 10px;
  background: var(--green-light);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb {
  background: var(--green-accent);
  border-