<!DOCTYPE html>
<html lang="zh-TW">
<head>
  <meta charset="UTF-8">
  <meta name="robots" content="noindex, nofollow" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>NasifyTech後台管理系統</title>
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-286HZQTWFH"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
  
    gtag('config', 'G-286HZQTWFH');
  </script>
  <style>
    *, *::before, *::after {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    :root {
      --primary-color: #2c3e50;
      --secondary-color: #34495e;
      --accent-color: #e67e22;
      --accent-color-hover: #d35400;
      --background-color: #ecf0f1;
      --header-height: 70px;
      --transition-speed: 0.3s;
      --font-family-primary: 'Noto Sans TC', sans-serif;
      --font-family-secondary: 'Exo 2', sans-serif;
      --text-color: #2c3e50;
      --input-border: #bdc3c7;
      --button-text-color: #fff;
      --footer-background: #2c3e50;
      --footer-text-color: #bdc3c7;
    }

    body {
      font-family: var(--font-family-primary);
      color: var(--text-color);
      background-color: var(--background-color);
      line-height: 1.6;
      overflow-x: hidden;
    }

    a {
      color: var(--accent-color);
      text-decoration: none;
      transition: color var(--transition-speed) ease;
    }

    a:hover {
      color: var(--accent-color-hover);
    }

    img {
      max-width: 100%;
      height: auto;
      display: block;
      margin: 0 auto;
    }

    header {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      background: #fff;
      padding: 15px 0;
      z-index: 1000;
      transition: box-shadow var(--transition-speed) ease;
      box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    header.scrolled {
      box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }

    .container {
      width: 90%;
      max-width: 1200px;
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
    }

    header h1 {
      font-family: var(--font-family-secondary);
      font-size: 1.8em;
      color: var(--primary-color);
      transition: color var(--transition-speed) ease;
    }

    nav ul {
      list-style: none;
      display: flex;
      gap: 20px;
      align-items: center;
    }
    nav ul li a {
      font-size: 1em;
      font-weight: 600;
      position: relative;
      padding: 5px 0;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    nav ul li a::after {
      content: '';
      position: absolute;
      width: 0%;
      height: 2px;
      background: var(--accent-color);
      left: 0;
      bottom: -2px;
      transition: width var(--transition-speed) ease;
    }
    nav ul li a:hover::after {
      width: 100%;
    }

    .menu-toggle {
      display: none;
      flex-direction: column;
      justify-content: space-between;
      width: 25px;
      height: 20px;
      cursor: pointer;
    }
    .menu-toggle div {
      width: 100%;
      height: 3px;
      background: var(--primary-color);
      border-radius: 1.5px;
      transition: all var(--transition-speed) ease;
    }
    .menu-toggle.active div:nth-child(1) {
      transform: rotate(45deg) translate(5px, 5px);
    }
    .menu-toggle.active div:nth-child(2) {
      opacity: 0;
    }
    .menu-toggle.active div:nth-child(3) {
      transform: rotate(-45deg) translate(5px, -5px);
    }

    section {
      padding: 100px 20px 60px;
      position: relative;
      overflow: hidden;
    }

    .section-title {
      text-align: center;
      margin-bottom: 40px;
    }
    .section-title h2 {
      font-family: var(--font-family-secondary);
      font-size: 2.5em;
      margin-bottom: 10px;
      color: var(--primary-color);
      position: relative;
      display: inline-block;
    }
    .section-title h2::after {
      content: '';
      width: 60px;
      height: 4px;
      background: var(--accent-color);
      display: block;
      margin: 10px auto 0;
      border-radius: 2px;
    }
    .section-title p {
      color: #7f8c8d;
      font-size: 1.1em;
      max-width: 700px;
      margin: 10px auto 0;
      padding: 0 10px;
    }

    footer {
      background: var(--footer-background);
      padding: 30px 20px;
      text-align: center;
      color: var(--footer-text-color);
    }
    footer p {
      margin-bottom: 10px;
      font-size: 1em;
    }
    footer a {
      color: var(--footer-text-color);
      margin: 0 10px;
      font-size: 1em;
      transition: color var(--transition-speed) ease;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }
    footer a:hover {
      color: #fff;
    }

    @media (max-width: 1024px) {
      .menu-toggle {
        display: flex;
      }
      nav ul {
        flex-direction: column;
        align-items: center;
        background: #fff;
        position: absolute;
        top: var(--header-height);
        right: 0;
        width: 220px;
        display: none;
        padding: 20px 0;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        z-index: 999;
      }
      nav ul.active {
        display: flex;
        max-height: calc(100vh - var(--header-height));
        overflow-y: auto;
      }
    }
    @media (max-width: 768px) {
      .section-title h2 {
        font-size: 2em;
      }
      .container {
        flex-direction: column;
        align-items: flex-start;
      }
      nav ul {
        width: 100%;
        right: 0;
        left: 0;
      }
      .login-card, .dashboard-section {
        padding: 20px;
      }
      .dashboard-links {
        grid-template-columns: 1fr;
      }
    }
    @media (max-width: 480px) {
      header h1 {
        font-size: 1.5em;
      }
      .section-title h2 {
        font-size: 1.8em;
      }
      .section-title p {
        font-size: 1em;
      }
      .login-card, .dashboard-section {
        padding: 15px;
      }
      .dashboard-links a {
        padding: 15px;
        font-size: 0.9em;
      }
      .back-button, .signout-btn {
        padding: 10px 20px;
        font-size: 0.9em;
      }
    }

    .back-button {
      display: inline-block;
      padding: 10px 20px;
      background: var(--accent-color);
      color: var(--button-text-color);
      border: none;
      border-radius: 6px;
      cursor: pointer;
      margin: 1em 0;
      font-size: 0.9em;
      transition: background var(--transition-speed) ease;
      text-align: center;
    }
    .back-button:hover {
      background: var(--accent-color-hover);
    }

    .login-section {
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: calc(100vh - var(--header-height));
      padding: 20px;
      text-align: center;
      background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    }
    .login-section.visible {
      display: flex;
    }
    .login-card {
      background: #fff;
      border: 1px solid #ddd;
      border-radius: 12px;
      padding: 40px 30px;
      max-width: 400px;
      width: 100%;
      box-shadow: 0 8px 16px rgba(0,0,0,0.1);
      transition: transform var(--transition-speed) ease;
    }
    .login-card:hover {
      transform: translateY(-5px);
    }
    .login-card h2 {
      font-family: var(--font-family-secondary);
      font-size: 1.8em;
      margin-bottom: 20px;
      color: var(--primary-color);
    }
    .login-card input {
      width: 100%;
      padding: 15px;
      margin-bottom: 20px;
      border: 1px solid var(--input-border);
      border-radius: 6px;
      font-size: 1em;
      transition: border-color var(--transition-speed) ease;
    }
    .login-card input:focus {
      border-color: var(--accent-color);
      outline: none;
      box-shadow: 0 0 5px rgba(230, 126, 34, 0.5);
    }

    .login-card button {
      width: 100%;
      padding: 15px;
      border: none;
      border-radius: 6px;
      font-size: 1em;
      cursor: pointer;
      font-weight: 600;
      background-color: var(--accent-color);
      color: var(--button-text-color);
      transition: background var(--transition-speed) ease, transform var(--transition-speed) ease;
    }
    .login-card button:hover {
      background-color: var(--accent-color-hover);
      transform: scale(1.02);
    }

    .dashboard-section {
      display: none;
      margin-top: var(--header-height);
      padding: 100px 20px 60px;
    }
    .dashboard-section.show {
      display: block;
    }

    .dashboard-links {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 20px;
      max-width: 800px;
      margin: 0 auto;
    }
    .dashboard-links a {
      display: flex;
      align-items: center;
      justify-content: center;
      background: #fff;
      color: var(--primary-color);
      padding: 20px;
      border-radius: 12px;
      transition: background var(--transition-speed) ease, transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
      font-weight: 600;
      box-shadow: 0 4px 6px rgba(0,0,0,0.1);
      text-align: center;
      gap: 10px;
    }
    .dashboard-links a i {
      font-size: 1.5em;
      color: var(--accent-color);
    }
    .dashboard-links a:hover {
      background: var(--accent-color);
      color: #fff;
      transform: translateY(-5px);
      box-shadow: 0 8px 12px rgba(0,0,0,0.2);
    }
    .dashboard-links a:hover i {
      color: #fff;
    }

    .signout-btn {
      background: var(--accent-color);
      margin-top: 40px;
      padding: 15px 30px;
      border: none;
      border-radius: 6px;
      color: var(--button-text-color);
      cursor: pointer;
      font-size: 1em;
      font-weight: 600;
      transition: background var(--transition-speed) ease, transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
      box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    .signout-btn:hover {
      background: var(--accent-color-hover);
      transform: translateY(-3px);
      box-shadow: 0 8px 12px rgba(0,0,0,0.2);
    }

    #loading {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      font-size: 1.5em;
      color: var(--primary-color);
      z-index: 2000;
    }
  </style>
</head>
<body>
  <div id="loading">載入中...</div>

  <header>
    <div class="container">
      <h1>NasifyTech管理系統</h1>
      <div class="menu-toggle" onclick="toggleMenu(this)">
        <div></div>
        <div></div>
        <div></div>
      </div>
      <nav>
        <ul id="navMenu"></ul>
      </nav>
    </div>
  </header>

  <section class="login-section" id="loginSection">
    <div class="login-card">
      <h2>請先登入</h2>
      <input type="email" id="email" placeholder="Email" />
      <input type="password" id="password" placeholder="密碼" />
      <button onclick="handleLogin()">登入</button>
    </div>
  </section>

  <section class="dashboard-section" id="dashboardSection">
    <div class="section-title">
      <h2>歡迎使用管理系統</h2>
      <p>管理您的內容和功能</p>
    </div>
    <div class="dashboard-links">
      <a href="cust.html"><i class="fas fa-user-friends"></i>客戶資料管理系統</a>
      <a href="vocmanage.html"><i class="fas fa-pen"></i>單字測驗管理系統</a>
      <a href="voc.html"><i class="fas fa-pen"></i>單字測驗</a>
      <a href="livetaipeibudget.html"><i class="fas fa-map-marker-alt"></i>留北計畫</a>
      <a href="eat.html"><i class="fas fa-utensils"></i>食物預算及菜單</a>
    </div>
    
    <div style="text-align: center;">
      <button class="signout-btn" onclick="handleSignOut()">登出</button>
    </div>
  </section>

  <footer>
    <p>&copy; 2025 NasifyTech 納啟科技. All rights reserved.</p>
  </footer>

  <script src="https://www.gstatic.com/firebasejs/9.22.0/firebase-app-compat.js"></script>
  <script src="https://www.gstatic.com/firebasejs/9.22.0/firebase-auth-compat.js"></script>
  <script>
    const firebaseConfig = {
      apiKey: "AIzaSyCknahg0vqFDiFYDQM1YkS4Sa6j4Eth7ro",
      authDomain: "nasirsweb.firebaseapp.com",
      databaseURL: "https://nasirsweb-default-rtdb.firebaseio.com",
      projectId: "nasirsweb",
      storageBucket: "nasirsweb.firebasestorage.app",
      appId: "1:472577461049:web:00b9cab35ce7b7401bf6e8",
      measurementId: "G-7HZ5KWXJGP"
    };

    firebase.initializeApp(firebaseConfig);
    const auth = firebase.auth();

    const loginSection = document.getElementById('loginSection');
    const dashboardSection = document.getElementById('dashboardSection');
    const navMenu = document.getElementById("navMenu");
    const loading = document.getElementById('loading');

    firebase.auth().onAuthStateChanged(user => {
      loading.style.display = 'none';

      if (user) {
        loginSection.classList.remove('visible');
        dashboardSection.classList.add('show');
        setupNavMenu(user);
      } else {
        loginSection.classList.add('visible');
        dashboardSection.classList.remove('show');
        navMenu.innerHTML = '';
      }
    });

    function handleLogin() {
      const email = document.getElementById('email').value;
      const password = document.getElementById('password').value;
      firebase.auth().signInWithEmailAndPassword(email, password)
        .catch(error => {
          alert('登入失敗：' + error.message);
        });
    }

    function handleSignOut() {
      firebase.auth().signOut()
        .catch(error => {
          alert('登出失敗：' + error.message);
        });
    }

    function toggleMenu(btn) {
      btn.classList.toggle("active");
      navMenu.classList.toggle("active");
    }

    function setupNavMenu(user) {
      navMenu.innerHTML = `
        <li><a href="#"><i class="fas fa-home"></i>首頁</a></li>
        <li><a href="#"><i class="fas fa-cog"></i>設定</a></li>
        <li><a href="#" onclick="handleSignOut()"><i class="fas fa-sign-out-alt"></i>登出</a></li>
      `;
    }

    window.addEventListener('scroll', () => {
      const header = document.querySelector('header');
      if (window.scrollY > 50) {
        header.classList.add('scrolled');
      } else {
        header.classList.remove('scrolled');
      }
    });
  </script>
</body>
</html>
