{{-- Mentorship Payment Receipt View --}}
{{-- Printable receipt for successful payments --}}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Payment Receipt - {{ $payment->reference }}</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f5f5f5;
            color: #333;
            line-height: 1.6;
            padding: 20px;
        }
        
        .receipt-container {
            max-width: 800px;
            margin: 0 auto;
            background: white;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        
        .receipt-header {
            background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
            color: white;
            padding: 30px;
            text-align: center;
        }
        
        .receipt-header h1 {
            font-size: 28px;
            margin-bottom: 10px;
        }
        
        .receipt-header p {
            opacity: 0.9;
            font-size: 14px;
        }
        
        .receipt-body {
            padding: 40px;
        }
        
        .receipt-info {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 20px;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 2px dashed #e5e5e5;
        }
        
        .info-group h3 {
            font-size: 12px;
            text-transform: uppercase;
            color: #666;
            margin-bottom: 5px;
        }
        
        .info-group p {
            font-size: 16px;
            font-weight: 500;
            color: #333;
        }
        
        .receipt-title {
            text-align: center;
            margin-bottom: 30px;
        }
        
        .receipt-title h2 {
            font-size: 24px;
            color: #16a34a;
            margin-bottom: 10px;
        }
        
        .receipt-title .badge {
            display: inline-block;
            background: #dcfce7;
            color: #166534;
            padding: 5px 15px;
            border-radius: 20px;
            font-size: 14px;
            font-weight: 500;
        }
        
        .payment-details {
            background: #f9fafb;
            border-radius: 8px;
            padding: 25px;
            margin-bottom: 30px;
        }
        
        .payment-details table {
            width: 100%;
        }
        
        .payment-details tr {
            border-bottom: 1px solid #e5e7eb;
        }
        
        .payment-details tr:last-child {
            border-bottom: none;
        }
        
        .payment-details td {
            padding: 12px 0;
        }
        
        .payment-details td:first-child {
            color: #666;
        }
        
        .payment-details td:last-child {
            text-align: right;
            font-weight: 500;
        }
        
        .payment-details .total td {
            font-size: 18px;
            font-weight: bold;
            color: #16a34a;
        }
        
        .receipt-footer {
            text-align: center;
            padding: 30px;
            background: #f9fafb;
            border-top: 2px dashed #e5e5e5;
        }
        
        .receipt-footer p {
            font-size: 12px;
            color: #666;
            margin-bottom: 5px;
        }
        
        .qr-code {
            margin: 20px auto;
            text-align: center;
        }
        
        .qr-code img {
            width: 100px;
            height: 100px;
        }
        
        .print-actions {
            text-align: center;
            margin-bottom: 20px;
        }
        
        .print-actions button {
            background: #16a34a;
            color: white;
            border: none;
            padding: 12px 30px;
            border-radius: 6px;
            font-size: 16px;
            cursor: pointer;
            margin: 0 5px;
        }
        
        .print-actions button:hover {
            background: #15803d;
        }
        
        .print-actions button.secondary {
            background: #6b7280;
        }
        
        .print-actions button.secondary:hover {
            background: #4b5563;
        }
        
        .divider {
            height: 2px;
            background: repeating-linear-gradient(
                90deg,
                #ccc,
                #ccc 5px,
                transparent 5px,
                transparent 10px
            );
            margin: 20px 0;
        }
        
        .watermark {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) rotate(-45deg);
            font-size: 120px;
            color: rgba(22, 163, 74, 0.05);
            font-weight: bold;
            pointer-events: none;
            white-space: nowrap;
        }
        
        @media print {
            body {
                background: white;
                padding: 0;
            }
            
            .print-actions {
                display: none;
            }
            
            .receipt-container {
                box-shadow: none;
            }
            
            .watermark {
                display: block;
            }
        }
        
        @media (max-width: 600px) {
            .receipt-info {
                grid-template-columns: 1fr;
            }
            
            .receipt-body {
                padding: 20px;
            }
        }
    </style>
</head>
<body>
    {{-- Print Actions --}}
    <div class="print-actions">
        <button onclick="window.print()">
            <svg style="width: 16px; height: 16px; display: inline-block; vertical-align: middle; margin-right: 8px;" fill="currentColor" viewBox="0 0 20 20">
                <path fill-rule="evenodd" d="M5 4v2H3a1 1 0 00-1 1v6a1 1 0 001 1h2v2a1 1 0 001 1h6a1 1 0 001-1v-2h2a1 1 0 001-1V7a1 1 0 00-1-1h-2V4a1 1 0 00-1-1H6a1 1 0 00-1 1zm2 0h6v2H7V4zm6 8H7v4h6v-4z" clip-rule="evenodd"/>
            </svg>
            Print Receipt
        </button>
        <button class="secondary" onclick="downloadPDF()">
            <svg style="width: 16px; height: 16px; display: inline-block; vertical-align: middle; margin-right: 8px;" fill="currentColor" viewBox="0 0 20 20">
                <path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z" clip-rule="evenodd"/>
            </svg>
            Download PDF
        </button>
    </div>

    {{-- Receipt Container --}}
    <div class="receipt-container">
        {{-- Watermark --}}
        <div class="watermark">PAID</div>
        
        {{-- Header --}}
        <div class="receipt-header">
            <h1>Mentorship Programme</h1>
            <p>Official Payment Receipt</p>
        </div>
        
        {{-- Body --}}
        <div class="receipt-body">
            {{-- Receipt Title --}}
            <div class="receipt-title">
                <h2>Payment Receipt</h2>
                <span class="badge">
                    <svg style="width: 16px; height: 16px; display: inline-block; vertical-align: middle; margin-right: 4px;" fill="currentColor" viewBox="0 0 20 20">
                        <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
                    </svg>
                    Payment Successful
                </span>
            </div>
            
            {{-- Receipt Info --}}
            <div class="receipt-info">
                <div class="info-group">
                    <h3>Receipt Number</h3>
                    <p>{{ $payment->receipt_number ?? $payment->reference }}</p>
                </div>
                <div class="info-group">
                    <h3>Date</h3>
                    <p>{{ $payment->completed_at?->format('F d, Y') ?? $payment->created_at->format('F d, Y') }}</p>
                </div>
                <div class="info-group">
                    <h3>Transaction Reference</h3>
                    <p>{{ $payment->reference }}</p>
                </div>
                <div class="info-group">
                    <h3>Payment Method</h3>
                    <p>
                        @if($payment->payment_method === 'mtn_momo')
                            MTN Mobile Money
                        @else
                            {{ ucfirst(str_replace('_', ' ', $payment->payment_method ?? 'N/A')) }}
                        @endif
                    </p>
                </div>
            </div>
            
            {{-- Payer Info --}}
            <div class="receipt-info" style="border-top: 2px dashed #e5e5e5; padding-top: 20px; border-bottom: none; margin-bottom: 0;">
                <div class="info-group">
                    <h3>Payer Name</h3>
                    <p>{{ $payment->user->name ?? $payment->application->name ?? 'N/A' }}</p>
                </div>
                <div class="info-group">
                    <h3>Email</h3>
                    <p>{{ $payment->user->email ?? $payment->application->email ?? 'N/A' }}</p>
                </div>
                <div class="info-group">
                    <h3>Phone Number</h3>
                    <p>{{ $payment->phone_number ?? $payment->application->phone ?? 'N/A' }}</p>
                </div>
                <div class="info-group">
                    <h3>Programme</h3>
                    <p>{{ $payment->programme->title ?? 'N/A' }}</p>
                </div>
            </div>
            
            <div class="divider"></div>
            
            {{-- Payment Details --}}
            <div class="payment-details">
                <table>
                    <tr>
                        <td>Description</td>
                        <td>Mentorship Programme Registration</td>
                    </tr>
                    <tr>
                        <td>Programme</td>
                        <td>{{ $payment->programme->title ?? 'N/A' }}</td>
                    </tr>
                    @if($payment->application && $payment->application->role_preference)
                        <tr>
                            <td>Role</td>
                            <td>{{ ucfirst($payment->application->role_preference) }}</td>
                        </tr>
                    @endif
                    <tr>
                        <td>Payment Method</td>
                        <td>
                            @if($payment->payment_method === 'mtn_momo')
                                MTN Mobile Money
                            @else
                                {{ ucfirst(str_replace('_', ' ', $payment->payment_method ?? 'N/A')) }}
                            @endif
                        </td>
                    </tr>
                    @if($payment->transaction_id)
                        <tr>
                            <td>Transaction ID</td>
                            <td>{{ $payment->transaction_id }}</td>
                        </tr>
                    @endif
                    <tr class="total">
                        <td>Total Amount</td>
                        <td>{{ $payment->formatted_amount }}</td>
                    </tr>
                </table>
            </div>
            
            {{-- QR Code Placeholder --}}
            <div class="qr-code">
                <div style="width: 100px; height: 100px; margin: 0 auto; background: #f0f0f0; display: flex; align-items: center; justify-content: center; border-radius: 8px;">
                    <span style="color: #999; font-size: 10px;">QR Code</span>
                </div>
                <p style="font-size: 12px; color: #666; margin-top: 10px;">Scan to verify</p>
            </div>
        </div>
        
        {{-- Footer --}}
        <div class="receipt-footer">
            <p><strong>Thank you for your payment!</strong></p>
            <p>This is an official receipt for your mentorship programme registration.</p>
            <p>For any inquiries, please contact support@example.com</p>
            <p style="margin-top: 15px; font-style: italic;">
                Generated on {{ now()->format('F d, Y \a\t H:i') }}
            </p>
        </div>
    </div>
    
    <script>
    function downloadPDF() {
        // In production, this would generate a PDF
        window.print();
    }
    </script>
</body>
</html>
