/* ============================================
   Page de Login - Style Moderne et Professionnel
   ============================================ */

/* Container principal de la page de login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 50%, #93c5fd 100%);
    position: relative;
    overflow: hidden;
}

/* Animation de fond avec des formes géométriques multiples */
.login-page::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 70%, transparent 100%);
    border-radius: 50%;
    top: -150px;
    right: -100px;
    animation: float 8s ease-in-out infinite;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.03) 70%, transparent 100%);
    border-radius: 50%;
    bottom: -100px;
    left: -80px;
    animation: float 10s ease-in-out infinite reverse;
}

/* Formes géométriques supplémentaires pour un design plus riche */
.login-page .bg-shape-1 {
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    top: 20%;
    left: 10%;
    animation: morphing 12s ease-in-out infinite;
}

.login-page .bg-shape-2 {
    position: absolute;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 63% 37% 54% 46% / 55% 48% 52% 45%;
    bottom: 25%;
    right: 15%;
    animation: morphing 15s ease-in-out infinite reverse;
}

.login-page .bg-shape-3 {
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: 60%;
    left: 15%;
    animation: float 7s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-30px) translateX(30px);
    }
}

@keyframes morphing {
    0%, 100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: rotate(0deg) scale(1);
    }
    25% {
        border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;
    }
    50% {
        border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
        transform: rotate(180deg) scale(1.1);
    }
    75% {
        border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;
    }
}

/* Conteneur du formulaire de login */
.login-container {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35), 0 10px 25px rgba(91, 127, 216, 0.2);
    padding: 50px 45px;
    max-width: 480px;
    width: 90%;
    position: relative;
    z-index: 1;
    animation: slideIn 0.6s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* Bande décorative en haut de la carte */
.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 50%, #3b82f6 100%);
    border-radius: 24px 24px 0 0;
}

/* Effet de brillance subtil */
.login-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    border-radius: 24px;
    pointer-events: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* En-tête du formulaire */
.login-container h2 {
    color: #2c3e50;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    text-align: center;
    letter-spacing: -0.5px;
}

.login-subtitle {
    color: #7f8c8d;
    font-size: 15px;
    text-align: center;
    margin-bottom: 35px;
    font-weight: 400;
    line-height: 1.5;
}

/* Logo/Icon au-dessus du titre */
.login-icon {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
}

.login-icon i {
    font-size: 70px;
    color: #3b82f6;
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    position: relative;
    animation: iconPulse 3s ease-in-out infinite;
}

/* Cercle décoratif derrière l'icône */
.login-icon::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(96, 165, 250, 0.15) 100%);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    animation: iconGlow 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes iconGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(59, 130, 246, 0.5);
    }
}

/* Styles du formulaire */
.login-container form {
    margin-top: 30px;
}

.login-container .form-group {
    margin-bottom: 25px;
}

.login-container label {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

/* Champs de formulaire améliorés */
.login-container input[type="text"],
.login-container input[type="password"],
.login-container input[type="email"] {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e8ecef;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    color: #333;
    font-weight: 400;
}

.login-container input[type="text"]:hover,
.login-container input[type="password"]:hover,
.login-container input[type="email"]:hover {
    border-color: #cbd5e0;
    background-color: #ffffff;
}

.login-container input[type="text"]:focus,
.login-container input[type="password"]:focus,
.login-container input[type="email"]:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

/* Message d'erreur */
.login-container .error,
.login-container .errorlist {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 5px;
    list-style: none;
    padding: 0;
}

.login-container .errorlist li {
    margin-bottom: 5px;
}

/* Bouton de soumission */
.login-container .button-holder {
    margin-top: 30px;
    margin-bottom: 20px;
}

.login-container .submit.button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.login-container .submit.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
}

.login-container .submit.button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

/* Lien "Mot de passe oublié" */
.login-container a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
}

.login-container a:hover {
    color: #2563eb;
    text-decoration: underline;
}

.password-reset-link {
    text-align: center;
    display: block;
    margin-top: 20px;
}

/* Messages d'alerte Django */
.alert-box {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-box.warning {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.alert-box.error {
    background-color: #f8d7da;
    border: 1px solid #e74c3c;
    color: #721c24;
}

.alert-box.success {
    background-color: #d4edda;
    border: 1px solid #28a745;
    color: #155724;
}

/* Checkbox "Se souvenir de moi" si présent */
.remember-me {
    display: flex;
    align-items: center;
    margin-top: 15px;
}

.remember-me input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
}

.remember-me label {
    margin-bottom: 0;
    font-weight: 400;
    cursor: pointer;
}

/* Footer du formulaire */
.login-footer {
    text-align: center;
    margin-top: 35px;
    padding-top: 25px;
    border-top: 1px solid #e8ecef;
    color: #95a5a6;
    font-size: 13px;
}

/* Séparateur décoratif avant le footer */
.login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 25px 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e8ecef;
}

.login-divider span {
    padding: 0 15px;
    color: #95a5a6;
    font-size: 13px;
    font-weight: 500;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .login-container {
        padding: 40px 25px;
        max-width: 90%;
    }

    .login-container h2 {
        font-size: 24px;
    }

    .login-icon i {
        font-size: 50px;
    }
}

@media screen and (max-width: 480px) {
    .login-container {
        padding: 30px 20px;
    }

    .login-container h2 {
        font-size: 22px;
    }
}

/* Amélioration pour Crispy Forms */
.login-container .form-group .control-label {
    font-weight: 600;
    color: #333;
}

.login-container .form-control {
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    padding: 14px 18px;
    background-color: #f8f9fa;
}

.login-container .form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* Animation de chargement */
.loading-spinner {
    display: none;
    text-align: center;
    margin-top: 20px;
}

.loading-spinner.active {
    display: block;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
