<!-- 智能仓储管理系统登录页面 - 深色科技风格 -->

<template>
  <div class="login-page">
    <!-- 超炫酷科技背景系统 -->
    <div class="bg-layer" />
    
    <!-- 霓虹电路板背景 -->
    <div class="circuit-bg">
      <div class="circuit-line circuit-h1" />
      <div class="circuit-line circuit-h2" />
      <div class="circuit-line circuit-v1" />
      <div class="circuit-line circuit-v2" />
      <div class="circuit-node node-1" />
      <div class="circuit-node node-2" />
      <div class="circuit-node node-3" />
      <div class="circuit-node node-4" />
    </div>
    
    <!-- 矩阵雨效果 -->
    <div class="matrix-rain">
      <div class="matrix-column" style="left: 5%; animation-delay: 0s;" />
      <div class="matrix-column" style="left: 15%; animation-delay: 0.5s;" />
      <div class="matrix-column" style="left: 25%; animation-delay: 1s;" />
      <div class="matrix-column" style="left: 35%; animation-delay: 1.5s;" />
      <div class="matrix-column" style="left: 45%; animation-delay: 2s;" />
      <div class="matrix-column" style="left: 55%; animation-delay: 2.5s;" />
      <div class="matrix-column" style="left: 65%; animation-delay: 3s;" />
      <div class="matrix-column" style="left: 75%; animation-delay: 3.5s;" />
      <div class="matrix-column" style="left: 85%; animation-delay: 4s;" />
      <div class="matrix-column" style="left: 95%; animation-delay: 4.5s;" />
    </div>
    
    <!-- 六边形蜂窝背景 -->
    <div class="hexagon-bg">
      <div class="hexagon hex-1" />
      <div class="hexagon hex-2" />
      <div class="hexagon hex-3" />
      <div class="hexagon hex-4" />
      <div class="hexagon hex-5" />
    </div>
    
    <!-- 扫描线效果 -->
    <div class="scan-lines">
      <div class="scan-line scan-1" />
      <div class="scan-line scan-2" />
      <div class="scan-line scan-3" />
    </div>
    
    <!-- 动态渐变背景 -->
    <div class="gradient-bg">
      <div class="gradient-orb gradient-orb-1" />
      <div class="gradient-orb gradient-orb-2" />
      <div class="gradient-orb gradient-orb-3" />
    </div>
    
    <!-- 粒子动画背景 -->
    <div class="particles-bg">
      <div class="particle particle-1" />
      <div class="particle particle-2" />
      <div class="particle particle-3" />
      <div class="particle particle-4" />
      <div class="particle particle-5" />
      <div class="particle particle-6" />
      <div class="particle particle-7" />
      <div class="particle particle-8" />
      <div class="particle particle-9" />
      <div class="particle particle-10" />
    </div>
    
    <!-- 几何线条动画 -->
    <div class="geometric-bg">
      <div class="geometric-line line-1" />
      <div class="geometric-line line-2" />
      <div class="geometric-line line-3" />
      <div class="geometric-dot dot-1" />
      <div class="geometric-dot dot-2" />
      <div class="geometric-dot dot-3" />
      <div class="geometric-dot dot-4" />
    </div>

    <!-- 主内容区域 -->
    <div class="login-content">
      <!-- 左侧信息区 -->
      <div class="login-left">
        <div class="system-info">
          <h1 class="system-title">无人线边库</h1>
          <!-- <p class="system-subtitle">Unmanned Line Side Warehouse</p> -->
          <p class="system-subtitle" />
          <div class="feature-list">
            <div class="feature-item">
              <i class="fas fa-check-circle" />
              <span>高效的库存管理</span>
            </div>
            <div class="feature-item">
              <i class="fas fa-check-circle" />
              <span>智能化物料追踪</span>
            </div>
            <div class="feature-item">
              <i class="fas fa-check-circle" />
              <span>实时数据分析</span>
            </div>
          </div>
        </div>
      </div>

      <!-- 右侧登录表单 -->
      <div class="login-right">
        <div class="login-form-wrapper">
          <div class="form-header">
            <div class="form-icon">
              <i class="fas fa-user-circle" />
            </div>
            <h2 class="form-title">欢迎登录</h2>
            <p class="form-subtitle">请输入您的账号信息</p>
          </div>

          <div class="form-content">
            <!-- 用户名输入框 -->
            <div class="form-item">
              <label class="input-label">用户名</label>
              <div class="input-wrapper">
                <i class="fas fa-user input-icon" />
                <input
                  v-model="username" type="text" placeholder="请输入用户名" class="dark-input"
                  @keyup.enter="handleLogin"
                />
              </div>
            </div>

            <!-- 密码输入框 -->
            <div class="form-item">
              <label class="input-label">密码</label>
              <div class="input-wrapper">
                <i class="fas fa-lock input-icon" />
                <input
                  v-model="password" :type="showPassword ? 'text' : 'password'" placeholder="请输入密码"
                  class="dark-input" @keyup.enter="handleLogin"
                />
                <i
                  :class="showPassword ? 'fas fa-eye-slash' : 'fas fa-eye'" class="password-toggle"
                  @click="showPassword = !showPassword"
                />
              </div>
            </div>

            <!-- 登录按钮 -->
            <button class="login-btn" :disabled="loading" @click="handleLogin">
              {{ loading ? '登录中...' : '登 录' }}
            </button>
            <button class="fingerprint-btn" @click="handleFingerprintLogin">
              <i class="fas fa-fingerprint" />
              指纹登录
            </button>
          </div>
        </div>
      </div>
    </div>

    <!-- Loading -->
    <div v-if="loading" class="loading-overlay">
      <div class="loading-dots">
        <div class="dot" />
        <div class="dot" />
        <div class="dot" />
      </div>
      <span class="loading-text">加载中...</span>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { loginApi, queryRemindTime, queryAwayAbnormalCar } from '../api/login.js';
import { getFormattedDateTime } from '../common/Common.js';
import { showNotify } from 'vant';

// 图片资源
// import bgImg from '../assets/images/bj.png';

const router = useRouter();
const route = useRoute();

// 表单数据
const username = ref('');
const password = ref('');
const loading = ref(false);
const showPassword = ref(false);

// 性能释放相关
const isPageVisible = ref(true);
let visibilityChangeHandler = null;

// 页面可见性变化处理
const handleVisibilityChange = () => {
    isPageVisible.value = !document.hidden;
    const loginPage = document.querySelector('.login-page');
    if (loginPage) {
        if (document.hidden) {
            // 页面不可见时暂停所有动画
            loginPage.style.animationPlayState = 'paused';
            loginPage.querySelectorAll('*').forEach(el => {
                el.style.animationPlayState = 'paused';
            });
        } else {
            // 页面可见时恢复动画
            loginPage.style.animationPlayState = 'running';
            loginPage.querySelectorAll('*').forEach(el => {
                el.style.animationPlayState = 'running';
            });
        }
    }
};

onMounted(() => {
    // 添加页面可见性监听器
    visibilityChangeHandler = handleVisibilityChange;
    document.addEventListener('visibilitychange', visibilityChangeHandler);
    
    // 检查URL参数中是否包含isOut=true，如果有则存储到localStorage
    // const isOutParam = route.query.isOut;
    // if (isOutParam !== undefined) {
    //     const isOutValue = String(isOutParam) === 'true' ? 'true' : 'false';
    //     if (isOutValue == 'true') {
    //         localStorage.setItem('isOut', isOutValue);
    //     } else {
    //         localStorage.setItem('isOut', isOutValue);
    //     }
    // } else {
    //     localStorage.setItem('isOut', 'false');
    // }
});

// 登录处理函数
const handleLogin = async () => {
    if (!username.value || !password.value) {
    // message.error('请输入完整的登录信息');
        showNotify({ type: 'danger', message: '请输入完整的登录信息' });
        return;
    }

    loading.value = true;
    try {
        const params = {
            username: username.value,
            password: password.value,
            accountDateTime: getFormattedDateTime(),
            languageId: 'zh-CN',
        };
        const formData = new FormData();
        formData.append('userName', params.username);
        formData.append('password', params.password);
        formData.append('accountDateTime', params.accountDateTime);
        formData.append('languageId', params.languageId);
        const res = await loginApi(formData);
        if (res.errorCode === 0) {
            if (res.data) {
                localStorage.setItem('#token', res.data.token);
                localStorage.setItem('#accountId', res.data.accountId);
                localStorage.setItem('#LoginInfo', JSON.stringify(res.data));
            }
            // message.success('欢迎登录，' + res.data.userName);
            showNotify({ type: 'success', message: '欢迎登录，' + res.data.userName });
            const redirectUrl = window.location.href.split('redirectUrl=')[1];

            if (redirectUrl) {
                window.location = decodeURIComponent(redirectUrl);
            } else {
                router.push('/home');
            }
            // checkPasswordReminder();
            checkAwayAbnormalCar();
        } else {
            showNotify({ type: 'danger', message: res.errorMessage });
        }
    } catch (error) {
        showNotify({ type: 'danger', message: '登录API调用失败' });
    } finally {
        loading.value = false;
    }
};

const checkPasswordReminder = async () => {
    try {
        const res = await queryRemindTime();
        if (res.errorCode === 0) {
            if (res.data === true) {
                setTimeout(() => {
                    showNotify({ type: 'danger', message: res.errorMessage });
                }, 4000);
            }
        } else {
            showNotify({ type: 'danger', message: res.errorMessage });
        }
    } catch (error) {
        console.error('提示修改密码Api调用失败', error);
        showNotify({ type: 'danger', message: '提示修改密码Api调用失败' });
    }
};

const checkAwayAbnormalCar = async () => {
    try {
        const res = await queryAwayAbnormalCar();
        if (res.errorCode !== 0) {
            if (res.errorCode === -1) {
                // 将异常信息存储到localStorage，以便在UserHome.vue中显示
                localStorage.setItem('abnormalCarMessage', res.errorMessage);
            } else {
                // 如果错误码不是-1，说明没有异常信息，清除localStorage中的异常信息
                localStorage.removeItem('abnormalCarMessage');
            }
        } else {
            // 如果接口返回正常，清除localStorage中的异常信息
            localStorage.removeItem('abnormalCarMessage');
        }
    } catch (error) {
        console.error('提示检查用户异常停泊区Api调用失败', error);
        // 存储错误信息到localStorage
        localStorage.setItem('abnormalCarMessage', '提示检查用户异常停泊区Api调用失败');
    }
};

const handleFingerprintLogin = () => {
    // const isOut = localStorage.getItem('isOut') === 'true';
    // if (isOut) {
    //     router.push({ path: '/fingerprint-login', query: { isOut: 'true' } });
    // } else {
    //     router.push('/fingerprint-login');
    // }
    router.push('/fingerprint-login');
};

// 忘记密码处理函数
const handleForgotPassword = () => {
    showNotify({ type: 'danger', message: '请联系管理员重置密码' });
};

// 组件卸载时清理资源
onUnmounted(() => {
    // 移除页面可见性监听器
    if (visibilityChangeHandler) {
        document.removeEventListener('visibilitychange', visibilityChangeHandler);
        visibilityChangeHandler = null;
    }
    
    // 暂停所有动画以释放性能
    const loginPage = document.querySelector('.login-page');
    if (loginPage) {
        loginPage.style.animationPlayState = 'paused';
        loginPage.querySelectorAll('*').forEach(el => {
            el.style.animationPlayState = 'paused';
        });
    }
});
</script>

<style scoped>
/* 登录页面 - 深色科技风格 */
.login-page {
  width: 100%;
  min-height: 100vh;
  position: relative;
  font-family: 'Microsoft YaHei', sans-serif;
  color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 炫酷科技背景层 */
.bg-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 20%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(0, 180, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 60%, rgba(0, 255, 127, 0.05) 0%, transparent 50%),
    linear-gradient(135deg, #0a0a23 0%, #1a1a3a 25%, #194777 50%, #1a1a3a 75%, #0a0a23 100%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  /* animation: bgShift 20s ease-in-out infinite; */
  z-index: 0;
}

@keyframes bgShift {
  0%, 100% { 
    background-position: 0% 0%, 100% 100%, 50% 50%, 0% 0%; 
  }
  33% { 
    background-position: 30% 10%, 80% 90%, 60% 40%, 10% 20%; 
  }
  66% { 
    background-position: 10% 30%, 90% 70%, 40% 60%, 20% 10%; 
  }
}

/* 增强的背景动画网格 */
.login-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(30, 144, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 144, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 1;
  pointer-events: none;
  animation: gridFloat 20s ease-in-out infinite;
}

@keyframes gridFloat {
  0%, 100% {
    opacity: 0.3;
    transform: translateX(0) translateY(0);
  }
  50% {
    opacity: 0.6;
    transform: translateX(-10px) translateY(-5px);
  }
}

/* 动态渐变背景 */
.gradient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 15s ease-in-out infinite;
  will-change: transform, opacity;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.gradient-orb-1 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(30, 144, 255, 0.2) 0%, transparent 70%);
  top: 10%;
  left: 20%;
  animation-delay: 0s;
}

.gradient-orb-2 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(0, 191, 255, 0.15) 0%, transparent 70%);
  bottom: 20%;
  right: 25%;
  animation-delay: 5s;
}

.gradient-orb-3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(135, 206, 250, 0.1) 0%, transparent 70%);
  top: 60%;
  left: 60%;
  animation-delay: 10s;
}

@keyframes orbFloat {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.6;
  }
  25% {
    transform: translate(50px, -30px) scale(1.1);
    opacity: 0.8;
  }
  50% {
    transform: translate(-30px, 40px) scale(0.9);
    opacity: 0.4;
  }
  75% {
    transform: translate(40px, 20px) scale(1.05);
    opacity: 0.7;
  }
}

/* 粒子动画背景 */
.particles-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 144, 255, 0.8) 0%, rgba(30, 144, 255, 0.2) 50%, transparent 100%);
  /* animation: particleFloat 12s linear infinite; */
  will-change: transform, opacity;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.particle-1 {
  width: 4px;
  height: 4px;
  left: 10%;
  animation-delay: 0s;
  animation-duration: 10s;
}

.particle-2 {
  width: 6px;
  height: 6px;
  left: 20%;
  animation-delay: 2s;
  animation-duration: 12s;
}

.particle-3 {
  width: 3px;
  height: 3px;
  left: 30%;
  animation-delay: 4s;
  animation-duration: 9s;
}

.particle-4 {
  width: 5px;
  height: 5px;
  left: 50%;
  animation-delay: 1s;
  animation-duration: 11s;
}

.particle-5 {
  width: 4px;
  height: 4px;
  left: 70%;
  animation-delay: 3s;
  animation-duration: 13s;
}

.particle-6 {
  width: 7px;
  height: 7px;
  left: 80%;
  animation-delay: 5s;
  animation-duration: 8s;
}

.particle-7 {
  width: 3px;
  height: 3px;
  left: 90%;
  animation-delay: 7s;
  animation-duration: 10s;
}

.particle-8 {
  width: 5px;
  height: 5px;
  left: 40%;
  animation-delay: 6s;
  animation-duration: 14s;
}

.particle-9 {
  width: 4px;
  height: 4px;
  left: 60%;
  animation-delay: 8s;
  animation-duration: 9s;
}

.particle-10 {
  width: 6px;
  height: 6px;
  left: 15%;
  animation-delay: 4.5s;
  animation-duration: 11s;
}

@keyframes particleFloat {
  0% {
    transform: translateY(100vh) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) translateX(50px) rotate(360deg);
    opacity: 0;
  }
}

/* 几何线条动画 */
.geometric-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.geometric-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(30, 144, 255, 0.3), transparent);
  transform-origin: center;
  will-change: transform, opacity;
  transform: translateZ(0);
}

.line-1 {
  width: 200px;
  height: 2px;
  top: 30%;
  left: 10%;
  /* animation: lineSlide 8s linear infinite; */
}

.line-2 {
  width: 150px;
  height: 1px;
  bottom: 40%;
  right: 20%;
  animation: lineSlide 6s linear infinite reverse;
}

.line-3 {
  width: 100px;
  height: 1px;
  top: 70%;
  left: 70%;
  animation: lineSlide 10s linear infinite;
  animation-delay: 3s;
}

@keyframes lineSlide {
  0% {
    transform: translateX(-100%) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateX(200px) rotate(5deg);
    opacity: 0;
  }
}

.geometric-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(30, 144, 255, 0.6);
  box-shadow: 0 0 20px rgba(30, 144, 255, 0.4);
  /* animation: dotPulse 3s ease-in-out infinite; */
  will-change: transform, opacity;
  transform: translateZ(0);
}

.dot-1 {
  top: 25%;
  left: 15%;
  animation-delay: 0s;
}

.dot-2 {
  top: 60%;
  right: 30%;
  animation-delay: 1s;
}

.dot-3 {
  bottom: 30%;
  left: 80%;
  animation-delay: 2s;
}

.dot-4 {
  top: 80%;
  left: 40%;
  animation-delay: 1.5s;
}

@keyframes dotPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.5);
    opacity: 1;
  }
}

/* 霓虹电路板背景 */
.circuit-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.circuit-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, #00ffff, #00ff00, #00ffff, transparent);
  box-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff;
  animation: circuitPulse 4s ease-in-out infinite;
}

.circuit-h1 {
  width: 300px;
  height: 2px;
  top: 20%;
  left: 10%;
  animation-delay: 0s;
}

.circuit-h2 {
  width: 200px;
  height: 1px;
  bottom: 30%;
  right: 15%;
  animation-delay: 2s;
}

.circuit-v1 {
  width: 1px;
  height: 150px;
  top: 40%;
  left: 25%;
  background: linear-gradient(0deg, transparent, #00aaff, #0088cc, #00aaff, transparent);
  animation-delay: 1s;
}

.circuit-v2 {
  width: 2px;
  height: 100px;
  bottom: 20%;
  right: 40%;
  background: linear-gradient(0deg, transparent, #0099cc, #00bbff, #0099cc, transparent);
  animation-delay: 3s;
}

.circuit-node {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ffff;
  box-shadow: 0 0 15px #00ffff, 0 0 30px #00ffff, 0 0 45px #00ffff;
  animation: nodePulse 2s ease-in-out infinite;
}

.node-1 { top: 20%; left: 25%; animation-delay: 0s; }
.node-2 { bottom: 30%; right: 30%; animation-delay: 0.5s; }
.node-3 { top: 60%; left: 70%; animation-delay: 1s; }
.node-4 { bottom: 50%; left: 50%; animation-delay: 1.5s; }

@keyframes circuitPulse {
  0%, 100% { opacity: 0.3; filter: brightness(1); }
  50% { opacity: 1; filter: brightness(2); }
}

@keyframes nodePulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.5); opacity: 1; }
}

/* 矩阵雨效果 */
.matrix-rain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.matrix-column {
  position: absolute;
  width: 1px;
  height: 100%;
  background: linear-gradient(0deg, 
    transparent 0%, 
    rgba(96, 108, 128, 0.15) 10%, 
    rgba(128, 140, 160, 0.6) 50%, 
    rgba(160, 172, 192, 0.8) 60%, 
    transparent 100%
  );
  /* animation: matrixFall 20s linear infinite; */
}

/* .matrix-column::before {
  content: '10110100111010010110';
  position: absolute;
  top: 0;
  left: -10px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #00ff00;
  writing-mode: vertical-rl;
  opacity: 0.6;
  animation: matrixText 8s linear infinite;
} */

@keyframes matrixFall {
  0% { transform: translateY(-100%); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 0.8; }
  100% { transform: translateY(100vh); opacity: 0; }
}

@keyframes matrixText {
  0% { transform: translateY(-50px); }
  100% { transform: translateY(100vh); }
}

/* 六边形蜂窝背景 */
.hexagon-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.hexagon {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 1px solid rgba(0, 255, 255, 0.2);
  background: rgba(0, 255, 255, 0.02);
  clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
  /* animation: hexGlow 6s ease-in-out infinite; */
}

.hex-1 { top: 15%; left: 20%; animation-delay: 0s; }
.hex-2 { top: 25%; right: 25%; animation-delay: 1s; }
.hex-3 { bottom: 30%; left: 60%; animation-delay: 2s; }
.hex-4 { top: 70%; left: 30%; animation-delay: 3s; }
.hex-5 { bottom: 15%; right: 40%; animation-delay: 4s; }

@keyframes hexGlow {
  0%, 100% { 
    border-color: rgba(0, 255, 255, 0.2);
    background: rgba(0, 255, 255, 0.02);
    transform: scale(1) rotate(0deg);
  }
  50% { 
    border-color: rgba(0, 255, 255, 0.8);
    background: rgba(0, 255, 255, 0.1);
    transform: scale(1.1) rotate(60deg);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
  }
}

/* 扫描线效果 */
.scan-lines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.scan-line {
  position: absolute;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.8), transparent);
  /* animation: scanMove 6s linear infinite; */
}

.scan-1 { animation-delay: 0s; }
.scan-2 { animation-delay: 1s; }
.scan-3 { animation-delay: 2s; }

@keyframes scanMove {
  0% { top: -2px; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 0.8; }
  100% { top: 100%; opacity: 0; }
}

/* 主内容区域 */
.login-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 40px;
  padding-bottom: 40px;
  padding-left: 20px;
  padding-right: 20px;
  position: relative;
  z-index: 10;
}

/* 左侧信息区 */
.login-left {
  flex: 1;
  max-width: 500px;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 40px;
  padding-right: 40px;
  color: white;
}

.system-info {
  animation: fadeInLeft 0.8s ease-out;
}

.system-title {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 0 20px rgba(30, 144, 255, 0.5);
}

.system-subtitle {
  font-size: 18px;
  opacity: 0.9;
  margin-bottom: 40px;
  font-weight: 300;
  color: #7ec8ff;
}

.feature-list {
  display: flex;
  flex-direction: column;
}

.feature-list>* {
  margin-bottom: 20px;
}

.feature-list>*:last-child {
  margin-bottom: 0;
}

/* 移除可能的左侧装饰线 */
.feature-list::before {
  display: none !important;
}

.system-info::before {
  display: none !important;
}

.feature-item {
  display: flex;
  align-items: center;
  font-size: 16px;
  opacity: 0.95;
}

.feature-item>* {
  margin-right: 12px;
}

.feature-item>*:last-child {
  margin-right: 0;
}

.feature-item i {
  font-size: 20px;
  color: #00bfff;
}

/* 右侧登录表单 */
.login-right {
  flex: 0 0 450px;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 20px;
  padding-right: 20px;
}

.login-form-wrapper {
  background: linear-gradient(135deg, rgba(9, 45, 82, 0.95) 0%, rgba(5, 30, 60, 0.95) 100%);
  border-radius: 16px;
  padding-top: 48px;
  padding-bottom: 48px;
  padding-left: 40px;
  padding-right: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(30, 144, 255, 0.2);
  animation: fadeInRight 0.8s ease-out;
  border: 1px solid rgba(30, 144, 255, 0.3);
}

.form-header {
  text-align: center;
  margin-bottom: 32px;
}

.form-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #1e90ff 0%, #00bfff 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(30, 144, 255, 0.4);
}

.form-icon i {
  font-size: 40px;
  color: #fff;
}

.form-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.form-subtitle {
  font-size: 14px;
  color: #7ec8ff;
}

.form-content {
  display: flex;
  flex-direction: column;
}

.form-content>* {
  margin-bottom: 20px;
}

.form-content>*:last-child {
  margin-bottom: 0;
}

.form-item {
  margin-bottom: 1.5rem;
}

.input-label {
  display: block;
  font-size: 14px;
  color: #7ec8ff;
  margin-bottom: 8px;
  font-weight: 500;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(4, 28, 61, 0.8);
  border: 1px solid rgba(30, 144, 255, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  transition: all 0.3s ease;
}

.input-wrapper:focus-within {
  border-color: #1e90ff;
  box-shadow: 0 0 15px rgba(30, 144, 255, 0.3);
}

.input-icon {
  color: #00bfff;
  font-size: 16px;
  margin-right: 12px;
}

.dark-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: #fff;
}

.dark-input::placeholder {
  color: rgba(126, 200, 255, 0.5);
}

.password-toggle {
  color: #7ec8ff;
  cursor: pointer;
  transition: color 0.3s;
  margin-left: 8px;
}

.password-toggle:hover {
  color: #00bfff;
}

/* 登录按钮 */
.login-btn {
  width: 100%;
  height: 48px;
  font-size: 16px;
  font-weight: 600;
  background: linear-gradient(90deg, #1e90ff 0%, #00bfff 100%);
  border: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  color: white;
  cursor: pointer;
  margin-top: 8px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(30, 144, 255, 0.5);
}

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* 指纹登录按钮 */
.fingerprint-btn {
  width: 100%;
  height: 48px;
  font-size: 16px;
  font-weight: 500;
  background: transparent;
  border: 1px solid rgba(30, 144, 255, 0.5);
  border-radius: 8px;
  transition: all 0.3s ease;
  color: #7ec8ff;
  cursor: pointer;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.fingerprint-btn:hover {
  background: rgba(30, 144, 255, 0.1);
  border-color: #1e90ff;
  color: #00bfff;
}

.fingerprint-btn i {
  font-size: 20px;
}

.form-footer {
  text-align: center;
  margin-top: 8px;
}

.forgot-link {
  color: #7ec8ff;
  font-size: 14px;
  text-decoration: none;
  transition: color 0.3s ease;
}

.forgot-link:hover {
  color: #00bfff;
  text-decoration: underline;
}

/* 底部版权 */
.login-footer {
  text-align: center;
  padding: 20px;
  color: white;
  font-size: 14px;
  opacity: 0.8;
  position: relative;
  z-index: 1;
}

/* 动画效果 */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 性能优化 - 减少动画支持 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .gradient-orb,
  .particle,
  .geometric-line,
  .geometric-dot {
    animation: none !important;
  }
}

/* 低性能设备优化 */
@media (max-width: 768px) {
  .gradient-orb {
    filter: blur(40px);
    animation-duration: 20s;
  }
  
  .particle {
    animation-duration: 15s;
  }
  
  .particles-bg .particle:nth-child(n+6) {
    display: none;
  }
}

@media (max-width: 480px) {
  .gradient-orb-3,
  .geometric-line,
  .geometric-dot {
    display: none;
  }
  
  .particles-bg .particle:nth-child(n+4) {
    display: none;
  }
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .login-left {
    display: none;
  }

  .login-right {
    flex: 0 0 100%;
    max-width: 450px;
  }
}

@media (max-width: 640px) {
  .login-form-wrapper {
    padding: 32px 24px;
    background: linear-gradient(135deg, rgba(9, 45, 82, 0.98) 0%, rgba(5, 30, 60, 0.98) 100%);
  }

  .form-title {
    font-size: 24px;
  }

  .login-right {
    padding: 0 16px;
  }

  .form-icon {
    width: 60px;
    height: 60px;
  }

  .form-icon i {
    font-size: 30px;
  }
}

/* 高刷新率设备优化 */
@media (min-resolution: 120dpi) {
  .particle {
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  }
}

/* 暗色主题适配 */
@media (prefers-color-scheme: dark) {
  .gradient-orb {
    filter: blur(100px);
    opacity: 0.8;
  }
}

/* 硬件加速优化 */
.circuit-line,
.circuit-node,
.matrix-column,
.hexagon,
.scan-line {
  will-change: transform, opacity;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* 深度性能优化 - 保留所有元素但优化性能 */
* {
  /* 减少重绘 */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* CSS Containment 优化 - 限制布局重计算范围 */
.bg-layer,
.gradient-bg,
.matrix-rain,
.circuit-bg,
.hexagon-bg,
.scan-lines,
.particles-bg,
.geometric-bg {
  contain: layout style paint;
  isolation: isolate;
}

/* 合成层优化 - 智能GPU加速 */
.login-page {
  transform: translateZ(0);
  will-change: auto;
}

/* 动画性能优化 - 使用更高效的动画函数 */
.hexagon {
  animation-timing-function: ease-out;
}

.scan-line {
  animation-timing-function: linear;
}

.matrix-column {
  animation-timing-function: linear;
}

/* 动画性能优化 - 使用transform替代其他属性 */
.gradient-orb {
  filter: blur(80px);
  animation-duration: 25s;
  animation-timing-function: ease-out;
  animation-fill-mode: both;
}

.matrix-column {
  animation-duration: 25s;
  animation-timing-function: linear;
  animation-fill-mode: both;
}

.circuit-line {
  animation-duration: 8s;
  animation-timing-function: ease-in-out;
  animation-fill-mode: both;
}

.circuit-node {
  animation-duration: 6s;
  animation-timing-function: ease-in-out;
  animation-fill-mode: both;
}

/* 分层优化 - 减少合成层数量 */
.bg-layer {
  animation-duration: 30s;
  animation-timing-function: ease-in-out;
}

/* 响应式性能优化 */
@media (max-width: 768px) {
  .gradient-orb {
    filter: blur(60px);
    animation-duration: 35s;
  }
  
  .matrix-column {
    animation-duration: 20s;
  }
}

@media (max-width: 480px) {
  .bg-layer {
    animation-duration: 45s;
  }
  
  .gradient-orb {
    filter: blur(40px);
    animation-duration: 50s;
  }
}

/* 特性列表文字颜色 */
.feature-item span {
  color: rgba(255, 255, 255, 0.9);
}
</style>
