<?php
    /*-------------------------
    Autor: Autor Dev
    Web: www.google.com
    E-Mail: waptoing7@gmail.com
    ---------------------------*/
    // session_start();
    include "admin/config/config.php";
    if (isset($_SESSION['user_id']) AND $_SESSION['user_id'] != 0) {
        header("location: ?view=tickets");
        // header("location: tickets.php");
        exit;
    }else if(isset($_SESSION['admin_id']) AND $_SESSION['admin_id'] != 0){
        // header("location: admin/dashboard.php");
        header("location: admin/?view=dashboard");
    }
    $config = mysqli_query($con, "select * from configuration where name='website' ");
    $row01=mysqli_fetch_array($config);
    $website=$row01['val'];

    $fav = mysqli_query($con, "select * from configuration where name='favicon' ");
    $row02=mysqli_fetch_array($fav);
    $favicon=$row02['val'];

?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?php echo $website ?> | Restablecer contraseña</title>
    <!-- favicon -->
    <link rel="shortcut icon" href="admin/images/<?php echo $favicon ?>" />
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="admin/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="admin/bootstrap/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="admin/https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="admin/dist/css/AdminLTE.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="admin/plugins/iCheck/square/blue.css">

    <style>
        @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

        body.login-page {
            font-family: 'Outfit', sans-serif !important;
            background: url('images/fondoserin.jpeg') no-repeat center center !important;
            background-size: cover !important;
            background-color: #0b1329 !important;
            display: flex !important;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            margin: 0;
            padding: 0;
            position: relative;
        }
        
        /* Backdrop overlay for readability */
        body.login-page::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(15, 23, 42, 0.6) !important; /* Translucent elegant overlay */
            backdrop-filter: blur(8px) !important; /* Soft blur to clear visual noise */
            -webkit-backdrop-filter: blur(8px) !important;
            z-index: 0;
        }

        .login-box {
            width: 100%;
            max-width: 440px;
            margin: 0 !important;
            padding: 20px;
            position: relative;
            z-index: 10;
        }

        .login-box-body {
            background: rgba(255, 255, 255, 0.96) !important;
            border-radius: 20px !important;
            border: 1px solid rgba(255, 255, 255, 0.8) !important;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35) !important;
            padding: 40px 35px 35px 35px !important;
            color: #334155 !important;
            transition: all 0.3s ease;
        }

        .login-logo-container {
            text-align: center;
            margin-bottom: 25px;
            margin-top: -20px;
        }

        .login-logo-container img {
            max-height: 110px;
            width: auto;
            object-fit: contain;
            filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.03));
            transition: transform 0.3s ease;
        }

        .login-logo-container img:hover {
            transform: scale(1.02);
        }

        .login-header {
            text-align: center;
            margin-bottom: 25px;
        }

        .login-header-icon {
            width: 48px;
            height: 48px;
            background: rgba(2, 82, 197, 0.1);
            color: #0252c5;
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            margin-bottom: 12px;
        }

        .login-header h2 {
            font-family: 'Outfit', sans-serif !important;
            font-size: 22px;
            font-weight: 700;
            color: #0f172a;
            margin: 0 0 6px 0;
            letter-spacing: -0.5px;
        }

        .login-header p {
            font-family: 'Outfit', sans-serif !important;
            font-size: 14px;
            color: #64748b;
            margin: 0;
        }

        .form-group {
            margin-bottom: 20px !important;
        }

        .form-control {
            font-family: 'Outfit', sans-serif !important;
            height: 48px !important;
            border-radius: 10px !important;
            border: 1.5px solid #cbd5e1 !important;
            background-color: #f8fafc !important;
            box-shadow: none !important;
            padding-left: 16px !important;
            padding-right: 40px !important;
            font-size: 15px !important;
            color: #1e293b !important;
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
        }

        .form-control:focus {
            border-color: #0252c5 !important;
            background-color: #ffffff !important;
            box-shadow: 0 0 0 4px rgba(2, 82, 197, 0.15) !important;
            outline: none !important;
        }

        .form-control::placeholder {
            color: #94a3b8 !important;
            opacity: 1 !important;
        }

        .has-feedback .form-control-feedback {
            line-height: 48px !important;
            height: 48px !important;
            color: #94a3b8 !important;
            right: 12px !important;
            font-size: 16px !important;
            transition: color 0.25s ease !important;
            pointer-events: none;
        }

        .form-control:focus ~ .form-control-feedback {
            color: #0252c5 !important;
        }

        /* Links styling */
        .login-links-container {
            display: flex !important;
            justify-content: center !important;
            align-items: center !important;
            margin-top: 15px !important;
            margin-bottom: 0px !important;
            font-size: 14px !important;
        }

        .login-links-container a {
            font-family: 'Outfit', sans-serif !important;
            color: #64748b !important;
            font-weight: 500 !important;
            text-decoration: none !important;
            transition: all 0.2s ease !important;
            position: relative !important;
            padding: 2px 0 !important;
        }

        .login-links-container a::after {
            content: '' !important;
            position: absolute !important;
            width: 100% !important;
            transform: scaleX(0) !important;
            height: 1.5px !important;
            bottom: 0 !important;
            left: 0 !important;
            background-color: #0252c5 !important;
            transform-origin: bottom right !important;
            transition: transform 0.25s ease-out !important;
        }

        .login-links-container a:hover {
            color: #0252c5 !important;
        }

        .login-links-container a:hover::after {
            transform: scaleX(1) !important;
            transform-origin: bottom left !important;
        }

        /* Button Styling */
        .btn-login {
            font-family: 'Outfit', sans-serif !important;
            width: 100% !important;
            height: 48px !important;
            background: linear-gradient(135deg, #0252c5 0%, #013580 100%) !important;
            color: #ffffff !important;
            border: none !important;
            border-radius: 10px !important;
            font-size: 16px !important;
            font-weight: 600 !important;
            letter-spacing: 0.5px !important;
            cursor: pointer !important;
            box-shadow: 0 4px 12px rgba(2, 82, 197, 0.3) !important;
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            gap: 8px !important;
        }

        .btn-login:hover {
            background: linear-gradient(135deg, #0261e8 0%, #0247ad 100%) !important;
            box-shadow: 0 6px 20px rgba(2, 82, 197, 0.45) !important;
            transform: translateY(-1px) !important;
        }

        .btn-login:active {
            transform: translateY(1px) scale(0.98) !important;
            box-shadow: 0 2px 8px rgba(2, 82, 197, 0.2) !important;
        }

        .btn-login:focus {
            outline: none !important;
            box-shadow: 0 0 0 4px rgba(2, 82, 197, 0.35) !important;
        }

        /* Alert Styling */
        .alert {
            border-radius: 10px !important;
            border: none !important;
            padding: 15px 20px !important;
            font-size: 14px !important;
            margin-bottom: 20px !important;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
        }

        .alert-danger {
            background-color: #fef2f2 !important;
            color: #991b1b !important;
            border-left: 4px solid #ef4444 !important;
        }

        .alert-danger .close {
            color: #991b1b !important;
            opacity: 0.5 !important;
        }

        .alert-danger .close:hover {
            opacity: 1 !important;
        }
    </style>
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-box-body">
        <div class="login-logo-container">
            <img src="assets/img/serintsa.png" alt="Logo">
            <b style="display: none;"><?php echo $website ?></b>
        </div>
        <?php if(isset($_SESSION['data'])){ ?>
            <div class="alert alert-<?php echo $_SESSION['data']['alert']; ?> fade in">
                <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                <strong><?php echo $_SESSION['data']['notice']; ?></strong> 
                <br><?php echo $_SESSION['data']['msg']; ?>
            </div>
        <?php 
                unset($_SESSION['data']);//elimino la variable de sesion
            } 
        ?>            
        <div class="login-header">
            <div class="login-header-icon">
                <i class="fa fa-lock"></i>
            </div>
            <h2>Restablecer Contraseña</h2>
            <p>Ingresa tu correo para recibir instrucciones</p>
        </div>
        <form action="action/reset_password.php" method="post">
            <div class="form-group has-feedback">
                <input type="email" class="form-control" name="email" placeholder="Correo Electrónico" required />
                <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
            </div>

            <button type="submit" name="token" value="Restablecer" class="btn-login">
                Restablecer Contraseña <i class="fa fa-refresh"></i>
            </button>
        </form>

        <div class="login-links-container">
            <a href="./">Iniciar Sesión</a>
        </div>
    </div><!-- /.login-box-body -->
</div><!-- /.login-box -->

<!-- jQuery 2.2.3 -->
<script src="admin/plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="admin/bootstrap/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="admin/plugins/iCheck/icheck.min.js"></script>
<script>
    $(function () {
        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });
    });
</script>
</body>
</html>
