:root {
  /* === Palette de couleurs du thème Classic === */
  --theme-background: #faf0ce; /* Fond du body */
  --theme-text: #2c3e50;       /* Texte principal, titres */
  --theme-primary: #c39b77;    /* Sidebar, boutons principaux */
  --theme-secondary: #f2e3b3;  /* Header, hover, boutons secondaires */
  --theme-tertiary: #fef9e7;   /* Section background */
  --theme-quaternary: #f8f9fa; /* Autres sections */
  --theme-header: #eed498;     /* Header/footer */
  --theme-footer: #eed498;     /* Footer background */
  --theme-accent: #9a4c18;     /* Accent (boutons génériques) */

  /* Ombres */
  --theme-header-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  --theme-section-shadow: 0 2px 5px rgba(0,0,0,0.1);
  --theme-sidebar-shadow: 0 2px 6px rgba(0,0,0,0.2);
  --theme-selector-shadow: 0 2px 6px rgba(0,0,0,0.2);

  /* Typo et autres */
  --theme-font-family: 'Georgia', serif;
  --theme-section-hover-transform: translateY(-5px);

  /* Couleurs de texte spécifiques */
  --theme-button-primary-text: #fff;
  --theme-button-secondary-text: var(--theme-text);
  --theme-sidebar-text-titre: #fff;
  --theme-sidebar-text: #fff;
  --theme-footer-text: #fff;
  --theme-text-shadow: none;

  /* Largeur sidebar et transitions */
  --sidebar-width: 280px;
  --transition-speed: 0.3s;
  --icon-animation-speed: 0.4s;
}

/* === Sidebar (Menu latéral) === */
.sidebar {
  position: fixed;
  left: calc(-1 * var(--sidebar-width));
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background-color: var(--theme-primary);
  color: var(--theme-sidebar-text);
  padding: 15px;
  display: flex;
  flex-direction: column;
  transition: left var(--transition-speed) ease;
  z-index: 500;
  overflow-y: scroll;
  box-shadow: var(--theme-sidebar-shadow);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--theme-primary) var(--theme-secondary);
}

/* Scrollbar Chrome/Edge/Safari */
.sidebar::-webkit-scrollbar {
  width: 8px;
}
.sidebar::-webkit-scrollbar-track {
  background: var(--theme-secondary);
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background-color: var(--theme-primary);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar.active {
  left: 0;
}

/* Contenu principal */
.sidebar-content {
  flex: 1;
  width: 100%;
  padding-bottom: 60px;
}

.sidebar-header {
  padding: 10px 0;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  margin-bottom: 15px;
  position: sticky;
  top: 0;
  background-color: var(--theme-primary);
  z-index: 501;
}

.sidebar-header h3 {
  margin: 0;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--theme-sidebar-text-titre);
}

/* === Sections du menu === */
.menu-section {
  margin-bottom: 15px;
  border-radius: 5px;
  overflow: visible;
  position: relative;
}

/* Container pour titre et bouton déroulant */
.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
}

/* Titre principal cliquable */
.section-title-link {
  flex-grow: 1;
  background-color: rgba(0, 0, 0, 0.08); /* Léger fondu sur le fond primaire */
  color: var(--theme-sidebar-text-titre);
  padding: 10px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
  transition: background-color var(--transition-speed) ease;
  display: flex;
  align-items: center;
  text-decoration: none;
  font-family: inherit;
  font-size: 1em;
}
.section-title-link:hover {
  background-color: rgba(0, 0, 0, 0.15);
}

/* Bouton déroulant */
.dropdown-toggle {
  background-color: rgba(0, 0, 0, 0.08);
  color: var(--theme-sidebar-text);
  width: 36px;
  height: 36px;
  border: none;
  cursor: pointer;
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
  transition: background-color var(--transition-speed) ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dropdown-toggle:hover {
  background-color: rgba(0, 0, 0, 0.15);
}
.dropdown-toggle .arrow {
  transition: transform var(--transition-speed) ease;
  color: var(--theme-sidebar-text-titre);
}
.dropdown-toggle.active .arrow {
  transform: rotate(180deg);
}

.menu-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.submenu {
  height: 0;
  overflow: hidden;
  transition: height var(--transition-speed) ease;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
.submenu.active {
  height: auto;
  padding: 5px;
  margin-top: 5px;
}

/* === Boutons dans la sidebar === */
.sidebar button.nav-button {
  background-color: var(--theme-secondary);
  color: var(--theme-text);
  padding: 8px 12px;
  font-size: 0.9em;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-speed) ease;
  display: flex;
  align-items: center;
  overflow: hidden;
  width: 100%;
  margin-bottom: 5px;
}

.sidebar button i {
  margin-right: 8px;
  width: 20px;
  text-align: center;
  transition: transform var(--icon-animation-speed) cubic-bezier(0.68, -0.55, 0.27, 1.55), color var(--icon-animation-speed) ease;
}
.sidebar button:hover {
  background-color: var(--theme-secondary);
  color: var(--theme-accent);
  transform: translateX(5px);
}
.sidebar button:hover i {
  transform: rotate(10deg) scale(1.2);
  color: var(--theme-accent);
}

/* Conteneur pour boutons spéciaux */
.button-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  justify-content: space-between;
}

/* === Bouton ouvrir/fermer menu === */
#toggleSidebarBtn {
  position: fixed;
  top: 10px;
  left: 10px;
  background-color: var(--theme-primary);
  color: var(--theme-button-primary-text);
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 5px;
  z-index: 505;
  transition: left var(--transition-speed) ease, background-color var(--transition-speed) ease, transform 0.2s ease;
}
#toggleSidebarBtn:hover {
  background-color: var(--theme-secondary);
  color: var(--theme-accent);
  transform: scale(1.05);
}
#toggleSidebarBtn.active {
  left: calc(var(--sidebar-width) + 10px);
}

/* === Bouton zone privée === */
.sidebar-footer {
  margin-top: auto;
  position: sticky;
  bottom: 0;
  background-color: var(--theme-primary);
  padding-top: 10px;
  z-index: 502;
  width: 100%;
  box-shadow: 0 -5px 10px -5px rgba(0, 0, 0, 0.1);
}
.private-zone-button {
  background-color: rgba(0, 0, 0, 0.08) !important;
  color: var(--theme-button-primary-text) !important;
  font-size: 0.9em;
  border: none !important;
  cursor: pointer;
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 4px !important;
  padding: 8px !important;
  width: 100% !important;
  transition: background-color var(--transition-speed) ease;
}
.private-zone-button:hover {
  background-color: rgba(0, 0, 0, 0.15) !important;
}
.lock-icon {
  margin-right: 8px;
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  display: inline-block;
}
.private-zone-button:hover .lock-icon {
  transform: rotate(360deg) scale(1.2);
  color: gold;
}

/* Séparateur pour les sections du menu */
.section-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.5), transparent);
  margin: 10px 0;
}

/* Grille de boutons */
.button-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.grid-button {
  background-color: var(--theme-secondary);
  color: var(--theme-text);
  padding: 8px 12px;
  font-size: 0.85em;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
  box-sizing: border-box;
}
.grid-button:hover {
  background-color: var(--theme-secondary);
  color: var(--theme-accent);
  transform: translateY(-2px);
}
.grid-button i {
  margin-right: 8px;
  transition: transform var(--icon-animation-speed) ease, color var(--icon-animation-speed) ease;
}
.grid-button:hover i {
  transform: rotate(15deg) scale(1.2);
  color: var(--theme-accent);
}

/* === Media Queries === */
@media (max-width: 576px) {
  :root { --sidebar-width: 250px; }
  .section-title-link, .dropdown-toggle, .sidebar button.nav-button {
    padding: 10px 8px;
    font-size: 0.85em;
  }
  .sidebar-header h3 { font-size: 1.1em; }
  .button-container { gap: 5px; padding: 0 2px; }
}
@media (min-width: 577px) and (max-width: 992px) {
  :root { --sidebar-width: 260px; }
  .sidebar button.nav-button { padding: 10px; }
}
@media (min-width: 993px) {
  :root { --sidebar-width: 280px; }
  .sidebar-header h3 { font-size: 1.2em; }
  .sidebar button.nav-button { padding: 12px; }
  .button-container { gap: 10px; justify-content: space-between; }
}
@media (pointer: coarse) {
  .dropdown-toggle { width: 44px; height: 44px; }
  .section-title-link, .sidebar button.nav-button { min-height: 44px; }
  .menu-items { gap: 8px; }
}
