/* Réinitialisation de base et styles globaux */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f0f2f5; /* Fond gris clair */
    color: #333;
}

main {
    max-width: 960px;
    margin: 2rem auto;
    padding: 1rem;
}

/* Header et Navigation */
header {
    background-color: #ffffff;
    padding: 0 2rem;
    border-bottom: 1px solid #e0e0e0;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

nav a.logo {
    font-weight: bold;
    font-size: 1.5em;
    color: #333;
    text-decoration: none;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
}

nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
}

/* NOUVEAU : Style pour le texte de la version */
.app-version {
    color: #999; /* Couleur grise et discrète */
    font-size: 0.8em; /* Police plus petite */
    font-weight: 500;
    padding-left: 1rem; /* Ajoute un peu d'espace à gauche */
    border-left: 1px solid #e0e0e0; /* Petite ligne de séparation */
}

/* Titre principal du tableau de bord */
.dashboard-header {
    margin-bottom: 2rem;
}

/* Système de cartes */
.card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}

.card h2 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 1.25em;
}

/* Mise en page en grille pour les formulaires côte à côte */
.card-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Styles de formulaire */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input { /* Sélecteur modifié pour ne cibler que les inputs */
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* NOUVEAU : Style spécifique pour les selects dans les formulaires */
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.button.primary {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

.button.primary:hover {
    background-color: #0056b3;
}

.full-width {
    width: 100%;
}

/* Graphique */
.chart-container {
    height: 400px;
}

.chart-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

/* MODIFICATION : La largeur du select est maintenant automatique */
.chart-controls select {
    width: auto; /* Permet au select de prendre la largeur de son contenu */
    flex-grow: 1; /* Permet de grandir si nécessaire, mais sans forcer 100% */
    max-width: 250px; /* Limite la largeur maximale pour un meilleur design */
}

/* Tableau */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    font-weight: 600;
}

/* Boutons d'action dans le tableau */
.action-buttons {
    display: flex;
    gap: 1rem;
}

.edit-btn, .delete-btn {
    font-size: 1.2em;
    text-decoration: none;
}
.edit-btn { color: #007bff; }
.delete-btn { color: #dc3545; }

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

/* Styles pour les contrôles d'import/export */
.data-transfer-controls {
    display: flex;
    justify-content: flex-start; /* Aligner les boutons à gauche sous le tableau */
    gap: 15px; /* Espace entre les boutons */
    margin-top: 25px; /* Espace au-dessus des boutons */
    padding-top: 15px; /* Un peu de padding interne pour la carte si nécessaire */
    border-top: 1px solid #eee; /* Ligne de séparation optionnelle */
}

/* Réutilisation des styles généraux de .button pour les boutons d'import/export */
.data-transfer-controls .button {
    /* Ces propriétés sont déjà définies dans .button.primary et .button.secondary */
    /* Assurons-nous qu'elles sont cohérentes */
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 1em;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-flex; /* Garde la flexbox pour un meilleur alignement */
    align-items: center;
    justify-content: center;
    height: 40px; /* Hauteur fixe pour la cohérence */
    line-height: 1; /* Assure que le texte est centré */
    box-sizing: border-box; /* Important pour la hauteur */
    border: none; /* Pas de bordure par défaut */
}

/* Style pour le bouton "Importer les données" (bleu, comme primary) */
.data-transfer-controls .button.primary {
    background-color: #007bff; /* Bleu standard */
    color: white;
}

.data-transfer-controls .button.primary:hover {
    background-color: #0056b3;
}

/* Style pour le bouton "Exporter les données" (bleu, comme primary mais peut être un peu plus clair) */
.data-transfer-controls .button.secondary {
    background-color: #007bff; /* Gardons le bleu pour l'instant pour la cohérence */
    color: white;
    /* On peut le rendre un peu plus clair si on veut une légère différence */
    /* background-color: #6c757d; pour revenir au gris */
    /* Ou un bleu légèrement différent: background-color: #5cb85c; */
}

.data-transfer-controls .button.secondary:hover {
    background-color: #0056b3; /* Bleu plus foncé au survol */
}

/* S'assurer que le label qui agit comme bouton d'upload est aussi bien stylisé */
.data-transfer-controls .upload-label {
    /* Il héritera déjà des styles .button.primary */
}

/* Styles pour les inputs et selects */
input[type="number"],
input[type="text"],
select {
    /* S'assurer que ces styles sont appliqués partout où nécessaire */
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
/* NOUVEAU : Styles pour les pages de connexion et d'inscription */
.auth-container {
    max-width: 450px; /* Largeur maximale du formulaire */
    margin: 4rem auto; /* Centrage vertical et horizontal */
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.auth-container h1 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 2rem;
    font-size: 1.75em;
    color: #333;
}

.auth-container .form-group {
    margin-bottom: 1.5rem;
}

.auth-container .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.auth-container .form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.auth-container .button.primary.full-width {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    margin-top: 1rem;
}

.auth-container .auth-switch-link {
    text-align: center;
    margin-top: 1.5rem;
    color: #555;
}

.auth-container .auth-switch-link a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.auth-container .auth-switch-link a:hover {
    text-decoration: underline;
}

/* Styles pour le footer */
footer {
    text-align: center;
    margin-top: 4rem;
    color: #888;
}
/* Styles pour les boutons d'action dans les formulaires (ex: édition) */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    align-items: center; /* Aligne verticalement les boutons s'ils ont des hauteurs différentes */
}

/* Style général pour les boutons à l'intérieur de form-actions */
.form-actions .button {
    flex-grow: 0;
    width: auto;
    padding: 12px 20px; /* Augmenté pour un meilleur aspect */
    font-size: 1em;
    font-weight: 500; /* Police un peu plus grasse */
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    border: none;
}

/* NOUVEAU : Cible spécifique pour les liens stylisés en boutons */
a.button {
    display: inline-flex; /* Utilise flex pour un centrage vertical parfait */
    align-items: center;
}

/* Styles spécifiques pour le bouton primaire (Mettre à jour) */
.form-actions .button.primary {
    background-color: #007bff;
    color: white;
}

.form-actions .button.primary:hover {
    background-color: #0056b3;
}

/* Styles spécifiques pour le bouton secondaire (Annuler) */
.form-actions .button.secondary {
    background-color: #6c757d;
    color: white;
}

.form-actions .button.secondary:hover {
    background-color: #5a6268;
}

/* NOUVEAU : Styles pour l'indicateur d'IMC */
.bmi-value {
    margin-bottom: 8px;
    font-size: 0.9em;
}

.bmi-category {
    font-size: 0.9em;
    color: #555;
    margin-left: 5px;
}

.bmi-indicator {
    position: relative;
    width: 100%;
    max-width: 200px; /* Limite la largeur de l'indicateur */
    height: 10px;
}

.bmi-bar {
    display: flex;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    overflow: hidden; /* Assure que les coins des segments sont arrondis */
}

.bmi-segment {
    height: 100%;
}

/* Largeurs proportionnelles basées sur l'échelle 15-40 (25 points) */
/* Maigreur (<18.5) : 3.5 points = 14% */
.bmi-segment.underweight { background-color: #3498db; width: 14%; }
/* Normal (18.5-25) : 6.5 points = 26% */
.bmi-segment.normal { background-color: #2ecc71; width: 26%; }
/* Surpoids (25-30) : 5 points = 20% */
.bmi-segment.overweight { background-color: #f1c40f; width: 20%; }
/* Obésité I (30-35) : 5 points = 20% */
.bmi-segment.obese-1 { background-color: #e67e22; width: 20%; }
/* Obésité II+ (>35) : 5 points = 20% */
.bmi-segment.obese-2 { background-color: #e74c3c; width: 20%; }

.bmi-pointer {
    position: absolute;
    top: -3px; /* Positionne le curseur légèrement au-dessus de la barre */
    width: 4px;
    height: 16px;
    background-color: #34495e; /* Couleur sombre pour le curseur */
    border-radius: 2px;
    transform: translateX(-50%); /* Centre le curseur sur sa position 'left' */
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    z-index: 10;
}

/* Styles pour le footer */
footer {
    text-align: center;
    margin-top: 4rem;
    color: #888;
}

/* NOUVEAU : Style pour le lien "Mot de passe oublié" */
.auth-forgot-password {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9em;
}

.auth-forgot-password a {
    color: #555;
    text-decoration: none;
}

.auth-forgot-password a:hover {
    text-decoration: underline;
}