<!DOCTYPE html>
<html lang="pt-BR">

<head>
    <meta charset="UTF-8">
    <title>Currículo - {{ $curriculo->name }}</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            margin: 0;
            padding: 0;
            line-height: 1.5;
            color: #000;
            background-color: #fff;
        }

        .banner {
            width: 900px;
            height: 60px;
            margin-top: -50px;
            margin-left: -100px;
            filter: grayscale(100%);
        }

        .header {
            margin-bottom: 20px;
            text-align: center;
        }

        h1 {
            color: #000;
            margin: 10px 0 5px;
            font-size: 24px;
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 700;
        }

        hr {
            border: 0.5px solid #ddd;
            margin: 15px 0;
        }

        .contato {
            background-color: #f9f9f9;
            max-width: 670px;
            padding: 12px 15px;
            border-radius: 0;
            margin: 17px 0;
            width: 100%;
            border: 1px solid #eee;
        }

        .contato td {
            vertical-align: top;
            padding: 5px 0;
            width: 50%;
            font-size: 16px;
        }

        .secao {
            margin-bottom: 25px;
            padding: 0 10px;
        }

        h2 {
            color: #000;
            border-left: 4px solid #555;
            padding-left: 10px;
            font-size: 18px;
            margin: 20px 0 12px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            font-weight: 600;
        }

        ul {
            padding-left: 22px;
            margin: 8px 0;
        }

        li {
            margin-bottom: 5px;
            font-size: 16px;
        }

        .experiencia,
        .educacao {
            margin-bottom: 22px;
        }

        .cargo-title,
        .grau {
            font-weight: 600;
            color: #000;
            font-size: 17px;
            margin-bottom: 2px;
        }

        .empresa,
        .instituicao {
            font-weight: 600;
            font-size: 16px;
            color: #333;
        }

        .periodo {
            font-style: italic;
            color: #555;
            font-size: 15px;
            margin: 3px 0;
        }

        .description {
            margin-top: 8px;
            font-size: 15px;
            color: #333;
            line-height: 1.4;
        }

        .secao>div {
            margin-bottom: 14px;
            page-break-inside: avoid;
        }

        .rodape {
            text-align: center;
            margin-top: 40px;
            font-size: 14px;
            color: #777;
            border-top: 1px solid #eee;
            padding-top: 10px;
        }

        strong {
            font-weight: 600;
            color: #000;
        }
    </style>
</head>

<body>
    <img src="pmar/assets/img/banner-bc-talento.png" class="banner">

    <div class="header">
        <h1>{{ $curriculo->name }}</h1>
        <hr>
        <div class="contato">
            <table width="100%">
                <tr>
                    <td><strong>Email:</strong> {{ $curriculo->email }}</td>
                    <td><strong>Telefone:</strong> {{ $curriculo->cellphone ?: $curriculo->telephone }}</td>
                </tr>
                <tr>
                    <td><strong>Endereço:</strong> {{ $curriculo->address }}</td>
                    <td><strong>Ocupação:</strong> {{ optional($curriculo->occupation)->name }}</td>
                </tr>
            </table>
        </div>
    </div>

    <div class="secao">
        <h2>Resumo Profissional</h2>
        <p style="line-height: 1.5; font-size: 14px;">{{ $curriculo->cv_summary }}</p>
    </div>

    <div class="secao">
        <h2>Experiência Profissional</h2>
        @foreach ($curriculo->experiences as $exp)
            <div class="experiencia">
                <div class="cargo-title">{{ optional($exp->occupation)->name }}</div>
                <div class="empresa">{{ $exp->company }}</div>
                <div class="periodo">
                    {{ date('d/m/Y', strtotime($exp->date_start)) }}
                    - {{ $exp->is_current ? 'Atual' : date('d/m/Y', strtotime($exp->date_end)) }}
                </div>
                <div class="description">{{ $exp->description }}</div>
            </div>
        @endforeach
    </div>

    <div class="secao">
        <h2>Formação Acadêmica</h2>
        @foreach ($curriculo->education as $edu)
            <div class="educacao">
                <div class="grau">{{ $edu->education_level_id->label() }} em
                    {{ $edu->academic_discipline_id->label() }}</div>
                <div class="instituicao">{{ $edu->institution }}</div>
                <div class="periodo">
                    {{ date('d/m/Y', strtotime($edu->date_start)) }}
                    - {{ date('d/m/Y', strtotime($edu->date_end ?? 'Atual')) }}
                </div>
            </div>
        @endforeach
    </div>

    <div class="secao">
        <h2>Cursos Complementares</h2>
        @foreach ($curriculo->courses as $course)
            <div>
                <strong>{{ $course->name }}</strong> - {{ $course->institution }}
                <span class="periodo">({{ $course->duration }})</span>
            </div>
        @endforeach
    </div>

    <div class="secao">
        <h2>Idiomas</h2>
        @foreach ($curriculo->languages as $lang)
            <div>
                {{ $lang->language_id->label() }} - <strong>{{ $lang->language_proficiency_id->label() }}</strong>
            </div>
        @endforeach
    </div>

    <div class="secao">
        <h2>Habilidades Técnicas</h2>
        <ul>
            @foreach ($curriculo->skills as $skill)
                <li>{{ $skill->name }}</li>
            @endforeach
        </ul>
    </div>

    <div class="rodape">
        <p>Currículo gerado pelo Banco de Talentos, Prefeitura de Angra dos Reis - {{ now()->format('d/m/Y') }}</p>
    </div>
</body>

</html>
