<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Análisis Numerológico - <?php echo e($name); ?></title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            font-family: 'DejaVu Sans', Arial, sans-serif;
            font-size: 10px;
            line-height: 1.4;
            color: #333;
        }
        .container {
            padding: 15px;
        }

        /* Header */
        .header {
            text-align: center;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 3px solid #6a1b9a;
        }
        .header h1 {
            font-size: 20px;
            color: #6a1b9a;
            margin-bottom: 8px;
        }
        .header-info {
            font-size: 11px;
            color: #555;
        }
        .header-info strong {
            color: #6a1b9a;
        }

        /* Section titles */
        .section-title {
            background: #6a1b9a;
            color: white;
            padding: 6px 10px;
            font-size: 13px;
            font-weight: bold;
            text-align: center;
            margin: 15px 0 10px 0;
        }

        /* Tabla Numerológica */
        .tabla-numerologica {
            margin-bottom: 15px;
        }
        .letters-grid {
            display: table;
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 10px;
        }
        .letters-row {
            display: table-row;
        }
        .letter-cell {
            display: table-cell;
            border: 1px solid #ddd;
            padding: 4px;
            text-align: center;
            font-size: 10px;
        }
        .letter-cell.vowel {
            background: #e1bee7;
            color: #6a1b9a;
            font-weight: bold;
        }
        .letter-cell.letter {
            background: #7b1fa2;
            color: white;
            font-weight: bold;
            font-size: 11px;
        }
        .letter-cell.consonant {
            background: #b2dfdb;
            color: #00796b;
            font-weight: bold;
        }
        .letter-cell.empty {
            background: #f5f5f5;
        }

        /* Totales */
        .totales-grid {
            display: table;
            width: 100%;
            border-collapse: collapse;
            margin-top: 10px;
        }
        .total-row {
            display: table-row;
        }
        .total-cell {
            display: table-cell;
            width: 33.33%;
            padding: 8px;
            text-align: center;
            border: 2px solid #ddd;
        }
        .total-cell.alma {
            border-color: #7b1fa2;
        }
        .total-cell.personalidad {
            border-color: #00796b;
        }
        .total-cell.expresion {
            border-color: #f57c00;
        }
        .total-label {
            font-size: 9px;
            font-weight: bold;
            text-transform: uppercase;
            margin-bottom: 3px;
        }
        .total-label.alma {
            color: #7b1fa2;
        }
        .total-label.personalidad {
            color: #00796b;
        }
        .total-label.expresion {
            color: #f57c00;
        }
        .total-number {
            font-size: 18px;
            font-weight: bold;
            color: #333;
        }

        /* Cuadro de Casas */
        .casas-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 10px;
        }
        .casas-table th,
        .casas-table td {
            border: 1px solid #666;
            padding: 5px;
            text-align: center;
            font-size: 9px;
        }
        .casas-table thead th {
            background: #7b1fa2;
            color: white;
            font-weight: bold;
        }
        .casas-table tbody th {
            background: #e1bee7;
            color: #6a1b9a;
            font-weight: bold;
            text-align: left;
            padding-left: 8px;
            font-size: 8px;
        }

        /* Árbol Numerológico */
        .arbol-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 10px;
        }
        .arbol-row {
            display: table-row;
        }
        .arbol-cell {
            display: table-cell;
            padding: 3px;
            text-align: center;
        }
        .arbol-node {
            display: inline-block;
            min-width: 35px;
            padding: 5px;
            border: 1.5px solid #333;
            background: white;
            font-size: 9px;
        }
        .arbol-node.base {
            background: #e1bee7;
            border-color: #6a1b9a;
            border-width: 2px;
            font-weight: bold;
        }
        .arbol-label {
            font-size: 7px;
            color: #666;
            margin-top: 2px;
            display: none; /* Ocultar letras */
        }

        /* Footer */
        .footer {
            margin-top: 20px;
            padding-top: 10px;
            border-top: 2px solid #6a1b9a;
            text-align: center;
            font-size: 8px;
            color: #666;
        }

        /* Page break */
        .page-break {
            page-break-after: always;
        }

        /* Árbol SVG render */
        .arbol-svg-container {
            width: 100%;
            height: 700px;
            position: relative;
            margin-top: 20px;
        }
        .arbol-box {
            position: absolute;
            border: 1.5px solid #333;
            background: white;
            padding: 3px 6px;
            text-align: center;
            font-size: 11px;
            font-weight: normal;
            min-width: 30px;
        }
        .arbol-box.base-node {
            background: #e1bee7;
            border: 2px solid #6a1b9a;
            font-weight: bold;
        }
        .arbol-letter {
            font-size: 8px;
            color: #666;
            margin-top: 1px;
        }
        .arbol-line {
            position: absolute;
            height: 1px;
            background: #444;
            transform-origin: left center;
        }
    </style>
</head>
<body>
    <div class="container">

        <!-- HEADER -->
        <div class="header">
            <h1>ANÁLISIS NUMEROLÓGICO</h1>
            <div class="header-info">
                <strong>Nombre:</strong> <?php echo e(strtoupper($name)); ?><br>
                <strong>Fecha de Nacimiento:</strong> <?php echo e(\Carbon\Carbon::parse($birth_date)->format('d/m/Y')); ?><br>
                <strong>Generado:</strong> <?php echo e($generated_at); ?>

            </div>
        </div>

        <!-- SECCIÓN 1: TABLA NUMEROLÓGICA -->
        <div class="section-title">TABLA NUMEROLÓGICA</div>
        <div class="tabla-numerologica">
            <div class="letters-grid">
                <!-- Row 1: Valores vocales -->
                <div class="letters-row">
                    <?php $__currentLoopData = $analysis['all_letters']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="letter-cell <?php echo e($item['is_vowel'] ? 'vowel' : 'empty'); ?>">
                            <?php echo e($item['is_vowel'] ? $item['value'] : ''); ?>

                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
                <!-- Row 2: Letras -->
                <div class="letters-row">
                    <?php $__currentLoopData = $analysis['all_letters']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="letter-cell letter">
                            <?php echo e($item['letter']); ?>

                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
                <!-- Row 3: Valores consonantes -->
                <div class="letters-row">
                    <?php $__currentLoopData = $analysis['all_letters']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="letter-cell <?php echo e(!$item['is_vowel'] ? 'consonant' : 'empty'); ?>">
                            <?php echo e(!$item['is_vowel'] ? $item['value'] : ''); ?>

                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>

            <!-- Totales -->
            <div class="totales-grid">
                <div class="total-row">
                    <div class="total-cell alma">
                        <div class="total-label alma">ALMA</div>
                        <div class="total-number"><?php echo e($analysis['vowel_sum']); ?>/<?php echo e($analysis['vowel_reduced']); ?></div>
                    </div>
                    <div class="total-cell personalidad">
                        <div class="total-label personalidad">PERSONALIDAD</div>
                        <div class="total-number"><?php echo e($analysis['consonant_sum']); ?>/<?php echo e($analysis['consonant_reduced']); ?></div>
                    </div>
                    <div class="total-cell expresion">
                        <div class="total-label expresion">EXPRESIÓN</div>
                        <div class="total-number"><?php echo e($analysis['total_sum']); ?>/<?php echo e($analysis['total_reduced']); ?></div>
                    </div>
                </div>
            </div>
        </div>

        <!-- SECCIÓN 2: CUADRO DE CASAS -->
        <div class="section-title">CUADRO DE NUMEROLOGÍA - CASAS</div>
        <table class="casas-table">
            <thead>
                <tr>
                    <th style="width: 25%;">CASAS</th>
                    <th>1</th>
                    <th>2</th>
                    <th>3</th>
                    <th>4</th>
                    <th>5</th>
                    <th>6</th>
                    <th>7</th>
                    <th>8</th>
                    <th>9</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <th>HABITANTES DE BASE</th>
                    <?php for($i = 1; $i <= 9; $i++): ?>
                        <td><?php echo e($analysis['houses']['habitantes'][$i]); ?></td>
                    <?php endfor; ?>
                </tr>
                <tr>
                    <th>INDUCCIÓN</th>
                    <?php for($i = 1; $i <= 9; $i++): ?>
                        <td></td>
                    <?php endfor; ?>
                </tr>
                <tr>
                    <th>PUENTES</th>
                    <?php for($i = 1; $i <= 9; $i++): ?>
                        <td><?php echo e(abs($analysis['houses']['puentes'][$i])); ?></td>
                    <?php endfor; ?>
                </tr>
                <tr>
                    <th>EVOLUCIÓN</th>
                    <?php for($i = 1; $i <= 9; $i++): ?>
                        <td><?php echo e($analysis['houses']['evolucion'][$i]); ?></td>
                    <?php endfor; ?>
                </tr>
                <tr>
                    <th>INCONSCIENTE</th>
                    <?php for($i = 1; $i <= 9; $i++): ?>
                        <td></td>
                    <?php endfor; ?>
                </tr>
            </tbody>
        </table>

        <!-- Footer Página 1 -->
        <div class="footer">
            <strong>Sistema de Numerología Laravel</strong><br>
            Documento generado automáticamente - <?php echo e($generated_at); ?>

        </div>

    </div>

    <!-- PÁGINA 2: ÁRBOL NUMEROLÓGICO -->
    <div class="page-break"></div>
    <div class="container">
        <div class="section-title">ÁRBOL NUMEROLÓGICO</div>

        <?php if($arbol_image): ?>
            <div style="text-align: center; margin-top: 30px;">
                <img src="<?php echo e($arbol_image); ?>" style="max-width: 100%; height: auto;" alt="Árbol Numerológico">
            </div>
        <?php else: ?>
            <div style="margin-top: 10px;">
                <table style="width: 100%; border-collapse: collapse;">
                    <tr>
                        <td colspan="7" style="text-align: center; padding: 5px;">
                            <div class="arbol-node"><?php echo e($arbol_values['H'] ?? ''); ?></div>
                            <div class="arbol-label">H</div>
                        </td>
                    </tr>
                <tr>
                    <td style="width: 14%; text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['V'] ?? ''); ?></div>
                        <div class="arbol-label">V</div>
                    </td>
                    <td style="width: 14%;"></td>
                    <td style="width: 14%; text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['G'] ?? ''); ?></div>
                        <div class="arbol-label">G</div>
                    </td>
                    <td style="width: 14%;"></td>
                    <td style="width: 14%;"></td>
                    <td style="width: 14%;"></td>
                    <td style="width: 14%; text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['U'] ?? ''); ?></div>
                        <div class="arbol-label">U</div>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['E'] ?? ''); ?></div>
                        <div class="arbol-label">E</div>
                    </td>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['I'] ?? ''); ?></div>
                        <div class="arbol-label">I</div>
                    </td>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['F'] ?? ''); ?></div>
                        <div class="arbol-label">F</div>
                    </td>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['J'] ?? ''); ?></div>
                        <div class="arbol-label">J</div>
                    </td>
                    <td></td>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['T'] ?? ''); ?></div>
                        <div class="arbol-label">T</div>
                    </td>
                </tr>
                <tr style="background: #f5f5f5;">
                    <td style="text-align: center; padding: 8px;">
                        <div class="arbol-node base"><?php echo e($arbol_values['A'] ?? ''); ?></div>
                        <div class="arbol-label">A</div>
                    </td>
                    <td colspan="2"></td>
                    <td style="text-align: center; padding: 8px;">
                        <div class="arbol-node base"><?php echo e($arbol_values['B'] ?? ''); ?></div>
                        <div class="arbol-label">B</div>
                    </td>
                    <td style="text-align: center; padding: 8px;">
                        <div class="arbol-node base"><?php echo e($arbol_values['C'] ?? ''); ?></div>
                        <div class="arbol-label">C</div>
                    </td>
                    <td></td>
                    <td style="text-align: center; padding: 8px;">
                        <div class="arbol-node base"><?php echo e($arbol_values['D'] ?? ''); ?></div>
                        <div class="arbol-label">D</div>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['K'] ?? ''); ?></div>
                        <div class="arbol-label">K</div>
                    </td>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['O'] ?? ''); ?></div>
                        <div class="arbol-label">O</div>
                    </td>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['L'] ?? ''); ?></div>
                        <div class="arbol-label">L</div>
                    </td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['W'] ?? ''); ?></div>
                        <div class="arbol-label">W</div>
                    </td>
                    <td></td>
                    <td colspan="2" style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['M'] ?? ''); ?></div>
                        <div class="arbol-label">M</div>
                    </td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['P'] ?? ''); ?></div>
                        <div class="arbol-label">P</div>
                    </td>
                    <td></td>
                    <td colspan="2" style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['N'] ?? ''); ?></div>
                        <div class="arbol-label">N</div>
                    </td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['Q'] ?? ''); ?></div>
                        <div class="arbol-label">Q</div>
                    </td>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['R'] ?? ''); ?></div>
                        <div class="arbol-label">R</div>
                    </td>
                    <td style="text-align: center; padding: 5px;">
                        <div class="arbol-node"><?php echo e($arbol_values['S'] ?? ''); ?></div>
                        <div class="arbol-label">S</div>
                    </td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                </table>
            </div>
        <?php endif; ?>

        <!-- Footer Página 2 -->
        <div class="footer">
            <strong>Sistema de Numerología Laravel</strong><br>
            Documento generado automáticamente - <?php echo e($generated_at); ?>

        </div>

    </div>
</body>
</html>
<?php /**PATH C:\xampp\htdocs\numerologia\resources\views/numerology/pdf.blade.php ENDPATH**/ ?>