<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>Login - SIPIAN</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <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;500;600;700;800&display=swap" rel="stylesheet">
    <style>
        body { font-family: 'Inter', sans-serif; }
        .form-container { animation: fadeIn 0.5s ease-in-out; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
        
        /* Smooth scrolling */
        html { scroll-behavior: smooth; }
    </style>
</head>
<body class="bg-gray-50 text-gray-900 antialiased">

    <!-- Container Utama: Menggunakan p-4 untuk padding aman di HP -->
    <div class="min-h-screen w-full flex items-center justify-center p-4 sm:p-6 lg:p-8">
        
        <!-- Kartu Login: 
             - h-auto di mobile agar flexibel 
             - lg:h-[600px] di desktop agar fix dan rapi 
             - flex-col di mobile (atas bawah), flex-row di desktop (kiri kanan) -->
        <div class="w-full max-w-5xl flex flex-col lg:flex-row bg-white rounded-2xl shadow-2xl overflow-hidden h-auto lg:h-[600px]"> 
            
            <!-- Bagian Kiri (Branding): 
                 - Tampil di atas pada mobile
                 - lg:w-1/2 (setengah lebar) di desktop -->
            <div class="w-full lg:w-1/2 bg-gradient-to-br from-indigo-600 to-blue-700 p-8 md:p-12 flex flex-col items-center justify-center text-white text-center relative overflow-hidden min-h-[250px] lg:min-h-full">
                <!-- Background Pattern -->
                <div class="absolute top-0 left-0 w-full h-full opacity-10 pointer-events-none">
                    <svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
                        <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">
                            <path d="M 40 0 L 0 0 0 40" fill="none" stroke="white" stroke-width="1"/>
                        </pattern>
                        <rect width="100%" height="100%" fill="url(#grid)" />
                    </svg>
                </div>

                <div class="relative z-10 my-auto flex flex-col items-center">
                    <div class="bg-white/10 backdrop-blur-sm p-4 lg:p-6 rounded-3xl mb-4 lg:mb-6 ring-1 ring-white/20 shadow-lg transition-transform hover:scale-105 duration-300">
                        <!-- Icon Responsive Size -->
                        <svg xmlns="http://www.w3.org/2000/svg" class="w-12 h-12 lg:w-20 lg:h-20 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5">
                            <path stroke-linecap="round" stroke-linejoin="round" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" />
                        </svg>
                    </div>
                    <h1 class="text-2xl lg:text-3xl font-bold mb-2 lg:mb-3 leading-tight tracking-tight">SIPIAN</h1>
                    <p class="text-indigo-100 text-base lg:text-lg font-medium mb-4 lg:mb-6">DP3APPKB Surabaya</p>
                    <p class="text-indigo-200 text-xs lg:text-sm max-w-xs mx-auto leading-relaxed hidden sm:block">
                        Monitoring Real-time Pinjam-Pakai Ruangan, Kendaraan dan Peralatan Operasional.
                    </p>
                </div>
            </div>

            <!-- Bagian Kanan (Form Login) -->
            <div class="w-full lg:w-1/2 p-6 sm:p-8 md:p-12 form-container flex flex-col justify-center bg-white relative">
                <div class="max-w-sm mx-auto w-full">
                    <div class="mb-6 lg:mb-8 text-center">
                        <h2 class="text-2xl lg:text-3xl font-extrabold text-gray-900">Login User</h2>
                        <p class="text-gray-500 mt-2 text-sm lg:text-base">Masukkan kredensial Anda untuk akses sistem</p>
                    </div>

                    @if ($errors->any())
                        <div class="bg-red-50 border-l-4 border-red-500 text-red-700 p-4 rounded-r-md mb-6 text-sm animate-pulse" role="alert">
                            <div class="flex items-start">
                                <svg class="h-5 w-5 text-red-500 mr-2 mt-0.5 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
                                </svg>
                                <div>
                                    <p class="font-bold">Gagal Masuk</p>
                                    <span>{{ $errors->first() }}</span>
                                </div>
                            </div>
                        </div>
                    @endif

                    <form method="POST" action="{{ route('login') }}" class="space-y-4 lg:space-y-5">
                        @csrf
                        <div class="space-y-1">
                            <label for="email" class="text-sm font-semibold text-gray-700 block">Email</label>
                            <div class="relative">
                                <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                                    <svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
                                      <path d="M2.003 5.884L10 9.882l7.997-3.998A2 2 0 0016 4H4a2 2 0 00-1.997 1.884z" />
                                      <path d="M18 8.118l-8 4-8-4V14a2 2 0 002 2h12a2 2 0 002-2V8.118z" />
                                    </svg>
                                </div>
                                <input id="email" name="email" type="email" value="{{ old('email') }}" required autofocus
                                    class="block w-full pl-10 pr-3 py-2.5 lg:py-3 border border-gray-300 rounded-lg leading-5 bg-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition sm:text-sm"
                                    placeholder="nama@instansi.go.id">
                            </div>
                        </div>

                        <div class="space-y-1">
                            <label for="password" class="text-sm font-semibold text-gray-700 block">Password</label>
                            <div class="relative">
                                <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                                    <svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
                                      <path fill-rule="evenodd" d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z" clip-rule="evenodd" />
                                    </svg>
                                </div>
                                <input id="password" name="password" type="password" required
                                    class="block w-full pl-10 pr-3 py-2.5 lg:py-3 border border-gray-300 rounded-lg leading-5 bg-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition sm:text-sm"
                                    placeholder="••••••••">
                            </div>
                        </div>

                        <div class="mt-2">
                            <!-- Recaptcha Container centered but scale down slightly on very small screens if needed -->
                            <div class="g-recaptcha flex justify-center transform scale-[0.85] sm:scale-100 origin-center" data-sitekey="{{ config('services.recaptcha.site_key') }}"></div>
                            @error('g-recaptcha-response')
                                <p class="text-red-600 text-xs mt-1 text-center">{{ $message }}</p>
                            @enderror
                        </div>

                        <div class="flex items-center justify-between text-sm mt-4">
                            <div class="flex items-center">
                                <input id="remember_me" name="remember" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded cursor-pointer">
                                <label for="remember_me" class="ml-2 block text-gray-700 cursor-pointer select-none">Ingat saya</label>
                            </div>
                            @if (Route::has('password.request'))
                                <a href="{{ route('password.request') }}" class="font-medium text-indigo-600 hover:text-indigo-500 hover:underline">
                                    Lupa Password?
                                </a>
                            @endif
                        </div>

                        <div class="pt-2">
                            <button type="submit" class="w-full flex justify-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-bold text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition-all transform active:scale-[0.98]">
                                LOGIN
                            </button>
                        </div>

                        <div class="text-center text-sm mt-4 lg:mt-6">
                            @if (Route::has('register'))
                                <p class="text-gray-600">
                                    Belum punya akun?
                                    <a href="{{ route('register') }}" class="font-medium text-indigo-600 hover:text-indigo-500 hover:underline transition-colors">
                                        Daftar sekarang
                                    </a>
                                </p>
                            @endif
                        </div>
                    </form>
                    
                    <div class="text-center text-xs text-gray-400 mt-6 lg:mt-8 pb-4 lg:pb-0">
                        &copy; {{ date('Y') }} DP3APPKB Surabaya. <br class="sm:hidden">All rights reserved.
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://www.google.com/recaptcha/api.js" async defer></script>
</body>
</html>