*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: clamp(12px, 4vw, 20px);
    background: linear-gradient(135deg, #667eea, #764ba2);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    background: white;
    padding: clamp(24px, 6vw, 40px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}
h2 {
    text-align: center;
    color: #2c3e50;
    margin: 0 0 clamp(20px, 5vw, 30px);
    font-size: clamp(1.4rem, 1.1rem + 1.5vw, 1.75rem);
    overflow-wrap: break-word;
}
.form-group {
    position: relative;
    margin-bottom: 20px;
}
.form-group input {
    width: 100%;
    min-height: 48px;
    padding: 12px 48px 12px 50px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font: inherit;
    font-size: 16px; /* évite le zoom automatique d'iOS */
    transition: border-color 0.3s, box-shadow 0.3s;
}
.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102,126,234,0.2);
}
.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 18px;
    pointer-events: none;
}
.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: #6c757d;
    font-size: 16px;
}
.password-toggle:focus-visible,
button[type="submit"]:focus-visible,
.remember input:focus-visible {
    outline: 3px solid rgba(0,123,255,0.7);
    outline-offset: 2px;
}

button[type="submit"] {
    width: 100%;
    min-height: 48px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
    margin-top: 10px;
}
button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102,126,234,0.4);
}
.remember {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin: 12px 0;
    font-size: 14px;
    cursor: pointer;
}
.remember input { width: 18px; height: 18px; margin: 0; }
.error {
    color: #721c24;
    background: #f8d7da;
    padding: 12px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #dc3545;
    overflow-wrap: anywhere;
}

/* Sélecteur de langue */
body { flex-direction: column; gap: 16px; }
.lang-switcher { display: flex; gap: 4px; align-self: flex-end; }
.lang-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 36px; padding: 6px 12px;
    border-radius: 18px; text-decoration: none; font-weight: 600; font-size: 13px;
    background: rgba(255,255,255,0.9); color: #495057;
}
.lang-btn.active { background: linear-gradient(135deg, #007bff, #0056b3); color: white; }
.lang-btn:focus-visible { outline: 3px solid rgba(255,255,255,0.9); outline-offset: 2px; }

/* RTL (arabe) */
html[dir="rtl"] .form-group input { padding: 12px 50px 12px 48px; }
html[dir="rtl"] .input-icon { left: auto; right: 18px; }
html[dir="rtl"] .password-toggle { right: auto; left: 4px; }
html[dir="rtl"] .error { border-left: 0; border-right: 4px solid #dc3545; }

/* Messages de succès (déconnexion, mot de passe changé…) */
.success {
    color: #155724;
    background: #d4edda;
    padding: 12px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #28a745;
    overflow-wrap: anywhere;
}
html[dir="rtl"] .success { border-left: 0; border-right: 4px solid #28a745; }

/* Mot de passe oublié / réinitialisation */
.auth-link { text-align: center; margin: 18px 0 0; font-size: 14px; }
.auth-link a { color: #5a4fcf; font-weight: 600; text-decoration: none; }
.auth-link a:hover, .auth-link a:focus-visible { text-decoration: underline; }
.auth-intro { color: #495057; font-size: 15px; line-height: 1.5; margin: 0 0 20px; text-align: center; }
.form-group input.no-icon { padding-left: 16px; }
html[dir="rtl"] .form-group input.no-icon { padding-right: 16px; }
.hint { color: #6c757d; font-size: 13px; margin: -12px 0 16px; }

/* Version de l'application (fichier VERSION), en bas de la carte */
.app-version { text-align: center; margin: 18px 0 0; font-size: 12px; color: #868e96; }
