<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; color: #333; background: #f5f5f5; padding: 20px 0;">
    <div style="background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
        <!-- Header -->
        <div style="background: linear-gradient(135deg, #0B1437 0%, #1A56DB 100%); color: white; padding: 2rem; text-align: center;">
            <h1 style="margin: 0; font-size: 1.75rem; font-weight: bold;">FIN-ANALYSIS PRO</h1>
            <p style="margin: 0.5rem 0 0 0; opacity: 0.9; font-size: 0.875rem;">Laporan Analisis Keuangan</p>
        </div>

        <!-- Content -->
        <div style="padding: 2rem;">
            <h2 style="color: #1E293B; margin-top: 0; margin-bottom: 1.5rem;">Laporan untuk {{ $companyName }}</h2>
            
            <!-- Z-Score Card -->
            <div style="background: #f0f9ff; padding: 1.5rem; border-radius: 8px; margin: 1.5rem 0; border-left: 4px solid #1A56DB; text-align: center;">
                <p style="margin: 0 0 0.5rem 0; color: #64748B; font-size: 0.875rem; text-transform: uppercase; font-weight: 600;">Z-Score Analysis Results</p>
                <p style="margin: 0 0 1rem 0; font-size: 2.5rem; font-weight: bold; color: #1E293B;">{{ $zScore }}</p>
                <p style="margin: 0; font-size: 0.875rem;">
                    Status: <span style="
                        @if($category === 'safe')
                            background: #D1FAE5; color: #065F46;
                        @elseif($category === 'grey')
                            background: #FEF3C7; color: #92400E;
                        @else
                            background: #FEE2E2; color: #991B1B;
                        @endif
                        padding: 6px 12px; border-radius: 20px; font-weight: 600; display: inline-block;">
                        @if($category === 'safe')
                            ZONA AMAN
                        @elseif($category === 'grey')
                            ZONA WASPADA
                        @else
                            ZONA BERBAHAYA
                        @endif
                    </span>
                </p>
            </div>

            @if($message && !empty($message))
            <!-- Custom Message -->
            <div style="background: #f1f5f9; padding: 1rem; border-radius: 8px; margin: 1.5rem 0; border-left: 4px solid #60a5fa;">
                <p style="margin: 0 0 0.5rem 0; color: #1E293B; font-weight: 600;">Pesan Tambahan:</p>
                <p style="margin: 0; color: #475569; white-space: pre-wrap; line-height: 1.6;">{{ $message }}</p>
            </div>
            @endif

            <p style="color: #64748B; font-size: 0.875rem; margin: 1.5rem 0;">
                Laporan analisis Z-Score untuk perusahaan Anda telah siap. Klik tombol di bawah untuk mengunduh atau melihat laporan lengkap.
            </p>

            <!-- Download Button -->
            <div style="text-align: center; margin: 2rem 0;">
                <a href="{{ $downloadUrl }}" style="
                    display: inline-block;
                    background: linear-gradient(135deg, #0B1437 0%, #1A56DB 100%);
                    color: white;
                    padding: 12px 32px;
                    border-radius: 8px;
                    text-decoration: none;
                    font-weight: 600;
                    font-size: 0.9375rem;">
                    📥 Unduh Laporan PDF
                </a>
            </div>

            <hr style="border: none; border-top: 1px solid #e2e8f0; margin: 2rem 0;">

            <p style="color: #94A3B8; font-size: 0.75rem; margin: 0; line-height: 1.6;">
                Email ini dikirim otomatis oleh sistem FIN-ANALYSIS PRO. Jika Anda tidak meminta laporan ini, mohon hubungi tim support kami. Akses laporan ini dilindungi dengan login Anda di platform FIN-ANALYSIS PRO.
            </p>
        </div>

        <!-- Footer -->
        <div style="background: #f8faff; padding: 1.25rem; text-align: center; border-top: 1px solid #e2e8f0;">
            <p style="margin: 0; color: #64748B; font-size: 0.75rem;">
                © {{ date('Y') }} PT Fin Analysis Indonesia. All rights reserved.
            </p>
            <p style="margin: 0.5rem 0 0 0; color: #94A3B8; font-size: 0.7rem;">
                <a href="#" style="color: #1A56DB; text-decoration: none;">Privacy Policy</a> | 
                <a href="#" style="color: #1A56DB; text-decoration: none;">Terms of Service</a>
            </p>
        </div>
    </div>
</body>
</html>
