/**
 * @file app/modules/Login/assets/css/login.css
 * @description Styles modernes, responsives (mobile-first) et accessibles pour le module de connexion.
 * @version 2.0
 */

/* Utilisation de Flexbox pour un centrage vertical et horizontal parfait */
.page-connexion {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh; /* Prend toute la hauteur de l'écran */
    width: 100%;
    padding: 1rem; /* Espace sur les côtés pour les petits écrans */
    box-sizing: border-box;
}

.bg {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: var(--color-accent, #0a4a6b); /* Couleur de secours */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 900'%3E%3Cpolygon fill='%23e57c0c' points='957 450 539 900 1396 900'/%3E%3Cpolygon fill='%23aa5c09' points='957 450 872.9 900 1396 900'/%3E%3Cpolygon fill='%23d88600' points='-60 900 398 662 816 900'/%3E%3Cpolygon fill='%239f6200' points='337 900 398 662 816 900'/%3E%3Cpolygon fill='%23c98e00' points='1203 546 1552 900 876 900'/%3E%3Cpolygon fill='%23936800' points='1203 546 1552 900 1162 900'/%3E%3Cpolygon fill='%23b78200' points='1710 900 1401 632 1365 900'/%3E%3Cpolygon fill='%239aa300' points='1210 900 971 687 725 900'/%3E%3Cpolygon fill='%236e7400' points='943 900 1210 900 971 687'/%3E%3C/svg%3E");
    background-attachment: fixed;
    background-size: cover;
    z-index: 0;
    filter: blur(2px); /* Effet de flou pour mettre le focus sur le formulaire */
}

.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px; /* Légèrement plus large */
    background-color: var(--color-primary, #e57c0c);
    border-radius: 12px;
    padding: 2rem; /* Plus d'espace intérieur */
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04));
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px); /* Effet de verre dépoli si le fond est visible */
    transform: scale(1);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.login-container .title {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-container .title img {
    max-width: 100%; 
    height: auto;
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600; /* Semi-bold */
    color: var(--text-white, #fff);
    font-size: 0.9rem;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid transparent; /* Bordure transparente par défaut */
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-white, #fff);
    outline: none;
    transition: all 0.2s ease-in-out;
}

.login-form input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Amélioration du focus pour l'accessibilité */
.login-form input:focus, .login-form input:focus-visible {
    border-color: var(--color-accent, #fff);
    background-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}

/* Style du bouton avec état de chargement */
.login-form .button {
    position: relative;
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.login-form .button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.login-form .button:active:not(:disabled) {
    transform: translateY(0);
}

.login-form .button:disabled {
    cursor: wait;
    background-color: #999;
}

/* Spinner pour l'état de chargement du bouton */
.button .spinner {
    display: none;
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.2rem;
    height: 1.2rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.button.loading .spinner { display: block; }
.button.loading .btn-text { visibility: hidden; }

.message-area {
    font-size: 0.9rem;
    text-align: center;
    color: var(--text-white, #fff);
    font-weight: 500;
    padding: 0.8rem;
    margin: 1rem 0;
    border-radius: 8px;
    display: none; /* Géré par JS */
}

.message-area.success { background-color: var(--color-success, #28a745); }
.message-area.error { background-color: var(--color-danger, #dc3545); }

.login-links {
    margin-top: 1.5rem;
    text-align: center;
}

.login-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.login-links a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Animation de secousse */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}
.shake {
    animation: shake 0.5s ease-in-out;
}

/* Spinner Keyframes */
@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Styles pour écrans plus larges (Desktop) */
@media (min-width: 768px) {
    .login-container {
        padding: 2.5rem;
    }
}