<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <title>Register - Sistem Hama Padi</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
    <style>

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

        body {
            font-family: 'Poppins', sans-serif;
            min-height: 100vh;
            background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 40%, #66bb6a 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .auth-card {
            background: white;
            border-radius: 20px;
            padding: 40px;
            width: 100%;
            max-width: 440px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.2);
        }

        .auth-header {
            text-align: center;
            margin-bottom: 28px;
        }

        .auth-header .icon {
            font-size: 44px;
            display: block;
            margin-bottom: 10px;
        }

        .auth-header h2 {
            font-size: 22px;
            font-weight: 700;
            color: #1b5e20;
            margin-bottom: 4px;
        }

        .auth-header p {
            font-size: 13px;
            color: #6b7280;
        }

        .alert {
            padding: 12px 14px;
            border-radius: 10px;
            font-size: 13px;
            margin-bottom: 20px;
        }

        .alert-danger {
            background: #fff0f0;
            color: #c62828;
            border: 1px solid #ffcdd2;
        }

        .alert ul {
            margin: 0;
            padding-left: 18px;
        }

        .form-group {
            margin-bottom: 16px;
        }

        .form-group label {
            display: block;
            font-size: 13px;
            font-weight: 500;
            color: #374151;
            margin-bottom: 6px;
        }

        .form-group input {
            width: 100%;
            padding: 11px 14px;
            border: 1.5px solid #e5e7eb;
            border-radius: 10px;
            font-size: 14px;
            font-family: 'Poppins', sans-serif;
            color: #111;
            transition: border-color 0.25s, box-shadow 0.25s;
            background: #fafafa;
        }

        .form-group input:focus {
            outline: none;
            border-color: #2e7d32;
            box-shadow: 0 0 0 3px rgba(46,125,50,0.12);
            background: white;
        }

        /* Tampilkan error per-field */
        .field-error {
            font-size: 12px;
            color: #c62828;
            margin-top: 5px;
            display: block;
        }

        .form-group input.is-error {
            border-color: #e53935;
        }

        .btn-submit {
            width: 100%;
            padding: 13px;
            background: linear-gradient(135deg, #2e7d32, #66bb6a);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 15px;
            font-weight: 600;
            font-family: 'Poppins', sans-serif;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
            box-shadow: 0 4px 15px rgba(46,125,50,0.35);
            margin-top: 6px;
        }

        .btn-submit:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(46,125,50,0.4);
        }

        .btn-submit:active {
            transform: translateY(0);
        }

        .auth-links {
            text-align: center;
            margin-top: 18px;
        }

        .auth-links a {
            font-size: 13px;
            color: #2e7d32;
            text-decoration: none;
            transition: color 0.2s;
        }

        .auth-links a:hover {
            color: #1b5e20;
            text-decoration: underline;
        }

        @media (max-width: 480px) {
            body {
                padding: 16px;
                align-items: flex-start;
                padding-top: 30px;
            }

            .auth-card {
                padding: 26px 20px;
                border-radius: 16px;
            }

            .auth-header .icon {
                font-size: 38px;
            }

            .auth-header h2 {
                font-size: 20px;
            }
        }

    </style>
</head>

<body>

<div class="auth-card">

    <div class="auth-header">
        <span class="icon">🌾</span>
        <h2>Buat Akun Baru</h2>
        <p>Daftarkan diri Anda di Sistem Hama Padi</p>
    </div>

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

    <form method="POST" action="/register">
        @csrf

        <div class="form-group">
            <label for="name">Nama Lengkap</label>
            <input
                type="text"
                id="name"
                name="name"
                placeholder="Masukkan nama lengkap"
                value="{{ old('name') }}"
                class="{{ $errors->has('name') ? 'is-error' : '' }}"
                required
                autocomplete="name"
            >
            @error('name')
                <span class="field-error">{{ $message }}</span>
            @enderror
        </div>

        <div class="form-group">
            <label for="email">Email</label>
            <input
                type="email"
                id="email"
                name="email"
                placeholder="contoh@email.com"
                value="{{ old('email') }}"
                class="{{ $errors->has('email') ? 'is-error' : '' }}"
                required
                autocomplete="email"
            >
            @error('email')
                <span class="field-error">{{ $message }}</span>
            @enderror
        </div>

        <div class="form-group">
            <label for="password">Password</label>
            <input
                type="password"
                id="password"
                name="password"
                placeholder="Minimal 8 karakter"
                class="{{ $errors->has('password') ? 'is-error' : '' }}"
                required
                autocomplete="new-password"
            >
            @error('password')
                <span class="field-error">{{ $message }}</span>
            @enderror
        </div>

        <div class="form-group">
            <label for="password_confirmation">Konfirmasi Password</label>
            <input
                type="password"
                id="password_confirmation"
                name="password_confirmation"
                placeholder="Ulangi password"
                required
                autocomplete="new-password"
            >
        </div>

        <button type="submit" class="btn-submit">Daftar Sekarang</button>

    </form>

    <div class="auth-links">
        <a href="/login">Sudah punya akun? <strong>Login di sini</strong></a>
    </div>

</div>

</body>
</html>