<!doctype html>
<html lang="{{ app()->getLocale() }}" dir="{{ app()->getLocale()==='ar' ? 'rtl' : 'ltr' }}">
<head>
    <meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
    <title>My Vehicles — {{ config('app.name') }}</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
</head>
<body class="bg-light">
<div class="container" style="max-width:720px; margin-top:24px;">
    <div class="d-flex justify-content-between align-items-center mb-3">
        <h4 class="mb-0">Hello, {{ $owner->name }}</h4>
        <a href="{{ route('vrc.portal.account.logout') }}" class="btn btn-sm btn-outline-secondary">Sign out</a>
    </div>

    <div class="card shadow-sm mb-3">
        <div class="card-header bg-primary text-white">My vehicles</div>
        <div class="card-body">
            @forelse($vehicles as $v)
                <a href="{{ route('vrc.portal.account.vehicle', $v->id) }}" class="btn btn-outline-primary btn-block text-left mb-2">
                    <strong>{{ $v->plate_number ?: ('Vehicle #'.$v->id) }}</strong>
                    <span class="text-muted">{{ $v->vin }}</span>
                </a>
            @empty
                <p class="text-muted mb-0">No vehicles on file.</p>
            @endforelse
        </div>
    </div>

    <div class="card shadow-sm mb-3">
        <div class="card-header">Recent repair orders</div>
        <ul class="list-group list-group-flush">
            @forelse($orders as $o)
                <li class="list-group-item d-flex justify-content-between">
                    <span>{{ $o->number ?: ('RO #'.$o->id) }}</span>
                    <span class="badge badge-info">{{ str_replace('_',' ', $o->status) }}</span>
                </li>
            @empty
                <li class="list-group-item text-muted">No repair orders yet.</li>
            @endforelse
        </ul>
    </div>

    <div class="card shadow-sm mb-3">
        <div class="card-header">Estimates</div>
        <ul class="list-group list-group-flush">
            @forelse($estimates as $e)
                <li class="list-group-item d-flex justify-content-between">
                    <span>{{ $e->number ?: ('EST #'.$e->id) }}</span>
                    <span>
                        <span class="badge badge-secondary">{{ $e->status }}</span>
                        @if($e->approval_token)
                            <a href="{{ route('vrc.portal.estimate', $e->approval_token) }}" class="badge badge-primary">view</a>
                        @endif
                    </span>
                </li>
            @empty
                <li class="list-group-item text-muted">No estimates.</li>
            @endforelse
        </ul>
    </div>
    <p class="text-center text-muted" style="font-size:12px;">{{ config('app.name') }}</p>
</div>
</body>
</html>
