<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login - E-Recruitment</title>
    <link rel="icon" type="image/png" href="{{ asset('assets/images/logo.png') }}">
    <link rel="stylesheet" href="{{ asset('css/style.css?v=1779407811') }}">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .auth-container {
            max-width: 900px;
            margin: 40px auto;
            background: #FFFFFF;
            padding: 30px 40px;
        }
        
        .auth-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 40px;
            padding-bottom: 20px;
            border-bottom: 1px solid #eee;
        }
        
        .top-nav {
            display: flex;
            justify-content: flex-end;
            gap: 20px;
            padding: 10px 40px;
            font-size: 0.85rem;
        }
        
        .top-nav a {
            text-decoration: none;
            color: #666;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .btn-login-small {
            background-color: #1976D2;
            color: white !important;
            padding: 5px 15px;
            border-radius: 4px;
            font-weight: 600;
        }
        
        .main-nav {
            display: flex;
            gap: 25px;
        }
        
        .main-nav a {
            text-decoration: none;
            color: var(--primary-green);
            font-weight: 600;
            font-size: 0.95rem;
        }
        
        .auth-card {
            border: 2px solid var(--primary-green);
            border-radius: 4px;
            padding: 30px 50px;
            max-width: 500px;
            margin: 0 auto;
        }
        
        .auth-card h2 {
            font-size: 1.5rem;
            margin-bottom: 10px;
            color: #333;
        }
        
        .auth-card p {
            color: #666;
            font-size: 0.95rem;
            margin-bottom: 30px;
            line-height: 1.5;
        }
        
        .auth-form-group {
            position: relative;
            display: flex;
            flex-direction: column;
            margin-bottom: 20px;
        }
        
        .auth-form-group label {
            position: absolute;
            top: -8px;
            left: 10px;
            background-color: #FFFFFF;
            padding: 0 5px;
            font-size: 0.75rem;
            color: #666;
            z-index: 1;
        }
        
        .auth-form-group input {
            width: 100%;
            padding: 14px 12px;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 0.95rem;
        }
        
        .password-toggle {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #666;
            cursor: pointer;
        }
        
        .btn-submit-auth {
            background-color: #1976D2;
            color: white;
            border: none;
            padding: 12px;
            border-radius: 4px;
            font-weight: 600;
            width: 100%;
            margin-top: 10px;
            cursor: pointer;
            font-size: 1rem;
        }
        
        .auth-links {
            margin-top: 30px;
            font-size: 0.9rem;
            color: #666;
        }
        
        .auth-links a {
            color: #1976D2;
            text-decoration: underline;
        }
        
        .auth-links p {
            margin-bottom: 15px;
        }
        
        .footer-auth {
            background-color: var(--primary-green);
            color: white;
            padding: 15px 40px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.85rem;
            margin-top: 40px;
            border-radius: 8px;
        }
    </style>
</head>
<body style="background-color: #E8F5E9;">

    <div class="top-bar">
        <div class="top-bar-left" style="display: flex; align-items: center; gap: 8px;">
            <div style="width: 20px; height: 20px; background-image: url('{{ asset('assets/images/logo.png') }}'); background-size: cover; border-radius: 2px;"></div>
            PT Brahma Bina Bakti
        </div>
                <div class="top-bar-right">
            <a href="{{ route('panduan') }}"><i class="fas fa-book"></i> Panduan</a>
            @guest
                <a href="{{ route('login') }}" class="btn-logout" style="background-color: #1976D2;"><i class="fas fa-sign-in-alt"></i> Login</a>
            @else
                <span style="color: #fff; margin-right: 15px;"><i class="fas fa-user"></i> {{ Auth::user()->nama_depan }}</span>
                <a href="#" onclick="event.preventDefault(); document.getElementById('logout-form').submit();" class="btn-logout"><i class="fas fa-sign-out-alt"></i> Logout</a>
            @endguest
        </div>
    </div>

    <header class="header">
        <div class="logo-container">
            <div style="width: 45px; height: 45px; background-image: url('{{ asset('assets/images/logo.png') }}'); background-size: cover; border-radius: 4px;"></div>
            <div class="logo-text">
                <h1 style="margin:0; font-size: 1.2rem; font-weight: 700; color: #333;">E-Recruitment PT BBB Sekernan</h1>
                <p style="margin:0; font-size: 0.9rem; color: #666;">Recruitment Online</p>
            </div>
        </div>
                <nav class="nav-links">
            <a href="{{ route('index') }}" class="{{ request()->routeIs('index') ? 'active' : '' }}">Beranda</a>
            <a href="{{ route('pengumuman') }}" class="{{ request()->routeIs('pengumuman') ? 'active' : '' }}">Pengumuman</a>
            @guest
                <a href="{{ route('daftar') }}" class="{{ request()->routeIs('daftar') ? 'active' : '' }}">Daftar</a>
            @endguest
            <a href="{{ route('faq') }}" class="{{ request()->routeIs('faq') ? 'active' : '' }}">FAQ</a>
            @auth
                <a href="#" onclick="event.preventDefault(); document.getElementById('logout-form').submit();" style="color: #d32f2f; font-weight: bold;">Logout</a>
                <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                    @csrf
                </form>
            @endauth
        </nav>
    </header>

    <div class="auth-container">

        @if(session('success'))
        <div style="background: #D4EDDA; color: #155724; padding: 14px 20px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #C3E6CB;">
            <i class="fas fa-check-circle"></i> {{ session('success') }}
        </div>
        @endif

        <div class="auth-card">
            <h2>Login</h2>
            <p>Silakan login dengan menggunakan email dan password anda</p>

            @if($errors->any())
            <div style="background: #F8D7DA; color: #721C24; padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; font-size: 0.9rem; border: 1px solid #F5C6CB;">
                <i class="fas fa-exclamation-circle"></i> {{ $errors->first() }}
            </div>
            @endif

            <form action="{{ route('login.post') }}" method="POST">
                @csrf
                <div class="auth-form-group">
                    <label>Email</label>
                    <input type="email" name="email" value="{{ old('email') }}" required>
                </div>
                
                <div class="auth-form-group">
                    <label>Password</label>
                    <input type="password" name="password" id="passwordField" required>
                    <i class="fas fa-eye-slash password-toggle" onclick="togglePassword()"></i>
                </div>
                
                <button type="submit" class="btn-submit-auth">LOGIN</button>
            </form>
            
            <div class="auth-links">
                <p>Apabila anda belum memiliki akun, silahkan <a href="{{ route('daftar') }}">Registrasi</a></p>
                <p style="margin-bottom: 0;">Tidak bisa mengakses akun Anda? <a href="#">Lupa Password</a></p>
            </div>
        </div>
        
        <div class="footer-auth">
            <span>Copyright &copy; 2026 PT Brahma Bina Bakti, All Rights Reserved.</span>
            <div style="font-weight: 900; font-style: italic; font-size: 1.2rem;">BBB</div>
        </div>
    </div>

    <script>
        function togglePassword() {
            const pwd = document.getElementById('passwordField');
            const icon = document.querySelector('.password-toggle');
            if (pwd.type === 'password') {
                pwd.type = 'text';
                icon.classList.remove('fa-eye-slash');
                icon.classList.add('fa-eye');
            } else {
                pwd.type = 'password';
                icon.classList.remove('fa-eye');
                icon.classList.add('fa-eye-slash');
            }
        }
    </script>
</body>
</html>
