@php
    $withdrawalUrl = app()->getLocale() === 'de' ? url('/de/widerrufsbelehrung') : url('/en/withdrawal');
@endphp
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="UTF-8">
    <title>{{ $forRecipient ? __('emails.gift_voucher.recipient.subject', ['amount' => $amount, 'currency' => $currency]) : __('emails.gift_voucher.purchaser.subject', ['amount' => $amount, 'currency' => $currency]) }}</title>
</head>
<body style="font-family: Arial, sans-serif; background-color: #f7f7f7; padding: 20px; color: #111827;">
<div style="max-width: 640px; margin: 0 auto; background: #ffffff; border-radius: 10px; padding: 28px; box-shadow: 0 10px 30px rgba(0,0,0,0.05);">
    <h1 style="margin-top: 0; font-size: 22px;">
        {{ $forRecipient ? __('emails.gift_voucher.recipient.greeting') : __('emails.gift_voucher.purchaser.greeting') }}
    </h1>
    <p style="font-size: 15px; line-height: 1.6; margin-bottom: 16px;">
        {!! $forRecipient
            ? __('emails.gift_voucher.recipient.body', [
                'amount' => $amount,
                'currency' => $currency,
                'purchaser' => $voucher->purchaser_email,
            ])
            : __('emails.gift_voucher.purchaser.body', [
                'amount' => $amount,
                'currency' => $currency,
                'recipient' => $voucher->recipient_email ?: __('emails.gift_voucher.purchaser.recipient_fallback'),
            ])
        !!}
    </p>

    @if ($voucher->message)
        <div style="margin: 18px 0; padding: 14px 16px; background: #f3f4f6; border-left: 4px solid #2563eb; border-radius: 8px;">
            <strong>{{ __('emails.gift_voucher.message_title') }}</strong>
            <p style="margin: 8px 0 0; white-space: pre-line;">{{ $voucher->message }}</p>
        </div>
    @endif

    <div style="margin: 18px 0; padding: 16px; border: 1px dashed #d1d5db; border-radius: 10px; background: #f9fafb;">
        <p style="margin: 0 0 6px; font-size: 14px; color: #6b7280;">{{ __('emails.gift_voucher.code_label') }}</p>
        <div style="display: inline-block; padding: 10px 14px; background: #111827; color: #ffffff; border-radius: 8px; font-weight: bold; letter-spacing: 1px;">
            {{ $voucher->code }}
        </div>
        <p style="margin: 10px 0 0; font-size: 14px; color: #4b5563;">
            {{ __('emails.gift_voucher.redeem_hint') }}
        </p>
        @isset($printUrl)
            <p style="margin: 8px 0 0; font-size: 14px;">
                <a href="{{ $printUrl }}">{{ __('emails.gift_voucher.printable') }}</a>
            </p>
        @endisset
    </div>

    <p style="font-size: 14px; color: #4b5563; margin: 12px 0;">
        {{ __('emails.gift_voucher.expiry', ['date' => optional($voucher->expires_at)->toFormattedDateString()]) }}
    </p>

    <p style="font-size: 14px; color: #4b5563; margin: 12px 0;">
        {!! __('emails.gift_voucher.withdrawal', ['url' => $withdrawalUrl]) !!}
    </p>

    <p style="font-size: 14px; color: #4b5563; margin-top: 20px;">
        {!! __('emails.gift_voucher.footer') !!}
    </p>
</div>
</body>
</html>
