<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
   <div class="main-content">
   <div class="container mt-2">
      <div class="row justify-content-center">

         <?php if ($this->session->flashdata('msg')): ?>
            <div class="alert alert-<?= $this->session->flashdata('tipo'); ?> font" role="alert">
                <?= $this->session->flashdata('msg'); ?>
            </div>
        <?php endif; ?>

         <div class="col">
            <div class="card">
               <div class="card-header">
                  <div class="d-flex align-items-center">
                     <h4 class="card-title mt-1"><?php echo $user->nome; ?></h4>
                     &nbsp;&nbsp; <?php if ($user->tipo === 'usuário') { ?>
                                        <span class="badge rounded-pill text-bg-primary">Usuário</span>
                                    <?php } elseif($user->tipo === 'afiliado') { ?>
                                        <span class="badge rounded-pill text-bg-success">Afiliado</span>
                                    <?php } else { ?>
                                        <span class="badge rounded-pill text-bg-danger"><?php echo $user->tipo; ?></span>
                                    <?php } ?>   
                     <div class="d-grid gap-2 d-md-block ms-auto">
                        <button class="btn btn-success" type="button" data-bs-toggle="modal" data-bs-target="#editarSaldoModal"><i class="fa-solid fa-money-bill-trend-up"></i> Saldo</button>   
                        <a class="btn btn-primary" href="<?php echo site_url('usuarios/edit/'.$user->id); ?>"><i class="fa-regular fa-pen-to-square"></i> Editar</a>
                     </div>
                  </div>
               </div>
               <div class="card-body">
                  <div class="row row-cols-1 row-cols-md-4 g-4">
                     <div class="col">
                        <div class="card">
                           <div class="card-body d-flex justify-content-between align-items-center">
                              <div>
                                 <h5 class="card-title">Telefone</h5>
                                 <p class="card-text"><?php echo $user->telefone; ?></p>
                              </div>
                              <span>
                              <i class="fa-solid fa-phone fa-lg"></i>
                              </span>
                           </div>
                        </div>
                     </div>
                     <div class="col">
                        <div class="card">
                           <div class="card-body d-flex justify-content-between align-items-center">
                              <div>
                                 <h5 class="card-title">E-mail</h5>
                                 <p class="card-text"><?php echo $user->email; ?></p>
                              </div>
                              <span>
                              <i class="fa-regular fa-envelope fa-lg"></i>
                              </span>
                           </div>
                        </div>
                     </div>
                     <div class="col">
                        <div class="card">
                           <div class="card-body d-flex justify-content-between align-items-center">
                              <div>
                                 <h5 class="card-title">Documento</h5>
                                 <p class="card-text"><?php echo $user->cpf; ?></p>
                              </div>
                              <span>
                              <i class="fa-regular fa-address-card fa-lg"></i>
                              </span>
                           </div>
                        </div>
                     </div>
                     <div class="col">
                        <div class="card">
                           <div class="card-body d-flex justify-content-between align-items-center">
                              <div>
                                 <h5 class="card-title">Carteira</h5>
                                 <p class="card-text"><?php echo 'R$ ' . number_format($financeiro->saldo, 2); ?></p>
                              </div>
                              <span>
                                 <i class="fa-solid fa-wallet fa-xl"></i>
                              </span>
                           </div>
                        </div>
                     </div>
                  </div>
                    <div class="row justify-content-center mt-2">
                        <div class="container">
                            <a class="btn btn-warning" href="<?php echo site_url('usuarios/historico/'.$user->id); ?>" role="button"><i class="fa-solid fa-clock-rotate-left"></i> Histórico</a>
                            <a class="btn btn-primary" href="<?php echo site_url('usuarios/depositos/'.$user->id); ?>" role="button"><i class="fa-solid fa-money-bill-transfer"></i> Depósitos</a>
                            <a class="btn btn-danger" href="<?php echo site_url('usuarios/saques/'.$user->id); ?>" role="button"><i class="fa-solid fa-sack-dollar"></i> Retiradas</a>
                            <a class="btn btn-info" href="<?php echo site_url('usuarios/metricas/'.$user->id); ?>" role="button"><i class="fa-solid fa-arrow-up-right-dots"></i> Métricas</a>
                            <a class="btn btn-info" href="<?php echo site_url('usuarios/configAfiliado/'.$user->id); ?>" role="button"><i class="fa-solid fa-users-gear"></i> Configurações de Afiliado</a>
                            <button class="btn btn-success" type="button" data-bs-toggle="modal" data-bs-target="#ganhoModal"><i class="fa-solid fa-gamepad"></i> Manipular Jogo</button>
                        </div>
                    </div>
                    