@extends('emails.layout')

@section('body')

@php $daysLeft = now()->diffInDays($invoice->due_date, false); @endphp

<div class="alert-box alert-warning">
    <strong style="color:#92400e;">⏰ Payment Reminder</strong>
    <p style="margin:0.4rem 0 0;color:#78350f;">
        @if($daysLeft > 0)
            Invoice <strong>{{ $invoice->invoice_number }}</strong> is due in <strong>{{ $daysLeft }} day(s)</strong> on {{ $invoice->due_date->format('d/m/Y') }}.
        @else
            Invoice <strong>{{ $invoice->invoice_number }}</strong> is due <strong>today</strong>.
        @endif
    </p>
</div>

<h2>Friendly payment reminder</h2>
<p>
    This is a reminder from <strong>{{ $invoice->user->business_name }}</strong> that
    your invoice <strong>{{ $invoice->invoice_number }}</strong> for
    <strong>₦{{ number_format($invoice->total, 2) }}</strong> is due soon.
</p>

<div style="background:#f8fafc;border-radius:8px;padding:1.25rem;margin:1.25rem 0;border:1px solid #e2e8f0;">
    <div class="info-grid">
        <div class="info-item">
            <label>Invoice</label>
            <div class="value" style="font-family:monospace;">{{ $invoice->invoice_number }}</div>
        </div>
        <div class="info-item">
            <label>Amount Due</label>
            <div class="value" style="color:#ca8a04;">₦{{ number_format($invoice->total, 2) }}</div>
        </div>
        <div class="info-item">
            <label>Due Date</label>
            <div class="value">{{ $invoice->due_date->format('d/m/Y') }}</div>
        </div>
        <div class="info-item">
            <label>From</label>
            <div class="value">{{ $invoice->user->business_name }}</div>
        </div>
    </div>
</div>

<div style="text-align:center;padding:0.5rem 0;">
    <a href="{{ $invoice->public_url }}" class="btn-pay">
        💳 &nbsp; Pay Now — ₦{{ number_format($invoice->total, 2) }}
    </a>
</div>

@if($invoice->user->bank_name)
<div class="alert-box alert-success" style="margin-top:1rem;">
    <strong style="color:#15803d;">Bank Transfer</strong><br>
    <span style="font-size:0.875rem;color:#166534;">
        {{ $invoice->user->bank_name }} · {{ $invoice->user->account_number }} · {{ $invoice->user->account_name }}
    </span>
</div>
@endif

@endsection
