<?php
require_once __DIR__ . '/includes/config.php';
// Student login page — placeholder for future CRM integration
// For now shows a clean login UI that links to the CRM student portal
$site_url = BASE_URL;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Student Portal — CY Consultancy Centre</title>
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Playfair+Display:wght@700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<style>
:root{--brand:#0d9488;--brand2:#0f766e;--dark:#030f0e;--text:#111827;--muted:#6b7280;--border:#e5e7eb;}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
body{font-family:'Outfit',sans-serif;min-height:100vh;display:flex;align-items:center;justify-content:center;background:var(--dark);position:relative;overflow:hidden;}
.bg-layer{position:absolute;inset:0;background:radial-gradient(ellipse 80% 60% at 20% 20%,rgba(13,148,136,0.2) 0%,transparent 60%),radial-gradient(ellipse 60% 80% at 80% 80%,rgba(15,118,110,0.25) 0%,transparent 60%),linear-gradient(135deg,#030f0e 0%,#0a2420 50%,#030f0e 100%);}
.bg-grid{position:absolute;inset:0;background-image:linear-gradient(rgba(255,255,255,0.02) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,0.02) 1px,transparent 1px);background-size:40px 40px;}
.orb{position:absolute;border-radius:50%;filter:blur(80px);animation:orbFloat 8s ease-in-out infinite;}
.orb-1{width:400px;height:400px;background:radial-gradient(circle,rgba(13,148,136,0.18),transparent 70%);top:-100px;left:-100px;}
.orb-2{width:300px;height:300px;background:radial-gradient(circle,rgba(16,185,129,0.1),transparent 70%);bottom:-80px;right:-80px;animation-delay:-4s;}
@keyframes orbFloat{0%,100%{transform:translate(0,0);}33%{transform:translate(30px,-20px);}66%{transform:translate(-20px,30px);}}
.page-wrap{position:relative;z-index:10;width:100%;max-width:480px;padding:20px;animation:pageIn 0.6s cubic-bezier(0.22,1,0.36,1) both;}
@keyframes pageIn{from{opacity:0;transform:translateY(32px);}to{opacity:1;transform:translateY(0);}}
.portal-label{text-align:center;margin-bottom:24px;}
.portal-label span{display:inline-block;background:rgba(13,148,136,0.15);border:1px solid rgba(13,148,136,0.3);color:#5eead4;font-size:11px;font-weight:600;letter-spacing:0.12em;text-transform:uppercase;padding:5px 14px;border-radius:20px;backdrop-filter:blur(8px);}
.login-card{background:rgba(255,255,255,0.97);border-radius:24px;padding:44px 40px 36px;box-shadow:0 32px 80px rgba(0,0,0,0.5),0 8px 20px rgba(0,0,0,0.3);}
.brand-area{display:flex;align-items:center;gap:14px;margin-bottom:28px;padding-bottom:24px;border-bottom:1px solid var(--border);}
.brand-logo{width:52px;height:52px;object-fit:contain;flex-shrink:0;}
.brand-logo-fallback{width:52px;height:52px;background:linear-gradient(135deg,var(--brand),var(--brand2));border-radius:14px;display:none;align-items:center;justify-content:center;font-family:'Playfair Display',serif;font-size:20px;font-weight:800;color:#fff;flex-shrink:0;}
.brand-text h1{font-family:'Playfair Display',serif;font-size:18px;font-weight:700;color:var(--text);line-height:1.2;}
.brand-text p{font-size:12px;color:var(--muted);margin-top:2px;}
.login-title{margin-bottom:22px;}
.login-title h2{font-size:22px;font-weight:700;color:var(--text);}
.login-title p{font-size:13px;color:var(--muted);margin-top:4px;}
.form-group{margin-bottom:16px;}
.form-label{display:block;font-size:12.5px;font-weight:600;color:#374151;margin-bottom:7px;}
.input-wrap{position:relative;}
.input-wrap .fi{position:absolute;left:14px;top:50%;transform:translateY(-50%);color:#9ca3af;font-size:14px;pointer-events:none;z-index:1;}
.form-input{width:100%;padding:11px 14px 11px 40px;border:1.5px solid var(--border);border-radius:11px;font-size:14px;font-family:'Outfit',sans-serif;background:#fafafa;color:var(--text);outline:none;transition:border-color 0.15s,box-shadow 0.15s;}
.form-input:focus{border-color:var(--brand);background:#fff;box-shadow:0 0 0 3px rgba(13,148,136,0.1);}
.eye-btn{position:absolute;right:12px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;color:#9ca3af;font-size:14px;padding:4px;z-index:2;transition:color 0.15s;}
.eye-btn:hover{color:var(--brand);}
.btn-login{width:100%;padding:13px;background:linear-gradient(135deg,var(--brand) 0%,var(--brand2) 100%);color:#fff;border:none;border-radius:11px;font-size:15px;font-weight:700;font-family:'Outfit',sans-serif;cursor:pointer;transition:opacity 0.15s,transform 0.15s;display:flex;align-items:center;justify-content:center;gap:8px;margin-top:8px;box-shadow:0 6px 20px rgba(13,148,136,0.35);}
.btn-login:hover{opacity:0.92;transform:translateY(-1px);}
.info-box{background:#f0fdfa;border:1px solid #99f6e4;border-radius:10px;padding:14px 16px;margin-top:20px;font-size:13px;color:#134e4a;display:flex;gap:10px;align-items:flex-start;}
.info-box i{color:var(--brand);margin-top:1px;flex-shrink:0;}
.divider{display:flex;align-items:center;gap:12px;margin:20px 0;color:#d1d5db;}
.divider::before,.divider::after{content:'';flex:1;height:1px;background:var(--border);}
.divider span{color:var(--muted);font-size:12px;font-weight:500;white-space:nowrap;}
.btn-admin{width:100%;padding:11px;background:transparent;color:#1a56db;border:1.5px solid #bfdbfe;border-radius:11px;font-size:13px;font-weight:600;font-family:'Outfit',sans-serif;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;transition:all 0.15s;}
.btn-admin:hover{background:#eff6ff;border-color:#1a56db;}
.card-footer{text-align:center;margin-top:20px;font-size:11.5px;color:#d1d5db;}
.card-footer a{color:#5eead4;text-decoration:none;}
@media(max-width:480px){.login-card{padding:32px 24px 28px;}.page-wrap{padding:16px;}}
</style>
</head>
<body>
<div class="bg-layer"></div>
<div class="bg-grid"></div>
<div class="orb orb-1"></div>
<div class="orb orb-2"></div>

<div class="page-wrap">
  <div class="portal-label">
    <span><i class="fas fa-graduation-cap"></i> &nbsp;Student Portal</span>
  </div>

  <div class="login-card">
    <div class="brand-area">
      <img
        src="assets/images/cyconsultancy.png"
        alt="CY Consultancy"
        class="brand-logo"
        onerror="this.style.display='none';document.getElementById('lf').style.display='flex';"
      >
      <div class="brand-logo-fallback" id="lf">CY</div>
      <div class="brand-text">
        <h1>CY Consultancy Centre</h1>
        <p>Student Visa &amp; Immigration Specialists</p>
      </div>
    </div>

    <div class="login-title">
      <h2>Student Login 🎓</h2>
      <p>Track your visa application status</p>
    </div>

    <form method="POST" action="#" autocomplete="off">
      <div class="form-group">
        <label class="form-label" for="student_id">Student ID / Email</label>
        <div class="input-wrap">
          <i class="fas fa-id-card fi"></i>
          <input type="text" id="student_id" name="student_id" class="form-input"
            placeholder="Enter your Student ID or email" required autofocus>
        </div>
      </div>
      <div class="form-group">
        <label class="form-label" for="password">Password</label>
        <div class="input-wrap">
          <i class="fas fa-lock fi"></i>
          <input type="password" id="password" name="password" class="form-input"
            placeholder="Enter your password" required>
          <button type="button" class="eye-btn" onclick="togglePass()">
            <i class="fas fa-eye" id="eyeIcon"></i>
          </button>
        </div>
      </div>
      <button type="submit" class="btn-login">
        <i class="fas fa-right-to-bracket"></i>
        Sign In to Portal
      </button>
    </form>

    <div class="info-box">
      <i class="fas fa-circle-info"></i>
      <div>Login credentials are provided by your consultant. Contact <strong>CY Consultancy</strong> if you need help accessing your account.</div>
    </div>

    <div class="divider"><span>admin area</span></div>

    <a href="admin/login.php" class="btn-admin">
      <i class="fas fa-shield-halved"></i>
      Admin Login
    </a>
  </div>

  <div class="card-footer">
    &copy; <?= date('Y') ?> CY Consultancy Centre &nbsp;&middot;&nbsp;
    <a href="<?= htmlspecialchars(BASE_URL) ?>">Visit Website</a>
  </div>
</div>

<script>
function togglePass(){
  const i=document.getElementById('password');
  const ic=document.getElementById('eyeIcon');
  if(i.type==='password'){i.type='text';ic.className='fas fa-eye-slash';}
  else{i.type='password';ic.className='fas fa-eye';}
}
</script>
</body>
</html>
