<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="">
	<meta name="author" content="">
	<link rel="icon" type="image/png" sizes="16x16" href="<?=base_url();?>/assets/favicon.png">
	<title>Summit-CRM Login</title>
	<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
	<style>
		body {
			background-color: #85b9df;
		}
		.login-container {
			min-height: 100vh;
		}
		.login-card {
			border-radius: 16px;
			overflow: hidden;
			box-shadow: 0 6px 18px rgba(0,0,0,0.1);
		}
		.login-img {
			object-fit: cover;
			width: 100%;
			height: 100%;
		}
		.form-control {
			border-radius: 10px;
			border: 1px solid #dee2e6;
			box-shadow: none;
			transition: all 0.3s ease-in-out;
		}
		.form-control:focus {
			border-color: #0d6efd;
			box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.15);
		}
		.btn-primary {
			border-radius: 10px;
			font-weight: 500;
			padding: 0.75rem;
			transition: all 0.3s ease-in-out;
		}
		.btn-primary:hover {
			transform: translateY(-2px);
			box-shadow: 0 4px 12px rgba(13,110,253,0.3);
		}
		.form-check-label {
			font-size: 0.9rem;
			color: #555;
		}
		h3 {
			font-weight: 700;
		}
		.card-footer {
			border: none !important;
			box-shadow: none !important;
			background-color: transparent; /* opsional biar menyatu */
		}
	</style>
</head>
<?php
helper('cookie');
if(!isset($email)) { $email = ''; }
if(!isset($password)) { $password = ''; }

?>
<body>
	<div class="preloader">
		<div class="loader">
			<div class="loader__figure"></div>
			<!-- <p class="loader__label">Summit-CRM</p> -->
		</div>
	</div>

	<div class="container login-container d-flex justify-content-center align-items-center">
		<div class="row w-100 justify-content-center">
			<div class="col-12">
				<div class="card login-card border-0">
					<div class="row g-0">

						<!-- Bagian Gambar -->
						<div class="col-sm-6 col-md-8 d-none d-md-block">
							<img src="<?=base_url();?>/assets/images/finalpanda.jpg" alt="login" class="login-img" alt="">
						</div>

						<!-- Bagian Form -->
						<div class="col-sm-6 col-md-4 d-flex align-items-center mt-4">
							<div class="card-body pt-5 pb-0 px-4 w-100">
								<h3 class="mb-5 text-center">CRM Login</h3>
								<form id="loginform" method='POST'>
									<?php if(isset($validation)) { ?>
										<div class='alert alert-danger alert-dismissible pt-3 pb-0'>
											<?= $validation->listErrors(); ?>
											<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
										</div>
									<?php } ?>
									<?php if (session()->getFlashdata('loginError')) : ?>
										<div class="alert alert-danger alert-dismissible">
											<?= session()->getFlashdata('loginError') ?>
											<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
										</div>
									<?php endif; ?>

									<div class="form-floating mb-4">
										<input type="email" class="form-control form-control-sm" required id="floatingEmail" name='email' placeholder='email' value='<?=$email;?>' >
										<label for="floatingEmail">Email</label>
									</div>
									<div class="form-floating mb-4">
										<input type="password" class="form-control form-control-sm" required id="floatingPassword" name='password' placeholder='password' value='<?=$password;?>'>
										<label for="floatingPassword">Password</label>
									</div>
									<div class="d-grid mb-3">
										<button type="submit" class="btn btn-primary btn-sm">Sign In</button>
									</div>
									<div class="form-check text-start mb-5">
										<input class="form-check-input" name='rememberme' type="checkbox" value="1" id="rememberme" <?php if(isset($rememberme)) { echo 'checked'; }?>>
										<label class="form-check-label" for="rememberme">
											Remember Me                      
										</label>
									</div>
								</form>
								<div class="card-footer pt-5 mt-5">
									<p class="text-end text-muted fw-light fs-6 m-0 p-0">© 2022 - <?php echo(date("Y")); ?> &nbsp;5PANDA🐼WA</p>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>