/* Variables CSS (pour la modernité et la cohérence) */
:root {
    --color-primary: #1e40af; /* Bleu profond, moderne */
    --color-primary-hover: #1d4ed8; 
    --color-text: #1f2937; /* Gris très foncé */
    --color-background: #f3f4f6; /* Gris clair pour le corps */
    --color-card-bg: #ffffff;
    --color-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius-lg: 12px;
    --transition-fast: all 0.2s ease-in-out;
}

/* 1. Base et Layout Général */
.login-modern-body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--color-background);
    color: var(--color-text);
    /* Optionnel : Ajout d'un fond texturé ou dégradé plus immersif */
    background-image: linear-gradient(135deg, #e0f2fe 0%, #f3f4f6 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.login-container {
    flex-grow: 1;
    display: flex;
    align-items: center; /* Centrage vertical */
    justify-content: center; /* Centrage horizontal */
    padding: 20px;
    /* Gère le cas où le contenu est plus grand que le viewport (mobile) */
    overflow-y: auto; 
}

/* 2. La Carte de Connexion (Le "Conteneur") */
.login-card-modern {
    display: flex;
    flex-direction: column; /* Mobile first : contenu en colonne */
    width: 100%;
    max-width: 400px; /* Largeur maximale pour mobile */
    background-color: var(--color-card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--color-shadow);
    overflow: hidden; /* Pour que les coins arrondis fonctionnent bien avec les sous-sections */
    transition: var(--transition-fast);
}

/* 3. Section Branding (Logo/Visuel) */
.login-branding-area {
    background-color: var(--color-primary); /* Couleur d'accentuation */
    color: white;
    padding: 40px 20px;
    text-align: center;
}

.branding-logo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.app-logo-modern {
    width: 60px; /* Petite taille pour un logo moderne */
    height: 60px;
    margin-bottom: 10px;
    /* Optionnel : ajouter un filtre pour le rendre blanc si nécessaire */
    /* filter: invert(1); */ 
}

.app-logo-placeholder {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.branding-slogan {
    font-size: 0.9rem;
    font-weight: 300;
    margin: 0;
    opacity: 0.9;
}


/* 4. Section Formulaire */
.login-form-area {
    padding: 30px;
}

.login-form-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--color-text);
}

.login-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin-bottom: 25px;
}

/* 5. Styles des Champs de Formulaire */
.form-group-modern {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

.form-control-modern {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--color-text);
    background-color: #f9fafb; /* Très léger gris pour le champ */
    border: 1px solid #d1d5db; /* Bordure légère */
    border-radius: 8px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control-modern:focus {
    color: var(--color-text);
    background-color: var(--color-card-bg);
    border-color: var(--color-primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.2); /* Anneau de focus élégant */
}

/* Validation moderne */
.needs-validation.was-validated .form-control-modern:invalid {
    border-color: #dc3545; /* Rouge d'erreur */
    padding-right: 2.25rem; /* Espace pour une icône si vous l'ajoutez */
}

.invalid-feedback-modern {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.needs-validation.was-validated .form-control-modern:invalid ~ .invalid-feedback-modern {
    display: block;
}

/* 6. Options (Se souvenir / Mdp oublié) */
.form-options-modern {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 0.85rem;
}

.form-check-input {
    margin-top: 0.15em;
    margin-right: 0.5em;
}

.small-label {
    font-size: 0.85rem;
    color: #4b5563; /* Gris pour les petits textes */
}

.forgot-link {
    color: #6b7280;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.forgot-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* 7. Bouton Principal */
.btn-primary-modern {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background-color: var(--color-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
    gap: 8px; /* Espace entre le texte et l'icône */
}

.btn-primary-modern:hover {
    background-color: var(--color-primary-hover);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
}

/* 8. Messages */
.login-message-area {
    margin-top: 20px;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    /* Les styles de succès/erreur seront gérés par JS en ajoutant des classes */
    /* Ex: .login-message-area.error { background-color: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; } */
}

/* 9. Pied de page */
.login-footer-modern {
    margin-top: 20px;
    padding: 10px;
    text-align: center;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* 10. RESPONSIVE DESIGN pour Écrans Larges (Tablette et Desktop) */
@media (min-width: 768px) {
    .login-card-modern {
        flex-direction: row; /* Colonnes sur desktop */
        max-width: 850px; /* Plus large pour accueillir deux colonnes */
    }

    .login-branding-area {
        flex: 1; /* Prend 50% de la largeur */
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 50px;
        /* Sur desktop, on peut rendre le visuel plus impactant (exemple de dégradé) */
        background: linear-gradient(135deg, var(--color-primary), #3b82f6);
        border-radius: var(--border-radius-lg) 0 0 var(--border-radius-lg); /* Coins arrondis seulement à gauche */
    }
    
    .login-form-area {
        flex: 1; /* Prend 50% de la largeur */
        padding: 40px 50px;
    }
    
    .app-logo-modern, .app-logo-placeholder {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }
    
    .branding-slogan {
        font-size: 1.1rem;
        margin-top: 15px;
    }
}