/* ============================================================
   星迈优品 · 登录页高级视觉优化 (login-premium)
   作者：高级开发工程师
   说明：仅做视觉与交互升级，完全兼容原有 login.js（保留所有 id / name）
   ============================================================ */

/* ---------- 主题变量（亮色 / 暗色） ---------- */
:root {
    --lx-accent: #1C84C6;
    --lx-accent-2: #166087;
    --lx-accent-grad: linear-gradient(135deg, #1C84C6 0%, #166087 100%);
    --lx-card-bg: rgba(255, 255, 255, 0.72);
    --lx-card-border: rgba(255, 255, 255, 0.65);
    --lx-text: #1f2d3d;
    --lx-text-soft: #5b6b7b;
    --lx-field-bg: rgba(255, 255, 255, 0.92);
    --lx-field-border: #dfe6ee;
    --lx-field-text: #1f2d3d;
    --lx-shadow: 0 30px 80px -20px rgba(20, 40, 70, 0.45);
    --lx-overlay: linear-gradient(135deg, rgba(22, 96, 135, 0.10), rgba(28, 132, 198, 0.18));
    --lx-banner-ov: linear-gradient(160deg, rgba(15, 42, 66, 0.55) 0%, rgba(15, 42, 66, 0.20) 45%, rgba(15, 42, 66, 0.75) 100%);
}

[data-theme="dark"] {
    --lx-card-bg: rgba(16, 26, 40, 0.55);
    --lx-card-border: rgba(255, 255, 255, 0.12);
    --lx-text: #eaf1f8;
    --lx-text-soft: #9fb0c3;
    --lx-field-bg: rgba(255, 255, 255, 0.06);
    --lx-field-border: rgba(255, 255, 255, 0.14);
    --lx-field-text: #eaf1f8;
    --lx-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.65);
    --lx-overlay: linear-gradient(135deg, rgba(0, 0, 0, 0.45), rgba(22, 96, 135, 0.30));
    --lx-banner-ov: linear-gradient(160deg, rgba(8, 18, 30, 0.78) 0%, rgba(8, 18, 30, 0.35) 45%, rgba(8, 18, 30, 0.88) 100%);
}

/* ---------- 页面基础布局 ---------- */
body.signin {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    transition: background-color .4s ease;
}

/* 背景压暗层（暗色模式下更深） */
body.signin::before {
    content: "";
    position: fixed;
    inset: 0;
    background: var(--lx-overlay);
    z-index: -1;
    transition: background .4s ease;
}

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
    position: fixed;
    top: 22px;
    right: 22px;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--lx-card-border);
    background: var(--lx-card-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: var(--lx-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.35);
    transition: transform .3s cubic-bezier(.16, 1, .3, 1), background .4s ease, color .4s ease;
}
.theme-toggle:hover {
    transform: translateY(-2px) rotate(12deg);
}
.theme-toggle .fa-sun { display: none; }
[data-theme="dark"] .theme-toggle .fa-sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .fa-moon { display: none; }

/* ---------- 登录卡片（玻璃拟态） ---------- */
.login-shell {
    width: 100%;
    display: flex;
    justify-content: center;
}
.login-card {
    display: flex;
    width: min(960px, 94vw);
    min-height: 560px;
    border-radius: 24px;
    overflow: hidden;
    background: var(--lx-card-bg);
    border: 1px solid var(--lx-card-border);
    box-shadow: var(--lx-shadow);
    backdrop-filter: blur(26px) saturate(160%);
    -webkit-backdrop-filter: blur(26px) saturate(160%);
    animation: cardIn .8s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(26px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

/* ---------- 左侧品牌展示区 ---------- */
.login-banner {
    position: relative;
    width: 46%;
    overflow: hidden;
    color: #fff;
}
.login-banner video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.login-banner .banner-overlay {
    position: absolute;
    inset: 0;
    background: var(--lx-banner-ov);
}
.login-banner .banner-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 38px 34px;
    z-index: 2;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.brand-logo {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    backdrop-filter: blur(6px);
}
.brand h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}
.brand p {
    margin: 2px 0 0;
    font-size: 13px;
    opacity: .82;
    letter-spacing: 2px;
}
.banner-foot .banner-tag {
    font-size: 19px;
    line-height: 1.6;
    font-weight: 600;
    margin: 0 0 18px;
}
.banner-feats {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.banner-feats li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    opacity: .92;
}
.banner-feats li i {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

/* ---------- 右侧表单区 ---------- */
.login-form-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 46px;
    color: var(--lx-text);
}
.mobile-brand {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    font-weight: 700;
    font-size: 17px;
}
.mobile-brand .brand-logo {
    width: 38px;
    height: 38px;
    font-size: 18px;
    color: #fff;
    background: var(--lx-accent-grad);
    border: none;
}

.login-form-wrap h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: .5px;
}
.login-form-wrap .sub {
    margin: 8px 0 30px;
    font-size: 14px;
    color: var(--lx-text-soft);
}

/* 表单字段 */
.field {
    position: relative;
    margin-bottom: 18px;
}
.field .field-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--lx-accent);
    font-size: 15px;
    pointer-events: none;
    transition: color .2s ease;
}
.field .form-control {
    width: 100%;
    height: 50px;
    padding: 0 46px 0 44px;
    border: 1px solid var(--lx-field-border);
    border-radius: 12px;
    background: var(--lx-field-bg);
    color: var(--lx-field-text);
    font-size: 15px;
    box-shadow: 0 2px 6px -4px rgba(0, 0, 0, 0.12);
    transition: border-color .2s ease, box-shadow .25s ease, background .4s ease;
}
.field .form-control::placeholder { color: var(--lx-text-soft); opacity: .8; }
.field .form-control:focus {
    outline: none;
    border-color: var(--lx-accent);
    box-shadow: 0 0 0 4px rgba(28, 132, 198, 0.16);
}
.field:focus-within .field-icon { color: var(--lx-accent-2); }

/* 密码可见切换 */
.toggle-pwd {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--lx-text-soft);
    cursor: pointer;
    font-size: 15px;
    transition: color .2s ease;
}
.toggle-pwd:hover { color: var(--lx-accent); }

/* 验证码行 */
.captcha-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 18px 0;
}
.captcha-row .field { flex: 1; margin-bottom: 0; }
.captcha-row .imgcode {
    width: 120px;
    height: 50px;
    border-radius: 12px;
    border: 1px solid var(--lx-field-border);
    cursor: pointer;
    object-fit: cover;
    flex-shrink: 0;
}

/* 记住我 */
.checkbox-custom {
    position: relative;
    padding: 0 0 0 28px;
    margin: 6px 0 22px;
    display: inline-block;
    color: var(--lx-text-soft);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}
.checkbox-custom input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    cursor: pointer;
    z-index: 2;
    margin: 0;
    width: 18px;
    height: 18px;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}
.checkbox-custom label { cursor: pointer; margin: 0; }
.checkbox-custom label:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    margin-top: -9px;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--lx-field-border);
    background: var(--lx-field-bg);
    transition: all .2s ease;
}
.checkbox-custom input:checked + label:before {
    background: var(--lx-accent-grad);
    border-color: transparent;
}
.checkbox-custom label:after {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: translateY(-65%) rotate(45deg) scale(0);
    transition: transform .2s ease;
}
.checkbox-custom input:checked + label:after { transform: translateY(-65%) rotate(45deg) scale(1); }

/* 登录按钮（磁吸悬浮 + 渐变） */
.btn-login {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: 12px;
    background: var(--lx-accent-grad);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 28px -10px rgba(28, 132, 198, 0.65);
    transition: transform .25s cubic-bezier(.16, 1, .3, 1), box-shadow .25s ease;
}
.btn-login::after {
    content: '';
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left .6s ease;
}
.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px -10px rgba(28, 132, 198, 0.75);
}
.btn-login:hover::after { left: 130%; }
.btn-login:active { transform: translateY(0); }

/* 版权 */
.login-copyright {
    margin: 26px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--lx-text-soft);
}

/* ---------- 字段入场动画 ---------- */
.login-form-wrap h2,
.login-form-wrap .sub,
.login-form-wrap .mobile-brand,
.field,
.captcha-row,
.checkbox-custom,
.btn-login,
.login-copyright {
    animation: fadeUp .6s cubic-bezier(.16, 1, .3, 1) both;
}
.login-form-wrap h2 { animation-delay: .15s; }
.login-form-wrap .sub { animation-delay: .22s; }
.field:nth-of-type(1) { animation-delay: .30s; }
.field:nth-of-type(2) { animation-delay: .37s; }
.captcha-row { animation-delay: .44s; }
.checkbox-custom { animation-delay: .50s; }
.btn-login { animation-delay: .56s; }
.login-copyright { animation-delay: .64s; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- 响应式 ---------- */
@media screen and (max-width: 768px) {
    .login-card { width: 100%; min-height: auto; }
    .login-banner { display: none; }
    .login-form-wrap { padding: 40px 26px; }
    .mobile-brand { display: flex; }
    .login-copyright { margin-top: 22px; }
}

@media screen and (max-width: 360px) {
    .login-form-wrap { padding: 32px 20px; }
}

/* 尊重用户的减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}
