/* --- Variables CSS pour une personnalisation facile --- */
:root {
    --primary-color: #4a90e2; /* Bleu doux */
    --secondary-color: #50e3c2; /* Turquoise */
    --gradient-start: var(--primary-color);
    --gradient-end: var(--secondary-color);
    --text-color: #333;
    --input-bg: #f7f9fc;
    --input-border: #dde4ee;
    --input-focus-border: var(--primary-color);
    --input-icon-color: #a0aec0;
    --white-color: #ffffff;
    --error-bg: #ffebee;
    --error-text: #c62828;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --font-family: 'Poppins', sans-serif;
}

/* --- Réinitialisation et styles de base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    color: var(--text-color);
    /* Dégradé animé */
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px; /* Espace pour les petits écrans */
}

/* Animation du dégradé de fond */
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Conteneur principal --- */
.login-wrapper {
    width: 100%;
    max-width: 450px; /* Largeur maximale du conteneur */
}

.login-container {
    background: var(--white-color);
    border-radius: 20px; /* Coins plus arrondis */
    box-shadow: 0 15px 35px var(--shadow-color), 0 5px 15px rgba(0,0,0,0.07);
    padding: 40px 35px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden; /* Pour contenir les éléments enfants */
}

/* Animation d'entrée pour le conteneur */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
.animated-entry {
    animation: fadeInScale 0.6s ease-out forwards;
}

/* --- En-tête du formulaire --- */
.login-header {
    margin-bottom: 30px;
}

.header-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: inline-block; /* Permet le margin */
}

.login-header h2 {
    color: var(--text-color);
    margin-bottom: 8px;
    font-size: 1.8rem; /* Taille de police augmentée */
    font-weight: 600;
}

.login-header p {
    color: #777;
    font-size: 0.95rem;
}

/* --- Groupe d'entrée (label + icône + input) --- */
.input-group {
    position: relative;
    margin-bottom: 20px; /* Espacement entre les champs */
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--input-icon-color);
    font-size: 1rem;
    pointer-events: none; /* L'icône ne bloque pas le clic sur l'input */
}

/* --- Champs Input & Select --- */
.formulaire-connexion input[type="text"],
.formulaire-connexion input[type="password"],
.formulaire-connexion select {
    width: 100%;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    padding: 14px 15px 14px 45px; /* Espace pour l'icône à gauche */
    border-radius: 10px; /* Coins arrondis */
    font-size: 1rem;
    color: var(--text-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    appearance: none; /* Supprime style natif du select */
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Style spécifique pour le select pour la flèche */
.input-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0aec0' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px 12px;
    padding-right: 40px; /* Espace pour la flèche */
}

/* Placeholder style */
.formulaire-connexion input::placeholder {
    color: #a0aec0;
    opacity: 1; /* Firefox */
}
.formulaire-connexion select:required:invalid { /* Style pour l'option disabled */
    color: #a0aec0;
}
.formulaire-connexion option[value=""][disabled] {
    display: none; /* Cache l'option par défaut dans la liste déroulante */
}
.formulaire-connexion option {
    color: var(--text-color); /* Couleur des options */
}

/* Focus state */
.formulaire-connexion input:focus,
.formulaire-connexion select:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2); /* Ombre douce au focus */
}

/* Bouton Afficher/Masquer mot de passe */
.toggle-password {
    position: absolute;
    right: 1px; /* Légèrement décalé du bord */
    top: 1px; /* Légèrement décalé du bord */
    bottom: 1px; /* Légèrement décalé du bord */
    width: 45px; /* Largeur cliquable */
    background: none;
    border: none;
    border-radius: 0 9px 9px 0; /* Arrondi côté droit */
    padding: 0 12px;
    cursor: pointer;
    color: var(--input-icon-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}
.toggle-password:hover {
    background-color: rgba(0,0,0,0.05);
}
.toggle-password i {
     font-size: 1rem;
}

/* --- Bouton de soumission --- */
.btn-submit {
    width: 100%;
    background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
    border: none;
    color: var(--white-color);
    padding: 14px 15px;
    border-radius: 10px;
    font-weight: 600; /* Texte en gras */
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.3s ease;
    margin-top: 10px; /* Espace avant le bouton */
    display: flex; /* Pour aligner icône et texte */
    align-items: center;
    justify-content: center;
    gap: 8px; /* Espace entre icône et texte */
}

.btn-submit:hover {
    transform: translateY(-3px); /* Léger soulèvement */
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.3);
}

.btn-submit:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.2);
}

/* --- Message d'erreur --- */
.error-banner {
    background-color: var(--error-bg);
    color: var(--error-text);
    padding: 12px 15px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 20px; /* Espace sous l'erreur */
    border: 1px solid rgba(198, 40, 40, 0.3);
    display: flex; /* Aligner icône et texte */
    align-items: center;
    gap: 10px; /* Espace entre icône et texte */
    animation: shake 0.5s ease-in-out; /* Animation pour attirer l'attention */
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* --- Pied de page --- */
.login-footer {
    margin-top: 30px;
    font-size: 0.85rem;
    color: #999;
}

/* --- Classe utilitaire pour 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-width: 0;
}

/* --- Responsive Design --- */
@media (max-width: 480px) {
    body {
        padding: 10px; /* Moins de padding sur mobile */
    }
    .login-container {
        padding: 25px 20px; /* Moins de padding interne */
        border-radius: 15px; /* Moins arrondi */
    }
    .login-header h2 {
        font-size: 1.5rem;
    }
    .header-icon {
        font-size: 2.5rem;
    }
    .formulaire-connexion input[type="text"],
    .formulaire-connexion input[type="password"],
    .formulaire-connexion select,
    .btn-submit {
        font-size: 0.95rem; /* Taille de police légèrement réduite */
        padding: 12px 15px 12px 40px; /* Ajuster padding */
    }
    .btn-submit {
         padding: 12px 15px;
    }
    .input-icon {
        left: 12px;
        font-size: 0.9rem;
    }
     .toggle-password {
         width: 40px;
         padding: 0 10px;
     }
     .toggle-password i {
         font-size: 0.9rem;
     }
     .input-group select {
         background-position: right 12px center;
     }
}