@php
    use SimpleSoftwareIO\QrCode\Facades\QrCode;
@endphp
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="UTF-8">
    <title>{{ __('Gift Voucher') }} - {{ $voucher->code }}</title>
    <style>
        body { font-family: Arial, sans-serif; background: #f7f7f7; margin: 0; padding: 20px; color: #111827; }
        .wrap { max-width: 720px; margin: 0 auto; background: #fff; padding: 28px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,0.06); }
        .badge { display: inline-block; padding: 6px 10px; background: #eef2ff; color: #4338ca; border-radius: 10px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
        .code { display: inline-block; padding: 10px 14px; background: #111827; color: #fff; border-radius: 10px; font-weight: bold; letter-spacing: 1px; }
        .grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 16px; margin-top: 18px; }
        .card { border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px; background: #f9fafb; }
        .muted { color: #6b7280; font-size: 14px; }
        .title { font-size: 24px; margin: 10px 0; }
        .qr { text-align: center; }
        .qr svg { max-width: 180px; }
    </style>
</head>
<body>
    <div class="wrap">
        <div class="badge">{{ __('Gift Voucher') }}</div>
        <h1 class="title">{{ config('app.name') }}</h1>
        <p class="muted">{{ __('Show or share this page, or scan the QR to redeem the voucher code at checkout.') }}</p>

        <div class="grid">
            <div class="card">
                <p class="muted">{{ __('Voucher code') }}</p>
                <div class="code">{{ $voucher->code }}</div>
                <p class="muted" style="margin-top:12px;">
                    {{ __('Value') }}: {{ number_format((float) $voucher->amount, 2) }} {{ $voucher->currency }}<br>
                    @if($voucher->expires_at)
                        {{ __('Valid until') }}: {{ $voucher->expires_at->toFormattedDateString() }}
                    @endif
                </p>
            </div>
            <div class="card qr">
                {!! QrCode::size(180)->generate($voucher->code) !!}
                <p class="muted">{{ __('Scan to redeem code at checkout') }}</p>
            </div>
        </div>

        @if($voucher->recipient_name || $voucher->recipient_email)
            <div class="card" style="margin-top:16px;">
                <strong>{{ __('Recipient') }}:</strong>
                <p class="muted" style="margin:6px 0 0;">
                    {{ $voucher->recipient_name ?? '' }} {{ $voucher->recipient_email ? '('.$voucher->recipient_email.')' : '' }}
                </p>
            </div>
        @endif

        @if($voucher->message)
            <div class="card" style="margin-top:16px;">
                <strong>{{ __('Message') }}</strong>
                <p style="margin:8px 0 0; white-space: pre-line;">{{ $voucher->message }}</p>
            </div>
        @endif
    </div>
</body>
</html>
