<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login — ESP32 Smart Dashboard</title>

    <!-- Bootstrap 5.3 -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Bootstrap Icons -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">

    <style>
        :root {
            --accent: #0d6efd;
            --accent-glow: rgba(13,110,253,0.3);
        }

        * { box-sizing: border-box; }

        body {
            font-family: 'Inter', sans-serif;
            background: #0d0f13;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            position: relative;
        }

        /* Animated background blobs */
        body::before, body::after {
            content: '';
            position: fixed;
            border-radius: 50%;
            filter: blur(80px);
            opacity: 0.15;
            animation: float 8s ease-in-out infinite alternate;
        }
        body::before {
            width: 500px; height: 500px;
            background: radial-gradient(circle, #0d6efd, transparent);
            top: -150px; left: -150px;
        }
        body::after {
            width: 400px; height: 400px;
            background: radial-gradient(circle, #6610f2, transparent);
            bottom: -100px; right: -100px;
            animation-delay: -4s;
        }

        @keyframes float {
            from { transform: translate(0, 0) scale(1); }
            to   { transform: translate(30px, 20px) scale(1.05); }
        }

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

        .login-card {
            background: rgba(26,29,33,0.9);
            backdrop-filter: blur(20px);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 20px;
            padding: 2.5rem;
            box-shadow: 0 25px 60px rgba(0,0,0,0.5);
        }

        .brand-icon {
            width: 60px; height: 60px;
            background: linear-gradient(135deg, #0d6efd, #6610f2);
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.6rem;
            margin: 0 auto 1.25rem;
            box-shadow: 0 8px 25px var(--accent-glow);
        }

        .login-title {
            font-size: 1.5rem;
            font-weight: 700;
            text-align: center;
            color: #fff;
            margin-bottom: 0.25rem;
        }

        .login-sub {
            font-size: 0.82rem;
            color: #6c757d;
            text-align: center;
            margin-bottom: 2rem;
        }

        .form-label {
            font-size: 0.82rem;
            font-weight: 600;
            color: #adb5bd;
            margin-bottom: 0.4rem;
        }

        .form-control {
            background: rgba(42,46,51,0.8) !important;
            border: 1px solid rgba(255,255,255,0.1) !important;
            color: #e6edf3 !important;
            border-radius: 10px !important;
            padding: 0.7rem 1rem !important;
            font-size: 0.875rem !important;
            transition: all 0.2s ease !important;
        }

        .form-control:focus {
            border-color: var(--accent) !important;
            box-shadow: 0 0 0 3px var(--accent-glow) !important;
            background: rgba(42,46,51,1) !important;
        }

        .form-control::placeholder { color: #555d65 !important; }

        .input-group-text {
            background: rgba(42,46,51,0.8) !important;
            border: 1px solid rgba(255,255,255,0.1) !important;
            border-right: none !important;
            color: #6c757d !important;
            border-radius: 10px 0 0 10px !important;
        }

        .input-group .form-control {
            border-left: none !important;
            border-radius: 0 10px 10px 0 !important;
        }

        .btn-login {
            background: linear-gradient(135deg, #0d6efd, #0a58ca);
            border: none;
            border-radius: 10px;
            font-weight: 600;
            font-size: 0.9rem;
            padding: 0.75rem;
            width: 100%;
            color: #fff;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: 0 4px 15px rgba(13,110,253,0.4);
            letter-spacing: 0.02em;
        }

        .btn-login:hover {
            transform: translateY(-1px);
            box-shadow: 0 8px 25px rgba(13,110,253,0.55);
        }

        .btn-login:active { transform: translateY(0); }

        .invalid-feedback { font-size: 0.8rem !important; }

        .alert-danger {
            background: rgba(220,53,69,0.15) !important;
            border: 1px solid rgba(220,53,69,0.3) !important;
            border-radius: 10px !important;
            font-size: 0.85rem !important;
            color: #f87d87 !important;
        }

        .form-check-input { border-color: rgba(255,255,255,0.2) !important; }
        .form-check-input:checked { background-color: var(--accent) !important; }
        .form-check-label { font-size: 0.82rem; color: #adb5bd; }
    </style>
</head>
<body>

<div class="login-wrapper">
    <div class="login-card">
        <div class="brand-icon">
            <i class="bi bi-cpu-fill text-white"></i>
        </div>
        <h1 class="login-title">ESP32 Dashboard</h1>
        <p class="login-sub">Sign in to your admin account</p>

        @if($errors->any())
            <div class="alert alert-danger mb-3">
                <i class="bi bi-exclamation-triangle-fill me-2"></i>
                {{ $errors->first() }}
            </div>
        @endif

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

            <div class="mb-3">
                <label for="email" class="form-label">Email Address</label>
                <div class="input-group">
                    <span class="input-group-text">
                        <i class="bi bi-envelope-fill"></i>
                    </span>
                    <input
                        type="email"
                        id="email"
                        name="email"
                        class="form-control @error('email') is-invalid @enderror"
                        placeholder="admin@esp32.local"
                        value="{{ old('email') }}"
                        autocomplete="email"
                        autofocus
                        required
                    >
                </div>
            </div>

            <div class="mb-4">
                <label for="password" class="form-label">Password</label>
                <div class="input-group">
                    <span class="input-group-text">
                        <i class="bi bi-lock-fill"></i>
                    </span>
                    <input
                        type="password"
                        id="password"
                        name="password"
                        class="form-control @error('password') is-invalid @enderror"
                        placeholder="••••••••"
                        autocomplete="current-password"
                        required
                    >
                </div>
            </div>

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

            <button type="submit" class="btn-login">
                <i class="bi bi-shield-lock-fill me-2"></i>Sign In
            </button>
        </form>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
