<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ACM System Notification</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: #333;
            margin: 0;
            padding: 0;
            background-color: #f4f4f4;
        }
        .container {
            max-width: 600px;
            margin: 20px auto;
            background: #ffffff;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }
        .header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 30px;
            text-align: center;
        }
        .header h1 {
            margin: 0;
            font-size: 24px;
        }
        .content {
            padding: 30px;
        }
        .alert {
            padding: 15px;
            border-radius: 6px;
            margin-bottom: 20px;
        }
        .alert-critical {
            background-color: #fee2e2;
            border-left: 4px solid #ef4444;
            color: #991b1b;
        }
        .alert-high {
            background-color: #fef3c7;
            border-left: 4px solid #f59e0b;
            color: #92400e;
        }
        .alert-medium {
            background-color: #dbeafe;
            border-left: 4px solid #3b82f6;
            color: #1e40af;
        }
        .info-box {
            background-color: #f8fafc;
            border: 1px solid #e2e8f0;
            border-radius: 6px;
            padding: 20px;
            margin: 20px 0;
        }
        .info-row {
            display: flex;
            justify-content: space-between;
            padding: 8px 0;
            border-bottom: 1px solid #e2e8f0;
        }
        .info-row:last-child {
            border-bottom: none;
        }
        .label {
            font-weight: 600;
            color: #64748b;
        }
        .value {
            color: #1e293b;
        }
        .button {
            display: inline-block;
            padding: 12px 30px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            text-decoration: none;
            border-radius: 6px;
            margin-top: 20px;
        }
        .footer {
            background-color: #f8fafc;
            padding: 20px;
            text-align: center;
            font-size: 12px;
            color: #64748b;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>🔔 ACM System</h1>
            <p>Access Control Management</p>
        </div>
        
        <div class="content">
            @php
                $alertClass = match($priority) {
                    'critical' => 'alert-critical',
                    'high' => 'alert-high',
                    default => 'alert-medium',
                };
                $title = match(true) {
                    str_contains($type, 'retirement') => 'Reminder Pensiun',
                    str_contains($type, 'revoke') => 'Pengingat Pencabutan Akses',
                    default => 'Notifikasi Sistem',
                };
            @endphp
            
            <div class="alert {{ $alertClass }}">
                <strong>{{ $title }}</strong>
            </div>
            
            <p>Halo,</p>
            
            <p>Sistem kami mendeteksi bahwa terdapat pegawai yang memerlukan perhatian Anda:</p>
            
            <div class="info-box">
                <div class="info-row">
                    <span class="label">Nama Pegawai:</span>
                    <span class="value">{{ $employee->name ?? 'Unknown' }}</span>
                </div>
                <div class="info-row">
                    <span class="label">Akses:</span>
                    <span class="value">{{ $accessCatalog->name ?? 'N/A' }}</span>
                </div>
                <div class="info-row">
                    <span class="label">Tanggal Expire:</span>
                    <span class="value">{{ $expiryDate }}</span>
                </div>
                <div class="info-row">
                    <span class="label">Sisa Waktu:</span>
                    <span class="value" style="color: {{ $daysLeft <= 1 ? '#ef4444' : ($daysLeft <= 7 ? '#f59e0b' : '#3b82f6') }}; font-weight: bold;">
                        {{ $daysLeft }} hari
                    </span>
                </div>
            </div>
            
            @if($daysLeft <= 7)
            <div class="alert alert-critical">
                <strong>⚠️ PERHATIAN:</strong> Segera proses pencabutan atau perpanjangan akses sebelum tanggal expire!
            </div>
            @endif
            
            <p>Silakan login ke sistem untuk melihat detail lengkap dan mengambil tindakan:</p>
            
            <center>
                <a href="{{ config('app.url') }}/dashboard" class="button">Buka Dashboard</a>
            </center>
            
            <p style="margin-top: 30px; font-size: 12px; color: #64748b;">
                Email ini dikirim secara otomatis oleh ACM System. Jangan membalas email ini.
            </p>
        </div>
        
        <div class="footer">
            <p>&copy; {{ date('Y') }} Access Control Management System</p>
            <p>{{ config('app.name') }}</p>
        </div>
    </div>
</body>
</html>