<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>密码帮助 - Amrita Dashboard</title>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <style>
      :root {
        --primary-color: #3498db;
        --secondary-color: #2980b9;
        --accent-color: #1abc9c;

        --bg-color: #f8f9fa;
        --text-color: #333;
        --text-light: #fff;
        --card-bg: #ffffff;
        --border-color: #e0d6ff;
        --input-bg: rgba(255, 255, 255, 0.8);

        --dark-bg-color: #1a1a1a;
        --dark-text-color: #f0f0f0;
        --dark-card-bg: #252525;
        --dark-border-color: #444;
        --dark-input-bg: rgba(37, 37, 37, 0.8);
        --dark-code-bg: #1e1e1e;
      }

      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
      }

      body {
        background: linear-gradient(-45deg, #ff9a9e, #fad0c4, #fbc2eb, #a6c1ee);
        background-size: 400% 400%;
        min-height: 100vh;
        animation: gradientBG 15s ease infinite;
        padding: 20px;
      }

      body.dark-mode {
        background: linear-gradient(-45deg, #2c1a2c, #2a1f2a, #251a25, #1a1a2c);
        background-size: 400% 400%;
      }

      @keyframes gradientBG {
        0% {
          background-position: 0% 50%;
        }
        50% {
          background-position: 100% 50%;
        }
        100% {
          background-position: 0% 50%;
        }
      }

      .help-container {
        background-color: rgba(255, 255, 255, 0.9);
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(164, 93, 181, 0.3);
        max-width: 800px;
        margin: 20px auto;
        padding: 30px;
        backdrop-filter: blur(5px);
        border: 1px solid rgba(255, 255, 255, 0.5);
      }

      body.dark-mode .help-container {
        background-color: rgba(37, 37, 37, 0.9);
        box-shadow: 0 10px 30px rgba(100, 50, 120, 0.3);
        border: 1px solid rgba(100, 100, 100, 0.5);
      }

      .logo-section {
        text-align: center;
        margin-bottom: 30px;
      }

      .logo-circle {
        width: 60px;
        height: 60px;
        background: linear-gradient(135deg, #ff7eb3, #ff758c);
        color: white;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 0 auto 15px;
        font-size: 24px;
        font-weight: bold;
        box-shadow: 0 5px 15px rgba(255, 117, 140, 0.4);
        position: relative;
        overflow: hidden;
      }

      body.dark-mode .logo-circle {
        background: linear-gradient(135deg, #8a2be2, #ba55d3);
      }

      h1 {
        color: #6a40bf;
        font-size: 24px;
        font-weight: 700;
        margin-bottom: 5px;
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
      }

      body.dark-mode h1 {
        color: #ba55d3;
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
      }

      .subtitle {
        color: #888;
        font-size: 14px;
        margin-bottom: 20px;
      }

      body.dark-mode .subtitle {
        color: #aaa;
      }

      .content-section {
        margin-bottom: 20px;
      }

      .content-title {
        color: #6a40bf;
        font-size: 18px;
        font-weight: 600;
        margin-bottom: 10px;
      }

      body.dark-mode .content-title {
        color: #ba55d3;
      }

      .content-text {
        color: #555;
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 10px;
      }

      body.dark-mode .content-text {
        color: #ccc;
      }

      .code-block {
        background: #f5f5f5;
        border-radius: 8px;
        padding: 10px;
        font-family: "Courier New", monospace;
        font-size: 12px;
        margin: 10px 0;
        overflow-x: auto;
      }

      body.dark-mode .code-block {
        background: #1e1e1e;
        color: #f0f0f0;
      }

      .link-button {
        display: inline-block;
        background: linear-gradient(to right, #9f78ff, #6a40bf);
        color: white;
        text-decoration: none;
        padding: 10px 15px;
        border-radius: 8px;
        font-weight: 600;
        transition: all 0.3s ease;
        border: none;
        cursor: pointer;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
        font-size: 14px;
      }

      body.dark-mode .link-button {
        background: linear-gradient(to right, #ba55d3, #8a2be2);
      }

      .link-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 15px rgba(159, 120, 255, 0.5);
      }

      body.dark-mode .link-button:hover {
        box-shadow: 0 6px 15px rgba(186, 85, 211, 0.5);
      }

      .back-button {
        display: block;
        background: #f0f0f0;
        color: #6a40bf;
        text-decoration: none;
        padding: 10px 15px;
        border-radius: 8px;
        font-weight: 600;
        transition: all 0.3s ease;
        border: 1px solid #ddd;
        cursor: pointer;
        text-align: center;
        margin-top: 10px;
        font-size: 14px;
      }

      body.dark-mode .back-button {
        background: #333;
        color: #ba55d3;
        border: 1px solid #444;
      }

      .back-button:hover {
        background: #e0e0e0;
        transform: translateY(-2px);
      }

      body.dark-mode .back-button:hover {
        background: #444;
      }

      .footer {
        text-align: center;
        margin-top: 30px;
        color: #aaa;
        font-size: 13px;
      }

      body.dark-mode .footer {
        color: #888;
      }

      @media (max-width: 480px) {
        .help-container {
          padding: 20px;
          margin: 10px;
        }

        .logo-circle {
          width: 50px;
          height: 50px;
          font-size: 20px;
        }

        h1 {
          font-size: 20px;
        }

        .content-text {
          font-size: 13px;
        }

        .content-title {
          font-size: 16px;
        }

        .code-block {
          font-size: 11px;
          padding: 8px;
        }
      }
    </style>
  </head>
  <body>
    <div class="help-container">
      <div class="logo-section">
        <div class="logo-circle">?</div>
        <h1>密码帮助</h1>
        <div class="subtitle">如何设置您的登录凭据</div>
      </div>
      <div class="content-section">
        <h2 class="content-title">账号密码设置说明</h2>
        <p class="content-text">
          Amrita Dashboard 的登录凭据需要通过环境变量或 dotenv 文件进行配置。
          这种方式可以确保您的敏感信息不会被意外提交到代码仓库中。
        </p>
        <h3 class="content-title">方法一：使用 .env 文件</h3>
        <p class="content-text">
          在项目根目录创建一个名为 <code>.env</code> 的文件，并添加以下内容：
        </p>
        <div class="code-block">
          # Amrita Dashboard 登录凭据
          <br />
          WEBUI_USERNAME=your_username
          <br />
          WEBUI_PASSWORD=your_password
        </div>
        <h3 class="content-title">方法二：使用环境变量</h3>
        <p class="content-text">您也可以直接设置环境变量：</p>
        <div class="code-block">
          # Linux/macOS
          <br />
          export WEBUI_USERNAME=your_username
          <br />
          export WEBUI_PASSWORD=your_password
          <br />
          <br />
          # Windows (CMD)
          <br />
          set WEBUI_USERNAME=your_username
          <br />
          set WEBUI_PASSWORD=your_password
          <br />
          <br />
          # Windows (PowerShell)
          <br />
          $env:WEBUI_USERNAME="your_username"
          <br />
          $env:WEBUI_PASSWORD="your_password"
        </div>
        <h3 class="content-title">安全建议</h3>
        <p class="content-text">
          1. 密码应至少包含8个字符，建议使用字母、数字和特殊字符的组合
          <br />
          2. 不要在代码中硬编码用户名和密码
          <br />
          3. 定期更换密码以确保安全
          <br />
          4. .env 文件应加入 .gitignore 中，避免被提交到版本控制系统
        </p>
      </div>
      <a
        href="https://amrita.suggar.top/amrita/config.html#env%E5%8F%82%E8%80%83"
        target="_blank"
        class="link-button"
        >查看官方文档</a
      >
      <a href="/" class="back-button">返回登录</a>
      <div class="footer">
        &copy; 2023-2025 Amrita Dashboard. 使用AGPL-3.0许可证。
      </div>
    </div>
    <script>
      document.addEventListener("DOMContentLoaded", function () {
        const helpContainer = document.querySelector(".help-container");
        setTimeout(() => {
          helpContainer.style.opacity = "1";
        }, 100);

        function setTheme(theme) {
          if (theme === "dark") {
            document.body.classList.add("dark-mode");
            localStorage.setItem("theme", "dark");
          } else {
            document.body.classList.remove("dark-mode");
            localStorage.setItem("theme", "light");
          }
        }

        function detectSystemTheme() {
          if (
            window.matchMedia &&
            window.matchMedia("(prefers-color-scheme: dark)").matches
          ) {
            return "dark";
          }
          return "light";
        }

        function initTheme() {
          const savedTheme = localStorage.getItem("theme");

          if (savedTheme) {
            setTheme(savedTheme);
          } else {
            const systemTheme = detectSystemTheme();
            setTheme(systemTheme);
          }

          window
            .matchMedia("(prefers-color-scheme: dark)")
            .addEventListener("change", (e) => {
              if (!localStorage.getItem("theme")) {
                setTheme(e.matches ? "dark" : "light");
              }
            });
        }

        initTheme();
      });
    </script>
  </body>
</html>
