﻿/* ========================================
   设计系统 - CSS 变量定义
   ======================================== */
:root {
    /* 主题色彩 */
    --color-primary-start: #667eea;
    --color-primary-end: #764ba2;
    --color-primary: linear-gradient(135deg, var(--color-primary-start) 0%, var(--color-primary-end) 100%);
    /* 功能色彩 */
    --color-success: #07C160;
    --color-success-hover: #06ae56;
    --color-success-bg: rgba(7, 193, 96, 0.95);
    /* 中性色彩 */
    --color-white: #ffffff;
    --color-text-primary: #1a1a1a;
    --color-text-secondary: #666666;
    --color-text-muted: #999999;
    --color-bg-light: #f8f9fa;
    --color-bg-lighter: #f0f0f0;
    /* 阴影系统 */
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    /* 圆角系统 */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    /* 间距系统 */
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 40px;
    /* 字体系统 */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    --font-size-lg: 15px;
    --font-size-xl: 16px;
    --font-size-2xl: 24px;
    --font-size-3xl: 28px;
    /* 动画 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.6s ease-out;
    /* 二维码容器尺寸 */
    --qr-size: 400px;
    --qr-size-mobile: 260px;
}

/* ========================================
   重置样式
   ======================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: var(--color-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.login-container {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.background-decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    /* 优化动画性能：仅使用 transform 和 opacity */
    will-change: transform;
    animation: float 20s infinite ease-in-out;
}

.circle-1 {
    width: 300px;
    height: 300px;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.circle-2 {
    width: 400px;
    height: 400px;
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

.circle-3 {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(50px, 50px) rotate(90deg);
    }

    50% {
        transform: translate(0, 100px) rotate(180deg);
    }

    75% {
        transform: translate(-50px, 50px) rotate(270deg);
    }
}

/* 减少动画敏感用户的支持 */
@media (prefers-reduced-motion: reduce) {
    .circle,
    .logo-icon,
    .refresh-btn svg {
        animation: none;
    }
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-lg);
    box-shadow: var(--shadow-lg);
    max-width: 520px;
    width: 90%;
    text-align: center;
    position: relative;
    z-index: 10;
    /* 优化动画性能 */
    will-change: opacity, transform;
    animation: slideUp var(--transition-slow);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    margin-bottom: var(--space-2xl);
}

.logo-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
    will-change: transform;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.login-header h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.5px;
}

.login-header p {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.qr-container {
    margin-bottom: var(--space-xl);
}

.qr-box {
    position: relative;
    width: var(--qr-size);
    height: calc(var(--qr-size) + 30px);
    margin: 0 auto;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    padding-top: var(--space-sm);
}

.qr-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-light);
}

    .qr-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.qr-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

    .qr-placeholder svg {
        width: 120px;
        height: 120px;
        opacity: 0.3;
    }

.qr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
    cursor: pointer;
}

    .qr-overlay.active {
        opacity: 1;
    }

.refresh-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    color: var(--color-white);
    transition: transform var(--transition-fast);
    will-change: transform;
}

    .refresh-btn:hover {
        transform: scale(1.1);
    }

    .refresh-btn svg {
        width: 48px;
        height: 48px;
        will-change: transform;
        animation: rotate 2s linear infinite;
    }

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.refresh-btn span {
    font-size: var(--font-size-base);
    font-weight: 500;
}

.login-footer {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.scan-tips {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    background: var(--color-bg-lighter);
    padding: 10px var(--space-md);
    border-radius: var(--radius-sm);
}

.tip-icon {
    font-size: 18px;
}

.wechat-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

    .wechat-link svg {
        width: 16px;
        height: 16px;
        color: var(--color-success);
    }

    .wechat-link a {
        color: var(--color-success);
        text-decoration: none;
        font-weight: 500;
        transition: color var(--transition-fast);
    }

        .wechat-link a:hover {
            color: var(--color-success-hover);
            text-decoration: underline;
        }

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 768px) {
    .login-box {
        padding: var(--space-2xl) var(--space-xl);
        border-radius: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        box-shadow: none;
        animation: none;
    }

    .circle {
        display: none;
    }

    .qr-box {
        width: var(--qr-size-mobile);
        height: calc(var(--qr-size-mobile) + 30px);
    }

    .login-header h1 {
        font-size: var(--font-size-2xl);
    }

    .login-header {
        margin-bottom: var(--space-xl);
    }

    .qr-container {
        margin-bottom: var(--space-lg);
    }
}

/* 超小屏幕优化 */
@media (max-width: 380px) {
    .login-box {
        padding: var(--space-lg) var(--space-md);
    }

    .logo-icon {
        width: 64px;
        height: 64px;
    }
}

/* ========================================
   加载动画
   ======================================== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--color-success);
    border-radius: 50%;
    will-change: transform;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   扫描成功动画
   ======================================== */
.scan-success {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-success-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

    .scan-success.active {
        opacity: 1;
    }

    .scan-success svg {
        width: 64px;
        height: 64px;
        margin-bottom: var(--space-md);
    }

    .scan-success p {
        font-size: var(--font-size-xl);
        font-weight: 500;
    }

/* ========================================
   焦点样式 - 可访问性
   ======================================== */
:focus-visible {
    outline: 2px solid var(--color-primary-start);
    outline-offset: 2px;
}

/* 移除按钮默认焦点样式 */
button:focus:not(:focus-visible) {
    outline: none;
}
