dimsee
Version:
Modern, flexible authentication solution for MERN applications with OAuth support
754 lines (642 loc) • 15.8 kB
CSS
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Poppins:wght@400;500;600;700&family=Source+Code+Pro:wght@400;700&display=swap');
* {
box-sizing: border-box;
}
/* Auth Container Base */
.auth-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
overflow: hidden;
font-family: 'Poppins', sans-serif;
transition: background-color 0.5s ease;
}
/* ==========================================
MODERN THEME (Professional Redesign)
========================================== */
.auth-container.modern {
background: #111;
display: flex;
justify-content: flex-start; /* Align form to the left */
align-items: center;
color: #fff;
}
/* Remove old ::before animation */
.auth-container.modern::before {
display: none;
}
/* The right-side image panel */
.auth-container.modern::after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 55%; /* Asymmetric split */
background-image: url('https://images.unsplash.com/photo-1511447333015-45b65e60f6d5?auto=format&fit=crop&q=80');
background-size: cover;
background-position: center;
z-index: 1;
}
/* Position the form in the left panel, above the image */
.auth-container.modern .auth-form {
position: relative;
z-index: 2;
background: transparent;
backdrop-filter: none;
border: none;
box-shadow: none;
padding: 40px;
margin-left: 8%; /* Indent the form from the left edge */
max-width: 480px;
}
.auth-container.modern .form-title {
color: #ffffff;
font-family: 'Playfair Display', serif;
font-size: 3rem;
font-weight: 700;
letter-spacing: -1.5px;
text-align: left;
}
.auth-container.modern .form-subtitle {
color: #a0a0a0;
text-align: left;
margin-bottom: 48px;
}
.auth-container.modern .form-input {
background: transparent;
border: none;
border-bottom: 1px solid #444;
border-radius: 0;
color: #ffffff;
padding: 16px 16px 16px 50px; /* Keep padding for icon */
font-family: 'Poppins', sans-serif;
font-weight: 400;
transition: border-color 0.3s ease;
}
.auth-container.modern .form-input::placeholder {
color: #777;
}
.auth-container.modern .form-input:focus {
border-color: #6366f1; /* Indigo color for focus */
background: transparent;
box-shadow: none;
transform: none;
}
.auth-container.modern .input-icon {
color: #888;
}
.auth-container.modern .submit-button {
background: #6366f1; /* Solid indigo color */
border-radius: 12px;
box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.3);
transition: background 0.3s ease, box-shadow 0.3s ease;
}
.auth-container.modern .submit-button:hover:not(:disabled) {
background: #4f46e5;
box-shadow: 0 6px 20px 0 rgba(79, 70, 229, 0.35);
transform: translateY(-2px);
}
.auth-container.modern .separator {
color: #888;
}
.auth-container.modern .separator::before,
.auth-container.modern .separator::after {
border-color: #444;
}
.auth-container.modern .oauth-button {
background: transparent;
border: 1px solid #444;
color: #fff;
transition: all 0.3s ease;
}
.auth-container.modern .oauth-button:hover {
background: rgba(255, 255, 255, 0.05);
border-color: #6366f1;
}
.auth-container.modern .oauth-button.github {
background: transparent; /* Keep consistent */
}
.auth-container.modern .oauth-button.google {
background: transparent;
border: 1px solid #444;
color: #fff;
}
.auth-container.modern .oauth-button.google:hover {
background: rgba(255, 255, 255, 0.05);
border-color: #6366f1;
}
/* ==========================================
MINIMAL THEME (Polished Redesign with Subtle Neomorphism)
========================================== */
.auth-container.minimal {
background-color: #eef0f4; /* Softer off-white for neomorphism */
color: #111827;
font-family: 'Poppins', sans-serif;
}
.auth-container.minimal .auth-form {
background: transparent;
box-shadow: none;
border-radius: 0;
padding: 0;
}
.auth-container.minimal .form-title {
color: #111827;
font-weight: 700;
font-size: 2.25rem;
letter-spacing: -1px;
}
.auth-container.minimal .form-subtitle {
color: #6b7280;
font-weight: 400;
}
.auth-container.minimal .form-input {
background: #eef0f4; /* Match container background */
border: none; /* Neomorphism uses shadows, not borders */
border-radius: 12px;
color: #111827;
padding: 16px 16px 16px 50px;
box-shadow: inset 5px 5px 10px #d8dade, inset -5px -5px 10px #ffffff; /* Subtle inset shadow */
font-weight: 500;
transition: all 0.3s ease;
}
.auth-container.minimal .form-input:focus {
border-color: transparent; /* Override base focus */
box-shadow: inset 2px 2px 5px #d8dade, inset -2px -2px 5px #ffffff;
}
.auth-container.minimal .input-icon {
color: #9ca3af;
}
.auth-container.minimal .submit-button {
border-radius: 12px;
background: #6366f1;
box-shadow: 5px 5px 10px #d8dade, -5px -5px 10px #ffffff; /* Subtle outset shadow */
color: #fff;
font-weight: 600;
text-transform: none;
transition: all 0.3s ease;
}
.auth-container.minimal .submit-button:hover:not(:disabled) {
background: #4f46e5;
box-shadow: 2px 2px 5px #d8dade, -2px -2px 5px #ffffff; /* Press-in effect on hover */
transform: translateY(0);
}
.auth-container.minimal .submit-button:active:not(:disabled) {
background: #4338ca;
box-shadow: inset 2px 2px 5px #d8dade, inset -2px -2px 5px #ffffff; /* Full press-in on active */
transform: translateY(0);
}
.auth-container.minimal .separator {
color: #9ca3af;
}
.auth-container.minimal .separator::before,
.auth-container.minimal .separator::after {
border-color: #e5e7eb;
}
.auth-container.minimal .oauth-button {
border-radius: 12px;
background: #eef0f4; /* Match container background */
box-shadow: 5px 5px 10px #d8dade, -5px -5px 10px #ffffff; /* Subtle outset shadow */
border: none;
color: #374151;
font-weight: 500;
transition: all 0.3s ease;
}
.auth-container.minimal .oauth-button:hover {
box-shadow: 2px 2px 5px #d8dade, -2px -2px 5px #ffffff;
background: #eef0f4;
border-color: transparent;
}
.auth-container.minimal .oauth-button.google {
background: #eef0f4;
color: #374151;
}
.auth-container.minimal .oauth-button.github {
background: #eef0f4;
color: #374151;
}
/* ==========================================
COLORFUL THEME (Gumroad Inspired)
========================================== */
.auth-container.colorful {
background: linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
color: #000000;
font-family: 'Poppins', sans-serif;
}
.auth-container.colorful .auth-form {
background: #ffffff;
border: 2px solid #000000;
border-radius: 16px;
box-shadow: 8px 8px 0px #000000;
}
.auth-container.colorful .form-title {
color: #000000;
font-family: 'Playfair Display', serif;
font-weight: 700;
}
.auth-container.colorful .form-subtitle {
color: #666;
}
.auth-container.colorful .form-input {
border: 2px solid #000000;
border-radius: 8px;
background: #ffffff;
color: #000000;
font-weight: 500;
padding-left: 50px;
text-indent: 0;
}
.auth-container.colorful .form-input:focus {
border-color: #4A00E0;
box-shadow: 0 0 0 3px rgba(74, 0, 224, 0.4);
}
.auth-container.colorful .input-icon {
color: #888;
}
.auth-container.colorful .submit-button {
background-color: #ff90e8;
color: #000000;
border: 2px solid #000000;
border-radius: 12px;
font-weight: 700;
box-shadow: 4px 4px 0 #000;
}
.auth-container.colorful .submit-button:hover:not(:disabled) {
background-color: #FFD600;
transform: translate(-2px, -2px);
box-shadow: 6px 6px 0 #000;
}
.auth-container.colorful .submit-button:active:not(:disabled) {
transform: translate(2px, 2px);
box-shadow: 2px 2px 0 #000;
}
.auth-container.colorful .separator {
color: #888;
}
.auth-container.colorful .separator::before,
.auth-container.colorful .separator::after {
border-color: #ddd;
}
.auth-container.colorful .oauth-button {
border: 2px solid #000;
border-radius: 12px;
background: #fff;
color: #000;
font-weight: 600;
}
.auth-container.colorful .oauth-button:hover {
border-color: #FFD600;
}
.auth-container.colorful .oauth-button.google {
background-color: #fff;
color: #000;
}
.auth-container.colorful .oauth-button.github {
background-color: #24292e;
color: #fff;
}
.auth-container.colorful .oauth-button.github:hover {
background-color: #333;
border-color: #000;
}
/* ==========================================
FORM STYLES (BASE)
========================================== */
.auth-form {
background: rgba(67, 68, 68, 0.8);
backdrop-filter: blur(15px);
border: 1px solid rgba(255, 255, 255, 0.3);
border-radius: 24px;
padding: 100px 60px;
width: 100%;
max-width: 480px; /* Reduced max-width for a more compact form */
box-shadow:
0 25px 50px rgba(0, 0, 0, 0.1),
0 0 0 1px rgba(255, 255, 255, 0.05);
position: relative;
z-index: 1;
transform: translateY(0);
transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.auth-form:hover {
transform: translateY(-5px);
box-shadow:
0 35px 70px rgba(0, 0, 0, 0.15),
0 0 0 1px rgba(255, 255, 255, 0.1);
}
/* Form Header */
.form-header {
text-align: center;
margin-bottom: 38px;
}
.form-title {
font-size: 2.2rem;
font-weight: 700;
margin: 0 0 8px 0;
transition: color 0.3s ease;
font-family: 'Playfair Display', serif;
}
.form-subtitle {
font-size: 1rem;
margin: 0;
font-weight: 400;
transition: color 0.3s ease;
}
/* Input Groups */
.input-group {
margin-bottom: 24px;
}
.input-wrapper {
position: relative;
display: flex;
align-items: center;
}
.form-input {
width: 100%;
padding: 16px 20px 16px 50px;
text-indent: 0px; /* Adjusted for icon padding */
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 16px;
font-size: 1rem;
font-weight: 500;
background: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(10px);
transition: all 0.3s ease;
outline: none;
color: #333;
}
.form-input:focus {
border-color: #667eea;
background: rgba(255, 255, 255, 0.95);
box-shadow:
0 0 0 4px rgba(102, 126, 234, 0.1),
0 8px 25px rgba(102, 126, 234, 0.15);
transform: translateY(-2px);
}
.form-input.error {
border-color: #ef4444 ;
background: rgba(239, 68, 68, 0.05);
}
.form-input.error:focus {
box-shadow:
0 0 0 4px rgba(239, 68, 68, 0.1),
0 8px 25px rgba(239, 68, 68, 0.15);
}
.input-icon {
position: absolute;
left: 18px; /* Standardized icon position */
top: 50%;
transform: translateY(-50%);
font-size: 1.1rem; /* Slightly larger icon */
z-index: 2;
pointer-events: none;
color: #6b7280;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
opacity: 0.8;
transition: color 0.3s ease;
}
/* Error Messages */
.error-message {
display: flex;
align-items: center;
gap: 8px;
color: #ef4444;
font-size: 0.875rem;
font-weight: 500;
margin-top: 8px;
margin-left: 4px;
}
.error-icon {
font-size: 1rem;
}
/* Submit Button */
.submit-button {
width: 100%;
padding: 18px 24px;
color: white;
border: none;
border-radius: 16px;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
position: relative;
overflow: hidden;
}
.submit-button:hover:not(:disabled) {
transform: translateY(-3px);
box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}
.submit-button:active:not(:disabled) {
transform: translateY(0);
}
.submit-button:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
.button-content {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
.button-icon {
font-size: 1.2rem;
}
/* Loading Spinner */
.loading-spinner {
width: 20px;
height: 20px;
border: 2px solid rgba(255, 255, 255, 0.3);
border-top: 2px solid white;
border-radius: 50%;
animation: spin 1s linear infinite;
}
/* ==========================================
ANIMATIONS
========================================== */
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* ==========================================
RESPONSIVE DESIGN
========================================== */
@media (max-width: 768px) {
.auth-form {
padding: 40px 30px;
border-radius: 20px;
}
.auth-container.minimal .auth-form {
padding: 60px 40px;
border-radius: 30px;
}
.form-title {
font-size: 1.8rem;
}
.form-input {
padding: 14px 18px 14px 50px;
}
.submit-button {
padding: 16px 20px;
font-size: 1rem;
}
}
@media (max-width: 480px) {
.auth-container {
padding: 16px;
}
.auth-form {
padding: 32px 24px;
width: 100%;
border-radius: 16px;
}
.auth-container.minimal .auth-form {
padding: 40px 30px;
border-radius: 20px;
box-shadow: 10px 10px 30px #bebebe, -10px -10px 30px #ffffff;
}
.form-title {
font-size: 1.6rem;
}
.form-subtitle {
font-size: 0.9rem;
}
.input-group {
margin-bottom: 20px;
}
}
/* ==========================================
ACCESSIBILITY & FOCUS STATES
========================================== */
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms ;
animation-iteration-count: 1 ;
transition-duration: 0.01ms ;
}
}
.auth-form *:focus-visible {
outline: 3px solid #667eea;
outline-offset: 3px;
}
.auth-container.colorful .auth-form *:focus-visible {
outline-color: #ff90e8;
}
/* High contrast mode support */
@media (prefers-contrast: high) {
.auth-form,
.auth-container.minimal .auth-form {
background: window;
color: windowText;
border: 2px solid windowText;
box-shadow: none;
}
.form-input,
.auth-container.minimal .form-input {
background: window;
color: windowText;
border: 1px solid windowText;
box-shadow: none;
}
.submit-button,
.auth-container.minimal .submit-button {
background: windowText;
color: window;
border: 1px solid window;
}
}
/* OAuth Buttons */
.oauth-buttons {
display: flex;
flex-direction: column;
gap: 12px;
margin-bottom: 24px;
width: 100%;
}
.oauth-button {
display: flex;
align-items: center;
justify-content: center;
gap: 12px;
width: 100%;
padding: 14px;
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 12px;
background-color: #fff;
color: #333;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease-in-out;
position: relative;
overflow: hidden;
}
.oauth-button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.oauth-button:active {
transform: translateY(0);
}
.oauth-button.github {
background-color: #24292e;
color: #fff;
}
.oauth-icon {
display: flex;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
}
.oauth-icon svg {
width: 100%;
height: 100%;
}
/* Separator */
.separator {
display: flex;
align-items: center;
text-align: center;
margin: 24px 0;
color: #6b7280;
}
.separator::before,
.separator::after {
content: '';
flex: 1;
border-bottom: 1px solid rgba(107, 114, 128, 0.2);
}
.separator span {
margin: 0 12px;
font-size: 0.875rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
/* Media Queries for OAuth */
@media (max-width: 480px) {
.oauth-buttons {
gap: 10px;
margin-bottom: 20px;
}
.oauth-button {
padding: 12px;
font-size: 0.95rem;
}
.separator {
margin: 20px 0;
}
}