/* ----------- Base générale ----------- */
body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background-color: #f7f9fc;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

h1, h2, h3 {
  color: #333;
  margin: 0;
}

/* ----------- Barre latérale ----------- */
#sidebar {
  width: 260px;
  background-color: #fff;
  border-right: 2px solid #ddd;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: width 0.3s ease;
  position: fixed;
  left: 0;
  top: 0;
}

#sidebar.collapsed {
  width: 60px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background-color: #e8eef8;
  border-bottom: 1px solid #ccc;
}

.sidebar-header h2 {
  font-size: 18px;
  margin: 0;
}

#toggle-sidebar {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
}

.sidebar-content {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
}

.sidebar-content h3 {
  margin-bottom: 5px;
}

.groupe-list {
  list-style: none;
  padding-left: 15px;
  margin-top: 0;
}

.groupe-list li {
  margin-bottom: 8px;
  cursor: pointer;
  transition: color 0.2s;
}

.groupe-list li:hover {
  color: #4a6edb;
}

/* Pied de la barre latérale */
.sidebar-footer {
  border-top: 1px solid #ccc;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-footer button {
  background-color: #4a6edb;
  color: white;
  border: none;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.sidebar-footer button:hover {
  background-color: #3654a4;
}

/* ----------- Contenu principal ----------- */
#main-content {
  flex: 1;
  margin-left: 260px; /* Décalé à droite du sidebar */
  padding: 30px;
  overflow-y: auto;
}

#main-content h1 {
  margin-bottom: 20px;
  font-size: 26px;
  color: #2f3640;
}

/* ----------- Années et sessions corrigées ----------- */
#annees-container {
  display: flex;
  gap: 25px;
  align-items: flex-start;
  overflow-x: auto; /* Permet de scroller si débordement horizontal */
  padding-bottom: 10px;
}

.annee {
  background-color: white;
  border-radius: 10px;
  padding: 12px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  position: relative;
  flex-shrink: 0; /* Empêche le rétrécissement lors du scroll */
}

.annee h2 {
  text-align: center;
  font-size: 18px;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.annee-sessions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  overflow-x: visible; /* Sessions visibles même si dépassent */
}

.session {
  flex: 1;
  background-color: #f0f4f8;
  border-radius: 8px;
  padding: 10px;
  border: 1px solid #d1d9e6;  
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 250px;
  max-height: 450px;
  overflow-y: auto;
}

.cours-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  border: 2px dashed #ccd3e0;
  border-radius: 6px;
  background-color: #fff;
  padding: 8px;
}

.cours-list:hover {
  background-color: #f9fbff;
}

/* --- Ajustements sidebar repliée --- */
#sidebar.collapsed .sidebar-header h2,
#sidebar.collapsed .sidebar-content,
#sidebar.collapsed .sidebar-footer {
  display: none;
}

#sidebar.collapsed {
  width: 60px;
  overflow: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 4px;
}

/* ---------- Fenêtre modale ---------- */
.modal {
  display: none; /* cachée par défaut */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #fff;
  padding: 20px 25px;
  border-radius: 10px;
  width: 400px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  animation: popin 0.2s ease;
}

@keyframes popin {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
  text-align: center;
  margin-bottom: 15px;
}

.modal-content label {
  display: block;
  margin-top: 10px;
  font-weight: 500;
}

.modal-content input,
.modal-content select {
  width: 100%;
  padding: 6px 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.modal-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

.modal-buttons button {
  flex: 1;
  margin: 5px;
  padding: 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
}

#save-course {
  background-color: #4a6edb;
  color: white;
}

#cancel-course {
  background-color: #ccc;
}

#save-course:hover {
  background-color: #3654a4;
}

/* --- Blocs de cours --- */
.cours-bloc {
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #d1d9e6;
  border-left: 6px solid #4a6edb;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.cours-bloc:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.cours-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  color: #1a1a1a;
  background-color: #f3f6fb;
  padding: 6px 8px;
  border-radius: 6px 6px 0 0;
}

.cours-code {
  color: #4a6edb;
}

.cours-credits {
  color: #6b6b6b;
  font-weight: 500;
}

.cours-bottom {
  font-size: 12.5px;
  color: #333;
  text-align: center;
  padding: 8px;
  background-color: #fafbff;
  border-radius: 0 0 6px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credits-info {
  margin-top: 6px;
  font-size: 14px;
  color: #4a6edb;
  font-weight: bold;
}

.total-credits {
  font-size: 14px;
  margin-top: 8px;
  font-weight: bold;
  color: #ffffff;
  background-color: #4a6edb;
  padding: 6px 8px;
  border-radius: 6px;
  text-align: center;
}

/* --- Menu contextuel --- */
#context-menu {
  position: absolute;
  display: none;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  z-index: 10000;
}

#context-menu ul {
  list-style: none;
  margin: 0;
  padding: 5px 0;
}

#context-menu li {
  padding: 8px 15px;
  cursor: pointer;
  font-size: 14px;
}

#context-menu li:hover {
  background-color: #f0f4f8;
}

