<!doctype html>
<html lang="{{ app()->getLocale() }}" dir="{{ in_array(app()->getLocale(), ['ar']) ? 'rtl' : 'ltr' }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{{ __('vrc::lang.status_tracker') }} — {{ $ro->number }}</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
    <style>
        .vrc-step { padding:12px 16px; border-left:4px solid #ddd; margin-left:8px; }
        .vrc-step.done { border-color:#28a745; } .vrc-step.current { border-color:#007bff; font-weight:700; }
        [dir=rtl] .vrc-step { border-left:none; border-right:4px solid #ddd; margin-right:8px; margin-left:0; }
    </style>
</head>
<body class="bg-light">
<div class="container" style="max-width:620px; margin-top:30px;">
    <div class="card shadow-sm">
        <div class="card-header bg-primary text-white"><h4 class="mb-0">{{ __('vrc::lang.track_repair') }}</h4></div>
        <div class="card-body">
            <p class="mb-1"><strong>{{ $ro->number }}</strong></p>
            <p class="text-muted">{{ optional($ro->vehicle)->label }}</p>

            @php $idx = array_search($ro->status, $ladder); @endphp
            <div class="mt-3">
                @foreach ($ladder as $i => $step)
                    @php $cls = $idx === false ? '' : ($i < $idx ? 'done' : ($i === $idx ? 'current' : '')); @endphp
                    <div class="vrc-step {{ $cls }}">
                        @if($cls==='done')<span class="text-success">&#10003;</span>@endif
                        {{ __('vrc::lang.ro_status_' . $step) }}
                    </div>
                @endforeach
            </div>

            @if($invoice)
                <hr>
                <p>{{ __('vrc::lang.invoice') }}: <strong>{{ $invoice['invoice_no'] }}</strong> —
                   {{ __('vrc::lang.payment_status') }}: <span class="badge badge-{{ $invoice['status']=='paid'?'success':'warning' }}">{{ $invoice['status'] }}</span></p>
                <p>{{ __('vrc::lang.paid') }}: {{ number_format($invoice['paid'],2) }} / {{ number_format($invoice['total'],2) }}</p>
            @endif
        </div>
    </div>
    <p class="text-center text-muted mt-3" style="font-size:12px;">{{ config('app.name') }}</p>
</div>
</body>
</html>
