/* Variables globales
-------------------------------------------------- */
:root {
    /* Couleurs principales */
    --primary: #2C5282;
    --primary-dark: #1a365d;
    --primary-darker: #233876;
    --primary-light: #4A69BB;
    --secondary: #38A169;
    --accent: #805AD5;
    
    /* Couleurs sémantiques */
    --text-primary: #2D3748;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    
    /* Couleurs de fond */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7FAFC;
    --bg-tertiary: #EDF2F7;
    
    /* Couleurs d'état */
    --selected-bg: var(--primary-dark);
    --selected-border: #2b4c85;
    --selected-hover: var(--primary-darker);
    
    /* Bordures et ombres */
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.15);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.2);
    --shadow-selected: 0 2px 4px rgba(0, 0, 0, 0.2);
    
    /* Espacements */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
}

/* Reset et styles de base
-------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Avenir', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    min-height: 100vh;
    padding: var(--spacing-lg);
}

/* Container principal
-------------------------------------------------- */
.container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* En-tête
-------------------------------------------------- */
.header {
    background: var(--primary);
    color: white;
    padding: var(--spacing-xl);
    text-align: center;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

/* Sections du formulaire
-------------------------------------------------- */
.form-section {
    margin-bottom: var(--spacing-xl);
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    animation: fadeIn 0.3s ease-out;
    padding: var(--spacing-lg);
}

.form-section h2 {
    background: var(--primary);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 1.25rem;
    font-weight: 600;
    margin: calc(-1 * var(--spacing-lg));
    margin-bottom: var(--spacing-lg);
}

/* Groupes de formulaire
-------------------------------------------------- */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

/* Champs de saisie
-------------------------------------------------- */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: var(--spacing-sm);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: var(--transition-fast);
    background: var(--bg-primary);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

/* Radio et Checkbox améliorés
-------------------------------------------------- */
.radio-group,
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xs);
}

.radio-group label,
.checkbox-group label {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 6px;
    background: var(--bg-tertiary);
    transition: all var(--transition-normal);
    border: 2px solid transparent;
    user-select: none;
}

/* Style des inputs radio et checkbox */
.radio-group input[type="radio"],
.checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

/* Style des éléments sélectionnés - AMÉLIORÉ */
.radio-group input[type="radio"]:checked + label,
.checkbox-group input[type="checkbox"]:checked + label,
.radio-group label:has(input[type="radio"]:checked),
.checkbox-group label:has(input[type="checkbox"]:checked) {
    background: var(--selected-bg);
    color: #ffffff;
    border: 2px solid var(--selected-border);
    box-shadow: var(--shadow-selected);
    font-weight: 600;
    transform: scale(1.02);
}

/* Hover sur éléments sélectionnés */
.radio-group input[type="radio"]:checked + label:hover,
.checkbox-group input[type="checkbox"]:checked + label:hover,
.radio-group label:has(input[type="radio"]:checked):hover,
.checkbox-group label:has(input[type="checkbox"]:checked):hover {
    background: var(--selected-hover);
    transform: scale(1.02) translateX(4px);
}

/* Tableaux
-------------------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-md) 0;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th, td {
    padding: var(--spacing-sm);
    text-align: left;
    border: 1px solid var(--border-color);
}

th {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

tr:nth-child(even) {
    background: var(--bg-tertiary);
}

/* Style amélioré pour les cases à cocher dans les tableaux */
table input[type="radio"]:checked + label,
table input[type="checkbox"]:checked + label {
    background: var(--selected-bg);
    color: white;
    padding: var(--spacing-xs);
    border-radius: 4px;
    box-shadow: var(--shadow-selected);
}

/* Boutons
-------------------------------------------------- */
.button-group {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

button {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    filter: brightness(110%);
}

/* Conteneur de résultats
-------------------------------------------------- */
#resultsContainer {
    background: var(--bg-tertiary);
    padding: var(--spacing-xl);
    border-radius: 12px;
    margin-top: var(--spacing-xl);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

.result-column {
    background: var(--bg-primary);
    padding: var(--spacing-lg);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.result-column h3 {
    color: var(--primary);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--border-color);
}

/* Résumé
-------------------------------------------------- */
#summary {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

/* Responsive Design
-------------------------------------------------- */
@media (max-width: 768px) {
    .container {
        margin: var(--spacing-sm);
        border-radius: 8px;
    }
    
    .radio-group,
    .checkbox-group {
        flex-direction: column;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
}

/* Mode sombre
-------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1A202C;
        --bg-secondary: #2D3748;
        --bg-tertiary: #4A5568;
        --text-primary: #EDF2F7;
        --text-secondary: #E2E8F0;
        --border-color: #4A5568;
        --selected-bg: #2c5282;
        --selected-border: #4a69bb;
        --selected-hover: #1a365d;
    }

    input[type="radio"]:checked + label,
    input[type="checkbox"]:checked + label {
        background: var(--selected-bg);
        border-color: var(--selected-border);
    }

    input, textarea, select {
        background: var(--bg-secondary);
        color: var(--text-primary);
    }
}

/* Animations
-------------------------------------------------- */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Accessibilité
-------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Messages d'erreur
-------------------------------------------------- */
.error-message {
    color: #dc3545;
    padding: var(--spacing-xs);
    margin-top: var(--spacing-xs);
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease-out;
}

/* Styles spécifiques pour les échelles
-------------------------------------------------- */
#epworth-scale input:checked + label,
#berlin-questionnaire input:checked + label,
#beck-scale input:checked + label,
#had-scale input:checked + label,
#isi-scale input:checked + label,
#sleep-impatience input:checked + label {
    background: var(--selected-bg);
    color: white;
    border-radius: 4px;
    padding: var(--spacing-xs) var(--spacing-sm);
    box-shadow: var(--shadow-selected);
    font-weight: 500;
}


/* Conteneur pour la navigation */
.form-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

/* Style pour le conteneur des boutons */
.navigation-buttons {
    display: flex;
    gap: 1rem;
    flex: 1;
    justify-content: center;
}

/* Style commun pour les boutons de navigation */
.nav-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Style spécifique pour le bouton Précédent */
#prevButton {
    background-color: #e0e0e0;
    color: #333;
}

#prevButton:hover {
    background-color: #d0d0d0;
}

/* Style spécifique pour le bouton Suivant */
#nextButton {
    background-color: var(--primary);
    color: white;
}

#nextButton:hover {
    background-color: var(--primary-light);
}

/* Style pour le compteur de progression */
.progress-counter {
    padding: 0.5rem 1rem;
    background-color: var(--primary);
    color: white;
    border-radius: 20px;
    font-weight: 500;
    min-width: 80px;
    text-align: center;
}

/* Ajout d'espace en bas du formulaire pour éviter que le contenu ne soit caché par la barre de navigation fixe */
form {
    padding-bottom: 80px;
}

/* Responsive design */
@media (max-width: 768px) {
    .form-navigation {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .navigation-buttons {
        width: 100%;
    }

    .nav-button {
        flex: 1;
    }
}












/* Style du tableau Epworth */
#epworth-scale table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

/* En-tête du tableau */
#epworth-scale th {
    background-color: #2C5282;
    color: white;
    padding: 15px 20px;
    text-align: center;
    font-weight: 600;
}

/* Cellules du tableau */
#epworth-scale td {
    padding: 15px 20px;
    vertical-align: middle;
}

/* Cellules cliquables (celles avec les boutons radio) */
#epworth-scale td:not(:first-child) {
    position: relative;
    cursor: pointer;
    text-align: center;
    width: 80px;
    transition: background-color 0.2s ease;
    user-select: none;
}

/* Style moderne des boutons radio */
#epworth-scale input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid #CBD5E0;
    border-radius: 50%;
    outline: none;
    margin: 0;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Point central du bouton radio coché */
#epworth-scale input[type="radio"]:checked {
    border-color: #2C5282;
    background-color: #2C5282;
    box-shadow: 0 0 0 2px white inset;
}

/* Effet hover sur les cellules */
#epworth-scale td:not(:first-child):hover {
    background-color: #EBF4FF;
}

/* Style de la cellule avec radio coché */
#epworth-scale td:has(input[type="radio"]:checked) {
    background-color: #E2EEFF;
}

/* Style pour la première colonne (questions) */
#epworth-scale td:first-child {
    max-width: 400px;
    padding-right: 25px;
    color: #2D3748;
    font-weight: 500;
}

/* Style des lignes alternées pour meilleure lisibilité */
#epworth-scale tr:nth-child(even) {
    background-color: #F7FAFC;
}

/* Focus visible pour l'accessibilité */
#epworth-scale input[type="radio"]:focus-visible {
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.3);
}

/* Style responsive */
@media (max-width: 768px) {
    #epworth-scale td,
    #epworth-scale th {
        padding: 12px 10px;
    }
    
    #epworth-scale input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    
    #epworth-scale td:first-child {
        max-width: 250px;
        padding-right: 15px;
    }
}












/* Style du tableau ISI */
#isi-scale table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

/* En-tête du tableau */
#isi-scale th {
    background-color: #2C5282;
    color: white;
    padding: 15px 20px;
    text-align: center;
    font-weight: 600;
}

/* Cellules du tableau */
#isi-scale td {
    padding: 15px 20px;
    vertical-align: middle;
}

/* Cellules cliquables avec boutons radio */
#isi-scale td:not(:first-child) {
    position: relative;
    cursor: pointer;
    text-align: center;
    width: 80px;
    transition: background-color 0.2s ease;
    user-select: none;
}

/* Style moderne des boutons radio */
#isi-scale input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid #CBD5E0;
    border-radius: 50%;
    outline: none;
    margin: 0;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Point central du bouton radio coché */
#isi-scale input[type="radio"]:checked {
    border-color: #2C5282;
    background-color: #2C5282;
    box-shadow: 0 0 0 2px white inset;
}

/* Effet hover sur les cellules */
#isi-scale td:not(:first-child):hover {
    background-color: #EBF4FF;
}

/* Style de la cellule avec radio coché */
#isi-scale td:has(input[type="radio"]:checked) {
    background-color: #E2EEFF;
}

/* Première colonne (texte des difficultés) */
#isi-scale td:first-child {
    max-width: 400px;
    padding-right: 25px;
    color: #2D3748;
    font-weight: 500;
}

/* Lignes alternées */
#isi-scale tr:nth-child(even) {
    background-color: #F7FAFC;
}

/* Focus visible */
#isi-scale input[type="radio"]:focus-visible {
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    #isi-scale td,
    #isi-scale th {
        padding: 12px 10px;
    }
    
    #isi-scale input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    
    #isi-scale td:first-child {
        max-width: 250px;
        padding-right: 15px;
    }
}


/* Style commun pour Epworth et ISI */
#epworth-scale input[type="radio"],
#isi-scale input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #CBD5E0;
    border-radius: 50%;
    outline: none;
    margin: 0;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Point central quand coché */
#epworth-scale input[type="radio"]:checked,
#isi-scale input[type="radio"]:checked {
    border-color: #2C5282;
    background-color: #2C5282;
    box-shadow: 0 0 0 2px white inset;
}

/* Cellules cliquables */
#epworth-scale td:not(:first-child),
#isi-scale td:not(:first-child) {
    position: relative;
    cursor: pointer;
    text-align: center;
    width: 60px; /* Réduit la largeur des colonnes */
    transition: background-color 0.2s ease;
    user-select: none;
    padding: 12px 15px; /* Ajusté le padding */
}

/* Focus visible pour l'accessibilité */
#epworth-scale input[type="radio"]:focus-visible,
#isi-scale input[type="radio"]:focus-visible {
    box-shadow: 0 0 0 2px rgba(44, 82, 130, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    #epworth-scale input[type="radio"],
    #isi-scale input[type="radio"] {
        width: 14px;
        height: 14px;
    }
}