<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>Admin Login - {{ config('app.name') }}</title>

    <!-- Admin Favicon -->
    <link rel="icon" type="image/png" href="{{ asset($siteSettings['admin_favicon'] ?? $siteSettings['site_favicon'] ?? 'images/favicon.ico') }}">

    <!-- Google Fonts - Poppins -->
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- Font Awesome -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">

    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Poppins', sans-serif;
            min-height: 100vh;
            background: url("{{ asset('bg.jpg') }}") no-repeat center center;
            background-size: cover;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .login-wrapper {
            filter: drop-shadow(2px 3px 15px rgba(0, 0, 0, 0.5));
            border-radius: 10px;
            overflow: hidden;
            max-width: 800px;
            width: 100%;
        }

        .login-container {
            display: flex;
            border-radius: 10px;
            overflow: hidden;
        }

        /* Left Panel - Branding */
        .login-brand {
            background-color: rgba(21, 30, 47, 1);
            padding: 60px 40px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            flex: 1;
            min-width: 300px;
        }

        .login-brand img {
            max-height: 120px;
            margin-bottom: 25px;
        }

        .login-brand h2 {
            color: #ffffff;
            font-weight: 300;
            font-size: 28px;
            margin-bottom: 10px;
        }

        .login-brand h4 {
            color: #ffffff;
            font-weight: 400;
            font-size: 16px;
            opacity: 0.9;
        }

        /* Right Panel - Form */
        .login-form-panel {
            background-color: #1a1a2e;
            padding: 50px 40px;
            flex: 1;
            min-width: 300px;
        }

        .login-form-panel h3 {
            color: #ffffff;
            font-weight: 500;
            font-size: 24px;
            margin-bottom: 30px;
        }

        .login-form-panel .form-group {
            margin-bottom: 20px;
        }

        .login-form-panel label {
            color: #ffffff;
            font-weight: 400;
            font-size: 14px;
            margin-bottom: 10px;
            display: block;
        }

        .login-form-panel .form-control {
            background-color: #2d2d44;
            border: 1px solid #3d3d5c;
            border-radius: 5px;
            color: #ffffff;
            padding: 12px 15px;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .login-form-panel .form-control:focus {
            background-color: #2d2d44;
            border-color: #5d78ff;
            box-shadow: 0 0 0 0.2rem rgba(93, 120, 255, 0.25);
            color: #ffffff;
        }

        .login-form-panel .form-control::placeholder {
            color: #8a8aa3;
        }

        .login-form-panel .btn-primary {
            background-color: #5d78ff;
            border-color: #5d78ff;
            border-radius: 50px;
            padding: 12px 40px;
            font-size: 14px;
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            transition: all 0.3s ease;
            width: 100%;
            margin-top: 10px;
        }

        .login-form-panel .btn-primary:hover {
            background-color: #3758ff;
            border-color: #2a4eff;
            transform: translateY(-2px);
            box-shadow: 0 5px 20px rgba(93, 120, 255, 0.4);
        }

        .login-form-panel .custom-checkbox {
            margin-top: 15px;
        }

        .login-form-panel .custom-control-label {
            color: #8a8aa3;
            font-size: 13px;
            cursor: pointer;
        }

        .login-form-panel .custom-control-input:checked ~ .custom-control-label::before {
            background-color: #5d78ff;
            border-color: #5d78ff;
        }

        .login-form-panel .alert {
            border-radius: 5px;
            margin-bottom: 20px;
            font-size: 13px;
        }

        .login-form-panel .alert-danger {
            background-color: rgba(239, 83, 80, 0.15);
            border-color: rgba(239, 83, 80, 0.3);
            color: #ef5350;
        }

        .back-link {
            display: block;
            text-align: center;
            margin-top: 20px;
            color: #8a8aa3;
            font-size: 13px;
            text-decoration: none;
            transition: color 0.3s ease;
        }

        .back-link:hover {
            color: #5d78ff;
            text-decoration: none;
        }

        .back-link i {
            margin-right: 5px;
        }

        /* Input Icons */
        .input-icon-wrapper {
            position: relative;
        }

        .input-icon-wrapper .form-control {
            padding-left: 45px;
        }

        .input-icon-wrapper .input-icon {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #8a8aa3;
            font-size: 16px;
        }

        /* Responsive */
        @media (max-width: 768px) {
            .login-container {
                flex-direction: column;
            }

            .login-brand {
                padding: 40px 30px;
                min-width: auto;
            }

            .login-brand img {
                max-height: 80px;
            }

            .login-brand h2 {
                font-size: 22px;
            }

            .login-form-panel {
                padding: 40px 30px;
                min-width: auto;
            }
        }

        @media (max-width: 480px) {
            body {
                padding: 10px;
            }

            .login-brand {
                padding: 30px 20px;
            }

            .login-form-panel {
                padding: 30px 20px;
            }

            .login-brand h4 {
                font-size: 14px;
            }
        }

        /* Footer Credits */
        .footer-credits {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            text-align: center;
            padding: 10px 20px;
            background: rgba(0, 0, 0, 0.5);
            color: #fff;
            font-size: 11px;
            letter-spacing: 0.3px;
        }

        .footer-credits a {
            color: #5d78ff;
            text-decoration: none;
        }

        .footer-credits a:hover {
            text-decoration: underline;
        }
    </style>
</head>

<body>
    <div class="login-wrapper">
        <div class="login-container">
            <!-- Left Panel - Branding -->
            <div class="login-brand">
                <img src="{{ asset($siteSettings['site_logo'] ?? 'assets/images/admin-logo.svg') }}" alt="{{ $siteSettings['site_name'] ?? 'KCG Inventory' }}">
                <h2>{{ $siteSettings['site_name'] ?? 'KCG Inventory' }}</h2>
                <h4>Warehouse Management System</h4>
            </div>

            <!-- Right Panel - Login Form -->
            <div class="login-form-panel">
                <h3>Login</h3>

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

                <form method="POST" action="{{ route('admin.login.post') }}" novalidate>
                    @csrf

                    <div class="form-group">
                        <label for="email">Email *</label>
                        <div class="input-icon-wrapper">
                            <i class="far fa-envelope input-icon"></i>
                            <input id="email"
                                   type="email"
                                   name="email"
                                   value="{{ old('email') }}"
                                   required
                                   class="form-control"
                                   placeholder="Enter your email">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="password">Password *</label>
                        <div class="input-icon-wrapper">
                            <i class="fas fa-lock input-icon"></i>
                            <input id="password"
                                   type="password"
                                   name="password"
                                   required
                                   class="form-control"
                                   placeholder="Enter your password">
                        </div>
                    </div>

                    <button type="submit" class="btn btn-primary">Login</button>
                </form>
            </div>
        </div>
    </div>

    <!-- Footer Credits -->
    <div class="footer-credits">
        Design, Maintained & Owned by BILLING and COST CONTROLL DEPARTMENT - KCG UAE &copy; {{ date('Y') }} | powered by Calper Global & Signtech | WMS
    </div>

    <!-- jQuery -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

    <!-- Bootstrap -->
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js"></script>
</body>
</html>
