<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title><?php echo e($jobDescription->job_title); ?> - Job Description</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .no-break {
            page-break-inside: avoid;
        }

        body {
            font-family: DejaVu Sans, sans-serif;
            font-size: 10.5pt;
            color: #111827;
            line-height: 1.6;
            background-color: #f9fafb;
        }

        /* Outer wrapper */
        .page {
            max-width: 680px;
            margin: 32px auto;
            background: #ffffff;
            border: 1px solid #e5e7eb;
            border-radius: 12px;
            overflow: hidden;
        }

        /* Inner padding */
        .inner {
            padding: 40px 48px 48px;
        }

        /* Title */
        h1.job-title {
            font-size: 22pt;
            font-weight: bold;
            color: #111827;
            margin-bottom: 20px;
            line-height: 1.2;
        }

        /* Meta grid */
        .meta-grid {
            display: table;
            width: 100%;
            margin-bottom: 28px;
        }

        .meta-row {
            display: table-row;
        }

        .meta-cell {
            display: table-cell;
            width: 25%;
            padding-right: 16px;
            padding-bottom: 8px;
            vertical-align: top;
        }

        .meta-label {
            font-size: 8.5pt;
            color: #6b7280;
            display: block;
            margin-bottom: 2px;
        }

        .meta-value {
            font-size: 10pt;
            font-weight: bold;
            color: #111827;
        }

        /* Divider */
        .divider {
            border: none;
            border-top: 1px solid #e5e7eb;
            margin: 24px 0;
        }

        /* Section heading */
        h2.section-title {
            font-size: 14pt;
            font-weight: bold;
            color: #111827;
            margin-bottom: 12px;
        }

        /* Prose paragraph (role summary) */
        p.prose {
            font-size: 10pt;
            color: #4b5563;
            line-height: 1.7;
            margin-bottom: 4px;
        }

        /* Bullet list (responsibilities / qualifications) */
        .bullet-list {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .bullet-list li {
            display: table;
            width: 100%;
            font-size: 10pt;
            color: #4b5563;
            margin-bottom: 8px;
        }

        .bullet-list li .dot {
            display: table-cell;
            width: 10px;
            padding-top: 6px;
            vertical-align: top;
        }

        .bullet-list li .dot-inner {
            width: 6px;
            height: 6px;
            background-color: #111827;
            border-radius: 50%;
            display: block;
        }

        .bullet-list li .text {
            display: table-cell;
            vertical-align: top;
            padding-left: 6px;
        }

        /* Check list (required skills) */
        .check-list {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .check-list li {
            display: table;
            width: 100%;
            font-size: 10pt;
            color: #4b5563;
            margin-bottom: 8px;
        }

        .check-list li .check {
            display: table-cell;
            width: 14px;
            padding-top: 2px;
            vertical-align: top;
            color: #22c55e;
            font-size: 11pt;
            font-weight: bold;
        }

        .check-list li .text {
            display: table-cell;
            vertical-align: top;
            padding-left: 6px;
        }

        /* Competency pills */
        .pills {
            margin-top: 4px;
        }

        .watermark {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            opacity: 0.06;
            z-index: 0;
            width: 320px;
            pointer-events: none;
        }

        .watermark img {
            width: 100%;
            height: auto;
        }

        .pill {
            display: inline-block;
            background-color: #f3f4f6;
            color: #374151;
            border: 1px solid #e5e7eb;
            border-radius: 9999px;
            padding: 4px 14px;
            font-size: 9.5pt;
            font-weight: 500;
            margin-right: 6px;
            margin-bottom: 6px;
        }
    </style>
</head>

<body>

    <?php
        $jd = $jobDescription;

        // Split a stored content string into clean lines, stripping any leading
        // bullet-prefix characters (- • *) the AI may have added.
        $parseLines = function (string $raw): array {
            return array_values(
                array_filter(
                    array_map(fn($l) => preg_replace('/^\s*[-•*]\s+/', '', trim($l)), preg_split('/\r\n|\r|\n/', $raw)),
                    fn($l) => $l !== '',
                ),
            );
        };

        $sectionsByType = $jd->sections->keyBy('section_type');

        $roleSummaryRaw = $sectionsByType->get(\App\Models\JobDescriptionSection::TYPE_ROLE_SUMMARY)?->content ?? '';
        $responsibilitiesLines = $parseLines(
            $sectionsByType->get(\App\Models\JobDescriptionSection::TYPE_KEY_RESPONSIBILITIES)?->content ?? '',
        );
        $skillsLines = $parseLines(
            $sectionsByType->get(\App\Models\JobDescriptionSection::TYPE_REQUIRED_SKILLS)?->content ?? '',
        );
        $qualificationsLines = $parseLines(
            $sectionsByType->get(\App\Models\JobDescriptionSection::TYPE_QUALIFICATIONS)?->content ?? '',
        );
        $competenciesLines = $parseLines(
            $sectionsByType->get(\App\Models\JobDescriptionSection::TYPE_CORE_COMPETENCIES)?->content ?? '',
        );
        $customSections = $jd->customSections ?? [];
    ?>

    <div class="page">
        <div class="watermark">
            <img src="https://ratemypay.com/logo.png" alt="logo">
        </div>
        <div class="inner">

            
            <h1 class="job-title"><?php echo e($jd->job_title); ?></h1>

            
            <div class="meta-grid">
                <div class="meta-row">
                    <?php if($jd->department): ?>
                        <div class="meta-cell">
                            <span class="meta-label">Department</span>
                            <span class="meta-value"><?php echo e($jd->department); ?></span>
                        </div>
                    <?php endif; ?>
                    <?php if($jd->level): ?>
                        <div class="meta-cell">
                            <span class="meta-label">Level</span>
                            <span class="meta-value"><?php echo e($jd->level); ?></span>
                        </div>
                    <?php endif; ?>
                    <?php if($jd->location): ?>
                        <div class="meta-cell">
                            <span class="meta-label">Location</span>
                            <span class="meta-value"><?php echo e($jd->location); ?></span>
                        </div>
                    <?php endif; ?>
                    <?php if($jd->employment_type): ?>
                        <div class="meta-cell">
                            <span class="meta-label">Employment Type</span>
                            <span class="meta-value"><?php echo e($jd->employment_type); ?></span>
                        </div>
                    <?php endif; ?>
                </div>
            </div>

            <hr class="divider">

            
            <?php if($roleSummaryRaw): ?>
                <h2 class="section-title">Role Summary</h2>
                <?php $__currentLoopData = preg_split('/\r\n|\r|\n/', trim($roleSummaryRaw)); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $line): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php if(trim($line) !== ''): ?>
                        <p class="prose"><?php echo e(trim($line)); ?></p>
                    <?php endif; ?>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <hr class="divider">
            <?php endif; ?>

            
            <?php if(count($responsibilitiesLines)): ?>
                <h2 class="section-title">Key Responsibilities</h2>
                <ul class="bullet-list">
                    <?php $__currentLoopData = $responsibilitiesLines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <li>
                            <span class="dot"><span class="dot-inner"></span></span>
                            <span class="text"><?php echo e($item); ?></span>
                        </li>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </ul>
                <hr class="divider">
            <?php endif; ?>

            
            <?php if(count($skillsLines)): ?>
                <h2 class="section-title">Required Skills</h2>
                <ul class="check-list">
                    <?php $__currentLoopData = $skillsLines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <li>
                            <span class="check">✓</span>
                            <span class="text"><?php echo e($item); ?></span>
                        </li>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </ul>
                <hr class="divider">
            <?php endif; ?>

            
            <?php if(count($qualificationsLines)): ?>
                <h2 class="section-title">Qualifications</h2>
                <ul class="bullet-list">
                    <?php $__currentLoopData = $qualificationsLines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <li>
                            <span class="dot"><span class="dot-inner"></span></span>
                            <span class="text"><?php echo e($item); ?></span>
                        </li>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </ul>
                <hr class="divider">
            <?php endif; ?>

            
            <?php if(count($competenciesLines)): ?>
                <h2 class="section-title">Core Competencies</h2>
                <div class="pills no-break">
                    <?php $__currentLoopData = $competenciesLines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $comp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <span class="pill"><?php echo e($comp); ?></span>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            <?php endif; ?>
            <?php if(!empty($customSections) && count($customSections)): ?>
                <hr class="divider">
                <?php $__currentLoopData = $customSections; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $section): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="no-break">
                        <h2 class="section-title"><?php echo e($section->title); ?></h2>

                        <?php $__currentLoopData = preg_split('/\r\n|\r|\n/', trim($section->content ?? '')); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $line): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if(trim($line) !== ''): ?>
                                <p class="prose"><?php echo e(trim($line)); ?></p>
                            <?php endif; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <div class="divider"></div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            <?php endif; ?>
        </div>
    </div>

</body>

</html>
<?php /**PATH /var/www/ratemypay_dev/resources/views/jd-wizard/export-pdf.blade.php ENDPATH**/ ?>