<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{ $report['title'] ?? 'Medical report' }}</title>
<style>
  body { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; color: #0f172a; padding: 24px; max-width: 800px; margin: 0 auto; }
  h1 { font-size: 20px; margin: 0 0 4px; }
  .clinic { color: #475569; font-size: 13px; margin-bottom: 18px; }
  .row { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #f1f5f9; }
  .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; font-weight: 700; margin-bottom: 4px; }
  .body { white-space: pre-wrap; font-size: 14px; line-height: 1.5; }
  .footer { margin-top: 20px; font-size: 11px; color: #64748b; }
  @media print { body { padding: 0; } .no-print { display: none; } }
  .no-print { background: #0d9488; color: white; border: 0; padding: 10px 18px; border-radius: 8px; font-weight: 700; cursor: pointer; margin-bottom: 16px; }
</style>
</head>
<body>
  <button class="no-print" onclick="window.print()">Print / Save as PDF</button>
  <h1>{{ $report['title'] }}</h1>
  <div class="clinic">{{ $clinic }} · {{ $report['date_label'] }} · {{ $report['doctor_name'] ?? '—' }}</div>

  <div class="row">
    <div class="lbl">Pet</div>
    <div class="body">{{ $report['pet_name'] }} ({{ ucfirst($report['pet_species'] ?? '') }})</div>
  </div>

  <div class="row">
    <div class="lbl">Findings</div>
    <div class="body">{{ $report['findings'] ?? '—' }}</div>
  </div>

  @if (!empty($report['attachments']))
    <div class="row">
      <div class="lbl">Attachments</div>
      <ul style="margin:0;padding-left:18px;">
        @foreach ($report['attachments'] as $att)
          <li><a href="{{ is_array($att) ? ($att['url'] ?? '#') : $att }}">{{ is_array($att) ? ($att['name'] ?? 'attachment') : basename($att) }}</a></li>
        @endforeach
      </ul>
    </div>
  @endif

  <div class="footer">Generated {{ now()->format('D M j, Y · H:i') }}</div>
</body>
</html>
