<!DOCTYPE html>
<html lang="pt-BR" class="scroll-smooth">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Contrato Assinado — OPCON</title>
    <link rel="icon" type="image/jpeg" href="{{ asset('favicon.jpg') }}">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: 'Poppins', sans-serif; background: #f1f5f9; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; }
    </style>
</head>
<body>

    <div style="background:#fff; border-radius:20px; border:1px solid #e2e8f0; max-width:480px; width:100%; padding:2.5rem; text-align:center; box-shadow:0 10px 40px rgba(0,0,0,0.06);">

        {{-- Success icon --}}
        <div style="width:72px;height:72px;border-radius:50%;background:#ecfdf5;display:flex;align-items:center;justify-content:center;margin:0 auto 1.5rem;">
            <svg style="width:36px;height:36px;color:#25b87e;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M5 13l4 4L19 7"/>
            </svg>
        </div>

        <h1 style="font-size:1.5rem; font-weight:800; color:#1e3a5f; margin-bottom:0.5rem;">Contrato assinado!</h1>
        <p style="font-size:0.9375rem; color:#64748b; margin-bottom:1.75rem; line-height:1.65;">
            Obrigado, <strong>{{ $contrato->assinatura_nome ?? $contrato->responsavel_legal ?? $contrato->razao_social }}</strong>.<br>
            Seu contrato foi assinado com sucesso e está agora <strong style="color:#25b87e;">ativo</strong>.
        </p>

        {{-- Summary box --}}
        <div style="background:#f8fafc; border-radius:12px; padding:1rem 1.25rem; margin-bottom:1.75rem; text-align:left;">
            <div style="display:flex; justify-content:space-between; align-items:center; padding:0.375rem 0; border-bottom:1px solid #f1f5f9;">
                <span style="font-size:0.8125rem; color:#64748b;">Empresa</span>
                <strong style="font-size:0.875rem; color:#1e3a5f;">{{ $contrato->razao_social }}</strong>
            </div>
            <div style="display:flex; justify-content:space-between; align-items:center; padding:0.375rem 0; border-bottom:1px solid #f1f5f9;">
                <span style="font-size:0.8125rem; color:#64748b;">Regime</span>
                <span style="font-size:0.875rem; color:#374151;">{{ $contrato->regime_tributario }}</span>
            </div>
            @if($contrato->honorario)
            <div style="display:flex; justify-content:space-between; align-items:center; padding:0.375rem 0; border-bottom:1px solid #f1f5f9;">
                <span style="font-size:0.8125rem; color:#64748b;">Honorário mensal</span>
                <strong style="font-size:0.875rem; color:#059669;">R$ {{ number_format($contrato->honorario, 2, ',', '.') }}</strong>
            </div>
            @endif
            @if($contrato->assinado_em)
            <div style="display:flex; justify-content:space-between; align-items:center; padding:0.375rem 0;">
                <span style="font-size:0.8125rem; color:#64748b;">Assinado em</span>
                <span style="font-size:0.8125rem; color:#374151;">{{ $contrato->assinado_em->format('d/m/Y \à\s H:i') }}</span>
            </div>
            @endif
        </div>

        {{-- Signature preview --}}
        @if($contrato->assinatura_dados)
        <div style="margin-bottom:1.75rem;">
            <p style="font-size:0.75rem; font-weight:600; text-transform:uppercase; letter-spacing:0.05em; color:#94a3b8; margin-bottom:0.625rem;">Assinatura registrada</p>
            <div style="border:1px solid #e2e8f0; border-radius:10px; padding:0.5rem; background:#fafafa;">
                <img src="{{ $contrato->assinatura_dados }}"
                     alt="Assinatura digital"
                     style="max-width:100%; height:auto; max-height:100px; display:block; margin:0 auto;">
            </div>
        </div>
        @endif

        <p style="font-size:0.8125rem; color:#94a3b8; margin-bottom:1.5rem;">
            Nossa equipe entrará em contato para dar início ao seu atendimento.
        </p>

        <a href="{{ route('home') }}"
           style="display:inline-flex; align-items:center; gap:0.5rem; padding:0.625rem 1.5rem; background:#1e3a5f; color:#fff; border-radius:10px; font-size:0.875rem; font-weight:600; text-decoration:none;">
            ← Voltar ao site
        </a>
    </div>

    <p style="margin-top:1.5rem; font-size:0.75rem; color:#94a3b8; text-align:center;">
        OPCON Soluções Contábeis · Palmas, Tocantins
    </p>

</body>
</html>
