/* ========== 全局变量 ========== */
:root {
    --primary: #4f6ef7;
    --primary-dark: #3b56d9;
    --primary-light: #eef1ff;
    --text-main: #1f2430;
    --text-secondary: #8a90a3;
    --bg: #f4f6fb;
    --card-bg: #ffffff;
    --border: #e6e9f2;
    --danger: #e5484d;
    --success: #30a46c;
    --radius: 14px;
    --shadow-card: 0 20px 60px rgba(79, 110, 247, 0.12);
    --shadow-btn: 0 8px 20px rgba(79, 110, 247, 0.35);
    --transition: 0.25s ease;
}

/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* ========== 登录页背景 ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #f4f6fb 45%, #e8f4ff 100%);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

/* 背景装饰圆 */
.bg-decoration .circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    animation: float 12s ease-in-out infinite;
}

.bg-decoration .circle-1 {
    width: 340px;
    height: 340px;
    background: rgba(79, 110, 247, 0.35);
    top: -80px;
    left: -80px;
}

.bg-decoration .circle-2 {
    width: 280px;
    height: 280px;
    background: rgba(56, 189, 248, 0.3);
    bottom: -60px;
    right: -60px;
    animation-delay: -4s;
}

.bg-decoration .circle-3 {
    width: 160px;
    height: 160px;
    background: rgba(167, 139, 250, 0.3);
    top: 55%;
    left: 12%;
    animation-delay: -8s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-24px) scale(1.05);
    }
}

/* ========== 登录卡片 ========== */
.login-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 40px 36px 24px;
    animation: cardIn 0.6s ease both;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

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

/* ========== 头部 ========== */
.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: 18px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
}

.login-header p {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

/* ========== 表单 ========== */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon>svg {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
    pointer-events: none;
    transition: color var(--transition);
}

.input-with-icon input {
    width: 100%;
    height: 46px;
    padding: 0 44px;
    font-size: 15px;
    color: var(--text-main);
    background: #f8f9fd;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition),
        background var(--transition);
}

.input-with-icon input::placeholder {
    color: #b6bccb;
}

.input-with-icon input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 110, 247, 0.12);
}

.input-with-icon input:focus~svg,
.input-with-icon:focus-within>svg {
    color: var(--primary);
}

/* 密码可见切换按钮 */
.toggle-password {
    position: absolute;
    right: 10px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: color var(--transition), background var(--transition);
}

.toggle-password:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.toggle-password .icon-eye-off {
    display: none;
}

.toggle-password[aria-pressed="true"] .icon-eye {
    display: none;
}

.toggle-password[aria-pressed="true"] .icon-eye-off {
    display: block;
}

/* 勾选框 */
.checkbox-group {
    display: flex;
    align-items: center;
    margin-top: -4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* 错误提示 */
.error-message {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--danger);
    background: rgba(229, 72, 77, 0.08);
    border: 1px solid rgba(229, 72, 77, 0.25);
    border-radius: 8px;
    animation: shake 0.4s ease;
}

.error-message[hidden] {
    display: none;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

/* 登录按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 4px;
    border-radius: 10px;
    transition: transform var(--transition), box-shadow var(--transition),
        background var(--transition);
}

.btn-primary {
    height: 48px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(79, 110, 247, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

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

/* 加载中 */
.btn .spinner {
    display: none;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn.loading .spinner {
    display: inline-block;
}

.btn.loading span {
    letter-spacing: 2px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 页脚 */
.login-footer {
    margin-top: 8px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.login-footer p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== 响应式 ========== */
@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px 20px;
    }

    .login-header h1 {
        font-size: 22px;
    }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-main: #e8eaf2;
        --text-secondary: #9aa1b5;
        --bg: #12141c;
        --card-bg: #1b1e2a;
        --border: #2b2f3f;
        --primary-light: rgba(79, 110, 247, 0.16);
        --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.45);
    }

    .login-page {
        background: linear-gradient(135deg, #141828 0%, #12141c 45%, #141b26 100%);
    }

    .input-with-icon input {
        background: #14161f;
    }

    .input-with-icon input:focus {
        background: #181b26;
    }
}