269 lines
9.1 KiB
HTML

<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Login - Free Alberta Influence Campaign Tool</title>
<link rel="icon" href="data:,">
<link rel="stylesheet" href="css/styles.css">
<style>
.login-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
padding: 20px;
}
.login-card {
background-color: white;
border-radius: 12px;
box-shadow: 0 10px 40px rgba(0,0,0,0.1);
padding: 40px;
width: 100%;
max-width: 400px;
}
.login-header {
text-align: center;
margin-bottom: 30px;
}
.login-header h1 {
color: #2c3e50;
font-size: 28px;
margin-bottom: 10px;
}
.login-header p {
color: #666;
font-size: 16px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 8px;
color: #2c3e50;
font-weight: 500;
}
.form-group input {
width: 100%;
padding: 12px 16px;
border: 2px solid #e0e0e0;
border-radius: 8px;
font-size: 16px;
transition: border-color 0.3s;
box-sizing: border-box;
}
.form-group input:focus {
outline: none;
border-color: #2196f3;
}
.btn-login {
width: 100%;
padding: 12px;
background: #2196f3;
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: background-color 0.3s;
margin-top: 10px;
}
.btn-login:hover {
background: #1976d2;
}
.btn-login:disabled {
background: #bdc3c7;
cursor: not-allowed;
}
.error-message {
color: #e74c3c;
background: #fff5f5;
border: 1px solid #fed7d7;
border-radius: 8px;
padding: 12px;
margin-bottom: 20px;
font-size: 14px;
}
.loading {
display: none;
text-align: center;
margin-top: 20px;
}
.spinner {
border: 3px solid #f3f3f3;
border-radius: 50%;
border-top: 3px solid #2196f3;
width: 20px;
height: 20px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.back-link {
text-align: center;
margin-top: 20px;
}
.back-link a {
color: #2196f3;
text-decoration: none;
font-size: 14px;
}
.back-link a:hover {
text-decoration: underline;
}
@media (max-width: 480px) {
.login-card {
padding: 30px 20px;
}
}
/* Dark mode overrides for login page */
[data-theme="dark"] .login-card {
background-color: var(--card-bg-color, #1e1e1e);
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
[data-theme="dark"] .login-header h1 {
color: var(--text-color, rgba(255, 255, 255, 0.87));
}
[data-theme="dark"] .login-header p {
color: var(--text-muted-color, rgba(255, 255, 255, 0.6));
}
[data-theme="dark"] .form-group label {
color: var(--text-color, rgba(255, 255, 255, 0.87));
}
[data-theme="dark"] .form-group input {
background-color: #252525;
color: var(--text-color, rgba(255, 255, 255, 0.87));
border-color: var(--card-border-color, #333);
}
[data-theme="dark"] .form-group input:focus {
border-color: var(--md-primary-fg-color, #2196f3);
}
[data-theme="dark"] .back-link a {
color: var(--md-primary-fg-color--light, #42a5f5);
}
[data-theme="dark"] .error-message {
background: rgba(248, 215, 218, 0.1);
border-color: rgba(245, 198, 203, 0.3);
}
</style>
</head>
<body>
<div class="login-container">
<div class="login-card">
<div class="login-header">
<h1>Login</h1>
<p>Access your campaign dashboard</p>
</div>
<div id="error-message" class="error-message" style="display: none;"></div>
<form id="login-form">
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" id="email" name="email" autocomplete="email" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" autocomplete="current-password" required>
</div>
<button type="submit" id="login-btn" class="btn-login">
<span id="login-text">Login</span>
<div class="loading">
<div class="spinner"></div>
</div>
</button>
</form>
<div class="back-link">
<a href="/" id="home-link">← Back to Campaign Tool</a>
</div>
</div>
</div>
<!-- Theme Toggle Button -->
<button class="theme-toggle" id="theme-toggle-btn" aria-label="Toggle dark mode">
<svg class="sun-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"/>
</svg>
<svg class="moon-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z"/>
</svg>
</button>
<!-- Theme Toggle Script -->
<script>
// Load saved theme preference immediately
(function() {
const savedTheme = localStorage.getItem('theme');
if (savedTheme) {
document.documentElement.setAttribute('data-theme', savedTheme);
} else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.setAttribute('data-theme', 'dark');
}
})();
// Add event listener for theme toggle button
document.addEventListener('DOMContentLoaded', function() {
const themeToggleBtn = document.getElementById('theme-toggle-btn');
if (themeToggleBtn) {
themeToggleBtn.addEventListener('click', function() {
const html = document.documentElement;
const currentTheme = html.getAttribute('data-theme');
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
html.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
});
}
});
</script>
<script src="js/api-client.js"></script>
<script src="js/login.js"></script>
<script>
// Update navigation link with APP_URL if needed
fetch('/api/config')
.then(res => res.json())
.then(config => {
if (config.appUrl && !window.location.href.startsWith(config.appUrl)) {
document.getElementById('home-link').href = config.appUrl + '/';
}
})
.catch(err => console.log('Config not loaded, using relative paths'));
</script>
</body>
</html>