/* Habillage des pages de connexion : login, activation 2FA, verification 2FA.
   Ces trois pages n'utilisent pas le theme de l'application ; cette feuille se
   suffit a elle-meme.

   Le degrade #47AD4F -> #1E7A3C est le seul "theme" du fichier : il revient sur
   le fond, le logo, le bouton, la case a cocher et l'icone bouclier. */

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

/* ---- Fond degrade anime + formes flottantes ---- */
.modern-bg-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0; overflow: hidden;
}
.modern-bg-gradient {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg,
        rgba(71, 173, 79, 0.88) 0%,      /* vert BG GROUPE */
        rgba(30, 122, 60, 0.88) 25%,     /* vert fonce */
        rgba(140, 198, 63, 0.88) 50%,    /* vert clair */
        rgba(0, 150, 136, 0.88) 75%,     /* vert-bleu */
        rgba(56, 193, 114, 0.88) 100%);  /* vert vif */
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.modern-bg-shapes { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.shape {
    position: absolute; border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}
.shape-1 { width: 300px; height: 300px; top: -100px; left: -100px; animation: float 20s ease-in-out infinite; }
.shape-2 { width: 200px; height: 200px; top: 60%; right: -50px; animation: float 15s ease-in-out infinite reverse; }
.shape-3 { width: 150px; height: 150px; bottom: 10%; left: 10%; animation: float 18s ease-in-out infinite; }
.shape-4 { width: 250px; height: 250px; top: 20%; right: 15%; animation: float 22s ease-in-out infinite reverse; }
@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* ---- Conteneur + carte ---- */
#modern-login-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; z-index: 1;
    overflow-y: auto;   /* la carte d'activation est haute : evite qu'elle soit coupee */
}
.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 50px 40px;
    width: 100%; max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: cardSlideUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: auto;
}
@keyframes cardSlideUp {
    from { opacity: 0; transform: translateY(50px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- En-tete de carte : logo + titres ---- */
.login-header { text-align: center; margin-bottom: 40px; }
.logo-wrapper {
    display: inline-block; margin-bottom: 20px; padding: 20px 30px;
    background: linear-gradient(135deg, #47AD4F 0%, #1E7A3C 100%);
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(71, 173, 79, 0.3);
}
.logo-image { width: 180px; max-width: 100%; height: auto; display: block; }
.login-title { font-size: 28px; font-weight: 700; color: #2d3748; margin: 0 0 10px 0; }
.login-subtitle { font-size: 14px; color: #718096; margin: 0; line-height: 1.6; }

/* Icone bouclier (page de verification) */
.security-icon {
    width: 80px; height: 80px; margin: 20px auto;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #47AD4F 0%, #1E7A3C 100%);
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(71, 173, 79, 0.3);
    animation: iconPulse 2s ease-in-out infinite;
}
.security-icon i { font-size: 36px; color: white; }
@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ---- Champs ---- */
.modern-form-group { margin-bottom: 30px; }
.modern-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: #4a5568; margin-bottom: 8px;
}
.modern-label i { color: #47AD4F; font-size: 16px; }
.modern-input-wrapper { position: relative; }
.modern-input {
    width: 100%; padding: 14px 16px; font-size: 15px;
    border: 2px solid #e2e8f0; border-radius: 12px;
    background: #ffffff; color: #2d3748;
    transition: all 0.3s ease; outline: none;
}
.modern-input:focus {
    border-color: #47AD4F;
    box-shadow: 0 0 0 4px rgba(71, 173, 79, 0.1);
    transform: translateY(-2px);
}
.modern-input::placeholder { color: #cbd5e0; }

/* Saisie du code : gros chiffres espaces */
.code-input {
    font-size: 32px; font-weight: 700; letter-spacing: 12px;
    text-align: center; font-family: 'Courier New', monospace;
}

/* Bouton "oeil" afficher/masquer le mot de passe */
.toggle-password {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: #a0aec0; cursor: pointer;
    padding: 8px; border-radius: 6px; transition: all 0.3s ease;
}
.toggle-password:hover { color: #47AD4F; background: rgba(71, 173, 79, 0.1); }

/* Case "Se souvenir de moi" */
.modern-form-options { margin-bottom: 30px; }
.modern-checkbox { display: flex; align-items: center; cursor: pointer; user-select: none; }
.modern-checkbox input[type="checkbox"] { display: none; }
.checkbox-custom {
    width: 20px; height: 20px; border: 2px solid #e2e8f0; border-radius: 6px;
    margin-right: 10px; position: relative; transition: all 0.3s ease; flex-shrink: 0;
}
.modern-checkbox input:checked + .checkbox-custom {
    background: linear-gradient(135deg, #47AD4F 0%, #1E7A3C 100%);
    border-color: #47AD4F;
}
.modern-checkbox input:checked + .checkbox-custom::after {
    content: '\2713';
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: white; font-size: 12px; font-weight: bold;
}
.checkbox-label { font-size: 14px; color: #4a5568; }

/* ---- Bouton principal ---- */
.modern-btn-submit {
    width: 100%; padding: 16px 24px; font-size: 16px; font-weight: 600;
    color: white; background: linear-gradient(135deg, #47AD4F 0%, #1E7A3C 100%);
    border: none; border-radius: 12px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(71, 173, 79, 0.4);
    margin-bottom: 20px;
}
.modern-btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(71, 173, 79, 0.5);
}
.modern-btn-submit:active { transform: translateY(0); }
.modern-btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Lien retour (pages 2FA) */
.back-link { text-align: center; }
.back-link a {
    color: #718096; text-decoration: none; font-size: 14px;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: 8px; transition: all 0.3s ease;
}
.back-link a:hover { color: #47AD4F; background: rgba(71, 173, 79, 0.1); }
.back-link a.disabled { opacity: 0.5; pointer-events: none; }

/* ---- Erreurs ---- */
.has-error .modern-input { border-color: #f56565; animation: shake 0.5s; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}
.help-block { color: #f56565; font-size: 13px; margin-top: 6px; }

/* Message d'erreur des pages 2FA */
.msg-2fa {
    display: none;
    background: #fff5f5; border: 1px solid #feb2b2; border-radius: 12px;
    color: #c53030; font-size: 14px; padding: 12px 16px; margin-bottom: 20px;
    text-align: center;
}

/* ---- Page d'activation : QR code et cle secrete ---- */
.qr-frame {
    display: inline-block; padding: 10px; background: #fff;
    border: 2px solid #47AD4F; border-radius: 12px; margin: 10px 0;
}
.qr-frame img { width: 220px; height: 220px; display: block; }
.secret-code {
    background: #f7fafc; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 8px 12px; font-family: monospace; font-size: 13px;
    word-break: break-all; color: #1E7A3C;
}
.setup-steps {
    text-align: left; font-size: 14px; color: #4a5568;
    margin: 0 0 20px; padding-left: 20px; line-height: 1.7;
}

/* ---- Responsive ---- */
@media (max-width: 576px) {
    .login-card { padding: 40px 30px; }
    .login-title { font-size: 24px; }
    .logo-image { width: 140px; }
    .code-input { font-size: 28px; letter-spacing: 8px; }
    .qr-frame img { width: 180px; height: 180px; }
}
