livestock / templates /login.html
vscode's picture
Upload 9 files
6cd713b verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AgroVet - Login</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
position: relative;
overflow: hidden;
}
/* Animated background elements */
.background-animation {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 0;
background-image:
radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
radial-gradient(circle at 80% 80%, rgba(252, 176, 69, 0.3) 0%, transparent 50%),
radial-gradient(circle at 40% 20%, rgba(131, 216, 100, 0.3) 0%, transparent 50%);
animation: backgroundShift 20s ease infinite;
}
@keyframes backgroundShift {
0%, 100% { transform: scale(1) rotate(0deg); }
50% { transform: scale(1.1) rotate(5deg); }
}
/* Floating animal icons */
.floating-icon {
position: absolute;
font-size: 3rem;
opacity: 0.1;
animation: float 15s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0px) rotate(0deg); }
50% { transform: translateY(-30px) rotate(10deg); }
}
.icon-1 { top: 10%; left: 10%; animation-delay: 0s; }
.icon-2 { top: 70%; left: 15%; animation-delay: 2s; }
.icon-3 { top: 30%; right: 10%; animation-delay: 4s; }
.icon-4 { bottom: 20%; right: 20%; animation-delay: 6s; }
.login-container {
position: relative;
z-index: 1;
background: rgba(255, 255, 255, 0.95);
padding: 50px 40px;
border-radius: 20px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
width: 90%;
max-width: 450px;
backdrop-filter: blur(10px);
animation: slideIn 0.6s ease-out;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(-30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.logo-section {
text-align: center;
margin-bottom: 30px;
}
.logo-icon {
font-size: 4rem;
margin-bottom: 10px;
animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
h1 {
color: #667eea;
font-size: 2.5rem;
margin-bottom: 10px;
font-weight: 700;
}
.subtitle {
color: #666;
font-size: 0.95rem;
margin-bottom: 30px;
}
.input-group {
margin-bottom: 25px;
position: relative;
}
.input-group label {
display: block;
color: #333;
font-weight: 600;
margin-bottom: 8px;
font-size: 0.9rem;
}
.input-wrapper {
position: relative;
}
.input-icon {
position: absolute;
left: 15px;
top: 50%;
transform: translateY(-50%);
font-size: 1.2rem;
color: #667eea;
}
.input-group input {
width: 100%;
padding: 15px 15px 15px 45px;
border: 2px solid #e0e0e0;
border-radius: 10px;
font-size: 1rem;
transition: all 0.3s ease;
background: #f8f9fa;
}
.input-group input:focus {
outline: none;
border-color: #667eea;
background: white;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.forgot-password {
text-align: right;
margin-bottom: 20px;
}
.forgot-password a {
color: #667eea;
text-decoration: none;
font-size: 0.85rem;
transition: color 0.3s ease;
}
.forgot-password a:hover {
color: #764ba2;
}
.login-btn {
width: 100%;
padding: 15px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 10px;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
.login-btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}
.login-btn:active {
transform: translateY(0);
}
.divider {
text-align: center;
margin: 25px 0;
position: relative;
}
.divider::before {
content: '';
position: absolute;
left: 0;
top: 50%;
width: 100%;
height: 1px;
background: #e0e0e0;
}
.divider span {
background: white;
padding: 0 15px;
color: #999;
position: relative;
z-index: 1;
}
.signup-link {
text-align: center;
margin-top: 20px;
color: #666;
}
.signup-link a {
color: #667eea;
text-decoration: none;
font-weight: 600;
transition: color 0.3s ease;
}
.signup-link a:hover {
color: #764ba2;
}
.alert {
padding: 12px;
border-radius: 8px;
margin-bottom: 20px;
display: none;
animation: slideDown 0.3s ease;
}
@keyframes slideDown {
from { opacity: 0; transform: translateY(-10px); }
to { opacity: 1; transform: translateY(0); }
}
.alert-error {
background: #fee;
color: #c33;
border: 1px solid #fcc;
}
.alert-success {
background: #efe;
color: #3c3;
border: 1px solid #cfc;
}
</style>
</head>
<body>
<div class="background-animation"></div>
<!-- Floating animal icons -->
<div class="floating-icon icon-1">๐Ÿ„</div>
<div class="floating-icon icon-2">๐Ÿ‘</div>
<div class="floating-icon icon-3">๐Ÿ”</div>
<div class="floating-icon icon-4">๐Ÿท</div>
<div class="login-container">
<div class="logo-section">
<div class="logo-icon">๐ŸŒพ๐Ÿฎ</div>
<h1>AgroVet</h1>
<p class="subtitle">Welcome back! Login to access your animal husbandry dashboard</p>
</div>
<div id="alertBox" class="alert"></div>
<form id="loginForm" onsubmit="handleLogin(event)">
<div class="input-group">
<label for="email">Email Address</label>
<div class="input-wrapper">
<span class="input-icon">๐Ÿ“ง</span>
<input type="email" id="email" placeholder="Enter your email" required>
</div>
</div>
<div class="input-group">
<label for="password">Password</label>
<div class="input-wrapper">
<span class="input-icon">๐Ÿ”’</span>
<input type="password" id="password" placeholder="Enter your password" required>
</div>
</div>
<div class="forgot-password">
<a href="#">Forgot Password?</a>
</div>
<button type="submit" class="login-btn">Login to Dashboard</button>
</form>
<div class="divider">
<span>OR</span>
</div>
<div class="signup-link">
Don't have an account? <a href="/signup">Create Account</a>
</div>
</div>
<script>
function showAlert(message, type) {
const alertBox = document.getElementById('alertBox');
alertBox.textContent = message;
alertBox.className = `alert alert-${type}`;
alertBox.style.display = 'block';
setTimeout(() => {
alertBox.style.display = 'none';
}, 3000);
}
function handleLogin(event) {
event.preventDefault();
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
// Get stored users from localStorage
const users = JSON.parse(localStorage.getItem('agrovetUsers') || '[]');
// Check if user exists and password matches
const user = users.find(u => u.email === email && u.password === password);
if (user) {
// Store logged in user
localStorage.setItem('agrovetLoggedIn', 'true');
localStorage.setItem('agrovetCurrentUser', JSON.stringify(user));
showAlert('Login successful! Redirecting...', 'success');
setTimeout(() => {
window.location.href = '/home';
}, 1500);
} else {
showAlert('Invalid email or password. Please try again.', 'error');
}
}
// Check if already logged in
if (localStorage.getItem('agrovetLoggedIn') === 'true') {
window.location.href = '/home';
}
</script>
</body>
</html>