<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Register - Absensi</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=Inter:wght@400;600;700&display=swap" rel="stylesheet">
    <style>
        :root { --bg: #050b1a; --card: rgba(17, 24, 39, 0.85); --muted: #94a3b8; --text: #e5e7eb; --primary: #3b82f6; }
        * { box-sizing: border-box; }
        body {
            margin: 0;
            font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
            color: var(--text);
            min-height: 100vh;
            display: grid;
            place-items: center;
            background:
                radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.16), transparent 55%),
                radial-gradient(circle at 80% 0%, rgba(14, 165, 233, 0.18), transparent 60%),
                radial-gradient(circle at 50% 85%, rgba(16, 185, 129, 0.12), transparent 60%),
                #030711;
        }
        .card {
            width: 100%;
            max-width: 520px;
            padding: 34px 36px;
            border-radius: 22px;
            background: var(--card);
            border: 1px solid rgba(148, 163, 184, 0.18);
            box-shadow: 0 25px 50px rgba(8, 15, 32, 0.42);
            position: relative;
            overflow: hidden;
        }
        .card::before {
            content: '';
            position: absolute;
            inset: -80px 20% auto -40px;
            height: 220px;
            background: conic-gradient(from 120deg, rgba(59, 130, 246, 0.28), transparent 60%);
            opacity: 0.7;
            filter: blur(30px);
            pointer-events: none;
        }
        .card > * { position: relative; z-index: 1; }
        .card-header { display: flex; flex-direction: column; gap: 12px; margin-bottom: 10px; }
        .brand-badge {
            align-self: flex-start;
            padding: 6px 12px;
            border-radius: 999px;
            background: rgba(59, 130, 246, 0.18);
            color: #bfdbfe;
            font-weight: 600;
            font-size: 12px;
            letter-spacing: 0.05em;
            text-transform: uppercase;
        }
        h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
        p.sub { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
        .card-divider { height: 1px; background: linear-gradient(90deg, rgba(59, 130, 246, 0.4), rgba(14, 165, 233, 0.05)); margin: 18px 0 16px; }
        .errors { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.32); color: #fecaca; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 13px; }
        .fields-grid { display: grid; gap: 16px; margin-top: 6px; }
        @media (min-width: 560px) {
            .fields-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .field.full { grid-column: span 2; }
        }
        .field { display: flex; flex-direction: column; gap: 6px; }
        label { font-size: 13px; color: #cbd5e1; }
        input {
            width: 100%;
            padding: 12px 14px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, 0.24);
            background: rgba(5, 11, 26, 0.46);
            color: var(--text);
            outline: none;
            transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
        }
        input:focus {
            border-color: rgba(59, 130, 246, 0.7);
            box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
            transform: translateY(-1px);
        }
        button {
            width: 100%;
            margin-top: 22px;
            padding: 13px 16px;
            background: linear-gradient(130deg, #2563eb, #14b8a6);
            border: none;
            border-radius: 14px;
            color: white;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 18px 30px rgba(37, 99, 235, 0.32);
            transition: transform 0.12s ease, filter 0.2s ease;
        }
        button:hover { filter: brightness(1.06); }
        button:active { transform: translateY(1px); }
        .card-footer { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.6; }
        a { color: #93c5fd; text-decoration: none; }
        a:hover { text-decoration: underline; }
    </style>
</head>
<body>
    <form class="card" method="POST" action="{{ route('register.post') }}">
        @csrf
        <div class="card-header">
            <span class="brand-badge">Absensi</span>
            <h1>Buat Akun</h1>
            <p class="sub">Daftar dan kelola absensi karyawan tanpa ribet. Lengkapi data di bawah untuk memulai.</p>
        </div>
        <div class="card-divider"></div>

        @if ($errors->any())
            <div class="errors">
                <ul style="margin:0; padding-left: 18px;">
                    @foreach ($errors->all() as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                </ul>
            </div>
        @endif

        <div class="fields-grid">
            <div class="field full">
                <label for="name">Nama Lengkap</label>
                <input id="name" type="text" name="name" value="{{ old('name') }}" required autofocus />
            </div>

            <div class="field full">
                <label for="nik">NIK</label>
                <input id="nik" type="text" name="nik" value="{{ old('nik') }}" required maxlength="32" placeholder="Masukkan NIK" />
            </div>

            <div class="field">
                <label for="username">Username (opsional)</label>
                <input id="username" type="text" name="username" value="{{ old('username') }}" placeholder="Contoh: budi.suparman" />
            </div>

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

            <div class="field">
                <label for="password">Password</label>
                <input id="password" type="password" name="password" required placeholder="Minimal 8 karakter" />
            </div>

            <div class="field">
                <label for="password_confirmation">Konfirmasi Password</label>
                <input id="password_confirmation" type="password" name="password_confirmation" required />
            </div>

            <div class="field full">
                <label>Keahlian</label>
                <div style="display: flex; gap: 12px; margin-top: 6px;">
                    <label style="flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 12px; border-radius: 10px; border: 1px solid rgba(148, 163, 184, 0.24); background: rgba(5, 11, 26, 0.46);">
                        <input type="radio" name="skill" value="mechanic" required {{ old('skill') == 'mechanic' ? 'checked' : '' }} style="width: 16px; height: 16px; accent-color: #3b82f6;">
                        <span>Mekanik</span>
                    </label>
                    <label style="flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 12px; border-radius: 10px; border: 1px solid rgba(148, 163, 184, 0.24); background: rgba(5, 11, 26, 0.46);">
                        <input type="radio" name="skill" value="welder" {{ old('skill') == 'welder' ? 'checked' : '' }} style="width: 16px; height: 16px; accent-color: #3b82f6;">
                        <span>Welder</span>
                    </label>
                </div>
            </div>
        </div>

        <button type="submit">Daftar</button>

        <div class="card-footer">
            Sudah punya akun? <a href="{{ route('login') }}">Masuk di sini</a>
        </div>
    </form>
</body>
</html>
