<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>Sign in · Saai Cards</title>

    <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=Outfit:wght@400;500;600;700&family=Syne:wght@600;700;800&display=swap" rel="stylesheet">

    <style>
        :root {
            --ink: #06101f;
            --ink-mid: #0c1a30;
            --ink-lift: #132844;
            --paper: #f4f7fc;
            --paper-pure: #ffffff;
            --accent: #1a5cff;
            --accent-deep: #0040c8;
            --muted: #5a6a80;
            --line: rgba(6, 16, 31, 0.12);
            --danger: #b42318;
            --ease: cubic-bezier(0.22, 1, 0.36, 1);
        }

        * { box-sizing: border-box; margin: 0; padding: 0; }

        html, body {
            height: 100%;
            font-family: 'Outfit', sans-serif;
            color: var(--ink);
            background: var(--ink);
            -webkit-font-smoothing: antialiased;
        }

        .stage {
            min-height: 100%;
            display: grid;
            grid-template-columns: 1.12fr 1fr;
        }

        /* —— Full-bleed brand plane —— */
        .brand-plane {
            position: relative;
            overflow: hidden;
            background:
                radial-gradient(ellipse 90% 70% at 10% 90%, rgba(26, 92, 255, 0.35), transparent 55%),
                radial-gradient(ellipse 60% 50% at 90% 10%, rgba(0, 180, 220, 0.18), transparent 45%),
                linear-gradient(155deg, #040b16 0%, #0a1628 42%, #122a4a 100%);
            color: #eef3fb;
            padding: clamp(2rem, 5vw, 4.5rem);
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            isolation: isolate;
        }

        .brand-plane::before {
            content: '';
            position: absolute;
            inset: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
            opacity: 0.07;
            pointer-events: none;
            z-index: 0;
            animation: grain-shift 9s steps(5) infinite;
        }

        .orbit {
            position: absolute;
            border-radius: 50%;
            border: 1px solid rgba(238, 243, 251, 0.08);
            z-index: 0;
            pointer-events: none;
        }

        .orbit-a {
            width: 58vmax;
            height: 58vmax;
            top: -22%;
            right: -28%;
            animation: spin 32s linear infinite;
        }

        .orbit-b {
            width: 36vmax;
            height: 36vmax;
            bottom: -18%;
            left: -14%;
            border-color: rgba(26, 92, 255, 0.25);
            animation: spin 48s linear infinite reverse;
        }

        .sheet-stack {
            position: absolute;
            top: 16%;
            right: 8%;
            width: min(38vw, 340px);
            height: min(48vw, 420px);
            z-index: 0;
            opacity: 0.55;
            animation: sheet-float 10s var(--ease) infinite alternate;
        }

        .sheet {
            position: absolute;
            inset: 0;
            border-radius: 4px;
            background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.03));
            border: 1px solid rgba(255,255,255,0.14);
            box-shadow: 0 20px 50px rgba(0,0,0,0.25);
        }

        .sheet:nth-child(1) { transform: rotate(6deg) translate(18px, 10px); }
        .sheet:nth-child(2) { transform: rotate(2deg) translate(8px, 4px); opacity: 0.8; }
        .sheet:nth-child(3) {
            transform: rotate(-3deg);
            background:
                linear-gradient(180deg, rgba(26, 92, 255, 0.2), transparent 40%),
                linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.04));
        }

        .sheet:nth-child(3)::before {
            content: '';
            position: absolute;
            left: 14%;
            right: 14%;
            top: 22%;
            height: 55%;
            background:
                repeating-linear-gradient(
                    transparent 0 18px,
                    rgba(238, 243, 251, 0.2) 18px 19px
                );
            opacity: 0.7;
        }

        .brand-top,
        .brand-hero,
        .brand-foot {
            position: relative;
            z-index: 1;
        }

        .brand-mark {
            display: inline-flex;
            align-items: center;
            gap: 0.7rem;
            opacity: 0;
            animation: rise 0.85s var(--ease) 0.08s forwards;
        }

        .brand-mark .glyph {
            width: 42px;
            height: 42px;
            display: grid;
            place-items: center;
            background: var(--accent);
            color: #fff;
            border-radius: 0.55rem;
        }

        .brand-mark .glyph svg { width: 22px; height: 22px; }

        .brand-mark strong {
            font-family: 'Syne', sans-serif;
            font-size: 1.15rem;
            font-weight: 800;
            letter-spacing: -0.02em;
        }

        .brand-hero {
            max-width: 30rem;
            padding: 2rem 0;
        }

        .brand-hero h1 {
            font-family: 'Syne', sans-serif;
            font-size: clamp(3rem, 6.5vw, 4.85rem);
            font-weight: 800;
            line-height: 0.96;
            letter-spacing: -0.045em;
            margin-bottom: 1.35rem;
            opacity: 0;
            animation: rise 0.95s var(--ease) 0.22s forwards;
        }

        .brand-hero h1 span {
            display: block;
            color: #7eb0ff;
        }

        .brand-hero p {
            font-size: 1.05rem;
            line-height: 1.65;
            color: rgba(238, 243, 251, 0.7);
            max-width: 23rem;
            opacity: 0;
            animation: rise 0.95s var(--ease) 0.4s forwards;
        }

        .brand-foot {
            font-size: 0.72rem;
            font-weight: 600;
            letter-spacing: 0.16em;
            text-transform: uppercase;
            color: rgba(238, 243, 251, 0.4);
            display: flex;
            align-items: center;
            gap: 1rem;
            opacity: 0;
            animation: rise 0.95s var(--ease) 0.58s forwards;
        }

        .brand-foot::before {
            content: '';
            width: 2.25rem;
            height: 1px;
            background: rgba(238, 243, 251, 0.28);
        }

        /* —— Form plane —— */
        .form-plane {
            background:
                radial-gradient(ellipse 80% 50% at 50% 0%, #e8f0ff 0%, transparent 55%),
                linear-gradient(180deg, #f8faff 0%, var(--paper) 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: clamp(1.5rem, 4vw, 3rem);
            position: relative;
        }

        .form-wrap {
            width: 100%;
            max-width: 400px;
            position: relative;
            z-index: 1;
            opacity: 0;
            animation: rise 0.9s var(--ease) 0.32s forwards;
        }

        .form-kicker {
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.16em;
            text-transform: uppercase;
            color: var(--accent-deep);
            margin-bottom: 0.7rem;
        }

        .form-wrap h2 {
            font-family: 'Syne', sans-serif;
            font-size: clamp(1.9rem, 3vw, 2.4rem);
            font-weight: 800;
            letter-spacing: -0.03em;
            margin-bottom: 0.4rem;
            line-height: 1.1;
        }

        .form-wrap .lede {
            color: var(--muted);
            font-size: 0.98rem;
            margin-bottom: 2rem;
            line-height: 1.55;
        }

        .alert {
            background: #fef3f2;
            color: var(--danger);
            border: 1px solid rgba(180, 35, 24, 0.18);
            border-radius: 0.5rem;
            padding: 0.85rem 1rem;
            font-size: 0.875rem;
            margin-bottom: 1.5rem;
            list-style: none;
        }

        .alert li + li { margin-top: 0.3rem; }

        .field { margin-bottom: 1.15rem; }

        .field label {
            display: block;
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--ink-mid);
            margin-bottom: 0.45rem;
        }

        .field input {
            width: 100%;
            border: 1.5px solid var(--line);
            background: var(--paper-pure);
            border-radius: 0.55rem;
            padding: 0.92rem 1rem;
            font-family: inherit;
            font-size: 0.98rem;
            color: var(--ink);
            transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s var(--ease);
        }

        .field input::placeholder { color: #94a3b8; }

        .field input:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(26, 92, 255, 0.16);
            transform: translateY(-1px);
        }

        .password-row { position: relative; }

        .toggle-pass {
            position: absolute;
            right: 0.85rem;
            top: 50%;
            transform: translateY(-50%);
            border: none;
            background: none;
            color: var(--muted);
            font-size: 0.78rem;
            font-weight: 600;
            cursor: pointer;
            font-family: inherit;
            padding: 0.25rem;
        }

        .toggle-pass:hover { color: var(--ink); }

        .submit {
            width: 100%;
            margin-top: 0.55rem;
            border: none;
            background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
            color: #fff;
            font-family: inherit;
            font-size: 0.98rem;
            font-weight: 700;
            letter-spacing: 0.01em;
            padding: 1rem 1.25rem;
            border-radius: 0.55rem;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.65rem;
            transition: filter 0.25s ease, transform 0.25s var(--ease);
            position: relative;
            overflow: hidden;
        }

        .submit::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.18) 50%, transparent 60%);
            transform: translateX(-120%);
            transition: transform 0.6s var(--ease);
        }

        .submit:hover {
            filter: brightness(1.06);
            transform: translateY(-2px);
        }

        .submit:hover::after { transform: translateX(120%); }
        .submit:active { transform: translateY(0); }

        .submit svg {
            width: 18px;
            height: 18px;
            transition: transform 0.25s var(--ease);
        }

        .submit:hover svg { transform: translateX(4px); }

        .form-meta {
            margin-top: 2rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--line);
            font-size: 0.78rem;
            color: var(--muted);
            text-align: center;
        }

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

        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        @keyframes sheet-float {
            from { transform: translateY(0) rotate(0deg); }
            to { transform: translateY(-14px) rotate(1.5deg); }
        }

        @keyframes grain-shift {
            0%, 100% { transform: translate(0, 0); }
            25% { transform: translate(-1.5%, 1%); }
            50% { transform: translate(1%, -1.5%); }
            75% { transform: translate(-1%, 1%); }
        }

        @media (max-width: 900px) {
            .stage { grid-template-columns: 1fr; }

            .brand-plane {
                min-height: 40vh;
                padding: 1.6rem 1.4rem 1.8rem;
            }

            .brand-hero { padding: 1rem 0 0.25rem; }

            .brand-hero h1 {
                font-size: clamp(2.5rem, 11vw, 3.4rem);
            }

            .brand-foot { display: none; }

            .sheet-stack {
                width: 160px;
                height: 200px;
                top: auto;
                bottom: 6%;
                right: 4%;
                opacity: 0.35;
            }
        }

        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
            .brand-mark, .brand-hero h1, .brand-hero p, .brand-foot, .form-wrap {
                opacity: 1;
            }
        }
    </style>
</head>
<body>
    <div class="stage">
        <aside class="brand-plane">
            <div class="orbit orbit-a"></div>
            <div class="orbit orbit-b"></div>

            <div class="sheet-stack" aria-hidden="true">
                <div class="sheet"></div>
                <div class="sheet"></div>
                <div class="sheet"></div>
            </div>

            <div class="brand-top">
                <div class="brand-mark">
                    <div class="glyph">
                        <svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
                            <path d="M6 7h12v12H6V7Z" stroke="currentColor" stroke-width="2"/>
                            <path d="M9 4h6v3H9V4Z" stroke="currentColor" stroke-width="2"/>
                            <path d="M9 11h6M9 15h4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
                        </svg>
                    </div>
                    <strong>Saai Cards</strong>
                </div>
            </div>

            <div class="brand-hero">
                <h1>
                    Saai Cards
                    <span>print command.</span>
                </h1>
                <p>Quotations, confirmed jobs, and press-floor status — one workspace for every sheet that leaves the shop.</p>
            </div>

            <div class="brand-foot">Management System · {{ date('Y') }}</div>
        </aside>

        <main class="form-plane">
            <div class="form-wrap">
                <p class="form-kicker">Secure access</p>
                <h2>Welcome back</h2>
                <p class="lede">Sign in to continue to your Saai Cards workspace.</p>

                @if($errors->any())
                    <ul class="alert" role="alert">
                        @foreach($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                @endif

                <form action="{{ route('login.post') }}" method="POST" autocomplete="on">
                    @csrf

                    <div class="field">
                        <label for="email">Email address</label>
                        <input
                            type="email"
                            id="email"
                            name="email"
                            value="{{ old('email') }}"
                            placeholder="you@saaicards.com"
                            required
                            autofocus
                        >
                    </div>

                    <div class="field">
                        <label for="password">Password</label>
                        <div class="password-row">
                            <input
                                type="password"
                                id="password"
                                name="password"
                                placeholder="Enter your password"
                                required
                                style="padding-right: 4.5rem;"
                            >
                            <button type="button" class="toggle-pass" id="togglePass" aria-label="Show password">Show</button>
                        </div>
                    </div>

                    <button type="submit" class="submit">
                        Sign in
                        <svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
                            <path d="M5 12h14M13 6l6 6-6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                        </svg>
                    </button>
                </form>

                <p class="form-meta">&copy; {{ date('Y') }} Saai Cards · All rights reserved</p>
            </div>
        </main>
    </div>

    <script>
        document.getElementById('togglePass')?.addEventListener('click', function () {
            const input = document.getElementById('password');
            const showing = input.type === 'text';
            input.type = showing ? 'password' : 'text';
            this.textContent = showing ? 'Show' : 'Hide';
            this.setAttribute('aria-label', showing ? 'Show password' : 'Hide password');
        });
    </script>
</body>
</html>
