<!-- tabla-contenedora -->
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="center" style="width: 100%; max-width: 100%; ">
    <tr>

        <td align="left" valign="top" style="padding-bottom: 16px;" bgcolor="#FAF9F9">

            <!-- contenida-tabla -->

            <?php if ($compra['precios'] != '') {
            ?>

                <!-- sm-title -->
                <table border="0" width="100%" cellpadding="0" cellspacing="0" align="center" style="width: 100%; max-width: 100%;">
                    <tr>
                        <td class="sm-title" valign="top" align="left" style="font-family:'Montserrat', serif !important; text-transform:uppercase; line-height: 24px; font-style: normal;  font-weight: 500; font-size: 18px; letter-spacing: 0.03em; color: #353535; padding: 0 8px 8px;border-bottom: 1px dashed #dddddd;">

                        Ton cadeau

                        </td>
                    </tr>
                </table>
                <!-- sm-title -->

                <!-- space -->
                <table border="0" width="100%" align="center" cellpadding="0" cellspacing="0" style="width:100%;max-width:100%;">
                    <tr>
                        <td valign="middle" align="center" height="16" style="font-size: 16px; line-height: 16px;">&nbsp;</td>
                    </tr>
                </table>
                <!-- space -->


                <table style="width:100%; max-width:100%;" width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
                    <tbody>
                        <tr>
                            <td class="title desplazar-derecha" valign="middle" align="left" style="padding: 0 20px;">

                                <table style="width:100%; max-width:100%;" width="100%" cellspacing="0" cellpadding="0" border="0" align="center">

                                    <tr style="font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 500; line-height: 20px; font-style: normal; color: #473d37; text-decoration: none; letter-spacing: 1px;">
                                        <th style="font-weight: 500; text-transform: uppercase; padding-bottom: 4px;" align="left">UNITÉS</th>
                                        <th style="font-weight: 500; text-transform: uppercase; padding-bottom: 4px;" align="left">FRAIS</th>
                                        <th style="font-weight: 500; text-transform: uppercase; padding-bottom: 4px;" align="right">PRIX</th>
                                    </tr>

                                    <?php foreach ($compra['precios'] as $key => $value) : ?>

                                        <tr style="font-family: 'Inter', sans-serif; font-size: 12px; line-height: 20px; color: #333; text-decoration: none; letter-spacing: 0.03em; padding-top: 10px;">

                                            <td>
                                                <?php echo $compra['unidades_tarifa'][$key]; ?>
                                            </td>

                                            <td>
                                                <?php echo $compra['tarifas_nombre'][$key]; ?>
                                            </td>

                                            <td align="right">
                                                <?php
                                                if (!is_string($value)) {
                                                    $value_format = number_format($value, 2);
                                                    echo $value_format . ' €';
                                                } else {
                                                    echo $value;
                                                }
                                                ?>
                                            </td>

                                        </tr>

                                    <?php endforeach; ?>

                                    <?php foreach ($compra['extras_seleccionados'] as $extra) : ?>
                                        <tr style="font-family: 'Inter', sans-serif; font-size: 12px; line-height: 20px; color: #333; text-decoration: none; letter-spacing: 0.03em; padding-top: 10px;">
                                            <td><?php echo $extra['cantidad']; ?></td>
                                            <td><?php echo $extra['nombre']; ?></td>
                                            <td align="right"><?php echo $extra['precio'] . ' €'; ?></td>
                                        </tr>
                                    <?php endforeach; ?>

                                    <?php if ($compra['cupon'] != '') { ?>
                                        <tr style="font-family: 'Inter', sans-serif; font-size: 12px; line-height: 20px; color: #333; text-decoration: none; letter-spacing: 0.03em; padding-top: 10px;">
                                            <td>1</td>
                                            <td><?php echo "Coupon: " . $compra['cupon']['codigo']; ?></td>
                                            <?php
                                            if ($compra['cupon']['porcentual'] == 1) {
                                                $simbolo = "%";
                                            } else {
                                                $simbolo = "€";
                                            }
                                            ?>
                                            <td style="text-align:right;"><?php echo "- " . $compra['cupon']['cantidad'] . ' ' . $simbolo; ?></td>
                                        </tr>
                                    <?php } ?>

                                    <?php if ($compra['descuento_coste_realizado'] != '') { ?>
                                        <tr style="">
                                            <td></td>
                                            <td></td>
                                            <td></td>
                                        </tr>
                                        <tr style="font-family: 'Inter', sans-serif; font-size: 12px; line-height: 20px; color: #333; text-decoration: none; letter-spacing: 0.03em; padding-top: 10px;">
                                            <td></td>
                                            <td><strong><?php echo $compra['tipo_aplicado']; ?></strong></td>
                                            <td align="right"><?php echo $compra['descuento_coste_realizado'] . ' €'; ?></td>
                                        </tr>
                                    <?php } ?>

                                    <tr height="40px">

                                        <td colspan="2" style="font-size: 18px; font-family: 'Inter', sans-serif; font-weight: 600; text-align: left; color: #111111; letter-spacing: 1px; padding-top: 10px;">Total</td>

                                        <?php if ($compra['descuento_coste'] != '') { ?>
                                            <td>
                                                <strong><?php echo $compra['descuento_coste']; ?></strong>
                                            </td>
                                        <?php } elseif ($compra['pago_parcial'] != '') { ?>
                                            <td><strong>Paiement partiel <?php echo $compra['pago_parcial']; ?></strong>
                                            </td>
                                        <?php } ?>
                                        <td style="font-size: 18px; font-family: 'Inter', sans-serif; font-weight: 600; text-align: right; color: #111111; letter-spacing: 1px; padding-top: 10px;">

                                            <?php
                                            if (!is_string($compra['total'])) {
                                                $compra_total = number_format($compra['total'], 2);
                                                echo $compra_total . ' €';
                                            } else {
                                                echo $compra['total'];
                                            }
                                            ?>

                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </tbody>
                </table>
            <?php } ?>

            <!-- fin-contenida-tabla -->
        </td>
    </tr>
</table>