<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Certificate of Appreciation - {{ $student->full_name }}</title>
    <style>
        @page { size: A4 landscape; margin: 0; }
        body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0; padding: 0; background-color: #ffffff; color: #1e293b; }
        .certificate-container { width: 297mm; height: 210mm; box-sizing: border-box; padding: 12mm; position: relative; }
        .outer-border { width: 100%; height: 100%; border: 4px solid #1e3a8a; box-sizing: border-box; padding: 5mm; position: relative; }
        .inner-border { width: 100%; height: 100%; border: 1px solid #3b82f6; box-sizing: border-box; padding: 8mm 12mm; text-align: center; }
        .ngo-name { font-size: 26px; font-weight: 800; color: #1e3a8a; text-transform: uppercase; margin: 0; }
        .cert-title { font-size: 32px; font-weight: 800; color: #1e293b; text-transform: uppercase; letter-spacing: 3px; margin: 15px 0 5px 0; }
        .student-name { font-size: 28px; font-weight: 800; color: #1e3a8a; border-bottom: 2px solid #3b82f6; display: inline-block; padding: 0 25px 4px 25px; margin: 10px 0; }
        .body-text { font-size: 13px; color: #334155; line-height: 1.6; margin: 15px 40px; }
        .highlight-text { font-weight: 700; color: #0f172a; }
        .footer-table { width: 100%; margin-top: 25px; border-collapse: collapse; }
    </style>
</head>
<body>
    <div class="certificate-container">
        <div class="outer-border">
            <div class="inner-border">
                <table style="width: 100%;">
                    <tr>
                        <td style="width: 70px; text-align: left;">
                            <div style="width: 55px; height: 55px; background: #1e3a8a; color: #ffffff; font-weight: 800; font-size: 20px; border-radius: 12px; line-height: 55px; text-align: center;">HWS</div>
                        </td>
                        <td style="text-align: center;">
                            <div class="ngo-name">Humanity Welfare Society</div>
                            <div style="font-size: 11px; color: #3b82f6; font-weight: 600;">Certificate of Appreciation & Social Recognition</div>
                        </td>
                        <td style="width: 70px; text-align: right;">
                            @if(isset($college) && $college->logo_path && file_exists(storage_path('app/public/' . $college->logo_path)))
                                <img src="{{ storage_path('app/public/' . $college->logo_path) }}" style="max-width: 60px; max-height: 60px; object-fit: contain;">
                            @endif
                        </td>
                    </tr>
                </table>

                <div class="cert-title">Certificate of Appreciation</div>
                <div style="font-size: 12px; color: #64748b; tracking-wider">THIS CERTIFICATE IS PROUDLY PRESENTED TO</div>
                
                <div class="student-name">{{ $student->full_name }}</div>

                <div class="body-text">
                    In recognition of valuable contribution and outstanding dedication during the internship in 
                    <span class="highlight-text">{{ $course->title ?? 'Social Service' }}</span> for a duration of 
                    <span class="highlight-text">{{ $certificate->duration }}</span>. Your efforts towards community welfare are deeply appreciated.
                </div>

                <table class="footer-table">
                    <tr>
                        <td style="width: 120px; text-align: left;">
                            @if(isset($qrCode)) <img src="{{ $qrCode }}" style="width: 85px; height: 85px;"> @endif
                        </td>
                        <td style="text-align: center;">
                            <div style="display: inline-block; width: 60px; height: 60px; border: 2px double #1e3a8a; border-radius: 50%; color: #1e3a8a; font-size: 8px; font-weight: 800; padding: 6px;">OFFICIAL SEAL</div>
                        </td>
                        <td style="width: 180px; text-align: right;">
                            <div style="width: 140px; border-top: 1px solid #475569; margin-left: auto; margin-bottom: 4px;"></div>
                            <div style="font-size: 11px; font-weight: 700;">{{ $certificate->signatory_title ?? 'President & Secretary' }}</div>
                            <div style="font-size: 9px; color: #64748b;">Humanity Welfare Society</div>
                        </td>
                    </tr>
                </table>

                <div style="font-size: 10px; color: #64748b; margin-top: 15px;">
                    Certificate ID: <strong>{{ $certificate->certificate_uuid }}</strong> | Issued: <strong>{{ date('d F Y', strtotime($certificate->issue_date)) }}</strong>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
