<!DOCTYPE html>
<html lang="zh-Hant">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TTVS後台管理系統</title>
    <link rel="icon" href="https://i.imgur.com/P3EVpnQ.png" type="image/png">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+TC&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.6.3/css/foundation.min.css">
    <link rel="stylesheet" href="css/teacher.css">
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-XELSWLMFDR"></script>
    <style>
        body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: #ffffff;
    margin: 0;
    padding: 20px;
    text-align: center;
    color: #333;
}
header {
    padding: 20px 0;
}
header img {
    width: 120px;
    margin-bottom: 10px;
}
h1 {
    margin: 10px 0;
    font-size: 2em;
    color: #2c3e50;
}
nav {
    margin: 30px 0;
    display: none; 
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
}
.nav-item {
    background-color: #f0f4f8;
    border-radius: 10px;
    width: 130px;
    height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: #333;
    box-shadow: 0 3px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}
.nav-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.15);
}
.nav-item img {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
}
.nav-item span {
    font-size: 14px;
    font-weight: 500;
}
.logout-button {
    background-color: #dc3545; 
    color: white;
    border: none;
    border-radius: 10px;
    width: 130px;
    height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 3px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s;
    font-size: 16px;
    font-weight: 500;
}
.logout-button:hover {
    background-color: #c82333; 
    transform: translateY(-4px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.15);
}
footer {
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #e0e0e0;
    color: #777;
}
footer a {
    color: #007BFF;
    text-decoration: none;
}
footer a:hover {
    text-decoration: underline;
}
.info-practice { background-color: #6a994e; color: #fff; }
.info-exam { background-color: #4da8da; color: #fff; }     
.business-practice { background-color: #ffc30b; color: #fff; } 
.business-exam { background-color: #d9424e; color: #fff; }   
.ict-exam { background-color: #ffeb3b; color: #333; } 
.tech-exam { background-color: #3f51b5; color: #fff; }       
.ec-exam { background-color: #607d8b; color: #fff; }      
@media (max-width: 600px) {
    .nav-item, .logout-button {
        width: 100px;
        height: 100px;
    }
    .nav-item img, .logout-button img {
        width: 30px;
        height: 30px;
    }
    .nav-item span, .logout-button span {
        font-size: 12px;
    }
    .logout-button {
        font-size: 14px;
    }
}
.modal {
    display: none; 
    position: fixed; 
    z-index: 1; 
    padding-top: 100px; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.4); 
}
.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 10px;
}
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}
.login-input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    box-sizing: border-box;
    font-size: 16px;
}
.login-submit {
    width: 100%;
    padding: 10px;
    background-color: #007BFF;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
}
.login-submit:hover {
    background-color: #0056b3;
}
.error-message {
    color: red;
    display: none;
}
    </style>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-XELSWLMFDR');
    </script>
<script src="java/teachersys.js"></script>
<script>document.addEventListener("DOMContentLoaded", function() {
    const allowedEmails = ["it@nasify.org", "lll@mail.ttvs.ntct.edu.tw"];
    const modal = document.getElementById("loginModal");
    const closeBtn = document.getElementById("closeModal");
    const loginForm = document.getElementById("loginForm");
    const errorMessage = document.getElementById("errorMessage");
    const nav = document.querySelector("nav");
    const isLoggedIn = localStorage.getItem("isLoggedIn");
    const userEmail = localStorage.getItem("userEmail");
    if (isLoggedIn && allowedEmails.includes(userEmail)) {
        nav.style.display = "flex";
    } else {
        if (isLoggedIn) {
            localStorage.removeItem("isLoggedIn");
            localStorage.removeItem("userEmail");
            window.location.href = 'ttvsexamsystemtest.html';
        } else {
            modal.style.display = "block";
        }
    }
    closeBtn.onclick = function() {
        modal.style.display = "none";
    }
    window.onclick = function(event) {
        if (event.target == modal) {
            modal.style.display = "none";
        }
    }
    loginForm.addEventListener("submit", function(e) {
        e.preventDefault();
        const email = document.getElementById("email").value.trim();
        if (allowedEmails.includes(email)) {
            localStorage.setItem("isLoggedIn", "true");
            localStorage.setItem("userEmail", email);
            nav.style.display = "flex";
            modal.style.display = "none";
        } else {
            errorMessage.style.display = "block";
            setTimeout(() => {
                window.location.href = 'ttvsexamsystemtest.html';
            }, 5000);
        }
    });
    const logoutBtn = document.getElementById("logoutBtn");
    if (logoutBtn) {
        logoutBtn.addEventListener("click", function() {
            localStorage.removeItem("isLoggedIn");
            localStorage.removeItem("userEmail");
            nav.style.display = "none";
            modal.style.display = "block";
        });
    }
});

function detectDevTools() {
    const threshold = 160;
    const isMobile = /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);

    if (!isMobile) {
        const isDevToolsOpen = window.outerWidth - window.innerWidth > threshold || window.outerHeight - window.innerHeight > threshold;

        if (isDevToolsOpen) {
            window.location.href = 'about:blank';
        }
    }
}

document.addEventListener('keydown', (e) => {
    if (e.key === 'F12') {
        e.preventDefault();
        window.location.href = 'about:blank';
    }
});
document.addEventListener('keydown', (e) => {
    if ((e.ctrlKey || e.metaKey) && e.key === 's') {
        e.preventDefault();
    }
});</script>
<script src="../java/antiDebug.js"></script>
</head>
<body>

<header>
    <img src="https://i.imgur.com/P3EVpnQ.png" alt="TTVS Logo">
    <h1>TTVS後台管理系統</h1>
</header>
<div id="loginModal" class="modal">
    <div class="modal-content">
        <span id="closeModal" class="close">&times;</span>
        <h2>請登入</h2>
        <form id="loginForm">
            <input type="email" id="email" class="login-input" placeholder="輸入您的電子郵件" required>
            <div id="errorMessage" class="error-message">無效的電子郵件，無權限存取。</div>
            <button type="submit" class="login-submit">登入</button>
        </form>
    </div>
</div>
<nav>
    <a href="selfselectedtestsysscore.html" class="nav-item info-practice">
        <img src="https://cdn-icons-png.flaticon.com/512/1087/1087920.png" alt="自選題測驗成績系統" style="width:40px; height:40px;">
        <span>自選題測驗成績系統</span>
    </a>
    <a href="quizscore.html" class="nav-item info-exam">
        <img src="https://cdn-icons-png.flaticon.com/512/1197/1197128.png" alt="段考測驗成績系統" style="width:40px; height:40px;">
        <span>段考測驗成績系統</span>
    </a>
    <button id="logoutBtn" class="logout-button">
        <img src="https://cdn-icons-png.flaticon.com/512/1828/1828479.png" alt="登出圖示" style="width:40px; height:40px; margin-bottom:8px;">
        <span>登出</span>
    </button>
</nav>


<footer>
    <p>國立草屯商工 &copy; 2024-2025 <a href="https://www.nasify.org" target="_blank">NasifyTech納啟科技開發</a></p>
</footer>

</body>
</html> 