<?php
if (session_status() == PHP_SESSION_NONE) {
    session_start();
}
?>

<!DOCTYPE html>
<html lang="es">
<head>
  <meta charset="UTF-8">
  <title>Login</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Bootstrap (si no está incluido ya) -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">

  <style>
    html, body {
      height: 100%;
      margin: 0;
      background-color: #111; /* Fondo oscuro */
      font-family: Arial, sans-serif;
    }

    #back {
      position: fixed;
      top: 0;
      left: 0;
      height: 100%;
      width: 100%;
      background: #111;
      z-index: -1;
    }

    .login-box {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 360px;
      z-index: 2;
      background: #fff;
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 0 20px rgba(0,0,0,0.5);
    }

    .login-logo img {
      width: 100%;
      height: auto;
    }

    .login-box-body {
      margin-top: 10px;
    }

    .login-box-msg {
      text-align: center;
      font-weight: bold;
      margin-bottom: 20px;
    }

    .form-control-feedback {
      right: 10px;
    }

    .btn-flat {
      border-radius: 4px;
    }

    .mensaje-error {
      color: red;
      margin-top: 10px;
      text-align: center;
    }
  </style>
</head>

<body>

<!-- Fondo -->
<div id="back"></div>

<!-- Caja de login centrada -->
<div class="login-box">
  
  <div class="login-logo">
    <img src="vistas/img/plantilla/logo-blanco-bloque.png" class="img-responsive" alt="Logo">
  </div>

  <div class="login-box-body">
    <p class="login-box-msg">Ingresar al sistema</p>

    <form method="post">

      <div class="form-group has-feedback">
        <input type="text" class="form-control" placeholder="Usuario" name="ingUsuario" required>
        <span class="glyphicon glyphicon-user form-control-feedback"></span>
      </div>

      <div class="form-group has-feedback">
        <input type="password" class="form-control" placeholder="Contraseña" name="ingPassword" required>
        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
      </div>

      <!-- Empresa (comentado) -->
      <!--<div class="form-group has-feedback">
        <select class="form-control input-lg" id="nuevaCategoria" name="nuevaCategoria" required>
          <option value="">Seleccionar empresa</option>
          <?php
          /*
          $item = null;
          $valor = null;
          $empresas = ControladorEmpresas::ctrMostrarEmpresas($item, $valor);
          foreach ($empresas as $key => $value) {
            echo '<option value="'.$value["id_empresa"].'">'.$value["empresa"].'</option>';
          }
          */
          ?>
        </select>
      </div>-->

      <div class="row">
        <div class="col-xs-12">
          <button type="submit" class="btn btn-primary btn-block btn-flat">Ingresar</button>
        </div>
      </div>

      <?php
        $login = new ControladorUsuarios();
        $login->ctrIngresoUsuario();
      ?>

    </form>

  </div>

</div>

</body>
</html>
