<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Masuk Portal - Sistem Informasi Pendataan Pegawai</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <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@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Outfit', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #e8e4d9 0%, #e6ddc5 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #4a3728;
            position: relative;
            overflow-x: hidden;
        }

        /* Decorative Glowing Blobs */
        .login-glow-blob {
            position: absolute;
            border-radius: 50%;
            filter: blur(100px);
            opacity: 0.12;
            z-index: 0;
            pointer-events: none;
        }

        .blob-login-1 {
            top: -10%;
            left: -10%;
            width: 450px;
            height: 450px;
            background: #d4a017;
        }

        .blob-login-2 {
            bottom: -10%;
            right: -10%;
            width: 500px;
            height: 500px;
            background: #c9930a;
        }

        .login-wrapper {
            position: relative;
            z-index: 10;
            max-width: 440px;
            width: 100%;
            padding: 1.5rem;
        }

        /* Glassmorphic Card */
        .login-card {
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid rgba(212, 160, 23, 0.2);
            border-radius: 24px;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
            overflow: hidden;
            transition: border-color 0.3s ease;
        }

        .login-card:hover {
            border-color: rgba(14, 165, 233, 0.25);
        }

        .login-header {
            background: linear-gradient(135deg, #e6ddc5 0%, #f6e5b3 100%);
            color: #4a3728;
            padding: 2.5rem 2rem 2rem;
            text-align: center;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        }

        .login-header h2 {
            margin-bottom: 0.5rem;
            font-weight: 800;
            font-size: 1.75rem;
        }

        .login-header h2 span {
            background: linear-gradient(to right, #f0c040, #e0b030);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .login-header p {
            margin-bottom: 0;
            font-size: 0.9rem;
            color: #6c757d;
        }

        .login-body {
            padding: 2.25rem 2rem;
        }

        /* Form elements */
        .form-label {
            font-weight: 600;
            color: #4a3728;
            margin-bottom: 0.5rem;
            font-size: 0.9rem;
        }

        .form-control-dark {
            background: #f4f1e9 !important;
            border: 1px solid rgba(0, 0, 0, 0.1) !important;
            color: #4a3728 !important;
            border-radius: 12px;
            padding: 0.8rem 1rem;
            transition: all 0.3s ease;
        }

        .form-control-dark:focus {
            background: #f4f1e9 !important;
            border-color: #d4a017 !important;
            box-shadow: 0 0 0 0.25rem rgba(212, 160, 23, 0.2) !important;
            outline: none;
        }

        .form-control-dark::placeholder {
            color: #475569 !important;
        }

        .form-check-label {
            color: #6c757d;
            font-size: 0.9rem;
            user-select: none;
        }

        .form-check-input {
            background-color: #f4f1e9;
            border-color: rgba(0, 0, 0, 0.15);
        }

        .form-check-input:checked {
            background-color: #d4a017;
            border-color: #d4a017;
        }

        /* Buttons */
        .btn-login-submit {
            background: linear-gradient(135deg, #d4a017 0%, #b8860b 100%);
            border: none;
            border-radius: 12px;
            padding: 0.85rem 1.5rem;
            font-weight: 700;
            color: #f4f1e9;
            width: 100%;
            box-shadow: 0 8px 20px rgba(14, 165, 233, 0.25);
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
        }

        .btn-login-submit:hover {
            transform: translateY(-2px);
            box-shadow: 0 12px 25px rgba(14, 165, 233, 0.45);
            color: #f4f1e9;
        }

        /* Demo credentials box */
        .demo-credentials-box {
            background: #e6ddc5;
            border: 1px solid rgba(212, 160, 23, 0.2);
            border-radius: 12px;
            padding: 1.25rem;
            margin-bottom: 1.75rem;
        }

        .demo-credentials-box h6 {
            color: #d4a017;
            font-weight: 700;
            margin-bottom: 0.75rem;
            display: flex;
            align-items: center;
            gap: 0.45rem;
            font-size: 0.95rem;
        }

        .demo-credentials-box p {
            margin: 0;
            font-size: 0.85rem;
            color: #6c757d;
            line-height: 1.5;
        }

        .demo-credentials-box strong {
            color: #4a3728;
        }

        .login-footer {
            text-align: center;
            padding: 1.25rem;
            background: #e8e4d9;
            font-size: 0.8rem;
            color: #64748b;
            border-top: 1px solid rgba(0, 0, 0, 0.05);
        }

        .alert-danger-dark {
            background-color: #f2d5d3;
            border: 1px solid rgba(239, 68, 68, 0.2);
            color: #8a4843;
            border-radius: 12px;
            padding: 1rem;
            font-size: 0.9rem;
        }

        .btn-close-white {
            filter: none;
        }
    </style>
</head>
<body>
    <!-- Background Glow -->
    <div class="login-glow-blob blob-login-1"></div>
    <div class="login-glow-blob blob-login-2"></div>

    <div class="login-wrapper">
        <div class="login-card">
            <!-- Header -->
            <div class="login-header">
                <h2><i class="fas fa-lock me-2" style="color: #d4a017;"></i><span>Masuk Portal</span></h2>
                <p>Sistem Informasi Pendataan Pegawai</p>
                <div class="small text-secondary mt-1">Kabupaten Sukabumi</div>
            </div>

            <!-- Body -->
            <div class="login-body">
                @if ($errors->any())
                    <div class="alert alert-danger-dark alert-dismissible fade show mb-4" role="alert">
                        <div class="fw-bold mb-1"><i class="fas fa-exclamation-triangle me-1"></i> Login Gagal!</div>
                        <ul class="mb-0 ps-3 mt-1" style="font-size: 0.85rem;">
                            @foreach ($errors->all() as $error)
                                <li>{{ $error }}</li>
                            @endforeach
                        </ul>
                        <button type="button" class="btn-close btn-close-white" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                @endif


                <!-- Form -->
                <form action="{{ route('login') }}" method="POST">
                    @csrf

                    <div class="mb-3">
                        <label for="email" class="form-label">Email Kantor</label>
                        <input type="email" id="email" name="email" class="form-control form-control-dark @error('email') is-invalid @enderror"
                            placeholder="Masukkan email terdaftar" value="{{ old('email') }}" required autofocus>
                        @error('email')
                            <div class="invalid-feedback mt-1">{{ $message }}</div>
                        @enderror
                    </div>

                    <div class="mb-4">
                        <label for="password" class="form-label">Kata Sandi</label>
                        <div class="input-group">
                            <input type="password" id="password" name="password"
                                class="form-control form-control-dark border-end-0 @error('password') is-invalid @enderror"
                                style="border-top-right-radius: 0; border-bottom-right-radius: 0;"
                                placeholder="Masukkan kata sandi Anda" required>
                            <span class="input-group-text form-control-dark border-start-0" 
                                style="border-top-left-radius: 0; border-bottom-left-radius: 0; cursor: pointer; padding-left: 0.75rem; padding-right: 1rem; background: #f4f1e9;" 
                                id="togglePassword">
                                <i class="fas fa-eye text-muted" id="eyeIcon"></i>
                            </span>
                        </div>
                        @error('password')
                            <div class="invalid-feedback mt-1 d-block">{{ $message }}</div>
                        @enderror
                    </div>

                    <div class="mb-4 d-flex align-items-center justify-content-between">
                        <div class="form-check m-0">
                            <input type="checkbox" id="remember" name="remember" class="form-check-input">
                            <label class="form-check-label" for="remember">
                                Ingat saya
                            </label>
                        </div>
                    </div>

                    <button type="submit" class="btn btn-login-submit">
                        <i class="fas fa-sign-in-alt"></i> <span>Masuk ke Sistem</span>
                    </button>
                </form>
            </div>

            <!-- Footer -->
            <div class="login-footer">
                <p class="mb-0">&copy; 2026 BKPSDM Kabupaten Sukabumi</p>
            </div>
        </div>

        <div class="text-center mt-4">
            <a href="{{ route('home') }}" class="text-secondary text-decoration-none small transition-all hover:text-dark" style="transition: color 0.2s;">
                <i class="fas fa-arrow-left me-1"></i> Kembali ke Beranda
            </a>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        document.addEventListener('DOMContentLoaded', function () {
            const togglePassword = document.getElementById('togglePassword');
            const password = document.getElementById('password');
            const eyeIcon = document.getElementById('eyeIcon');

            if(togglePassword && password && eyeIcon) {
                togglePassword.addEventListener('click', function () {
                    const type = password.getAttribute('type') === 'password' ? 'text' : 'password';
                    password.setAttribute('type', type);
                    eyeIcon.classList.toggle('fa-eye');
                    eyeIcon.classList.toggle('fa-eye-slash');
                });
            }
        });
    </script>
</body>
</html>
