<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Login - SIPDAM</title>

    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">

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

        body {
            font-family: 'Plus Jakarta Sans', Arial, sans-serif;
            min-height: 100vh;
            display: flex;
            background: linear-gradient(160deg, #e8f5eb 0%, #f2faf4 40%, #e4f3f8 100%);
        }

        /* ── KIRI ── */
       .left-panel {
            width: 55%;
            background: #1a5c2a;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 60px 40px;
            position: relative;
            overflow: hidden;
        }
        .left-panel::before {
            content: '';
            position: absolute;
            top: -100px; right: -100px;
            width: 400px; height: 400px;
            background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
            border-radius: 50%;
        }
        .left-panel::after {
            content: '';
            position: absolute;
            bottom: -80px; left: -80px;
            width: 350px; height: 350px;
            background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
            border-radius: 50%;
        }
        .left-logo {
            position: relative; z-index: 2;
            margin-bottom: 40px;
        }
        .left-logo img {
            height: 120px;
            width: auto;
            object-fit: contain;
            mix-blend-mode: screen;
            filter: brightness(1.2);
        }
        .left-title {
            position: relative; z-index: 2;
            color: #fff;
            font-size: 28px;
            font-weight: 800;
            text-align: center;
            line-height: 1.3;
            margin-bottom: 14px;
        }
        .left-desc {
            position: relative; z-index: 2;
            color: rgba(255,255,255,0.75);
            font-size: 14px;
            text-align: center;
            line-height: 1.7;
            max-width: 340px;
            margin-bottom: 40px;
        }
        .left-badges {
            position: relative; z-index: 2;
            display: flex;
            flex-direction: column;
            gap: 14px;
            width: 100%;
            max-width: 320px;
        }
        .left-badge {
            background: rgba(255,255,255,0.12);
            border: 1px solid rgba(255,255,255,0.2);
            border-radius: 14px;
            padding: 14px 18px;
            display: flex;
            align-items: center;
            gap: 14px;
            color: #fff;
        }
        .left-badge .badge-icon {
            width: 38px; height: 38px;
            background: rgba(255,255,255,0.2);
            border-radius: 10px;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0;
        }
        .left-badge .badge-text { font-size: 13px; font-weight: 600; }
        .left-badge .badge-sub { font-size: 11px; opacity: 0.7; margin-top: 2px; }

        /* ── KANAN ── */
        .right-panel {
            width: 45%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 60px 50px;
        }
        .login-box {
            width: 100%;
            max-width: 400px;
        }
        .login-header {
            margin-bottom: 36px;
        }
        .login-header .tirta-logo {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 28px;
        }
        .login-header .tirta-logo img {
            width: 48px; height: 48px;
            object-fit: contain;
        }
        .login-header .tirta-logo-text .name {
            font-size: 15px;
            font-weight: 700;
            color: #1a5c2a;
            line-height: 1.2;
        }
        .login-header .tirta-logo-text .sub {
            font-size: 11px;
            color: #1e6fa8;
            font-weight: 600;
            letter-spacing: 1px;
            text-transform: uppercase;
        }
        .login-header h2 {
            font-size: 26px;
            font-weight: 800;
            color: #1a2e1c;
            margin-bottom: 8px;
        }
        .login-header p {
            font-size: 14px;
            color: #6b8c72;
        }

        /* Form */
        .form-group { margin-bottom: 20px; }
        .form-group label {
            display: block;
            font-size: 13px;
            font-weight: 600;
            color: #1a2e1c;
            margin-bottom: 8px;
        }
        .form-group input {
            width: 100%;
            padding: 13px 16px;
            border: 1.5px solid #d1e8d4;
            border-radius: 12px;
            font-size: 14px;
            font-family: inherit;
            color: #1a2e1c;
            background: #fff;
            outline: none;
            transition: border-color 0.2s, box-shadow 0.2s;
        }
        .form-group input:focus {
            border-color: #3a9e52;
            box-shadow: 0 0 0 3px rgba(58,158,82,0.12);
        }
        .form-group input::placeholder { color: #a0b8a4; }

        .password-wrap {
            position: relative;
            display: flex;
            align-items: center;
        }
        .password-wrap input {
            padding-right: 40px;
        }
        .password-toggle {
            position: absolute;
            right: 12px;
            color: #6b8c72;
            cursor: pointer;
            padding: 5px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: color 0.2s;
        }
        .password-toggle:hover {
            color: #1a5c2a;
        }

        .form-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 24px;
        }
        .form-row label {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            color: #3d5c42;
            cursor: pointer;
        }
        .form-row input[type="checkbox"] {
            width: 16px; height: 16px;
            accent-color: #3a9e52;
            cursor: pointer;
        }
        .form-row a {
            font-size: 13px;
            color: #1e6fa8;
            text-decoration: none;
            font-weight: 600;
        }
        .form-row a:hover { text-decoration: underline; }

        .btn-login {
            width: 100%;
            padding: 14px;
            background: linear-gradient(135deg, #2d7a3e, #1a5c2a);
            color: #fff;
            border: none;
            border-radius: 12px;
            font-size: 15px;
            font-weight: 700;
            font-family: inherit;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            box-shadow: 0 6px 20px rgba(42,120,60,0.35);
            transition: all 0.25s;
            letter-spacing: 0.3px;
        }
        .btn-login:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 28px rgba(42,120,60,0.4);
        }

        .login-footer {
            text-align: center;
            margin-top: 24px;
            font-size: 12px;
            color: #6b8c72;
        }
        .login-footer a {
            color: #1a5c2a;
            font-weight: 600;
            text-decoration: none;
        }
        .login-footer a:hover { text-decoration: underline; }

        /* Error */
        .error-msg {
            color: #dc2626;
            font-size: 12px;
            margin-top: 6px;
        }
        .alert-error {
            background: #fef2f2;
            border: 1px solid #fecaca;
            border-radius: 10px;
            padding: 12px 16px;
            color: #dc2626;
            font-size: 13px;
            margin-bottom: 20px;
        }
        .alert-success {
            background: #f0fdf4;
            border: 1px solid #bbf7d0;
            border-radius: 10px;
            padding: 12px 16px;
            color: #15803d;
            font-size: 13px;
            margin-bottom: 20px;
        }

        @media (max-width: 768px) {
            body { flex-direction: column; }
            .left-panel { width: 100%; padding: 40px 24px; min-height: auto; }
            .left-badges { display: none; }
            .right-panel { width: 100%; padding: 40px 24px; }
        }
    </style>
</head>
<body>

    <!-- Kiri: Branding -->
    <div class="left-panel">
        <div class="left-logo">
            <img src="{{ asset('images/SIPDAM.png') }}" alt="SIPDAM">
        </div>
        <h2 class="left-title">Selamat Datang di SIPDAM</h2>
        <p class="left-desc">Sistem Informasi Penggajian PDAM untuk pengelolaan tenaga kerja lepas PERUMDA Tirta Sanjiwani</p>
        <div class="left-badges">
            <div class="left-badge">
                <div class="badge-icon">
                    <svg width="20" height="20" fill="none" stroke="white" stroke-width="2" viewBox="0 0 24 24">
                        <path d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"/>
                    </svg>
                </div>
                <div>
                    <div class="badge-text">Manajemen Tenaga Kerja</div>
                    <div class="badge-sub">Data terpusat & terstruktur</div>
                </div>
            </div>
            <div class="left-badge">
                <div class="badge-icon">
                    <svg width="20" height="20" fill="none" stroke="white" stroke-width="2" viewBox="0 0 24 24">
                        <path d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
                    </svg>
                </div>
                <div>
                    <div class="badge-text">Penggajian Otomatis</div>
                    <div class="badge-sub">Akurat & tepat waktu</div>
                </div>
            </div>
            <div class="left-badge">
                <div class="badge-icon">
                    <svg width="20" height="20" fill="none" stroke="white" stroke-width="2" viewBox="0 0 24 24">
                        <path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
                    </svg>
                </div>
                <div>
                    <div class="badge-text">Absensi & Kontrak</div>
                    <div class="badge-sub">Monitoring real-time</div>
                </div>
            </div>
        </div>
    </div>

    <!-- Kanan: Form Login -->
    <div class="right-panel">
        <div class="login-box">

            <div class="login-header">
                <div class="tirta-logo">
                    <img src="{{ asset('images/logo tirta sanjiwani.png') }}" alt="Tirta Sanjiwani">
                    <div class="tirta-logo-text">
                        <div class="name">PERUMDA Air Minum</div>
                        <div class="sub">Tirta Sanjiwani</div>
                    </div>
                </div>
                <h2>Masuk ke Sistem</h2>
                <p>Masukkan kredensial Anda untuk mengakses SIPDAM</p>
            </div>

            {{-- Session Status --}}
            @if (session('status'))
                <div class="alert-success">{{ session('status') }}</div>
            @endif

            {{-- Error dari Session --}}
            @if (session('error'))
                <div class="alert-error">{{ session('error') }}</div>
            @endif

            {{-- Error --}}
            @if ($errors->any())
                <div class="alert-error">Email atau password salah. Silakan coba lagi.</div>
            @endif

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

                <div class="form-group">
                    <label for="email">Username</label>
                    <input id="email" type="email" name="email" 
                           value="{{ old('email') }}" 
                           placeholder="contoh@email.com"
                           required autofocus>
                    @error('email')
                        <div class="error-msg">{{ $message }}</div>
                    @enderror
                </div>

                <div class="form-group">
                    <label for="password">Password</label>
                    <div class="password-wrap">
                        <input id="password" type="password" name="password" 
                               placeholder="Masukkan password"
                               required>
                        <span class="password-toggle" id="togglePassword">
                            <svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
                                <path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
                                <path d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/>
                            </svg>
                        </span>
                    </div>
                    @error('password')
                        <div class="error-msg">{{ $message }}</div>
                    @enderror
                </div>

                <div class="form-row">
                    <label>
                        <input type="checkbox" name="remember" id="remember_me">
                        Ingat saya
                    </label>
                    @if (Route::has('password.request'))
                        <a href="{{ route('password.request') }}">Lupa password?</a>
                    @endif
                </div>

                <button type="submit" class="btn-login">
                    <svg width="18" height="18" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24">
                        <path d="M15 3h4a2 2 0 012 2v14a2 2 0 01-2 2h-4M10 17l5-5-5-5M14 12H3"/>
                    </svg>
                    Masuk Sekarang
                </button>
            </form>

            @if (Route::has('register'))
            <div class="login-footer">
                Belum punya akun? <a href="{{ route('register') }}">Daftar di sini</a>
            </div>
            @endif

        </div>
    </div>

<script>
    const togglePassword = document.querySelector('#togglePassword');
    const password = document.querySelector('#password');

    togglePassword.addEventListener('click', function (e) {
        // Toggle the type attribute
        const type = password.getAttribute('type') === 'password' ? 'text' : 'password';
        password.setAttribute('type', type);
        
        // Toggle the eye / eye-slash icon
        if (type === 'text') {
            this.innerHTML = `<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
        } else {
            this.innerHTML = `<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>`;
        }
    });
</script>

</body>
</html>