/**
 * login.css
 *
 * 登录页面样式 - 赛博朋克风格
 * 创建时间: 2025-02-25
 * 作者: Meng
 */

/* ============================================
   CSS 变量定义 - 赛博朋克色彩系统
   ============================================ */
:root {
    /* 主色调 */
    --cyber-blue: #3b82f6;
    --cyber-violet: #8b5cf6;
    --cyber-pink: #ec4899;

    /* 渐变定义 */
    --gradient-main: linear-gradient(135deg, #3b82f6 30%, #a78bfa 70%, #ec4899 100%);
    --gradient-btn: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(139, 92, 246, 0.8));
    --gradient-text: linear-gradient(135deg, #60a5fa, #a78bfa, #ec4899);
    --gradient-border: linear-gradient(90deg, transparent, rgba(125, 178, 255, 0.9), rgba(236, 72, 153, 0.68), transparent);

    /* 背景色 */
    --bg-dark: rgba(15, 23, 42, 0.98);
    --bg-secondary: rgba(30, 41, 59, 0.95);
    --bg-hover: rgba(30, 41, 59, 0.6);
    --bg-active: rgba(30, 41, 59, 0.8);

    /* 阴影 */
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-glow-blue: 0 4px 15px rgba(59, 130, 246, 0.3);
    --shadow-glow-hover: 0 6px 25px rgba(59, 130, 246, 0.5);

    /* 动画曲线 */
    --ease-cubic: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-smooth: ease-out;
}

/* ============================================
   全局样式重置
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    margin: 0;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   页面主体样式
   ============================================ */
body.login-body {
    position: relative;
    font-family: "Space Grotesk", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    color: #e5edff;
    background:
        radial-gradient(1000px 500px at 8% -8%, rgba(59, 130, 246, 0.26), transparent 60%),
        radial-gradient(860px 520px at 100% -5%, rgba(236, 72, 153, 0.2), transparent 62%),
        linear-gradient(170deg, #040913 0%, #081327 50%, #070f1f 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden;
}

/* ============================================
   背景装饰元素
   ============================================ */
.login-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.23;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.92), transparent 90%);
    -webkit-mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.92), transparent 90%);
}

.login-glow {
    position: fixed;
    width: 340px;
    height: 340px;
    border-radius: 999px;
    filter: blur(40px);
    pointer-events: none;
    opacity: 0.45;
}

.login-glow-a {
    top: -120px;
    right: -90px;
    background: rgba(139, 92, 246, 0.44);
}

.login-glow-b {
    bottom: -130px;
    left: -90px;
    background: rgba(59, 130, 246, 0.4);
}

/* ============================================
   登录卡片样式
   ============================================ */
.login-card {
    position: relative;
    z-index: 1;
    width: 480px;
    max-width: 90vw;
    border-radius: 20px;
    padding: 36px 32px 28px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    background:
        radial-gradient(120% 90% at 8% 0%, rgba(59, 130, 246, 0.15), transparent 45%),
        linear-gradient(155deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    box-shadow: 0 30px 56px rgba(2, 6, 23, 0.58);
    transform: translateY(0);
    animation: loginCardRise 620ms var(--ease-smooth);
    transition: all 0.3s var(--ease-cubic);
}

.login-card:hover {
    box-shadow:
        0 6px 25px rgba(59, 130, 246, 0.3),
        inset 0 0 30px rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.4);
}

.login-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 1px;
    background: var(--gradient-border);
}

.login-card::after {
    content: "";
    position: absolute;
    right: -80px;
    top: -80px;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.24), transparent 68%);
    pointer-events: none;
}

/* ============================================
   卡片头部样式
   ============================================ */
.login-head {
    margin-bottom: 24px;
    text-align: center;
}

.login-head h3 {
    margin: 0;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.75rem;
    line-height: 1.2;
    letter-spacing: 0.5px;
    font-weight: 700;
    text-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
}

.login-head p {
    margin: 10px 0 0;
    font-size: 0.92rem;
    color: #9eb4dc;
    letter-spacing: 0.3px;
}

/* ============================================
   徽章样式
   ============================================ */
.login-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    letter-spacing: 1px;
    color: #dbeafe;
    border: 1px solid rgba(125, 178, 255, 0.42);
    background: var(--bg-secondary);
    border-radius: 999px;
    padding: 4px 11px;
    margin-bottom: 14px;
    transition: all 0.3s ease;
}

.login-badge:hover {
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

/* ============================================
   表单组样式
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

/* ============================================
   标签样式
   ============================================ */
.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.3px;
}

/* ============================================
   输入框样式
   ============================================ */
.login-card input {
    width: 100%;
    border-radius: 12px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    background: rgba(30, 41, 59, 0.6);
    color: rgba(255, 255, 255, 0.9);
    padding: 14px 16px;
    margin: 0;
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.login-card input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.login-card input:focus {
    border-color: var(--cyber-blue);
    box-shadow:
        0 0 0 4px rgba(59, 130, 246, 0.2),
        0 0 20px rgba(59, 130, 246, 0.15);
    background: rgba(30, 41, 59, 0.8);
}

.login-card input:hover:not(:focus) {
    border-color: rgba(59, 130, 246, 0.5);
}

/* ============================================
   按钮样式
   ============================================ */
.login-card button {
    width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    border: 2px solid rgba(59, 130, 246, 0.6);
    background: var(--gradient-btn);
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 14px 24px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-glow-blue);
    transition: all 0.3s var(--ease-cubic);
}

.login-card button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
    transition: left 0.5s ease;
}

.login-card button:hover::before {
    left: 100%;
}

.login-card button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 25px rgba(59, 130, 246, 0.5),
        inset 0 0 30px rgba(59, 130, 246, 0.1);
}

.login-card button:active {
    transform: scale(0.97);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.4);
}

/* ============================================
   错误提示样式
   ============================================ */
.login-error {
    margin: 0 0 16px;
    border: 1px solid rgba(248, 113, 113, 0.32);
    background: rgba(239, 68, 68, 0.13);
    color: #fecaca;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-error::before {
    content: "⚠";
    font-size: 1rem;
}

/* ============================================
   提示文字样式
   ============================================ */
.login-tip {
    margin: 12px 0 0;
    color: #90a6cd;
    font-size: 0.82rem;
}

/* ============================================
   页脚样式
   ============================================ */
.login-footer {
    position: relative;
    z-index: 1;
    margin-top: 30px;
    color: rgba(191, 209, 243, 0.75);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    line-height: 1.8;
    text-align: center;
}

.login-footer a {
    color: #a9c4ff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.login-footer a:hover,
.login-footer a:focus-visible {
    color: #c7daff;
    text-decoration: none;
}

/* ============================================
   动画定义
   ============================================ */
@keyframes loginCardRise {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   H5 移动端适配 (≤480px)
   ============================================ */
@media (max-width: 480px) {
    html, body {
        width: 100%;
        overflow-x: hidden;
    }

    body.login-body {
        display: block !important;
        text-align: center;
        padding: 12px;
        padding-top: max(12px, env(safe-area-inset-top));
        min-height: 100vh;
        min-height: 100dvh;
    }

    .login-card {
        display: block;
        width: calc(100% - 40px);
        max-width: 400px;
        margin-left: auto !important;
        margin-right: auto !important;
        margin-top: max(20px, env(safe-area-inset-top)) !important;
        border-radius: 16px;
        padding: 24px 20px;
        animation-duration: 500ms;
        box-sizing: border-box;
        text-align: left;
    }

    .login-head h3 {
        font-size: 1.4rem;
    }

    .login-head p {
        font-size: 0.82rem;
    }

    .login-card input {
        padding: 13px 15px;
        font-size: 16px; /* 防止 iOS 自动缩放 */
        margin-bottom: 0;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-label {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }

    .login-card button {
        padding: 13px 20px;
        font-size: 16px;
    }

    .login-error {
        font-size: 0.82rem;
        padding: 8px 12px;
    }

    .login-footer {
        font-size: 0.72rem;
        padding: 0 8px;
        text-align: center;
        margin-top: 24px;
    }

    .login-badge {
        font-size: 0.68rem;
        padding: 3px 9px;
    }

    /* 发光球体适配 */
    .login-glow {
        width: 200px;
        height: 200px;
    }

    .login-glow-a {
        top: -60px;
        right: -40px;
    }

    .login-glow-b {
        bottom: -70px;
        left: -40px;
    }
}

/* ============================================
   平板端适配 (481px - 768px)
   ============================================ */
@media (min-width: 481px) and (max-width: 768px) {
    .login-card {
        width: auto;
        max-width: 420px;
        padding: 32px 28px 24px;
    }

    .login-head h3 {
        font-size: 1.6rem;
    }
}

/* ============================================
   触摸设备优化
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* 禁用 hover 效果 - 触摸设备不支持 hover */

    /* 触摸目标最小尺寸 44px */
    .login-card button,
    .login-card input {
        min-height: 44px;
    }

    /* 按钮按下效果 */
    .login-card button:active {
        transform: scale(0.97);
        background: linear-gradient(135deg, rgba(59, 130, 246, 1), rgba(139, 92, 246, 0.9));
    }

    /* 输入框聚焦效果 */
    .login-card input:focus {
        border-color: var(--cyber-blue);
        border-width: 2px;
    }
}

/* ============================================
   横屏适配
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    body.login-body {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .login-card {
        margin-top: 0;
        padding: 20px 24px;
        max-width: 400px;
    }

    .login-head {
        margin-bottom: 16px;
    }

    .login-head h3 {
        font-size: 1.3rem;
    }

    .login-head p {
        display: none;
    }

    .login-card input {
        padding: 10px 14px;
    }

    .form-group {
        margin-bottom: 14px;
    }

    .login-card button {
        padding: 11px 20px;
    }
}

/* ============================================
   减少动画偏好支持
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .login-card {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* ============================================
   高对比度模式支持
   ============================================ */
@media (prefers-contrast: high) {
    .login-card {
        border-width: 2px;
        border-color: rgba(59, 130, 246, 0.6);
    }

    .login-card input {
        border-width: 2px;
    }

    .login-card button {
        border-width: 2px;
    }
}

/* ============================================
   深色模式增强
   ============================================ */
@media (prefers-color-scheme: dark) {
    body.login-body {
        background-color: #040913;
    }
}
