<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ \App\Models\SystemSetting::get('app_name', 'Enterprise FMS') }} - Authenticate</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <style>
        :root {
            --primary: #3b82f6;
            --primary-dark: #2563eb;
            --secondary: #64748b;
            --accent: #f59e0b;
        }

        body, html {
            height: 100%;
            margin: 0;
            font-family: 'Inter', sans-serif;
            overflow: hidden;
        }

        .login-container {
            display: flex;
            height: 100vh;
            width: 100vw;
        }

        /* 2/3 Background Section */
        .bg-section {
            flex: 2;
            position: relative;
            background: url("{{ asset('images/auth-bg.png') }}") no-repeat center center;
            background-size: cover;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .bg-section::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.4) 100%);
        }

        .bg-overlay-content {
            position: relative;
            z-index: 2;
            color: white;
            padding: 4rem;
            max-width: 800px;
            animation: fadeIn 1s ease-out;
        }

        .bg-overlay-content h1 {
            font-size: 4rem;
            font-weight: 800;
            line-height: 1.1;
            margin-bottom: 1.5rem;
            letter-spacing: -0.025em;
        }

        .bg-overlay-content p {
            font-size: 1.25rem;
            opacity: 0.9;
            line-height: 1.6;
            max-width: 600px;
        }

        /* 1/3 Form Section */
        .form-section {
            flex: 1;
            background: white;
            display: flex;
            flex-direction: column;
            justify-content: center;
            padding: 4rem 3.5rem;
            min-width: 450px;
            box-shadow: -10px 0 50px rgba(0,0,0,0.1);
            position: relative;
            z-index: 10;
        }

        .logo-box {
            width: 54px;
            height: 54px;
            background: var(--primary);
            border-radius: 1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 1.75rem;
            margin-bottom: 2rem;
            box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.2);
        }

        .form-label {
            font-weight: 600;
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--secondary);
            margin-bottom: 0.75rem;
        }

        .form-control {
            border-radius: 0.75rem;
            padding: 0.85rem 1rem;
            border: 1.5px solid #e2e8f0;
            font-size: 0.95rem;
            transition: all 0.2s;
        }

        .form-control:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
            transform: translateY(-1px);
        }

        .btn-primary {
            background: var(--primary);
            border: none;
            border-radius: 0.75rem;
            padding: 1rem;
            font-weight: 700;
            font-size: 1rem;
            margin-top: 1.5rem;
            transition: all 0.3s;
        }

        .btn-primary:hover {
            background: var(--primary-dark);
            transform: translateY(-2px);
            box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.4);
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @media (max-width: 1024px) {
            .bg-section { display: none; }
            .form-section { flex: 1; min-width: 100%; padding: 2rem; }
        }
    </style>
</head>
<body>
    <div class="login-container">
        <!-- 2/3 Visual Content -->
        <div class="bg-section">
            <div class="bg-overlay-content">
                <span class="badge bg-primary px-3 py-2 mb-3 rounded-pill text-uppercase fw-bold" style="letter-spacing: 1px;">Smart Infrastructure</span>
                <h1>Precision Manufacturing Ecosystem</h1>
                <p>Empower your production facility with real-time analytics, automated workflows, and global resource management.</p>
                <div class="mt-5 d-flex gap-4">
                    <div class="d-flex align-items-center gap-2">
                        <i class="bi bi-check-circle-fill text-primary"></i>
                        <span class="fw-bold small">Enterprise Scalability</span>
                    </div>
                    <div class="d-flex align-items-center gap-2">
                        <i class="bi bi-check-circle-fill text-primary"></i>
                        <span class="fw-bold small">AI-Powered Insights</span>
                    </div>
                    <div class="d-flex align-items-center gap-2">
                        <i class="bi bi-check-circle-fill text-primary"></i>
                        <span class="fw-bold small">Seamless Logistics</span>
                    </div>
                </div>
            </div>
        </div>

        <!-- 1/3 Login Form -->
        <div class="form-section">
            <div class="mb-5">
                <div class="logo-box">
                    <i class="bi bi-cpu-fill"></i>
                </div>
                <h2 class="fw-bold text-dark h3">Account Login</h2>
                <p class="text-muted small">Access your management console securely.</p>
            </div>

            <form action="{{ route('login') }}" method="POST">
                @csrf
                <div class="mb-3">
                    <label class="form-label">Email Address</label>
                    <input type="email" name="email" class="form-control" placeholder="admin@enterprise.com" required autofocus>
                </div>

                <div class="mb-4">
                    <div class="d-flex justify-content-between">
                        <label class="form-label">Security Key</label>
                        <a href="#" class="small text-primary text-decoration-none fw-bold">Reset Credential</a>
                    </div>
                    <input type="password" name="password" class="form-control" placeholder="••••••••" required>
                </div>

                <div class="form-check mb-4">
                    <input class="form-check-input" type="checkbox" id="remember">
                    <label class="form-check-label small text-muted" for="remember">Maintain Session</label>
                </div>

                <button type="submit" class="btn btn-primary w-100 py-3">
                    Launch Ecosystem <i class="bi bi-arrow-right ms-2"></i>
                </button>

                @if($errors->any())
                    <div class="alert alert-danger border-0 rounded-3 mt-4 py-2 small">
                        <i class="bi bi-exclamation-triangle-fill me-2"></i> {{ $errors->first() }}
                    </div>
                @endif
            </form>

            <div class="mt-auto pt-5 text-center">
                <p class="small text-muted mb-0">Powered by <strong>NexGen Dynamics</strong></p>
                <div class="mt-2 d-flex justify-content-center gap-3">
                    <a href="#" class="text-muted small text-decoration-none">Terms</a>
                    <a href="#" class="text-muted small text-decoration-none">Privacy</a>
                    <a href="#" class="text-muted small text-decoration-none">Support</a>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
