:root {
  /* Palette de couleurs optimisée */
  --color-primary: #03ce03;
  --color-primary-hover: #02a302;
  --color-secondary: #eab308;
  --color-success: #16a34a;
  --color-success-hover: #14803d;
  --color-error: #ef4444;
  --color-text-dark: #1f2937;
  --color-text-medium: #4b5563;
  --color-text-light: #054a91;
  --color-bg-light: #f9fafb;
  --color-border-light: #d1d5db;
  --color-border-accent: #63f199;
  --color-gray-bg: #f3f4f6;
  --color-black-overlay: rgba(0, 0, 0, 0.5);
  --color-shadow-primary: #e5e7eb;
  --color-text-black: #000;
  --color-text-white: #ffff;

  /* Système de tailles responsive */
  --font-size-xs: 1rem;
  --font-size-sm: 1.75rem;
  --font-size-base: 1.5rem;
  --font-size-lg: 2rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 1.75rem;
  --font-size-3xl: 2.95rem;
  --font-size-4xl: 2.5rem;
  --font-size-5xl: 3rem;
  --font-size-6xl: 4.75rem;

  /* Espacements cohérents */
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-3: 0.75rem;
  --spacing-4: 1rem;
  --spacing-6: 1.5rem;
  --spacing-8: 2rem;
  --spacing-10: 2.5rem;
  --spacing-12: 3rem;
  --spacing-16: 4rem;

  /* Typographie */
  --font-family-base: "Nunito Sans", sans-serif;

  /* Variables responsive */
    --mobile-padding: 10px;
    --tablet-padding: 20px;
    --desktop-padding: 30px;

}

/* Reset et base */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-base);
  height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  /* overflow: hidden; */
}

/* Classe utilitaire pour les lecteurs d'écran */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.main-content {
    contain: layout style paint;
    height: 90vh; /* Assurer la hauteur minimale */
    position: relative; /* Référence pour les éléments absolus */
}

/* Styles pour le carrousel d'images de fond avec optimisations */
.slide {
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 1;
}

/* Styles pour les éléments de formulaire */
.input-style {
  padding: var(--spacing-3) var(--spacing-4);
  border-radius: var(--spacing-2);
  border: 2px solid var(--color-border-light);
  transition: border-color 0.3s ease;
  outline: none;
  color: var(--color-text-dark);
  font-size: var(--font-size-base);
  width: 100%;
  background-color: white;
}

.input-style:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(3, 206, 3, 0.1);
}

.input-style:invalid {
  border-color: var(--color-error);
}

/* Animation pour les erreurs */
.error-message {
  color: var(--color-error);
  font-size: var(--font-size-xs);
  margin-top: 0.25rem;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* Optimisations pour les performances */
.main-content {
  contain: layout style paint;
}

/* Styles responsive améliorés */
@media (max-width: 768px) {
  :root {
    --font-size-4xl: 2rem;
    --font-size-6xl: 3rem;
    --font-size-2xl: 1.5rem;
    --font-size-lg: 1.75rem;
  }
}

/* Amélioration de l'accessibilité */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mode sombre si préféré */
@media (prefers-color-scheme: dark) {
  .auto-dark {
    --color-text-dark: #f9fafb;
    --color-bg-light: #1f2937;
    --color-border-light: #4b5563;
  }
}

/* Loading spinner pour les états de chargement */
.loading-spinner {
  border: 2px solid var(--color-border-light);
  border-top: 2px solid var(--color-primary);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 8px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Footer optimisé */
footer {
  max-width: 1250px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 20;
  background: white;
  border-radius: 10px;
  margin-top: auto;
}

.footer_top_section {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.footer_top_section a {
  color: var(--color-text-dark);
  text-decoration: none;
  font-weight: 400;
  margin: 0 10px;
  transition: color 0.3s ease;
}

.footer_top_section a:hover,
.footer_top_section a:focus {
  color: var(--color-primary);
  text-decoration: underline;
}

.footer_bottom_section {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-medium);
}

.footer_bottom_section p {
  max-width: 800px;
  margin: 10px auto;
  line-height: 1.5;
}

/* Modal optimisé */
.app_overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(2px);
}

.app_modal {
  background: white;
  border-radius: 10px;
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
  position: relative;
  padding: 20px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.button_close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-medium);
  z-index: 1001;
  padding: 5px;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.button_close:hover,
.button_close:focus {
  background-color: var(--color-bg-light);
  color: var(--color-text-dark);
}

.modal-content {
  margin-top: 20px;
  line-height: 1.6;
}

.modal-content h1,
.modal-content h2,
.modal-content h3 {
  color: var(--color-text-dark);
  margin-bottom: 1rem;
}

.modal-content p {
  margin-bottom: 1rem;
  color: var(--color-text-medium);
}


/* Mobile (jusqu'à 640px) */
@media (max-width: 640px) {
    .main-content {
        grid-template-columns: 1fr;
        padding: 8px;
        height: 100vh;
        overflow: hidden;
    }
    
    #text-slider {
        padding: 15px;
        height: 30vh; /* Limiter la hauteur du texte */
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    #text-slider h1 {
        font-size: 1.8rem;
        margin-bottom: 8px;
        line-height: 1.2;
    }
    
    #text-slider p {
        font-size: 0.9rem;
        margin-bottom: 4px;
    }
    
    /* Formulaire mobile */
    .col-span-1.md\:col-span-1.lg\:col-span-3 {
        height: 65vh;
        padding: 15px;
        margin: 0 5px;
        overflow-y: auto;
        border-radius: 15px;
    }
    
    /* Footer mobile */
    footer {
        bottom: 5px;
        padding: 5px;
        font-size: 0.6rem;
    }
    
    .footer_top_section {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .footer_top_section a {
        font-size: 0.65rem;
        margin: 0 3px;
    }
    
    .footer_bottom_section p {
        display: none; /* Masquer le texte long sur mobile */
    }
}

/* Tablette portrait (641px à 768px) */
@media (min-width: 641px) and (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        height: 100vh;
        overflow: hidden;
    }
    
    #text-slider {
        padding: 20px;
        height: 100vh;
    }
    
    #text-slider h1 {
        font-size: 2.2rem;
    }
    
    .col-span-1.md\:col-span-1.lg\:col-span-3 {
        height: 90vh;
        overflow-y: auto;
        margin-right: 10px;
    }
    
    footer {
        bottom: 8px;
        max-width: 90%;
    }
}

/* Tablette paysage (769px à 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-content {
        grid-template-columns: 2fr 3fr;
        height: 100vh;
        padding: 15px;
    }
    
    #text-slider {
        height: 100vh;
        padding: 25px;
    }
    
    .col-span-1.md\:col-span-1.lg\:col-span-3 {
        height: 85vh;
        overflow-y: auto;
        margin-right: 15px;
    }
}

/* Desktop (1025px et plus) */
@media (min-width: 1025px) {
    .main-content {
        height: 100vh;
        overflow: hidden;
    }
    
    .col-span-1.md\:col-span-1.lg\:col-span-3 {
        height: 80vh;
        overflow-y: auto;
    }
}

/* Très petits écrans (320px à 480px) */
@media (max-width: 480px) {
    #text-slider h1 {
        font-size: 1.5rem;
    }
    
    #text-slider p:first-of-type {
        font-size: 0.8rem;
    }
    
    #text-slider p:last-of-type {
        display: none; /* Masquer le sous-titre sur très petits écrans */
    }
    
    .col-span-1.md\:col-span-1.lg\:col-span-3 {
        height: 70vh;
        padding: 10px;
    }
    
    .col-span-1.md\:col-span-1.lg\:col-span-3 h2 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    /* Réduire la taille des boutons sur mobile */
    .option-card {
        padding: 15px;
    }
    
    .gender-option {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

/* Orientation paysage mobile */
@media (max-width: 768px) and (orientation: landscape) {
    #text-slider {
        height: 50vh;
        padding: 10px;
    }
    
    .col-span-1.md\:col-span-1.lg\:col-span-3 {
        height: 45vh;
    }
    
    footer {
        position: fixed;
        bottom: 0;
        height: 5vh;
        overflow: hidden;
    }
    
    .footer_bottom_section p {
        display: none;
    }
}


/* Utilisation conditionnelle */
@media (max-width: 640px) {
    :root {
        --font-size-4xl: 1.8rem;
        --font-size-2xl: 1.2rem;
        --font-size-lg: 1rem;
        --spacing-4: 0.5rem;
        --spacing-8: 1rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    :root {
        --font-size-4xl: 2.2rem;
        --font-size-2xl: 1.4rem;
    }
}

/* Ajustements mobiles */
@media (max-width: 641px) {
  /* Réduction des tailles de texte */
  :root {
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.9rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.1rem;
    --font-size-xl: 1.2rem;
    --font-size-2xl: 1.4rem;
    --font-size-3xl: 1.6rem;
    --font-size-4xl: 1.8rem;
  }

  /* Réduction du padding global du formulaire */
  #formSection {
    padding: 1rem !important;
    max-width: 100% !important;
    margin: 0 auto;
    border-radius: 1rem;
  }

  /* Champs input moins grands */
  .input-style {
    font-size: 1rem;
    padding: 0.6rem 0.8rem;
  }

  /* Boutons adaptés */
  .next-btn,
  .prev-btn,
  #submitBtn {
    font-size: 1rem;
    padding: 0.8rem 1rem;
    width: 100%;
  }

  /* Espacement réduit entre les étapes */
  fieldset {
    margin-bottom: 1rem;
  }

  legend {
    font-size: 1.2rem !important;
    margin-bottom: 0.8rem;
  }
}
