/* === VARIABLES ET RESET === */
:root {
  --primary-color: #c41e3a;
  --primary-hover: #a01830;
  --secondary-color: #2c3e50;
  --text-dark: #2c3e50;
  --text-light: #555;
  --border-color: #ddd;
  --bg-light: #f8f9fa;
  --bg-white: #ffffff;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.12);
  --border-radius: 8px;
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background: var(--bg-light);
  margin: 0;
  padding: 0;
}

/* === CONTENEUR PRINCIPAL === */
body > div,
body > form {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--spacing-sm);
  background: var(--bg-white);
  box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
  body > div,
  body > form {
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) auto;
    border-radius: var(--border-radius);
  }
}

/* === HEADER ET LOGO === */
img[src*="IEC-CENTRE-DE-FORMATION"] {
  max-width: 300px;
  height: auto;
  display: block;
  margin: 0 auto var(--spacing-lg);
}

@media (max-width: 767px) {
  img[src*="IEC-CENTRE-DE-FORMATION"] {
    max-width: 280px;
    margin-bottom: var(--spacing-md);
  }
}

/* === TITRES === */
h1 {
  font-size: 1.75rem;
  color: var(--primary-color);
  text-align: center;
  margin: 0 0 var(--spacing-md);
  font-weight: 700;
  line-height: 1.3;
}

h2 {
  font-size: 1.35rem;
  color: var(--primary-color);
  margin: var(--spacing-xl) 0 var(--spacing-md);
  padding-bottom: var(--spacing-xs);
  border-bottom: 3px solid var(--secondary-color);
  font-weight: 600;
}

h3 {
  font-size: 1.1rem;
  color: var(--text-dark);
  margin: var(--spacing-lg) 0 var(--spacing-sm);
  font-weight: 600;
}

@media (min-width: 768px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
}

/* === PARAGRAPHES === */
p {
  margin: var(--spacing-sm) 0;
  line-height: 1.7;
  color: var(--text-light);
  text-align: justify;
  padding: 0 var(--spacing-sm);
}

@media (min-width: 768px) {
  p {
    padding: 0;
  }
}

/* === TABLEAUX === */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-md) 0;
  background: var(--bg-white);
  box-shadow: var(--shadow-sm);
  border-radius: var(--border-radius);
  overflow: hidden;
}

thead tr {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
}

th {
  padding: var(--spacing-sm);
  text-align: left;
  font-weight: 600;
  font-size: 0.95rem;
}

td {
  padding: var(--spacing-sm);
  border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
  background: var(--bg-light);
  transition: background 0.2s ease;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Responsive tableaux sur mobile */
@media (max-width: 767px) {
  /* Transformation des tableaux de formation en cartes sur mobile */
  table {
    display: block;
    font-size: 0.9rem;
  }
  
  thead {
    display: none;
  }
  
  tbody {
    display: block;
  }
  
  tr {
    display: block;
    margin-bottom: var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-white);
    padding: var(--spacing-sm);
  }
  
  td {
    display: block;
    padding: var(--spacing-xs) 0;
    border: none;
    text-align: left;
  }
  
  /* Affichage des en-têtes pour chaque cellule sur mobile */
  td:before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--primary-color);
    display: inline-block;
    margin-right: var(--spacing-xs);
  }
  
  /* Style spécifique pour les checkboxes dans les tableaux */
  td input[type="checkbox"] {
    margin-left: var(--spacing-xs);
  }
}

/* === FORMULAIRES === */
label {
  display: inline-block;
  margin: var(--spacing-md) 0 var(--spacing-xs);
  font-weight: 500;
  color: var(--text-dark);
  font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: all 0.3s ease;
  background: var(--bg-white);
  font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

/* === RADIO ET CHECKBOX === */
input[type="radio"],
input[type="checkbox"] {
  margin-right: var(--spacing-xs);
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
  vertical-align: middle;
}

/* Liste horizontale pour radio/checkbox - label à droite de l'input */
label:has(input[type="radio"]),
label:has(input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  margin-right: var(--spacing-md);
  margin-bottom: var(--spacing-xs);
  font-weight: normal;
  flex-direction: row;
}

/* Style pour les inputs radio/checkbox dans les tableaux */
td input[type="radio"],
td input[type="checkbox"] {
  display: inline-block;
  margin: 0 0.25rem;
}

/* Affichage en ligne des labels d'années à côté des inputs */
td label {
  display: inline;
  margin: 0 0.5rem 0 0.25rem;
  font-weight: normal;
  font-size: 0.9rem;
}

/* Structure générale : input PUIS label (texte à droite) */
input[type="radio"] + *,
input[type="checkbox"] + * {
  margin-left: var(--spacing-xs);
}

/* Groupe de radio/checkbox sur la même ligne */
.radio-group,
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin: var(--spacing-xs) 0;
}

.radio-group label,
.checkbox-group label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
}

/* === BOUTONS === */
button,
input[type="submit"],
input[type="button"],
.btn {
  padding: 0.875rem 1.75rem;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0.5rem;
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

button:active,
input[type="submit"]:active,
input[type="button"]:active,
.btn:active {
  transform: translateY(0);
}

/* Bouton annuler */
button[onclick*="ANNULER"],
.btn-secondary {
  background: linear-gradient(135deg, #6c757d, #5a6268);
}

/* === UPLOAD DE FICHIERS === */
input[type="file"] {
  padding: var(--spacing-sm);
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  width: 100%;
  cursor: pointer;
  background: var(--bg-light);
  transition: all 0.3s ease;
}

input[type="file"]:hover {
  border-color: var(--primary-color);
  background: #e8f0fe;
}

.file-upload-section {
  background: var(--bg-light);
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  margin: var(--spacing-md) 0;
}

/* Aperçu image */
img[alt="Aperçu"] {
  max-width: 150px;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  margin: var(--spacing-sm) 0;
}

/* === SECTIONS === */
section,
fieldset {
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-md);
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

fieldset {
  border: 2px solid var(--border-color);
}

legend {
  padding: 0 var(--spacing-sm);
  font-weight: 600;
  color: var(--primary-color);
}

/* === ALERTES ET INFOS === */
.info-box,
.alert {
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  margin: var(--spacing-md) 0;
  border-left: 4px solid var(--primary-color);
  background: #e8f0fe;
}

.warning {
  background: #fff3cd;
  border-left-color: var(--secondary-color);
}

.error {
  background: #f8d7da;
  border-left-color: #dc3545;
}

/* === FOOTER === */
footer,
body > div:last-child {
  text-align: center;
  padding: var(--spacing-lg);
  background: var(--text-dark);
  color: white;
  margin-top: var(--spacing-xl);
  font-size: 0.9rem;
  line-height: 1.8;
}

footer a {
  color: var(--secondary-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* === GRILLE RESPONSIVE === */
@media (min-width: 768px) {
  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
  }
  
  .form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--spacing-md);
  }
  
  .form-full {
    grid-column: 1 / -1;
  }
}

/* === LIENS === */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* === ANIMATIONS === */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section,
fieldset {
  animation: fadeIn 0.5s ease-out;
}

/* === ACCESSIBILITÉ === */
:focus-visible {
  outline: 3px solid var(--secondary-color);
  outline-offset: 2px;
}

/* === UTILITAIRES === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }

/* === IMPRESSION === */
@media print {
  body {
    background: white;
  }
  
  button,
  input[type="submit"],
  input[type="button"] {
    display: none;
  }
  
  body > div,
  body > form {
    box-shadow: none;
    max-width: 100%;
  }
}
ul.listeForm {
  list-style: none;
}
/* Amélioration de l'affichage des options Oui/Non dans le tableau */
.ouinon {
    /* Utilise Flexbox pour aligner les éléments sur une seule ligne */
    display: flex; 
    /* Les centres dans la cellule (optionnel, mais souvent plus esthétique) */
    justify-content: center; 
    /* Centre verticalement si le contenu des autres cellules est plus haut */
    align-items: center;
    /* Ajuste l'espacement entre les options Oui et Non */
    gap: 15px; 
}

/* S'assure que les labels (Oui/Non) et les radios restent proches */
.ouinon label {
    /* Force l'affichage en ligne si ce n'est pas déjà le cas dans votre CSS */
    display: inline; 
    /* Ajoute une petite marge à droite pour séparer "Oui" du radio "Non" */
    margin-right: 5px; 
}

/* S'assure que le contenu ne déborde pas si la colonne est trop étroite */
.ouinon input[type="radio"] {
    /* Enlève toute marge inutile qui pourrait causer un retour à la ligne */
    margin: 0; 
}

