<!DOCTYPE html>
<html lang="es">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>U-site</title>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
    <script src="https://cdn.tailwindcss.com"></script>
    <!-- Cargar jQuery primero -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <!-- Luego cargar Select2 -->
    <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
    <style>
        [x-cloak] {
            display: none !important;
        }
    </style>
</head>

<body class="bg-gray-200 w-full">
    <main class="flex justify-between w-full">
        <div class="w-full px-3 py-3 h-[calc(100vh-64px)] overflow-auto">
            {{embed}}
        </div>
    </main>
    <div x-data="sessionTimeout" x-init="init()" x-cloak class="hidden sm:block">
        <!-- Contador General de Inactividad  -->
        <div x-show="!showModal" class="fixed top-2 right-20 border text rounded-lg p-2 bg-gray-100 text-sm">
            <p>Tiempo restante: <span x-text="formatTime(inactivityCountdown)"></span></p>
        </div>
        <!-- Modal -->
        <div x-show="showModal" class="fixed inset-0 flex items-center justify-center bg-gray-800 bg-opacity-75">
            <div class="bg-white rounded-lg shadow-md p-8 w-[600px] relative">
                <h2 class="text-xl font-bold mb-6 text-center">¿Deseas continuar?</h2>
                <p class="text-gray-600 mb-6 text-center text-base">
                    Has estado inactivo. Elige "Continuar" para seguir con tu sesión o "Cerrar sesión" para salir.
                </p>
                <!-- Contador del tiempo para responder -->
                <p class="text-center text-red-500 font-semibold mb-4">
                    Tiempo para responder: <span x-text="countdown"></span> seg
                </p>
                <div class="flex justify-around">
                    <button @click="continueSession"
                        class="px-6 py-3 bg-[#8eb02f]  text-white text-base rounded-lg hover:bg-[#698126]">
                        Continuar
                    </button>
                    <form action="/do/logout" method="POST" class="inline-block">
                        <button type="submit"
                            class="px-6 py-3 bg-gray-500 text-white text-base rounded-lg hover:bg-gray-600">
                            Cerrar sesión
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>



</body>

</html>