/* ===== GITHUB REDIRECT STYLES ===== */
.github-redirect {
  margin: 2rem 0;
}

.github-card {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
  background: var(--bg-secondary);
}

.github-card h3 {
  margin-top: 0;
  color: var(--primary-color);
}

.github-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
}

.github-link:hover {
  text-decoration: underline;
}

.github-redirect h3 {
  color: var(--primary-color);
  margin-top: 2rem;
}

.github-redirect ul li,
.github-redirect ol li {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.note {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  padding: 1rem;
  border-radius: 6px;
  margin-top: 2rem;
  font-style: italic;
}

/* ===== COLLAPSIBLE MENU STYLES ===== */
.menu-section.collapsible {
  margin-bottom: 0.5rem;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text-color);
  font-family: inherit;
  font-size: inherit;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  border-radius: 4px;
}

.menu-toggle:hover {
  background-color: var(--bg-secondary);
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.menu-toggle:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.menu-title {
  font-weight: bold;
  color: var(--primary-color);
}

.toggle-icon {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  color: var(--text-muted);
}

.menu-toggle[aria-expanded="false"] .toggle-icon {
  transform: rotate(-90deg);
}

.menu-items {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  max-height: 500px;
  opacity: 1;
}

.menu-section.collapsed .menu-items {
  max-height: 0;
  opacity: 0;
  margin: 0;
}

.menu-items li {
  margin: 0.2rem 0;
  margin-left: 1rem;
}

.menu-items a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: var(--transition);
}

.menu-items a:hover {
  background-color: var(--bg-secondary);
  padding-left: 1rem;
}

/* ===== CSS VARIABLES ===== */
:root {
  --primary-color: #007acc;
  --primary-hover: #005c99;
  --text-color: #000;
  --text-muted: #666;
  --text-light: #aaa;
  --bg-color: #fff;
  --bg-secondary: #f4f4f4;
  --bg-tertiary: #fafafa;
  --border-color: #ccc;
  --border-light: #e0e0e0;
  --shadow-light: rgba(0, 0, 0, 0.05);
  --shadow-medium: rgba(0, 0, 0, 0.1);
  --menu-width: 220px;
  --content-max-width: 800px;
  --border-radius: 6px;
  --transition: all 0.3s ease;
}

/* Dark mode variables */
@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #e0e0e0;
    --text-muted: #b0b0b0;
    --text-light: #888;
    --bg-color: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #333;
    --border-color: #444;
    --border-light: #333;
    --shadow-light: rgba(255, 255, 255, 0.05);
    --shadow-medium: rgba(255, 255, 255, 0.1);
  }
}


/* ===== RESET ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: monospace, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  scroll-behavior: smooth;
  transition: var(--transition);
}

/* ===== LOADING STATES ===== */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== STRUCTURE ===== */
body {
  display: flex;
  min-height: 100vh;
}

/* ===== MENU LATÉRAL ===== */
nav {
  width: var(--menu-width);
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-right: 1px solid var(--border-color);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: auto;
  transition: var(--transition);
}

nav h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

nav a {
  display: block;
  padding: 0.5rem 0;
  color: var(--text-color);
  text-decoration: none;
  transition: var(--transition);
  border-radius: 4px;
  padding-left: 0.5rem;
}

nav a:hover {
  color: var(--primary-color);
  background: var(--bg-tertiary);
  transform: translateX(4px);
}

nav a:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ===== PAGE ===== */
#page {
  margin-left: var(--menu-width);
  flex: 1;
  padding: 2rem;
  max-width: var(--content-max-width);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* ===== MENU ERROR STATE ===== */
.menu-error {
  background: #fee;
  color: #c33;
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  border: 1px solid #fcc;
}

.menu-retry {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: var(--transition);
}

.menu-retry:hover {
  background: var(--primary-hover);
}

/* ===== FORM-ROW ===== */
.form-row {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* ===== FORM SECTION ===== */
.form-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1em 2em;
  align-items: end;
  margin-top: 1.5em;
}

.form-section label {
  display: flex;
  flex-direction: column;
  font-size: 0.95em;
  min-width: 200px;
}

.form-section input,
.form-section select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-color);
  color: var(--text-color);
  transition: var(--transition);
}

.form-section input:focus,
.form-section select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

/* ===== FORM FOOTER ===== */
.form-footer {
  display: flex;
  align-items: center;
  gap: 1em;
  margin-top: 1.5em;
}

/* ===== MENU SECTION ===== */
.menu-section {
  margin-top: 1rem;
}

.menu-title {
  font-weight: bold;
  font-size: 1rem;
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text-color);
}

.menu-section ul {
  list-style: none;
  padding-left: 1rem;
  margin: 0;
}

.menu-section ul li {
  margin-bottom: 0.5rem;
}

/* ===== TYPOGRAPHIE ===== */
h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

h2 {
  font-size: 1.5rem;
  margin: 1.5rem 0 1rem 0;
  color: var(--text-color);
}

h3 {
  font-size: 1.2rem;
  margin: 1rem 0 0.5rem 0;
  color: var(--text-color);
}

p {
  margin-bottom: 1rem;
  color: var(--text-color);
}

ul, ol {
  margin: 1rem 0 2rem 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

a {
  color: var(--primary-color);
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ===== BUTTONS ===== */
button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}

button:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-medium);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== FOOTER ===== */
footer {
  padding: 2rem;
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: center;
  border-top: 1px solid var(--border-light);
  margin-top: 2rem;
}

/* ===== BACK TO TOP BUTTON ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--shadow-medium);
  z-index: 100;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

/* ===== FILE BROWSER IMPROVEMENTS ===== */
.file-section {
  margin-bottom: 2rem;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  overflow: hidden;
  background: var(--bg-color);
  box-shadow: 0 2px 8px var(--shadow-light);
}

.file-section h2 {
  background: var(--bg-secondary);
  margin: 0;
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 1.1rem;
}

.file-section .content {
  padding: 1rem;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-list li {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  border-radius: 4px;
  transition: var(--transition);
}

.file-list li:hover {
  background: var(--bg-tertiary);
}

.file-list a {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-list a::before {
  content: "▪";
  font-size: 1rem;
  color: var(--primary-color);
  font-weight: bold;
}

/* ===== MENU HAMBURGER ===== */
.hamburger-button {
  display: none;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  background: var(--primary-color);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px var(--shadow-medium);
  transition: var(--transition);
}

.hamburger-button:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.hamburger-button.active {
  background: var(--primary-hover);
}

/* Overlay pour fermer le menu en cliquant à côté */
.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.menu-overlay.active {
  display: block;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  :root {
    --menu-width: 280px;
  }
  
  body {
    flex-direction: column;
  }

  /* Afficher le bouton hamburger sur mobile */
  .hamburger-button {
    display: block;
  }

  /* Menu caché par défaut sur mobile */
  nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: var(--menu-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    border-bottom: none;
    padding: 1.5rem;
    overflow-y: auto;
    transition: left 0.3s ease;
    z-index: 1000;
  }

  /* Menu visible quand actif */
  nav.active {
    left: 0;
  }

  /* Contenu principal prend toute la largeur */
  #page {
    margin-left: 0;
    padding: 1rem;
    padding-top: 1rem; /* Espace normal, le hamburger ne bloque plus */
  }

  .form-section {
    grid-template-columns: 1fr;
  }
  
  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
  }
  
  #page {
    padding: 0.5rem;
  }
  
  .file-section .content {
    padding: 0.5rem;
  }
}

/* ===== Code block stylé ===== */
pre {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  overflow-x: auto;
  font-family: 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 2rem 0;
  box-shadow: 0 2px 6px var(--shadow-light);
  transition: var(--transition);
}

code {
  font-family: 'Fira Code', 'SF Mono', Consolas, monospace;
  background-color: var(--bg-tertiary);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.9em;
}

/* ===== SECTION EXPLICATIVE ===== */
#explanation h2 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

#explanation h3 {
  font-size: 1rem;
  margin-top: 1rem;
  margin-bottom: 0.3rem;
}

#explanation p,
#explanation li {
  font-size: 0.9rem;
  line-height: 1.4;
}

#explanation ul,
#explanation ol {
  margin-left: 1.2rem;
}

.note {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  border-left: 4px solid var(--text-light);
  padding-left: 0.8rem;
}

/* Collapsible explanation bubble */
details#explanation {
  margin: 1.5em 0;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-tertiary);
  padding: 0.5em 1em;
  transition: var(--transition);
}

details#explanation summary {
  cursor: pointer;
  font-weight: bold;
  outline: none;
  padding: 0.5rem 0;
  user-select: none;
}

details#explanation summary::-webkit-details-marker {
  display: none;
}

details#explanation summary:before {
  content: "▶";
  display: inline-block;
  width: 1em;
  transition: transform 0.2s ease;
  color: var(--primary-color);
}

details#explanation[open] summary:before {
  transform: rotate(90deg);
}

details#explanation[open] {
  box-shadow: 0 4px 12px var(--shadow-light);
}

/* ===== PRINT STYLES ===== */
@media print {
  nav {
    display: none;
  }
  
  #page {
    margin-left: 0;
    max-width: none;
  }
  
  .back-to-top {
    display: none;
  }
  
  a {
    color: #000;
  }
  
  pre {
    border: 1px solid #000;
  }
}