Key Features:
Modern UI Design:
- Clean, minimalist interface with rounded corners
- Soft shadows and smooth animations
- Segoe UI system font for modern typography
Popup Functionality:
- Centered modal with scale-in animation
- Semi-transparent overlay that dims the background
- Close button (×) in top-right corner
- Closes when clicking outside or pressing Escape
Form Elements:
- Email/username field
- Password field
- "Remember me" checkbox
- "Forgot password?" link
- Submit button with hover animation
Interactive Effects:
- Input field focus effects with soft glow
- Button hover and active states
- Smooth transitions for all interactive elements
- Social login options (visual only)
Responsive Design:
- Adapts to mobile screens
- Proper spacing and sizing on all devices
- Stacked layout for smaller screens
Accessibility:
- Proper labels for all form fields
- Keyboard navigation (Escape to close)
- Focus states for interactive elements
The form includes all the requested features and provides a polished user experience with smooth animations and intuitive interactions. The JavaScript handles the modal opening/closing functionality while maintaining accessibility standards.
/* Base Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: #f5f7fa;
}
/* Trigger Button */
.login-trigger {
padding: 12px 24px;
background: #4a6cf7;
color: white;
border: none;
border-radius: 6px;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 12px rgba(74, 108, 247, 0.2);
}
.login-trigger:hover {
background: #3a5ce4;
transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(74, 108, 247, 0.3);
}
.login-trigger:active {
transform: translateY(0);
}
/* Overlay */
.overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(5px);
display: none;
justify-content: center;
align-items: center;
z-index: 1000;
opacity: 0;
transition: opacity 0.3s ease;
}
.overlay.active {
display: flex;
opacity: 1;
}
/* Login Form */
.login-form {
background: white;
border-radius: 12px;
width: 100%;
max-width: 400px;
padding: 30px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
transform: scale(0.9);
transition: all 0.3s ease;
position: relative;
opacity: 0;
}
.overlay.active .login-form {
transform: scale(1);
opacity: 1;
}
.close-btn {
position: absolute;
top: 15px;
right: 15px;
background: none;
border: none;
font-size: 1.5rem;
color: #888;
cursor: pointer;
transition: color 0.2s ease;
}
.close-btn:hover {
color: #333;
}
.form-header {
text-align: center;
margin-bottom: 25px;
}
.form-header h2 {
color: #333;
font-weight: 600;
margin-bottom: 5px;
}
.form-header p {
color: #777;
font-size: 0.9rem;
}
.form-group {
margin-bottom: 20px;
position: relative;
}
.form-group label {
display: block;
margin-bottom: 8px;
color: #555;
font-size: 0.9rem;
font-weight: 500;
}
.form-group input {
width: 100%;
padding: 12px 15px;
border: 1px solid #ddd;
border-radius: 8px;
font-size: 0.95rem;
transition: all 0.3s ease;
}
.form-group input:focus {
outline: none;
border-color: #4a6cf7;
box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}
.form-group input:hover {
border-color: #bbb;
}
.form-footer {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
font-size: 0.9rem;
}
.remember-me {
display: flex;
align-items: center;
gap: 8px;
color: #555;
}
.remember-me input {
accent-color: #4a6cf7;
}
.forgot-password {
color: #4a6cf7;
text-decoration: none;
transition: color 0.2s ease;
}
.forgot-password:hover {
color: #3a5ce4;
text-decoration: underline;
}
.submit-btn {
width: 100%;
padding: 12px;
background: #4a6cf7;
color: white;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
}
.submit-btn:hover {
background: #3a5ce4;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
}
.submit-btn:active {
transform: translateY(0);
}
.social-login {
margin-top: 25px;
text-align: center;
}
.social-login p {
color: #777;
font-size: 0.9rem;
margin-bottom: 15px;
position: relative;
}
.social-login p::before,
.social-login p::after {
content: '';
position: absolute;
top: 50%;
width: 30%;
height: 1px;
background: #eee;
}
.social-login p::before {
left: 0;
}
.social-login p::after {
right: 0;
}
.social-icons {
display: flex;
justify-content: center;
gap: 15px;
}
.social-icon {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 1.1rem;
cursor: pointer;
transition: all 0.3s ease;
}
.social-icon:hover {
transform: translateY(-3px);
}
.facebook {
background: #3b5998;
}
.google {
background: #db4437;
}
.twitter {
background: #1da1f2;
}
/* Responsive Design */
@media (max-width: 480px) {
.login-form {
padding: 25px 20px;
margin: 0 15px;
}
.form-header h2 {
font-size: 1.3rem;
}
.form-footer {
flex-direction: column;
gap: 10px;
align-items: flex-start;
}
}
document.addEventListener('DOMContentLoaded', function() {
const loginTrigger = document.querySelector('.login-trigger');
const overlay = document.querySelector('.overlay');
const closeBtn = document.querySelector('.close-btn');
const loginForm = document.querySelector('.login-form');
// Open modal
loginTrigger.addEventListener('click', function() {
overlay.classList.add('active');
document.body.style.overflow = 'hidden'; // Prevent scrolling
});
// Close modal
function closeModal() {
overlay.classList.remove('active');
document.body.style.overflow = ''; // Re-enable scrolling
}
closeBtn.addEventListener('click', closeModal);
overlay.addEventListener('click', function(e) {
if (e.target === overlay) {
closeModal();
}
});
// Close with Escape key
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape' && overlay.classList.contains('active')) {
closeModal();
}
});
// Form submission
const form = document.querySelector('form');
form.addEventListener('submit', function(e) {
e.preventDefault();
// Add your form submission logic here
alert('Login functionality would be implemented here');
closeModal();
});
});
إرسال تعليق
Thank you
Learning robo team