<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - EduTrack PRO</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="css/style.css">
    <style>
        :root {
            --primary: #1e3a5f;
            --secondary: #3498db;
            --bg-body: #f5f7fa;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #1e3a5f 0%, #3498db 50%, #1e3a5f 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .login-container {
            width: 100%;
            max-width: 450px;
        }

        .login-card {
            background: #ffffff;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            overflow: hidden;
        }

        .login-header {
            background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
            padding: 50px 30px;
            text-align: center;
            color: white;
            position: relative;
            overflow: hidden;
        }

        .login-header::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
        }

        .login-header h1 {
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 10px;
            position: relative;
        }

        .login-header p {
            font-size: 14px;
            opacity: 0.9;
            position: relative;
        }

        .login-header i {
            font-size: 52px;
            margin-bottom: 15px;
            position: relative;
        }

        .login-body {
            padding: 40px 35px;
        }

        .form-group {
            margin-bottom: 25px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #1e3a5f;
            font-size: 14px;
        }

        .form-control {
            height: 52px;
            border: 2px solid #e0e6ed;
            border-radius: 10px;
            padding: 12px 18px;
            font-size: 14px;
            transition: all 0.3s ease;
            background: #f8f9fa;
        }

        .form-control:focus {
            border-color: #3498db;
            box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
            outline: none;
            background: white;
        }

        .btn-login {
            width: 100%;
            height: 52px;
            background: linear-gradient(135deg, #1e3a5f 0%, #3498db 100%);
            border: none;
            border-radius: 10px;
            color: white;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }

        .btn-login:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 30px rgba(52, 152, 219, 0.4);
        }

        .btn-login:disabled {
            opacity: 0.7;
            cursor: not-allowed;
        }

        .remember-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
        }

        .remember-row .form-check {
            margin-bottom: 0;
        }

        .remember-row .form-check-input:checked {
            background-color: #3498db;
            border-color: #3498db;
        }

        .forgot-link {
            color: #3498db;
            text-decoration: none;
            font-size: 14px;
            font-weight: 500;
        }

        .forgot-link:hover {
            text-decoration: underline;
        }

        .alert {
            border-radius: 10px;
            padding: 15px 18px;
            margin-bottom: 20px;
            border: none;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .alert-danger {
            background: rgba(231, 76, 60, 0.15);
            color: #e74c3c;
        }

        .alert-success {
            background: rgba(39, 174, 96, 0.15);
            color: #27ae60;
        }

        .password-toggle {
            cursor: pointer;
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #7f8c8d;
            z-index: 10;
        }

        .password-toggle:hover {
            color: #3498db;
        }

        .loading-spinner {
            display: none;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(255,255,255,0.3);
            border-radius: 50%;
            border-top-color: white;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        .footer-text {
            text-align: center;
            margin-top: 25px;
            color: #7f8c8d;
            font-size: 13px;
        }

        .input-group {
            position: relative;
        }

        .input-group i {
            position: absolute;
            left: 18px;
            top: 50%;
            transform: translateY(-50%);
            color: #7f8c8d;
            z-index: 5;
        }

        .input-group .form-control {
            padding-left: 45px;
        }
        
        /* Redesigned professional footer */
.footer-text {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    text-align: left;
}

.portal-links {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 0;
}

.portal-item {
    flex: 1;
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 10px;
    transition: all 0.2s ease;
    text-align: center;
    border: 1px solid #eef2f6;
}

.portal-item:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.portal-item strong {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #2c3e66;
    margin-bottom: 6px;
    font-weight: 700;
}

.portal-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e3a5f;
    text-decoration: none;
    background: rgba(30, 58, 95, 0.04);
    padding: 6px 14px;
    border-radius: 40px;
    transition: all 0.2s;
}

.portal-link i {
    font-size: 0.85rem;
    color: #3498db;
    transition: transform 0.15s;
}

.portal-link:hover {
    background: #1e3a5f;
    color: white;
    text-decoration: none;
}

.portal-link:hover i {
    color: white;
    transform: translateX(2px);
}

.footer-note {
    font-size: 0.7rem;
    text-align: center;
    color: #8ba0bc;
    margin-top: 16px;
    letter-spacing: 0.3px;
}

@media (max-width: 480px) {
    .portal-links {
        flex-direction: column;
        gap: 12px;
    }
}
    </style>
</head>
<body>
    <div class="login-container">
        <div class="login-card">
            <div class="login-header">
                <i class="fas fa-graduation-cap"></i>
<h1>EduTrack PRO</h1>
                <p>School Management System</p>
                  <p style="display:block;font-size:13px;opacity:.85">Want to see EduTrack? <a href="request-demo.php" style="color:#fff;text-decoration:underline">Request a demo</a></p>
            </div>
            <div class="login-body">
                <div id="alertMessage"></div>
                
                <form id="loginForm">
                    <div class="form-group position-relative">
                        <label for="username">
                            <i class="fas fa-user me-2"></i>Username
                        </label>
                        <div class="input-group">
                            <i class="fas fa-user"></i>
                            <input type="text" class="form-control" id="username" name="username" placeholder="Enter your username" required>
                        </div>
                    </div>
                    
                    <div class="form-group position-relative">
                        <label for="password">
                            <i class="fas fa-lock me-2"></i>Password
                        </label>
                        <div class="input-group">
                            <i class="fas fa-lock"></i>
                            <input type="password" class="form-control" id="password" name="password" placeholder="Enter your password" required style="padding-right: 45px;">
                        </div>
                    </div>
                    
                    <div class="remember-row">
                        <div class="form-check">
                            <input class="form-check-input" type="checkbox" id="rememberMe">
                            <label class="form-check-label" for="rememberMe">Remember me</label>
                        </div>
                          <a href="forgot_password.php" class="forgot-link">Forgot Password?</a>
                    </div>
                    
                    <button type="submit" class="btn-login" id="loginBtn">
                        <span class="loading-spinner" id="spinner"></span>
                        <span id="btnText">Sign In</span>
                    </button>
                </form>
                
               <div class="footer-text">
    <div class="portal-links">
        <div class="portal-item">
            <strong><i class="fas fa-users me-1"></i> PARENT ACCESS</strong>
            <a href="https://edutrack.oricnetwork.com/parent-portal/login.php" class="portal-link">
                <span>Click here</span> <i class="fas fa-arrow-right"></i>
            </a>
        </div>
        <div class="portal-item">
            <strong><i class="fas fa-chalkboard-user me-1"></i> TEACHER ACCESS</strong>
            <a href="https://edutrack.oricnetwork.com/teacher-portal/login.php" class="portal-link">
                <span>Click here</span> <i class="fas fa-arrow-right"></i>
            </a>
        </div>
    </div>
    <div class="footer-note">
        <i class="far fa-clock"></i> Secure portal access for parents & faculty
    </div>
</div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
    <script>
        $(document).ready(function() {
            // Login form submission
            $('#loginForm').on('submit', function(e) {
                e.preventDefault();
                
                const username = $('#username').val().trim();
                const password = $('#password').val();
                
                if (!username || !password) {
                    showAlert('Please enter username and password', 'danger');
                    return;
                }

                $('#loginBtn').prop('disabled', true);
                $('#spinner').show();
                $('#btnText').text('Signing in...');

                $.ajax({
                    url: 'ajax/login.php',
                    type: 'POST',
                    data: { username: username, password: password },
                    dataType: 'json',
                    success: function(response) {
                        if (response.success) {
                            showAlert('Login successful! Redirecting...', 'success');
                            setTimeout(function() {
                                window.location.href = 'dashboard.php';
                            }, 1000);
                        } else {
                            showAlert(response.message, 'danger');
                            $('#loginBtn').prop('disabled', false);
                            $('#spinner').hide();
                            $('#btnText').text('Sign In');
                        }
                    },
                    error: function() {
                        showAlert('An error occurred. Please try again.', 'danger');
                        $('#loginBtn').prop('disabled', false);
                        $('#spinner').hide();
                        $('#btnText').text('Sign In');
                    }
                });
            });

            function showAlert(message, type) {
                const alertHtml = '<div class="alert alert-' + type + ' alert-dismissible fade show" role="alert">' +
                    '<i class="fas fa-' + (type === 'success' ? 'check-circle' : 'exclamation-circle') + '"></i>' +
                    message +
                    '<button type="button" class="btn-close" data-bs-dismiss="alert"></button>' +
                    '</div>';
                $('#alertMessage').html(alertHtml);
            }
        });
    </script>
</body>
</html>
